diff options
author | Tianjie Xu <xunchang@google.com> | 2019-11-05 23:07:27 +0100 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2019-11-05 23:07:27 +0100 |
commit | 845bf488cb2712357b7a23f4142fa264ed6a9333 (patch) | |
tree | b74020df6412c509f9ceea9f561bdf1d089e81e5 /recovery_main.cpp | |
parent | DO NOT MERGE - qt-qpr1-dev-plus-aosp-without-vendor@5915889 into stage-aosp-master (diff) | |
parent | Merge "Start adbd in user mode if bootloader is unlocked" (diff) | |
download | android_bootable_recovery-845bf488cb2712357b7a23f4142fa264ed6a9333.tar android_bootable_recovery-845bf488cb2712357b7a23f4142fa264ed6a9333.tar.gz android_bootable_recovery-845bf488cb2712357b7a23f4142fa264ed6a9333.tar.bz2 android_bootable_recovery-845bf488cb2712357b7a23f4142fa264ed6a9333.tar.lz android_bootable_recovery-845bf488cb2712357b7a23f4142fa264ed6a9333.tar.xz android_bootable_recovery-845bf488cb2712357b7a23f4142fa264ed6a9333.tar.zst android_bootable_recovery-845bf488cb2712357b7a23f4142fa264ed6a9333.zip |
Diffstat (limited to 'recovery_main.cpp')
-rw-r--r-- | recovery_main.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
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")) { |