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/LocationManagerService.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/LocationManagerService.java')
-rw-r--r-- | services/java/com/android/server/LocationManagerService.java | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/services/java/com/android/server/LocationManagerService.java b/services/java/com/android/server/LocationManagerService.java index 26753094a978..b162c6bb6354 100644 --- a/services/java/com/android/server/LocationManagerService.java +++ b/services/java/com/android/server/LocationManagerService.java @@ -63,6 +63,7 @@ import android.util.Slog; import com.android.internal.content.PackageMonitor; import com.android.internal.location.ProviderProperties; import com.android.internal.location.ProviderRequest; +import com.android.internal.os.BackgroundThread; import com.android.server.location.GeocoderProxy; import com.android.server.location.GeofenceProxy; import com.android.server.location.GeofenceManager; @@ -93,7 +94,6 @@ public class LocationManagerService extends ILocationManager.Stub { public static final boolean D = Log.isLoggable(TAG, Log.DEBUG); private static final String WAKELOCK_KEY = TAG; - private static final String THREAD_NAME = TAG; // Location resolution level: no location data whatsoever private static final int RESOLUTION_LEVEL_NONE = 0; @@ -143,7 +143,6 @@ public class LocationManagerService extends ILocationManager.Stub { private LocationWorkerHandler mLocationHandler; private PassiveProvider mPassiveProvider; // track passive provider for special cases private LocationBlacklist mBlacklist; - private HandlerThread mHandlerThread; // --- fields below are protected by mWakeLock --- private int mPendingBroadcasts; @@ -216,9 +215,7 @@ public class LocationManagerService extends ILocationManager.Stub { mWakeLock = powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, WAKELOCK_KEY); // prepare worker thread - mHandlerThread = new HandlerThread(THREAD_NAME, Process.THREAD_PRIORITY_BACKGROUND); - mHandlerThread.start(); - mLocationHandler = new LocationWorkerHandler(mHandlerThread.getLooper()); + mLocationHandler = new LocationWorkerHandler(BackgroundThread.get().getLooper()); // prepare mLocationHandler's dependents mLocationFudger = new LocationFudger(mContext, mLocationHandler); |