recovery: Add "Enable ADB" to advanced options
Change-Id: I78ff93a43a17caeaae8a9601ec299b53a2802b20
diff --git a/recovery.cpp b/recovery.cpp
index 864e8cb..70fc11c 100644
--- a/recovery.cpp
+++ b/recovery.cpp
@@ -665,6 +665,14 @@
choose_recovery_file(device);
break;
+ case Device::ENABLE_ADB:
+ android::base::SetProperty("ro.adb.secure.recovery", "0");
+ android::base::SetProperty("ctl.restart", "adbd");
+ device->RemoveMenuItemForAction(Device::ENABLE_ADB);
+ device->GoHome();
+ ui->Print("Enabled ADB.\n");
+ break;
+
case Device::RUN_GRAPHICS_TEST:
run_graphics_test();
break;
diff --git a/recovery_main.cpp b/recovery_main.cpp
index 97c97ab..a0ee7c4 100644
--- a/recovery_main.cpp
+++ b/recovery_main.cpp
@@ -460,6 +460,10 @@
device->RemoveMenuItemForAction(Device::ENTER_RESCUE);
}
+ if (get_build_type() != "userdebug") {
+ device->RemoveMenuItemForAction(Device::ENABLE_ADB);
+ }
+
if (get_build_type() == "user") {
device->RemoveMenuItemForAction(Device::WIPE_SYSTEM);
device->RemoveMenuItemForAction(Device::MOUNT_SYSTEM);
diff --git a/recovery_ui/device.cpp b/recovery_ui/device.cpp
index d006cca..76e6d85 100644
--- a/recovery_ui/device.cpp
+++ b/recovery_ui/device.cpp
@@ -43,6 +43,7 @@
{ "Reboot to recovery", Device::REBOOT_RECOVERY },
{ "Mount /system", Device::MOUNT_SYSTEM },
{ "View recovery logs", Device::VIEW_RECOVERY_LOGS },
+ { "Enable ADB", Device::ENABLE_ADB },
{ "Run graphics test", Device::RUN_GRAPHICS_TEST },
{ "Run locale test", Device::RUN_LOCALE_TEST },
{ "Enter rescue", Device::ENTER_RESCUE },
diff --git a/recovery_ui/include/recovery_ui/device.h b/recovery_ui/include/recovery_ui/device.h
index 1433092..e01385a 100644
--- a/recovery_ui/include/recovery_ui/device.h
+++ b/recovery_ui/include/recovery_ui/device.h
@@ -65,6 +65,7 @@
REBOOT_RECOVERY = 18,
REBOOT_RESCUE = 19,
WIPE_SYSTEM = 100,
+ ENABLE_ADB = 101,
MENU_BASE = 200,
MENU_WIPE = 202,
MENU_ADVANCED = 203,