From 12f328489b4642162a427c6d8d3b13af48ad825b Mon Sep 17 00:00:00 2001 From: Josh Gao Date: Mon, 4 Feb 2019 13:18:54 -0800 Subject: [PATCH] adbd: switch the default USB implementation. Switch to the nonblocking FFS implementation that fixes several race conditions on connect/disconnect. Test: treehugger Change-Id: I91fdb9b27152078cb38e610861a05f1fa95aa3a2 --- adb/daemon/usb.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/adb/daemon/usb.cpp b/adb/daemon/usb.cpp index f0e286103..69d1c3149 100644 --- a/adb/daemon/usb.cpp +++ b/adb/daemon/usb.cpp @@ -628,9 +628,10 @@ static void usb_ffs_open_thread() { } void usb_init() { - if (!android::base::GetBoolProperty("persist.adb.nonblocking_ffs", false)) { - usb_init_legacy(); - } else { + bool use_nonblocking = android::base::GetBoolProperty("persist.adb.nonblocking_ffs", true); + if (use_nonblocking) { std::thread(usb_ffs_open_thread).detach(); + } else { + usb_init_legacy(); } }