Merge "drmserver: add group drm"
diff --git a/adb/adb.h b/adb/adb.h
index 85922bf..03a7393 100644
--- a/adb/adb.h
+++ b/adb/adb.h
@@ -86,6 +86,11 @@
*/
int closing;
+ /* flag: quit adbd when both ends close the
+ ** local service socket
+ */
+ int exit_on_close;
+
/* the asocket we are connected to
*/
diff --git a/adb/services.c b/adb/services.c
index 6940be8..495a083 100644
--- a/adb/services.c
+++ b/adb/services.c
@@ -125,12 +125,10 @@
return;
}
+ property_set("service.adb.root", "1");
snprintf(buf, sizeof(buf), "restarting adbd as root\n");
writex(fd, buf, strlen(buf));
adb_close(fd);
-
- // This will cause a property trigger in init.rc to restart us
- property_set("service.adb.root", "1");
}
}
@@ -152,10 +150,6 @@
snprintf(buf, sizeof(buf), "restarting in TCP mode port: %d\n", port);
writex(fd, buf, strlen(buf));
adb_close(fd);
-
- // quit, and init will restart us in TCP mode
- sleep(1);
- exit(1);
}
void restart_usb_service(int fd, void *cookie)
@@ -166,10 +160,6 @@
snprintf(buf, sizeof(buf), "restarting in USB mode\n");
writex(fd, buf, strlen(buf));
adb_close(fd);
-
- // quit, and init will restart us in USB mode
- sleep(1);
- exit(1);
}
void reboot_service(int fd, void *arg)
@@ -369,7 +359,6 @@
break;
}
}
- usleep(100000); // poll every 0.1 sec
}
D("shell exited fd=%d of pid=%d err=%d\n", fd, pid, errno);
if (SHELL_EXIT_NOTIFY_FD >=0) {
diff --git a/adb/sockets.c b/adb/sockets.c
index df223b1..ce3c65e 100644
--- a/adb/sockets.c
+++ b/adb/sockets.c
@@ -199,6 +199,8 @@
static void local_socket_destroy(asocket *s)
{
apacket *p, *n;
+ int exit_on_close = s->exit_on_close;
+
D("LS(%d): destroying fde.fd=%d\n", s->id, s->fde.fd);
/* IMPORTANT: the remove closes the fd
@@ -214,6 +216,11 @@
}
remove_socket(s);
free(s);
+
+ if (exit_on_close) {
+ D("local_socket_destroy: exiting\n");
+ exit(1);
+ }
}
@@ -418,6 +425,13 @@
s = create_local_socket(fd);
D("LS(%d): bound to '%s' via %d\n", s->id, name, fd);
+
+ if (!strcmp(name, "root:") || !strcmp(name, "usb:") ||
+ !strcmp(name, "tcpip:")) {
+ D("LS(%d): enabling exit_on_close\n", s->id);
+ s->exit_on_close = 1;
+ }
+
return s;
}
diff --git a/rootdir/init.rc b/rootdir/init.rc
index c445f8e..8520854 100644
--- a/rootdir/init.rc
+++ b/rootdir/init.rc
@@ -379,18 +379,6 @@
on property:ro.kernel.qemu=1
start adbd
-# This property trigger has added to imitiate the previous behavior of "adb root".
-# The adb gadget driver used to reset the USB bus when the adbd daemon exited,
-# and the host side adb relied on this behavior to force it to reconnect with the
-# new adbd instance after init relaunches it. So now we force the USB bus to reset
-# here when adbd sets the service.adb.root property to 1. We also restart adbd here
-# rather than waiting for init to notice its death and restarting it so the timing
-# of USB resetting and adb restarting more closely matches the previous behavior.
-on property:service.adb.root=1
- write /sys/class/android_usb/android0/enable 0
- restart adbd
- write /sys/class/android_usb/android0/enable 1
-
service servicemanager /system/bin/servicemanager
class core
user system