From da388d69fe0bcbeed80d9020bf9eb6b897607e43 Mon Sep 17 00:00:00 2001 From: Aaron Liu Date: Tue, 13 Feb 2024 09:01:30 -0800 Subject: Ensure that disable is enqueued We are getting a NPE trying to read an arraylist of callbacks while it is being modified in a different thread. This code path is the only one that uses "handleMessage" which directly invokes the message. We need to have this conform to the pattern to ensure that the list read/write is synchronized. Fixes: 324867208 Test: atest CommandQueueTest Test: adb stop start and observe that boot works properly. Flag: NONE Change-Id: Ie4f0450239223482463957050f385283cbd03f0c --- .../src/com/android/systemui/statusbar/CommandQueue.java | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/CommandQueue.java b/packages/SystemUI/src/com/android/systemui/statusbar/CommandQueue.java index ffb11dd3cf92..778726e0422e 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/CommandQueue.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/CommandQueue.java @@ -609,14 +609,7 @@ public class CommandQueue extends IStatusBar.Stub implements args.argi2 = state1; args.argi3 = state2; args.argi4 = animate ? 1 : 0; - Message msg = mHandler.obtainMessage(MSG_DISABLE, args); - if (Looper.myLooper() == mHandler.getLooper()) { - // If its the right looper execute immediately so hides can be handled quickly. - mHandler.handleMessage(msg); - msg.recycle(); - } else { - msg.sendToTarget(); - } + mHandler.obtainMessage(MSG_DISABLE, args).sendToTarget(); } } -- cgit v1.2.3-59-g8ed1b