adbd: use libadbd_auth for authentication.
Bug: http://b/137798163
Test: for i in `seq 1 100000`; do echo $i; adb wait-for-device shell "su 0 stop; su 0 start; sleep 10"; adb disconnect; done
Change-Id: Ie481e79a48c4aabf18ef797317ba18f207808c63
diff --git a/adb/daemon/main.cpp b/adb/daemon/main.cpp
index 9ebab74..70e4dd4 100644
--- a/adb/daemon/main.cpp
+++ b/adb/daemon/main.cpp
@@ -214,8 +214,6 @@
}
#endif
- adbd_auth_init();
-
// Our external storage path may be different than apps, since
// we aren't able to bind mount after dropping root.
const char* adb_external_storage = getenv("ADB_EXTERNAL_STORAGE");
@@ -230,6 +228,9 @@
drop_privileges(server_port);
#endif
+ // adbd_auth_init will spawn a thread, so we need to defer it until after selinux transitions.
+ adbd_auth_init();
+
bool is_usb = false;
#if defined(__ANDROID__)