diff options
author | Amith Yamasani <yamasani@google.com> | 2013-09-18 16:28:50 -0700 |
---|---|---|
committer | Amith Yamasani <yamasani@google.com> | 2013-09-19 10:57:16 -0700 |
commit | 450a16b33f5d58370d181a7539aa113779efa247 (patch) | |
tree | 8d95468a611be7b9bf55b5eb4cb7aa8b2567577d /services/java/com/android/server/NetworkTimeUpdateService.java | |
parent | 6df7d4a574ffd85c82cad402552e3854df3a3f85 (diff) |
Use a separate thread for services that do NTP lookup
Some services do periodic network time lookups and can wedge the other operations on
BackgroundThread and IO Thread, causing Watchdog to kill the runtime. So best to put
those handlers on separate threads.
Going forward, should convert NTP lookups to be async with callbacks.
Bug: 10646480
Change-Id: I8c7ba6052cb3539575712c2099a706b14ff60196
Diffstat (limited to 'services/java/com/android/server/NetworkTimeUpdateService.java')
-rw-r--r-- | services/java/com/android/server/NetworkTimeUpdateService.java | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/services/java/com/android/server/NetworkTimeUpdateService.java b/services/java/com/android/server/NetworkTimeUpdateService.java index cbddf6797797..fddb54e138e2 100644 --- a/services/java/com/android/server/NetworkTimeUpdateService.java +++ b/services/java/com/android/server/NetworkTimeUpdateService.java @@ -27,6 +27,7 @@ import android.database.ContentObserver; import android.net.ConnectivityManager; import android.net.NetworkInfo; import android.os.Handler; +import android.os.HandlerThread; import android.os.Looper; import android.os.Message; import android.os.SystemClock; @@ -35,7 +36,6 @@ import android.util.Log; import android.util.NtpTrustedTime; import android.util.TrustedTime; -import com.android.internal.os.BackgroundThread; import com.android.internal.telephony.TelephonyIntents; /** @@ -113,7 +113,9 @@ public class NetworkTimeUpdateService { registerForAlarms(); registerForConnectivityIntents(); - mHandler = new MyHandler(BackgroundThread.get().getLooper()); + HandlerThread thread = new HandlerThread(TAG); + thread.start(); + mHandler = new MyHandler(thread.getLooper()); // Check the network time on the new thread mHandler.obtainMessage(EVENT_POLL_NETWORK_TIME).sendToTarget(); |