Skip to content

Commit ffc45b7

Browse files
benoitgobyAndroid (Google) Code Review
authored andcommitted
Merge "UsbDebuggingManager: Fix restart when toggling USB debugging" into jb-mr1-dev
2 parents f404d10 + 509bf2d commit ffc45b7

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

services/java/com/android/server/usb/UsbDebuggingManager.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,16 +53,15 @@ public class UsbDebuggingManager implements Runnable {
5353
private final int BUFFER_SIZE = 4096;
5454

5555
private final Context mContext;
56-
private final Thread mThread;
5756
private final Handler mHandler;
5857
private final HandlerThread mHandlerThread;
58+
private Thread mThread;
5959
private boolean mAdbEnabled = false;
6060
private String mFingerprints;
6161
private LocalSocket mSocket = null;
6262
private OutputStream mOutputStream = null;
6363

6464
public UsbDebuggingManager(Context context) {
65-
mThread = new Thread(this);
6665
mHandlerThread = new HandlerThread("UsbDebuggingHandler");
6766
mHandlerThread.start();
6867
mHandler = new UsbDebuggingHandler(mHandlerThread.getLooper());
@@ -165,6 +164,7 @@ public void handleMessage(Message msg) {
165164

166165
mAdbEnabled = true;
167166

167+
mThread = new Thread(UsbDebuggingManager.this);
168168
mThread.start();
169169

170170
break;
@@ -181,6 +181,7 @@ public void handleMessage(Message msg) {
181181
} catch (Exception ex) {
182182
}
183183

184+
mThread = null;
184185
mOutputStream = null;
185186
mSocket = null;
186187
break;

0 commit comments

Comments
 (0)