From 3d3e99c465a25ec1a9eed930c2b1dbd745284d84 Mon Sep 17 00:00:00 2001 From: Jason Monk Date: Thu, 20 Apr 2017 11:26:36 -0400 Subject: [PATCH] Fix status bar not hiding quickly Appears to be from the delay of posting in the CommandQueue, skip post when possible. Test: Turn screen off the right back on. Change-Id: I285b45544f32891ab86fd1f4a4aba3204bcbfdb4 Fixes: 36463611 --- .../src/com/android/systemui/statusbar/CommandQueue.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/CommandQueue.java b/packages/SystemUI/src/com/android/systemui/statusbar/CommandQueue.java index 5c9360abc7f44..30ff30f98a111 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/CommandQueue.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/CommandQueue.java @@ -171,7 +171,14 @@ public class CommandQueue extends IStatusBar.Stub { mDisable1 = state1; mDisable2 = state2; mHandler.removeMessages(MSG_DISABLE); - mHandler.obtainMessage(MSG_DISABLE, state1, state2, animate).sendToTarget(); + Message msg = mHandler.obtainMessage(MSG_DISABLE, state1, state2, animate); + 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(); + } } }