ActivityThread: Avoid creating duplicate handlers and reuse mH
sMainThreadHandler is used for notification of changes in SharedPreferences and refers to a new instance of Handler instead of the existing instance, mH, of the ActivityThread. Fix to reuse existing handlers associated with main looper. Change-Id: I794a5802a9eacdb188bd0619db5e70e3ae89a07d
This commit is contained in:
@@ -4728,13 +4728,14 @@ public final class ActivityThread {
|
||||
Process.setArgV0("<pre-initialized>");
|
||||
|
||||
Looper.prepareMainLooper();
|
||||
if (sMainThreadHandler == null) {
|
||||
sMainThreadHandler = new Handler();
|
||||
}
|
||||
|
||||
ActivityThread thread = new ActivityThread();
|
||||
thread.attach(false);
|
||||
|
||||
if (sMainThreadHandler == null) {
|
||||
sMainThreadHandler = thread.getHandler();
|
||||
}
|
||||
|
||||
AsyncTask.init();
|
||||
|
||||
if (false) {
|
||||
|
||||
Reference in New Issue
Block a user