Fix prop using script

This commit is contained in:
LoveSy 2021-10-27 19:28:04 +08:00
parent 0ecdf47877
commit 3ada02c299

View File

@ -226,310 +226,78 @@ jobs:
sudo find system/product/{app,etc,overlay,priv-app} -type f -exec chcon --reference=system/product/etc/permissions/privapp-permissions-venezia.xml {} \; sudo find system/product/{app,etc,overlay,priv-app} -type f -exec chcon --reference=system/product/etc/permissions/privapp-permissions-venezia.xml {} \;
sudo ./magisk/magiskpolicy --load system/vendor/etc/selinux/precompiled_sepolicy --save system/vendor/etc/selinux/precompiled_sepolicy "allow gmscore_app gmscore_app vsock_socket { create connect write read }" "allow gmscore_app device_config_runtime_native_boot_prop file read" sudo ./magisk/magiskpolicy --load system/vendor/etc/selinux/precompiled_sepolicy --save system/vendor/etc/selinux/precompiled_sepolicy "allow gmscore_app gmscore_app vsock_socket { create connect write read }" "allow gmscore_app device_config_runtime_native_boot_prop file read"
- name: Fix GApps prop
shell: sudo python {0}
run: |
from __future__ import annotations
from io import TextIOWrapper
from os import system
from typing import OrderedDict
sudo tee system/product/build.prop <<EOF
# begin common build properties
# autogenerated by build/make/tools/buildinfo_common.sh
ro.product.product.brand=google
ro.product.product.device=redfin
ro.product.product.manufacturer=Google
ro.product.product.model=Pixel 5
ro.product.product.name=redfin
ro.product.build.date=Tue Aug 24 22:34:56 UTC 2021
ro.product.build.date.utc=1629844496
ro.product.build.fingerprint=google/redfin/redfin:12/SPB5.210812.002/7671067:user/release-keys
ro.product.build.id=SPB5.210812.002
ro.product.build.tags=release-keys
ro.product.build.type=user
ro.product.build.version.incremental=7671067
ro.product.build.version.release=11
ro.product.build.version.release_or_codename=11
ro.product.build.version.sdk=30
# end common build properties
#
# ADDITIONAL PRODUCT PROPERTIES
#
ro.support_one_handed_mode=true class Prop(OrderedDict):
ro.charger.enable_suspend=true def __init__(self, file: TextIOWrapper) -> None:
ro.opa.eligible_device=true super().__init__()
ro.com.google.ime.theme_id=5 for i, line in enumerate(file.read().splitlines(False)):
ro.com.google.ime.bs_theme=true if '=' in line:
# ro.com.google.ime.system_lm_dir=/product/usr/share/ime/google/d3_lms k, v = line.split('=', 2)
EOF self[k] = v
else:
self[f".{i}"] = line
sudo tee system/build.prop <<EOF def __str__(self) -> str:
# begin common build properties return '\n'.join([v if k.startswith('.') else f"{k}={v}" for k, v in self.items()])
# autogenerated by build/make/tools/buildinfo_common.sh
ro.system.build.date=Tue Aug 24 22:34:56 UTC 2021
ro.system.build.date.utc=1629844496
ro.system.build.fingerprint=google/redfin/redfin:12/SPB5.210812.002/7671067:user/release-keys
ro.system.build.id=SPB5.210812.002
ro.system.build.tags=release-keys
ro.system.build.type=user
ro.system.build.version.incremental=7671067
ro.system.build.version.release=11
ro.system.build.version.release_or_codename=11
ro.system.build.version.sdk=30
ro.product.system.brand=google
ro.product.system.device=generic
ro.product.system.manufacturer=Google
ro.product.system.model=mainline
ro.product.system.name=mainline
# end common build properties
# begin build properties
# autogenerated by buildinfo.sh
ro.build.id=SPB5.210812.002
ro.build.display.id=SPB5.210812.002
ro.build.version.incremental=7671067
ro.build.version.sdk=30
ro.build.version.preview_sdk=0
ro.build.version.preview_sdk_fingerprint=REL
ro.build.version.codename=REL
ro.build.version.all_codenames=REL
ro.build.version.release=11
ro.build.version.release_or_codename=11
ro.build.version.security_patch=2021-09-05
ro.build.version.base_os=
ro.build.version.min_supported_target_sdk=23
ro.build.date=Tue Aug 24 22:34:56 UTC 2021
ro.build.date.utc=1629844496
ro.build.type=user
ro.build.user=android-build
ro.build.host=abfarm807
ro.build.tags=release-keys
ro.build.flavor=redfin-user
ro.build.system_root_image=false
# ro.product.cpu.abi and ro.product.cpu.abi2 are obsolete,
# use ro.product.cpu.abilist instead.
ro.product.cpu.abi=x86_64
ro.product.cpu.abilist=x86_64,x86,arm64-v8a,armeabi-v7a,armeabi
ro.product.cpu.abilist32=x86,armeabi-v7a,armeabi
ro.product.cpu.abilist64=x86_64,arm64-v8a
ro.product.locale=en-US
ro.wifi.channels=
# ro.build.product is obsolete; use ro.product.device
ro.build.product=redfin
# Do not try to parse description or thumbprint
ro.build.description=redfin-user 12 SPB5.210812.002 7671067 release-keys
# end build properties
# def __iadd__(self, other: str) -> Prop:
# ADDITIONAL_BUILD_PROPERTIES self[f".{len(self)}"] = other
# return self
ro.treble.enabled=true
net.bt.name=Android
ro.build.fingerprint=google/redfin/redfin:12/SPB5.210812.002/7671067:user/release-keys
ro.product.brand=google
ro.product.device=redfin
ro.product.manufacturer=Google
ro.product.model=Pixel 5
ro.product.name=redfin
EOF
sudo tee system/system/build.prop <<EOF new_props = {
# begin common build properties ("product", "brand"): "google",
# autogenerated by build/make/tools/buildinfo_common.sh ("product", "manufacturer"): "Google",
ro.system.build.date=Tue Aug 24 22:34:56 UTC 2021 ("build", "product"): "redfin",
ro.system.build.date.utc=1629844496 ("product", "name"): "redfin",
ro.system.build.fingerprint=google/redfin/redfin:12/SPB5.210812.002/7671067:user/release-keys ("product", "device"): "redfin",
ro.system.build.id=SPB5.210812.002 ("product", "model"): "Pixel 5",
ro.system.build.tags=release-keys ("build", "flavor"): "redfin-user"
ro.system.build.type=user }
ro.system.build.version.incremental=7671067
ro.system.build.version.release=11
ro.system.build.version.release_or_codename=11
ro.system.build.version.sdk=30
ro.product.system.brand=google
ro.product.system.device=generic
ro.product.system.manufacturer=Google
ro.product.system.model=mainline
ro.product.system.name=mainline
# end common build properties
# begin build properties
# autogenerated by buildinfo.sh
ro.build.id=SPB5.210812.002
ro.build.display.id=SPB5.210812.002
ro.build.version.incremental=7671067
ro.build.version.sdk=30
ro.build.version.preview_sdk=0
ro.build.version.preview_sdk_fingerprint=REL
ro.build.version.codename=REL
ro.build.version.all_codenames=REL
ro.build.version.release=11
ro.build.version.release_or_codename=11
ro.build.version.security_patch=2021-09-05
ro.build.version.base_os=
ro.build.version.min_supported_target_sdk=23
ro.build.date=Tue Aug 24 22:34:56 UTC 2021
ro.build.date.utc=1629844496
ro.build.type=user
ro.build.user=android-build
ro.build.host=abfarm807
ro.build.tags=release-keys
ro.build.flavor=redfin-user
ro.build.system_root_image=false
# ro.product.cpu.abi and ro.product.cpu.abi2 are obsolete,
# use ro.product.cpu.abilist instead.
ro.product.cpu.abi=x86_64
ro.product.cpu.abilist=x86_64,x86,arm64-v8a,armeabi-v7a,armeabi
ro.product.cpu.abilist32=x86,armeabi-v7a,armeabi
ro.product.cpu.abilist64=x86_64,arm64-v8a
ro.product.locale=en-US
ro.wifi.channels=
# ro.build.product is obsolete; use ro.product.device
ro.build.product=redfin
# Do not try to parse description or thumbprint
ro.build.description=redfin-user 12 SPB5.210812.002 7671067 release-keys
# end build properties
#
# ADDITIONAL_BUILD_PROPERTIES
#
ro.treble.enabled=true
net.bt.name=Android
ro.build.fingerprint=google/redfin/redfin:12/SPB5.210812.002/7671067:user/release-keys def description(sec: str, p: Prop) -> str:
ro.product.brand=google return f"{p[f'ro.{sec}.build.flavor']} {p[f'ro.{sec}.build.version.release_or_codename']} {p[f'ro.{sec}.build.id']} {p[f'ro.{sec}.build.version.incremental']} {p[f'ro.{sec}.build.tags']}"
ro.product.device=redfin
ro.product.manufacturer=Google
ro.product.model=Pixel 5
ro.product.name=redfin
EOF
sudo tee system/system_ext/build.prop <<EOF
# begin common build properties
# autogenerated by build/make/tools/buildinfo_common.sh
ro.system_ext.build.date=Tue Aug 24 22:34:56 UTC 2021
ro.system_ext.build.date.utc=1629844496
ro.system_ext.build.fingerprint=google/redfin/redfin:12/SPB5.210812.002/7671067:user/release-keys
ro.system_ext.build.id=SPB5.210812.002
ro.system_ext.build.tags=release-keys
ro.system_ext.build.type=user
ro.system_ext.build.version.incremental=7671067
ro.system_ext.build.version.release=11
ro.system_ext.build.version.release_or_codename=11
ro.system_ext.build.version.sdk=30
ro.product.system_ext.brand=google
ro.product.system_ext.device=redfin
ro.product.system_ext.manufacturer=Google
ro.product.system_ext.model=Pixel 5
ro.product.system_ext.name=redfin
# end common build properties
# def fingerprint(sec: str, p: Prop) -> str:
# from build/make/target/board/gsi_system_ext_user.prop return f"""{p[f"ro.product.{sec}.brand"]}/{p[f"ro.product.{sec}.name"]}/{p[f"ro.product.{sec}.device"]}:{p[f"ro.{sec}.build.version.release"]}/{p[f"ro.{sec}.build.id"]}/{p[f"ro.{sec}.build.version.incremental"]}:{p[f"ro.{sec}.build.type"]}/{p[f"ro.{sec}.build.tags"]}"""
#
# GSI always generate dex pre-opt in system image
ro.cp_system_other_odex=0
# GSI disables non-AOSP nnapi extensions on product partition
ro.nnapi.extensions.deny_on_product=true
# TODO(b/120679683): disable RescueParty before all problem apps solved def fix_prop(sec, prop):
persist.sys.disable_rescue=true print(f"fixing {prop}", flush=True)
with open(prop, 'r') as f:
p = Prop(f)
# TODO(b/78105955): disable privapp_permissions checking before the bug solved p += "# extra prop added by MagiskOnWSA"
ro.control_privapp_permissions=disable
# TODO(b/136212765): the default for LMK for k, v in new_props.items():
ro.lmk.kill_timeout_ms=100 p[f"ro.{k[0]}.{k[1]}"] = v
# end of build/make/target/board/gsi_system_ext_user.prop
#
# ADDITIONAL SYSTEM_EXT BUILD PROPERTIES
#
ro.setupwizard.mode=DISABLED
EOF
sudo tee system/vendor/build.prop <<EOF if k[0] == "build":
ro.boot.dynamic_partitions=true p[f"ro.{sec}.{k[0]}.{k[1]}"] = v
ro.product.first_api_level=30 elif k[0] == "product":
ro.vendor.build.security_patch= p[f"ro.{k[0]}.{sec}.{k[1]}"] = v
ro.vendor.product.cpu.abilist=x86_64,x86,arm64-v8a,armeabi-v7a,armeabi
ro.vendor.product.cpu.abilist32=x86,armeabi-v7a,armeabi
ro.vendor.product.cpu.abilist64=x86_64,arm64-v8a
ro.product.board=windows
ro.board.platform=windows
ro.hwui.use_vulkan=
# begin common build properties
# autogenerated by build/make/tools/buildinfo_common.sh
ro.vendor.build.date=Tue Aug 24 22:34:56 UTC 2021
ro.vendor.build.date.utc=1629844496
ro.vendor.build.fingerprint=google/redfin/redfin:12/SPB5.210812.002/7671067:user/release-keys
ro.vendor.build.id=SPB5.210812.002
ro.vendor.build.tags=release-keys
ro.vendor.build.type=user
ro.vendor.build.version.incremental=7671067
ro.vendor.build.version.release=11
ro.vendor.build.version.release_or_codename=11
ro.vendor.build.version.sdk=30
ro.product.vendor.brand=google
ro.product.vendor.device=redfin
ro.product.vendor.manufacturer=Google
ro.product.vendor.model=Pixel 5
ro.product.vendor.name=redfin
# end common build properties
#
# BOOTIMAGE_BUILD_PROPERTIES
#
ro.bootimage.build.date=Tue Aug 24 22:34:56 UTC 2021
ro.bootimage.build.date.utc=1629844496
ro.bootimage.build.fingerprint=google/redfin/redfin:12/SPB5.210812.002/7671067:user/release-keys
#
# ADDITIONAL VENDOR BUILD PROPERTIES
#
init.userspace_reboot.is_supported=true
ro.virtual_ab.enabled=true
external_storage.projid.enabled=1
external_storage.casefold.enabled=1
external_storage.sdcardfs.enabled=0
dalvik.vm.heapstartsize=16m
dalvik.vm.heapgrowthlimit=192m
dalvik.vm.heapsize=512m
dalvik.vm.heaptargetutilization=0.75
dalvik.vm.heapminfree=512k
dalvik.vm.heapmaxfree=8m
debug.sf.nobootanimation=1
ro.opengles.version=196608
debug.stagefright.ccodec=0
debug.egl.force_msaa=true
ro.sf.lcd_density=240
ro.surface_flinger.running_without_sync_framework=true
debug.sf.vsync_reactor_ignore_present_fences=true
ro.hardware.audio.primary=windows
ro.dalvik.vm.isa.arm=x86
ro.enable.native.bridge.exec=1
ro.dalvik.vm.isa.arm64=x86_64
ro.enable.native.bridge.exec64=1
EOF
sudo tee system/vendor/odm/etc/vendor.prop <<EOF p["ro.build.description"] = description(sec, p)
ro.odm.product.cpu.abilist=x86_64,x86,arm64-v8a,armeabi-v7a,armeabi p[f"ro.build.fingerprint"] = fingerprint(sec, p)
ro.odm.product.cpu.abilist32=x86,armeabi-v7a,armeabi p[f"ro.{sec}.build.description"] = description(sec, p)
ro.odm.product.cpu.abilist64=x86_64,arm64-v8a p[f"ro.{sec}.build.fingerprint"] = fingerprint(sec, p)
# begin common build properties p[f"ro.bootimage.build.fingerprint"] = fingerprint(sec, p)
# autogenerated by build/make/tools/buildinfo_common.sh
ro.odm.build.date=Tue Aug 24 22:34:56 UTC 2021 with open(prop, 'w') as f:
ro.odm.build.date.utc=1629844496 f.write(str(p))
ro.odm.build.fingerprint=google/redfin/redfin:12/SPB5.210812.002/7671067:user/release-keys
ro.odm.build.id=SPB5.210812.002 for sec, prop in {"system": "system/system/build.prop", "product": "system/product/build.prop", "system_ext": "system/system_ext/build.prop", "vendor": "system/vendor/build.prop", "odm": "system/vendor/odm/etc/build.prop"}.items():
ro.odm.build.tags=release-keys fix_prop(sec, prop)
ro.odm.build.type=user
ro.odm.build.version.incremental=7671067
ro.odm.build.version.release=11
ro.odm.build.version.release_or_codename=11
ro.odm.build.version.sdk=30
ro.product.odm.brand=google
ro.product.odm.device=redfin
ro.product.odm.manufacturer=Google
ro.product.odm.model=Pixel 5
ro.product.odm.name=redfin
# end common build properties
#
# ADDITIONAL ODM BUILD PROPERTIES
#
EOF
- name: Umount images - name: Umount images
run: | run: |
sudo umount system/vendor sudo umount system/vendor