From 1ecd7cd58ed0f823610c7fdae56806d08339e7ca Mon Sep 17 00:00:00 2001 From: Jorim Jaggi Date: Mon, 3 Nov 2014 16:18:03 +0100 Subject: [PATCH] Update QS tile states after unlocking So the visibility state is up-to-date when we do a two-finger expansion gesture, so the height is correct. Also fixes flickering when overscrolling the initial panel expansion. Also set thread priority of QS handler thread to background priority, so it doesn't eat away precious cycles during animations. Bug: 18183633 Change-Id: I0609509484582d82f0dc307eb2535bc3711b30e3 --- packages/SystemUI/src/com/android/systemui/qs/QSPanel.java | 2 +- .../android/systemui/statusbar/phone/PhoneStatusBar.java | 6 ++++++ .../com/android/systemui/statusbar/phone/QSTileHost.java | 4 +++- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java b/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java index 54a84141b341f..1ddd3520c8366 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java +++ b/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java @@ -203,7 +203,7 @@ public class QSPanel extends ViewGroup { } } - private void refreshAllTiles() { + public void refreshAllTiles() { for (TileRecord r : mRecords) { r.tile.refreshState(); } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java index eb487547f9675..65762ec1cdcd9 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java @@ -3611,6 +3611,12 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, instantCollapseNotificationPanel(); } updateKeyguardState(staying, false /* fromShadeLocked */); + + // Keyguard state has changed, but QS is not listening anymore. Make sure to update the tile + // visibilities so next time we open the panel we know the correct height already. + if (mQSPanel != null) { + mQSPanel.refreshAllTiles(); + } return staying; } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/QSTileHost.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/QSTileHost.java index a4db46a0b567d..45a138610b1c7 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/QSTileHost.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/QSTileHost.java @@ -21,6 +21,7 @@ import android.content.Intent; import android.content.res.Resources; import android.database.ContentObserver; import android.net.Uri; +import android.os.Process; import android.os.Handler; import android.os.HandlerThread; import android.os.Looper; @@ -108,7 +109,8 @@ public class QSTileHost implements QSTile.Host { mKeyguard = keyguard; mSecurity = security; - final HandlerThread ht = new HandlerThread(QSTileHost.class.getSimpleName()); + final HandlerThread ht = new HandlerThread(QSTileHost.class.getSimpleName(), + Process.THREAD_PRIORITY_BACKGROUND); ht.start(); mLooper = ht.getLooper();