Don't enable ADB by default on userdebug builds
Squashed with the following commits:
Author: Scott Mertz <scott@cyngn.com>
Date: Thu Feb 26 10:51:44 2015 -0800
Enable ADB by default when ro.adb.secure is not 1
* Property ro.build.type is not part of the default.prop we can't
use this to decide how to apply adb by default within this function
Change-Id: Ib3eb24c655353966d64c7148d7530244b628ce94
Author: LibXZR <i@xzr.moe>
Date: Sat Apr 30 16:29:35 2022 +0800
tools: Let adb secure check depend on "==0" rather than "!=1"
We are using PRODUCT_SYSTEM_DEFAULT_PROPERTIES to set
`ro.adb.secure` property. But unfortunately this flag only
affect system partition, which means in other partitions
e.g. vendor and system_ext `ro.adb.secure` stays empty.
Thus `persist.sys.usb.config=adb` is unconditionally set
in partitions other than system, which lead to adb enabled
by default even on user build.
Change-Id: I1f8b463b3ec645309369f36014bed556e75ed210
Signed-off-by: LibXZR <i@xzr.moe>
Change-Id: I33ae5c6f2787017a62e679aa0c28d4b909d45935
diff --git a/tools/post_process_props.py b/tools/post_process_props.py
index 6f429fa..2d7699c 100755
--- a/tools/post_process_props.py
+++ b/tools/post_process_props.py
@@ -30,9 +30,9 @@
# Put the modifications that you need to make into the */build.prop into this
# function.
def mangle_build_prop(prop_list, kernel_version_file_for_uffd_gc):
- # If ro.debuggable is 1, then enable adb on USB by default
- # (this is for userdebug builds)
- if prop_list.get_value("ro.debuggable") == "1":
+ # If ro.adb.secure is 0, then enable adb on USB by default
+ # (this is for eng builds)
+ if prop_list.get_value("ro.adb.secure") == "0":
val = prop_list.get_value("persist.sys.usb.config")
if "adb" not in val:
if val == "":