Auto enable usb adb if booting with debug ramdisk
If booting with debug ramdisk (ro.force.debuggable is true), override
the persistent property "persist.sys.usb.config" to always enable adb.
This ensures a consistent debug experience. The developer can expect
that after debug ramdisk (debug boot image) is flashed,
1. Device is rootable with (adb root)
2. adb is enabled automatically
3. no-auth (if $ADB_VENDOR_KEYS is used)
Bug: 223517900
Test: 1. Flash & boot user build, verify device doesn't have usb
debugging enabled.
2. Reboot to bootloader and flash vendor_boot-debug.img.
3. Boot and verify usb debugging is automatically enabled.
4. Enter Developer Options and manually turn off usb debugging.
5. Reboot and verify that usb debugging is automatically enabled.
Change-Id: I729e961d645f2dd521ead8ca30b5cb8eb1d9f909
diff --git a/init/property_service.cpp b/init/property_service.cpp
index a1f6e04..7e92538 100644
--- a/init/property_service.cpp
+++ b/init/property_service.cpp
@@ -1351,6 +1351,11 @@
InitPropertySet(persistent_property_record.name(),
persistent_property_record.value());
}
+ // Apply debug ramdisk special settings after persistent properties are loaded.
+ if (android::base::GetBoolProperty("ro.force.debuggable", false)) {
+ // Always enable usb adb if device is booted with debug ramdisk.
+ update_sys_usb_config();
+ }
InitPropertySet("ro.persistent_properties.ready", "true");
persistent_properties_loaded = true;
break;