diff options
author | Dianne Hackborn <hackbod@google.com> | 2013-04-30 17:24:15 -0700 |
---|---|---|
committer | Dianne Hackborn <hackbod@google.com> | 2013-05-02 17:42:40 -0700 |
commit | 8d044e8bc287c1a567d82aedbe30085b011544c3 (patch) | |
tree | 89966111423d4519c15874aa871d35d3cc92b206 /services/java/com/android/server/usb/UsbDebuggingManager.java | |
parent | 34761434a0957dde28d6156afb48372934581c16 (diff) |
Start combining threads in system process.
This introduces four generic thread that services can
use in the system process:
- Background: part of the framework for all processes, for
work that is purely background (no timing constraint).
- UI: for time-critical display of UI.
- Foreground: normal foreground work.
- IO: performing IO operations.
I went through and moved services into these threads in the
places I felt relatively comfortable about understanding what
they are doing. There are still a bunch more we need to look
at -- lots of networking stuff left, 3 or so different native
daemon connectors which I didn't know how much would block,
audio stuff, etc.
Also updated Watchdog to be aware of and check these new
threads, with a new API for other threads to also participate
in this checking.
Change-Id: Ie2f11061cebde5f018d7383b3a910fbbd11d5e11
Diffstat (limited to 'services/java/com/android/server/usb/UsbDebuggingManager.java')
-rw-r--r-- | services/java/com/android/server/usb/UsbDebuggingManager.java | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/services/java/com/android/server/usb/UsbDebuggingManager.java b/services/java/com/android/server/usb/UsbDebuggingManager.java index 93d31144815f..ba3f1d1b6041 100644 --- a/services/java/com/android/server/usb/UsbDebuggingManager.java +++ b/services/java/com/android/server/usb/UsbDebuggingManager.java @@ -22,15 +22,14 @@ import android.content.Intent; import android.net.LocalSocket; import android.net.LocalSocketAddress; import android.os.Handler; -import android.os.HandlerThread; import android.os.Environment; import android.os.FileUtils; import android.os.Looper; import android.os.Message; -import android.os.Process; import android.os.SystemClock; import android.util.Slog; import android.util.Base64; +import com.android.server.FgThread; import java.lang.Thread; import java.io.File; @@ -54,7 +53,6 @@ public class UsbDebuggingManager implements Runnable { private final Context mContext; private final Handler mHandler; - private final HandlerThread mHandlerThread; private Thread mThread; private boolean mAdbEnabled = false; private String mFingerprints; @@ -62,9 +60,7 @@ public class UsbDebuggingManager implements Runnable { private OutputStream mOutputStream = null; public UsbDebuggingManager(Context context) { - mHandlerThread = new HandlerThread("UsbDebuggingHandler"); - mHandlerThread.start(); - mHandler = new UsbDebuggingHandler(mHandlerThread.getLooper()); + mHandler = new UsbDebuggingHandler(FgThread.get().getLooper()); mContext = context; } @@ -165,7 +161,7 @@ public class UsbDebuggingManager implements Runnable { mAdbEnabled = true; - mThread = new Thread(UsbDebuggingManager.this); + mThread = new Thread(UsbDebuggingManager.this, "UsbDebuggingManager"); mThread.start(); break; |