Skip to content

Commit b0b4a70

Browse files
Dianne Hackbornandroid code review
authored andcommitted
Merge "ActivityThread: Avoid creating duplicate handlers and reuse mH"
2 parents b8da225 + 7335cfd commit b0b4a70

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

core/java/android/app/ActivityThread.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4728,13 +4728,14 @@ public static void main(String[] args) {
47284728
Process.setArgV0("<pre-initialized>");
47294729

47304730
Looper.prepareMainLooper();
4731-
if (sMainThreadHandler == null) {
4732-
sMainThreadHandler = new Handler();
4733-
}
47344731

47354732
ActivityThread thread = new ActivityThread();
47364733
thread.attach(false);
47374734

4735+
if (sMainThreadHandler == null) {
4736+
sMainThreadHandler = thread.getHandler();
4737+
}
4738+
47384739
AsyncTask.init();
47394740

47404741
if (false) {

0 commit comments

Comments
 (0)