summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTianjie Xu <xunchang@google.com>2019-11-05 23:00:48 +0100
committerandroid-build-merger <android-build-merger@google.com>2019-11-05 23:00:48 +0100
commite5288e6b69b86d7394adb9d3904e228501aad24b (patch)
treeb74020df6412c509f9ceea9f561bdf1d089e81e5
parentDO NOT MERGE - qt-qpr1-dev-plus-aosp-without-vendor@5915889 into stage-aosp-master (diff)
parentMerge "Start adbd in user mode if bootloader is unlocked" (diff)
downloadandroid_bootable_recovery-e5288e6b69b86d7394adb9d3904e228501aad24b.tar
android_bootable_recovery-e5288e6b69b86d7394adb9d3904e228501aad24b.tar.gz
android_bootable_recovery-e5288e6b69b86d7394adb9d3904e228501aad24b.tar.bz2
android_bootable_recovery-e5288e6b69b86d7394adb9d3904e228501aad24b.tar.lz
android_bootable_recovery-e5288e6b69b86d7394adb9d3904e228501aad24b.tar.xz
android_bootable_recovery-e5288e6b69b86d7394adb9d3904e228501aad24b.tar.zst
android_bootable_recovery-e5288e6b69b86d7394adb9d3904e228501aad24b.zip
-rw-r--r--etc/init.rc4
-rw-r--r--recovery_main.cpp8
2 files changed, 11 insertions, 1 deletions
diff --git a/etc/init.rc b/etc/init.rc
index 0822aba03..9786f6104 100644
--- a/etc/init.rc
+++ b/etc/init.rc
@@ -99,6 +99,10 @@ on property:service.adb.root=1
on fs && property:ro.debuggable=1
setprop sys.usb.config adb
+# Also start adbd on user build with an unlocked bootloader
+on fs && property:ro.debuggable=0 && androidboot.verifiedbootstate=orange
+ setprop sys.usb.config adb
+
on fs && property:sys.usb.configfs=1
mount configfs none /config
mkdir /config/usb_gadget/g1 0770 shell shell
diff --git a/recovery_main.cpp b/recovery_main.cpp
index 89253dcd2..30a1fc0a4 100644
--- a/recovery_main.cpp
+++ b/recovery_main.cpp
@@ -69,6 +69,10 @@ static bool IsRoDebuggable() {
return android::base::GetBoolProperty("ro.debuggable", false);
}
+static bool IsDeviceUnlocked() {
+ return "orange" == android::base::GetProperty("ro.boot.verifiedbootstate", "");
+}
+
static void UiLogger(android::base::LogId /* id */, android::base::LogSeverity severity,
const char* /* tag */, const char* /* file */, unsigned int /* line */,
const char* message) {
@@ -463,7 +467,9 @@ int main(int argc, char** argv) {
listener_thread.detach();
while (true) {
- std::string usb_config = fastboot ? "fastboot" : IsRoDebuggable() ? "adb" : "none";
+ // We start adbd in recovery for the device with userdebug build or a unlocked bootloader.
+ std::string usb_config =
+ fastboot ? "fastboot" : IsRoDebuggable() || IsDeviceUnlocked() ? "adb" : "none";
std::string usb_state = android::base::GetProperty("sys.usb.state", "none");
if (usb_config != usb_state) {
if (!SetUsbConfig("none")) {