summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Albert <danalbert@google.com>2015-03-28 11:52:10 -0700
committerDan Albert <danalbert@google.com>2015-03-28 19:04:15 +0000
commit868402e5bfcc14305f216f34751d6c2e150aa849 (patch)
tree352dfa3599743a6c9998451895eb4d4f005f8156
parente29744d94df787fa83307572d90a954b1592f69b (diff)
downloadsystem_core-868402e5bfcc14305f216f34751d6c2e150aa849.zip
system_core-868402e5bfcc14305f216f34751d6c2e150aa849.tar.gz
system_core-868402e5bfcc14305f216f34751d6c2e150aa849.tar.bz2
Revert "Remove the emulator special case from the "adb root" code."
adb root doesn't work on the emulator, so this prevents root access to a userdebug emulator. Since the emulator has always been root even on userdebug builds, it may be that adb root has never worked on the emulator. Bug: 19974213 This reverts commit abd6773b41effd1e1005ad7ce8cb5e370a367302.
-rw-r--r--adb/adb_main.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/adb/adb_main.cpp b/adb/adb_main.cpp
index a03fcf1..fb17e89 100644
--- a/adb/adb_main.cpp
+++ b/adb/adb_main.cpp
@@ -110,6 +110,13 @@ static bool should_drop_privileges() {
#if defined(ALLOW_ADBD_ROOT)
char value[PROPERTY_VALUE_MAX];
+ // The emulator is never secure, so don't drop privileges there.
+ // TODO: this seems like a bug --- shouldn't the emulator behave like a device?
+ property_get("ro.kernel.qemu", value, "");
+ if (strcmp(value, "1") == 0) {
+ return false;
+ }
+
// The properties that affect `adb root` and `adb unroot` are ro.secure and
// ro.debuggable. In this context the names don't make the expected behavior
// particularly obvious.