Only handle keycodes when adb is enabled.

This prevents accidental bugreports on userdebug/eng devices.

Bug: 8541006
Change-Id: Iefd15826090fd91434403f197cfd166e64400224
This commit is contained in:
Jeff Sharkey 2013-04-04 10:44:41 -07:00
parent c1e47294c9
commit b4d52a437e

View file

@ -100,10 +100,7 @@ void handle_keychord()
int ret; int ret;
__u16 id; __u16 id;
// only handle keychords if ro.debuggable is set or adb is enabled. // Only handle keychords if adb is enabled.
// the logic here is that bugreports should be enabled in userdebug or eng builds
// and on user builds for users that are developers.
debuggable = property_get("ro.debuggable");
adb_enabled = property_get("init.svc.adbd"); adb_enabled = property_get("init.svc.adbd");
ret = read(keychord_fd, &id, sizeof(id)); ret = read(keychord_fd, &id, sizeof(id));
if (ret != sizeof(id)) { if (ret != sizeof(id)) {
@ -111,8 +108,7 @@ void handle_keychord()
return; return;
} }
if ((debuggable && !strcmp(debuggable, "1")) || if ((adb_enabled && !strcmp(adb_enabled, "running"))) {
(adb_enabled && !strcmp(adb_enabled, "running"))) {
svc = service_find_by_keychord(id); svc = service_find_by_keychord(id);
if (svc) { if (svc) {
INFO("starting service %s from keychord\n", svc->name); INFO("starting service %s from keychord\n", svc->name);