From 6d5ebb7b7056548479a4a4416ce07aad919e819e Mon Sep 17 00:00:00 2001 From: Adrian Roos Date: Thu, 3 Aug 2017 15:10:22 +0200 Subject: [PATCH 1/2] AOD: Fix janky launch transition from AOD2 Fixes the transition that happens when when a notification is launched from AOD2 and the keyguard can be unlocked without going through the bouncer. Change-Id: Iac9835ade42be4ecf02ee7430cf76d05fc006361 Fixes: 64164248 Test: Disable lockscreen security, turn off phone, receive SMS, double tap; verify no jank --- .../statusbar/phone/FingerprintUnlockController.java | 6 +++++- .../android/systemui/statusbar/phone/StatusBar.java | 11 ++++++++++- .../systemui/statusbar/phone/StatusBarTest.java | 9 +++++++++ 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/FingerprintUnlockController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/FingerprintUnlockController.java index fdfd8e88b4465..cb96dea08ae0e 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/FingerprintUnlockController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/FingerprintUnlockController.java @@ -187,8 +187,12 @@ public class FingerprintUnlockController extends KeyguardUpdateMonitorCallback { Trace.endSection(); return; } + startWakeAndUnlock(calculateMode()); + } + + public void startWakeAndUnlock(int mode) { boolean wasDeviceInteractive = mUpdateMonitor.isDeviceInteractive(); - mMode = calculateMode(); + mMode = mode; mHasScreenTurnedOnSinceAuthenticating = false; if (mMode == MODE_WAKE_AND_UNLOCK_PULSING && pulsingOrAod()) { // If we are waking the device up while we are pulsing the clock and the diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java index db84cff5c204c..7499f8dc331c7 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java @@ -142,6 +142,7 @@ import android.widget.RemoteViews; import android.widget.TextView; import android.widget.Toast; +import com.android.internal.annotations.VisibleForTesting; import com.android.internal.colorextraction.ColorExtractor; import com.android.internal.graphics.ColorUtils; import com.android.internal.logging.MetricsLogger; @@ -748,7 +749,7 @@ public class StatusBar extends SystemUI implements DemoMode, private SysuiColorExtractor mColorExtractor; private ForegroundServiceController mForegroundServiceController; private ScreenLifecycle mScreenLifecycle; - private WakefulnessLifecycle mWakefulnessLifecycle; + @VisibleForTesting WakefulnessLifecycle mWakefulnessLifecycle; private void recycleAllVisibilityObjects(ArraySet array) { final int N = array.size(); @@ -3776,6 +3777,14 @@ public class StatusBar extends SystemUI implements DemoMode, private void dismissKeyguardThenExecute(OnDismissAction action, Runnable cancelAction, boolean afterKeyguardGone) { + if (mWakefulnessLifecycle.getWakefulness() == WAKEFULNESS_ASLEEP + && mUnlockMethodCache.canSkipBouncer() + && isPulsing()) { + // Reuse the fingerprint wake-and-unlock transition if we dismiss keyguard from a pulse. + // TODO: Factor this transition out of FingerprintUnlockController. + mFingerprintUnlockController.startWakeAndUnlock( + FingerprintUnlockController.MODE_WAKE_AND_UNLOCK_PULSING); + } if (mStatusBarKeyguardViewManager.isShowing()) { mStatusBarKeyguardViewManager.dismissWithAction(action, cancelAction, afterKeyguardGone); diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarTest.java index c33897e6b3a11..a706368a0880d 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarTest.java @@ -65,6 +65,7 @@ import com.android.internal.logging.testing.FakeMetricsLogger; import com.android.internal.statusbar.IStatusBarService; import com.android.keyguard.KeyguardHostView.OnDismissAction; import com.android.systemui.SysuiTestCase; +import com.android.systemui.keyguard.WakefulnessLifecycle; import com.android.systemui.recents.misc.SystemServicesProxy; import com.android.systemui.statusbar.ActivatableNotificationView; import com.android.systemui.statusbar.CommandQueue; @@ -500,6 +501,14 @@ public class StatusBarTest extends SysuiTestCase { mSystemServicesProxy = ssp; mNotificationPanel = panelView; mBarService = barService; + mWakefulnessLifecycle = createAwakeWakefulnessLifecycle(); + } + + private WakefulnessLifecycle createAwakeWakefulnessLifecycle() { + WakefulnessLifecycle wakefulnessLifecycle = new WakefulnessLifecycle(); + wakefulnessLifecycle.dispatchStartedWakingUp(); + wakefulnessLifecycle.dispatchFinishedWakingUp(); + return wakefulnessLifecycle; } public void setBarStateForTest(int state) { From 61676aa7f4fe814b22c9beaed298f3ee13cb7b7d Mon Sep 17 00:00:00 2001 From: Adrian Roos Date: Thu, 3 Aug 2017 16:24:32 +0200 Subject: [PATCH 2/2] AOD: Fix RemoteInput from dozing Launching remote input from doze was broken because: - We reset the keyguard, calling showKeyguard and clearing the states when stopping to doze - updateIsKeyguard cleared the state; instead clear it now when we actually show / hide the keyguard Change-Id: I901908d96ba93a49e4104b622bdd5ca604a8e392 Fixes: 64335172 Test: Receive message on AOD2, click Reply, verify it opens reply box --- .../systemui/statusbar/phone/StatusBar.java | 15 ++++++++++----- .../phone/StatusBarKeyguardViewManager.java | 6 ++++-- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java index 7499f8dc331c7..bcfdf5206d566 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java @@ -3779,6 +3779,7 @@ public class StatusBar extends SystemUI implements DemoMode, boolean afterKeyguardGone) { if (mWakefulnessLifecycle.getWakefulness() == WAKEFULNESS_ASLEEP && mUnlockMethodCache.canSkipBouncer() + && !mLeaveOpenOnKeyguardHide && isPulsing()) { // Reuse the fingerprint wake-and-unlock transition if we dismiss keyguard from a pulse. // TODO: Factor this transition out of FingerprintUnlockController. @@ -4221,6 +4222,8 @@ public class StatusBar extends SystemUI implements DemoMode, public void showKeyguard() { mKeyguardRequested = true; + mLeaveOpenOnKeyguardHide = false; + mPendingRemoteInputView = null; updateIsKeyguard(); mAssistManager.onLockscreenShown(); } @@ -4271,13 +4274,11 @@ public class StatusBar extends SystemUI implements DemoMode, } updateKeyguardState(false /* goingToFullShade */, false /* fromShadeLocked */); updatePanelExpansionForKeyguard(); - mLeaveOpenOnKeyguardHide = false; if (mDraggedDownRow != null) { mDraggedDownRow.setUserLocked(false); mDraggedDownRow.notifyHeightChanged(false /* needsAnimation */); mDraggedDownRow = null; } - mPendingRemoteInputView = null; } private void updatePanelExpansionForKeyguard() { @@ -4417,15 +4418,19 @@ public class StatusBar extends SystemUI implements DemoMode, setBarState(StatusBarState.SHADE); View viewToClick = null; if (mLeaveOpenOnKeyguardHide) { - mLeaveOpenOnKeyguardHide = false; + if (!mKeyguardRequested) { + mLeaveOpenOnKeyguardHide = false; + } long delay = calculateGoingToFullShadeDelay(); mNotificationPanel.animateToFullShade(delay); if (mDraggedDownRow != null) { mDraggedDownRow.setUserLocked(false); mDraggedDownRow = null; } - viewToClick = mPendingRemoteInputView; - mPendingRemoteInputView = null; + if (!mKeyguardRequested) { + viewToClick = mPendingRemoteInputView; + mPendingRemoteInputView = null; + } // Disable layout transitions in navbar for this transition because the load is just // too heavy for the CPU and GPU on any device. diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java index acf42785f8267..314700907f577 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java @@ -156,7 +156,6 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb */ protected void showBouncerOrKeyguard(boolean hideBouncerWhenShowing) { if (mBouncer.needsFullscreenBouncer() && !mDozing) { - // The keyguard might be showing (already). So we need to hide it. mStatusBar.hideKeyguard(); mBouncer.show(true /* resetSecuritySelection */); @@ -167,6 +166,7 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb mBouncer.prepare(); } } + updateStates(); } private void showBouncer() { @@ -250,7 +250,9 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb public void setDozing(boolean dozing) { if (mDozing != dozing) { mDozing = dozing; - reset(dozing /* hideBouncerWhenShowing */); + if (dozing || mBouncer.needsFullscreenBouncer() || mOccluded) { + reset(dozing /* hideBouncerWhenShowing */); + } updateStates(); } }