diff --git a/adb/adb_main.cpp b/adb/adb_main.cpp index a03fcf1a7..fb17e89f4 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.