adbd: avoid starting multiple worker threads.

A previous patch intended to make receiving multiple FUNCTIONFS_ENABLEs
non-fatal, but failed to do so because we would try to spawn another
worker thread and hit a different assertion.

Bug: http://b/130638368
Test: echo mem | adb shell "su 0 sh -c 'cat > /sys/power/state'"
Change-Id: I53456112244d8b4f7d26df6ec6961389fca70498
This commit is contained in:
Josh Gao 2019-05-01 16:53:53 -07:00
parent cc30f4d7dd
commit 910ce0ff08
1 changed files with 4 additions and 0 deletions

View File

@ -310,11 +310,13 @@ struct UsbFfsConnection : public Connection {
if (bound) {
LOG(WARNING) << "received FUNCTIONFS_BIND while already bound?";
running = false;
break;
}
if (enabled) {
LOG(WARNING) << "received FUNCTIONFS_BIND while already enabled?";
running = false;
break;
}
bound = true;
@ -324,11 +326,13 @@ struct UsbFfsConnection : public Connection {
if (!bound) {
LOG(WARNING) << "received FUNCTIONFS_ENABLE while not bound?";
running = false;
break;
}
if (enabled) {
LOG(WARNING) << "received FUNCTIONFS_ENABLE while already enabled?";
running = false;
break;
}
enabled = true;