From a280a66b5ab2a3e738230d994a91778afa95befb Mon Sep 17 00:00:00 2001 From: Bowgo Tsai Date: Thu, 21 Mar 2019 16:48:52 +0800 Subject: [PATCH] Adding adb_debug.prop The adb_debug.prop will be loaded by init when the file /force_debuggable is present in the first-stage ramdisk, and the device is unlocked. This file has the highest priority to override other system properties, thus can override ro.debuggable to 1 to allow adb root. Bug: 126493225 Test: boot a device with /force_debuggable in ramdisk, checks adb_debug.prop is loaded Change-Id: I75d661bb04178f584d8b6f5eba26ae35ccb01239 --- target/product/gsi/adb_debug.prop | 12 ++++++++++++ target/product/gsi_common.mk | 6 +++++- 2 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 target/product/gsi/adb_debug.prop diff --git a/target/product/gsi/adb_debug.prop b/target/product/gsi/adb_debug.prop new file mode 100644 index 0000000000..37e2f2d719 --- /dev/null +++ b/target/product/gsi/adb_debug.prop @@ -0,0 +1,12 @@ +# Note: This file will be loaded with highest priority to override +# other system properties, if a special ramdisk with "/force_debuggable" +# is used and the device is unlocked. + +# Disable adb authentication to allow test automation on user build GSI +ro.adb.secure=0 + +# Allow 'adb root' on user build GSI +ro.debuggable=1 + +# Introduce this property to indicate that init has loaded adb_debug.prop +ro.force.debuggable=1 diff --git a/target/product/gsi_common.mk b/target/product/gsi_common.mk index fb0478d933..72d8b41c78 100644 --- a/target/product/gsi_common.mk +++ b/target/product/gsi_common.mk @@ -51,13 +51,13 @@ PRODUCT_ARTIFACT_PATH_REQUIREMENT_WHITELIST += %.odex %.vdex %.art PRODUCT_ARTIFACT_PATH_REQUIREMENT_WHITELIST += \ system/etc/init/config/skip_mount.cfg \ system/etc/init/init.gsi.rc \ + system/etc/adb_debug.prop \ # Exclude all files under system/product and system/product_services PRODUCT_ARTIFACT_PATH_REQUIREMENT_WHITELIST += \ system/product/% \ system/product_services/% - # Split selinux policy PRODUCT_FULL_TREBLE_OVERRIDE := true @@ -97,3 +97,7 @@ PRODUCT_COPY_FILES += \ # Provide a libnfc-nci.conf to GSI product PRODUCT_COPY_FILES += \ device/generic/common/nfc/libnfc-nci.conf:$(TARGET_COPY_OUT_PRODUCT)/etc/libnfc-nci.conf + +# Allow 'adb root' on user build GSI +PRODUCT_COPY_FILES += \ + build/make/target/product/gsi/adb_debug.prop:$(TARGET_COPY_OUT_SYSTEM)/etc/adb_debug.prop