From a6b68e72b1a6238547fcbc00d8446ac0d755eb2b Mon Sep 17 00:00:00 2001 From: Hung-ying Tyan Date: Tue, 13 Jun 2017 11:25:23 +0800 Subject: [PATCH] Revert "Revert "Move /default.prop to /system/etc/prop.default"" This reverts commit 88c9dddd0f93494b6b3bc124b36ef28a457f54d0. Bug: 37815285 Bug: 62525809 Test: Tested with ag/2400523 and ag/2400524. Booted pixel phones, checked the location of prop.default, verified the symlink, checked a few properties via adb shell and manually tested a few apps (Camera, Maps etc). sign_target_files_apks.py was tested with: sign_target_files_apks -o -e DynamiteLoader.apk= -e DynamiteModulesA.apk= \ -e DynamiteModulesB.apk= -e DynamiteModulesC.apk= -e DynamiteModulesD.apk= \ -e GoogleCertificates.apk= out/dist/*-target_files-*.zip signed-target_files.zip Booted to recovery and ran 'adb sideload' successfully. Change-Id: I2ddf287f42360d1a7c7a22f08e7b9e203e7e603a --- core/Makefile | 18 ++++++++++++++---- tools/post_process_props.py | 5 +++-- tools/releasetools/sign_target_files_apks.py | 20 +++++++++++++------- 3 files changed, 30 insertions(+), 13 deletions(-) diff --git a/core/Makefile b/core/Makefile index 961f35d4f8..9bb0495390 100644 --- a/core/Makefile +++ b/core/Makefile @@ -78,8 +78,13 @@ ifeq ($(BOARD_PROPERTY_OVERRIDES_SPLIT_ENABLED), true) endif # ----------------------------------------------------------------- -# default.prop +# prop.default +ifdef property_overrides_split_enabled +INSTALLED_DEFAULT_PROP_TARGET := $(TARGET_OUT)/etc/prop.default +else +# legacy path INSTALLED_DEFAULT_PROP_TARGET := $(TARGET_ROOT_OUT)/default.prop +endif ALL_DEFAULT_INSTALLED_MODULES += $(INSTALLED_DEFAULT_PROP_TARGET) FINAL_DEFAULT_PROPERTIES := \ $(call collapse-pairs, $(ADDITIONAL_DEFAULT_PROPERTIES)) @@ -95,6 +100,7 @@ intermediate_system_build_prop := $(call intermediates-dir-for,ETC,system_build_ $(INSTALLED_DEFAULT_PROP_TARGET): $(intermediate_system_build_prop) @echo Target buildinfo: $@ @mkdir -p $(dir $@) + @rm -f $@ $(hide) echo "#" > $@; \ echo "# ADDITIONAL_DEFAULT_PROPERTIES" >> $@; \ echo "#" >> $@; @@ -107,6 +113,9 @@ $(INSTALLED_DEFAULT_PROP_TARGET): $(intermediate_system_build_prop) $(hide) echo ro.bootimage.build.date.utc=`$(DATE_FROM_FILE) +%s`>>$@ $(hide) echo ro.bootimage.build.fingerprint="$(BUILD_FINGERPRINT_FROM_FILE)">>$@ $(hide) build/tools/post_process_props.py $@ +ifdef property_overrides_split_enabled + $(hide) ln -sf system/etc/prop.default $(TARGET_ROOT_OUT)/default.prop +endif # ----------------------------------------------------------------- # vendor default.prop @@ -1184,12 +1193,13 @@ define build-recoveryimage-target $(hide) cp -f $(recovery_wipe) $(TARGET_RECOVERY_ROOT_OUT)/etc/recovery.wipe) $(hide) cp $(RECOVERY_INSTALL_OTA_KEYS) $(TARGET_RECOVERY_ROOT_OUT)/res/keys $(hide) cat $(INSTALLED_DEFAULT_PROP_TARGET) \ - > $(TARGET_RECOVERY_ROOT_OUT)/default.prop + > $(TARGET_RECOVERY_ROOT_OUT)/prop.default $(if $(INSTALLED_VENDOR_DEFAULT_PROP_TARGET), \ $(hide) cat $(INSTALLED_VENDOR_DEFAULT_PROP_TARGET) \ - >> $(TARGET_RECOVERY_ROOT_OUT)/default.prop) + >> $(TARGET_RECOVERY_ROOT_OUT)/prop.default) $(hide) cat $(recovery_build_props) \ - >> $(TARGET_RECOVERY_ROOT_OUT)/default.prop + >> $(TARGET_RECOVERY_ROOT_OUT)/prop.default + $(hide) ln -sf prop.default $(TARGET_RECOVERY_ROOT_OUT)/default.prop $(BOARD_RECOVERY_IMAGE_PREPARE) $(if $(filter true,$(BOARD_BUILD_SYSTEM_ROOT_IMAGE)), \ $(hide) mkdir -p $(TARGET_RECOVERY_ROOT_OUT)/system_root; \ diff --git a/tools/post_process_props.py b/tools/post_process_props.py index 83c6f9a5dd..9355e4b22d 100755 --- a/tools/post_process_props.py +++ b/tools/post_process_props.py @@ -35,7 +35,7 @@ def mangle_build_prop(prop): def mangle_default_prop_override(prop): pass -# Put the modifications that you need to make into the /default.prop into this +# Put the modifications that you need to make into the /system/etc/prop.default into this # function. The prop object has get(name) and put(name,value) methods. def mangle_default_prop(prop): # If ro.debuggable is 1, then enable adb on USB by default @@ -122,7 +122,8 @@ def main(argv): elif (filename.endswith("/vendor/default.prop") or filename.endswith("/odm/default.prop")): mangle_default_prop_override(properties) - elif filename.endswith("/default.prop"): + elif (filename.endswith("/default.prop") or # legacy + filename.endswith("/prop.default")): mangle_default_prop(properties) else: sys.stderr.write("bad command line: " + str(argv) + "\n") diff --git a/tools/releasetools/sign_target_files_apks.py b/tools/releasetools/sign_target_files_apks.py index 2e0b44dacb..71311e6c42 100755 --- a/tools/releasetools/sign_target_files_apks.py +++ b/tools/releasetools/sign_target_files_apks.py @@ -235,15 +235,21 @@ def ProcessTargetFiles(input_tf_zip, output_tf_zip, misc_info, # System properties. elif info.filename in ("SYSTEM/build.prop", "VENDOR/build.prop", - "BOOT/RAMDISK/default.prop", - "ROOT/default.prop", - "RECOVERY/RAMDISK/default.prop"): + "SYSTEM/etc/prop.default", + "BOOT/RAMDISK/default.prop", # legacy + "ROOT/default.prop", # legacy + "RECOVERY/RAMDISK/prop.default", + "RECOVERY/RAMDISK/default.prop"): # legacy print "rewriting %s:" % (info.filename,) - new_data = RewriteProps(data, misc_info) + if stat.S_ISLNK(info.external_attr >> 16): + new_data = data + else: + new_data = RewriteProps(data, misc_info) common.ZipWriteStr(output_tf_zip, out_info, new_data) - if info.filename in ("BOOT/RAMDISK/default.prop", - "ROOT/default.prop", - "RECOVERY/RAMDISK/default.prop"): + if info.filename in ("BOOT/RAMDISK/default.prop", # legacy + "ROOT/default.prop", # legacy + "RECOVERY/RAMDISK/prop.default", + "RECOVERY/RAMDISK/default.prop"): # legacy write_to_temp(info.filename, info.external_attr, new_data) elif info.filename.endswith("mac_permissions.xml"):