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 ./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
ro.charger.enable_suspend=true
ro.opa.eligible_device=true
ro.com.google.ime.theme_id=5
ro.com.google.ime.bs_theme=true
# ro.com.google.ime.system_lm_dir=/product/usr/share/ime/google/d3_lms
EOF
class Prop(OrderedDict):
def __init__(self, file: TextIOWrapper) -> None:
super().__init__()
for i, line in enumerate(file.read().splitlines(False)):
if '=' in line:
k, v = line.split('=', 2)
self[k] = v
else:
self[f".{i}"] = line
sudo tee system/build.prop <<EOF
# begin common build properties
# 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 __str__(self) -> str:
return '\n'.join([v if k.startswith('.') else f"{k}={v}" for k, v in self.items()])
#
# ADDITIONAL_BUILD_PROPERTIES
#
ro.treble.enabled=true
net.bt.name=Android
def __iadd__(self, other: str) -> Prop:
self[f".{len(self)}"] = other
return self
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
# begin common build properties
# 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
new_props = {
("product", "brand"): "google",
("product", "manufacturer"): "Google",
("build", "product"): "redfin",
("product", "name"): "redfin",
("product", "device"): "redfin",
("product", "model"): "Pixel 5",
("build", "flavor"): "redfin-user"
}
#
# 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
ro.product.brand=google
ro.product.device=redfin
ro.product.manufacturer=Google
ro.product.model=Pixel 5
ro.product.name=redfin
EOF
def description(sec: str, p: Prop) -> str:
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']}"
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
#
# from build/make/target/board/gsi_system_ext_user.prop
#
# GSI always generate dex pre-opt in system image
ro.cp_system_other_odex=0
def fingerprint(sec: str, p: Prop) -> str:
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 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
persist.sys.disable_rescue=true
def fix_prop(sec, prop):
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
ro.control_privapp_permissions=disable
p += "# extra prop added by MagiskOnWSA"
# TODO(b/136212765): the default for LMK
ro.lmk.kill_timeout_ms=100
# 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
ro.boot.dynamic_partitions=true
ro.product.first_api_level=30
ro.vendor.build.security_patch=
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
for k, v in new_props.items():
p[f"ro.{k[0]}.{k[1]}"] = v
if k[0] == "build":
p[f"ro.{sec}.{k[0]}.{k[1]}"] = v
elif k[0] == "product":
p[f"ro.{k[0]}.{sec}.{k[1]}"] = v
sudo tee system/vendor/odm/etc/vendor.prop <<EOF
ro.odm.product.cpu.abilist=x86_64,x86,arm64-v8a,armeabi-v7a,armeabi
ro.odm.product.cpu.abilist32=x86,armeabi-v7a,armeabi
ro.odm.product.cpu.abilist64=x86_64,arm64-v8a
# begin common build properties
# autogenerated by build/make/tools/buildinfo_common.sh
ro.odm.build.date=Tue Aug 24 22:34:56 UTC 2021
ro.odm.build.date.utc=1629844496
ro.odm.build.fingerprint=google/redfin/redfin:12/SPB5.210812.002/7671067:user/release-keys
ro.odm.build.id=SPB5.210812.002
ro.odm.build.tags=release-keys
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
p["ro.build.description"] = description(sec, p)
p[f"ro.build.fingerprint"] = fingerprint(sec, p)
p[f"ro.{sec}.build.description"] = description(sec, p)
p[f"ro.{sec}.build.fingerprint"] = fingerprint(sec, p)
p[f"ro.bootimage.build.fingerprint"] = fingerprint(sec, p)
with open(prop, 'w') as f:
f.write(str(p))
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():
fix_prop(sec, prop)
- name: Umount images
run: |
sudo umount system/vendor