summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfaces.java28
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java21
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/CentralSurfacesTest.java10
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManagerTest.java13
4 files changed, 40 insertions, 32 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfaces.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfaces.java
index 1932680de2fa..d0e861c312e9 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfaces.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfaces.java
@@ -359,6 +359,16 @@ public class CentralSurfaces extends CoreStartable implements
private float mTransitionToFullShadeProgress = 0f;
private NotificationListContainer mNotifListContainer;
+ private final KeyguardStateController.Callback mKeyguardStateControllerCallback =
+ new KeyguardStateController.Callback() {
+ @Override
+ public void onKeyguardShowingChanged() {
+ boolean occluded = mKeyguardStateController.isOccluded();
+ mStatusBarHideIconsForBouncerManager.setIsOccludedAndTriggerUpdate(occluded);
+ mScrimController.setKeyguardOccluded(occluded);
+ }
+ };
+
void onStatusBarWindowStateChanged(@WindowVisibleState int state) {
updateBubblesVisibility();
mStatusBarWindowState = state;
@@ -655,7 +665,6 @@ public class CentralSurfaces extends CoreStartable implements
private int mLastLoggedStateFingerprint;
private boolean mTopHidesStatusBar;
private boolean mStatusBarWindowHidden;
- private boolean mIsOccluded;
private boolean mIsLaunchingActivityOverLockscreen;
private final UserSwitcherController mUserSwitcherController;
@@ -1002,7 +1011,6 @@ public class CentralSurfaces extends CoreStartable implements
mCommandQueue.setIcon(result.mIcons.keyAt(i), result.mIcons.valueAt(i));
}
-
if (DEBUG) {
Log.d(TAG, String.format(
"init: icons=%d disabled=0x%08x lights=0x%08x imeButton=0x%08x",
@@ -1036,7 +1044,6 @@ public class CentralSurfaces extends CoreStartable implements
mKeyguardStateController.addCallback(new KeyguardStateController.Callback() {
@Override
public void onUnlockedChanged() {
- updateKeyguardState();
logStateToEventlog();
}
});
@@ -1599,6 +1606,7 @@ public class CentralSurfaces extends CoreStartable implements
mBiometricUnlockController,
mStackScroller,
mKeyguardBypassController);
+ mKeyguardStateController.addCallback(mKeyguardStateControllerCallback);
mKeyguardIndicationController
.setStatusBarKeyguardViewManager(mStatusBarKeyguardViewManager);
mBiometricUnlockController.setKeyguardViewController(mStatusBarKeyguardViewManager);
@@ -1853,13 +1861,7 @@ public class CentralSurfaces extends CoreStartable implements
* @return whether the keyguard is currently occluded
*/
public boolean isOccluded() {
- return mIsOccluded;
- }
-
- public void setOccluded(boolean occluded) {
- mIsOccluded = occluded;
- mStatusBarHideIconsForBouncerManager.setIsOccludedAndTriggerUpdate(occluded);
- mScrimController.setKeyguardOccluded(occluded);
+ return mKeyguardStateController.isOccluded();
}
/** A launch animation was cancelled. */
@@ -3383,11 +3385,6 @@ public class CentralSurfaces extends CoreStartable implements
return mLightRevealScrim;
}
- private void updateKeyguardState() {
- mKeyguardStateController.notifyKeyguardState(mStatusBarKeyguardViewManager.isShowing(),
- mStatusBarKeyguardViewManager.isOccluded());
- }
-
public void onTrackingStarted() {
mShadeController.runPostCollapseRunnables();
}
@@ -4385,7 +4382,6 @@ public class CentralSurfaces extends CoreStartable implements
checkBarModes();
updateScrimController();
mPresenter.updateMediaMetaData(false, mState != StatusBarState.KEYGUARD);
- updateKeyguardState();
Trace.endSection();
}
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 b8478855e8ff..75bc39fa3b25 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java
@@ -659,12 +659,14 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
@Override
public void setOccluded(boolean occluded, boolean animate) {
- mCentralSurfaces.setOccluded(occluded);
- if (occluded && !mOccluded && mShowing) {
+ final boolean isOccluding = !mOccluded && occluded;
+ final boolean isUnOccluding = mOccluded && !occluded;
+ setOccludedAndUpdateStates(occluded);
+
+ if (mShowing && isOccluding) {
SysUiStatsLog.write(SysUiStatsLog.KEYGUARD_STATE_CHANGED,
SysUiStatsLog.KEYGUARD_STATE_CHANGED__STATE__OCCLUDED);
if (mCentralSurfaces.isInLaunchTransition()) {
- setOccludedAndUpdateStates(true);
final Runnable endRunnable = new Runnable() {
@Override
public void run() {
@@ -680,8 +682,6 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
}
if (mCentralSurfaces.isLaunchingActivityOverLockscreen()) {
- setOccludedAndUpdateStates(true);
-
// When isLaunchingActivityOverLockscreen() is true, we know for sure that the post
// collapse runnables will be run.
mShadeController.get().addPostCollapseAction(() -> {
@@ -690,16 +690,14 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
});
return;
}
- } else if (!occluded && mOccluded && mShowing) {
+ } else if (mShowing && isUnOccluding) {
SysUiStatsLog.write(SysUiStatsLog.KEYGUARD_STATE_CHANGED,
SysUiStatsLog.KEYGUARD_STATE_CHANGED__STATE__SHOWN);
}
- boolean isOccluding = !mOccluded && occluded;
- setOccludedAndUpdateStates(occluded);
if (mShowing) {
- mMediaManager.updateMediaMetaData(false, animate && !occluded);
+ mMediaManager.updateMediaMetaData(false, animate && !mOccluded);
}
- mNotificationShadeWindowController.setKeyguardOccluded(occluded);
+ mNotificationShadeWindowController.setKeyguardOccluded(mOccluded);
// setDozing(false) will call reset once we stop dozing.
if (!mDozing) {
@@ -707,7 +705,7 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
// by a FLAG_DISMISS_KEYGUARD_ACTIVITY.
reset(isOccluding /* hideBouncerWhenShowing*/);
}
- if (animate && !occluded && mShowing && !mBouncer.isShowing()) {
+ if (animate && !mOccluded && mShowing && !mBouncer.isShowing()) {
mCentralSurfaces.animateKeyguardUnoccluding();
}
}
@@ -1041,6 +1039,7 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
if (occluded != mLastOccluded || mFirstUpdate) {
mKeyguardUpdateManager.onKeyguardOccludedChanged(occluded);
+ mKeyguardStateController.notifyKeyguardState(showing, occluded);
}
if ((showing && !occluded) != (mLastShowing && !mLastOccluded) || mFirstUpdate) {
mKeyguardUpdateManager.onKeyguardVisibilityChanged(showing && !occluded);
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/CentralSurfacesTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/CentralSurfacesTest.java
index c72f89512230..91a1d7fffafc 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/CentralSurfacesTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/CentralSurfacesTest.java
@@ -861,11 +861,17 @@ public class CentralSurfacesTest extends SysuiTestCase {
@Test
public void testSetOccluded_propagatesToScrimController() {
- mCentralSurfaces.setOccluded(true);
+ ArgumentCaptor<KeyguardStateController.Callback> callbackCaptor =
+ ArgumentCaptor.forClass(KeyguardStateController.Callback.class);
+ verify(mKeyguardStateController).addCallback(callbackCaptor.capture());
+
+ when(mKeyguardStateController.isOccluded()).thenReturn(true);
+ callbackCaptor.getValue().onKeyguardShowingChanged();
verify(mScrimController).setKeyguardOccluded(eq(true));
reset(mScrimController);
- mCentralSurfaces.setOccluded(false);
+ when(mKeyguardStateController.isOccluded()).thenReturn(false);
+ callbackCaptor.getValue().onKeyguardShowingChanged();
verify(mScrimController).setKeyguardOccluded(eq(false));
}
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManagerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManagerTest.java
index 29488f1ba8a3..ede3de83b572 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManagerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManagerTest.java
@@ -149,6 +149,7 @@ public class StatusBarKeyguardViewManagerTest extends SysuiTestCase {
mBiometricUnlockController,
mNotificationContainer,
mBypassController);
+ when(mKeyguardStateController.isOccluded()).thenReturn(false);
mStatusBarKeyguardViewManager.show(null);
}
@@ -286,23 +287,27 @@ public class StatusBarKeyguardViewManagerTest extends SysuiTestCase {
@Test
public void setOccluded_onKeyguardOccludedChangedCalledCorrectly() {
- mStatusBarKeyguardViewManager.setOccluded(false /* occluded */, false /* animated */);
- verify(mKeyguardUpdateMonitor).onKeyguardOccludedChanged(false);
-
+ clearInvocations(mKeyguardStateController);
clearInvocations(mKeyguardUpdateMonitor);
+ // Should be false to start, so no invocations
mStatusBarKeyguardViewManager.setOccluded(false /* occluded */, false /* animated */);
verify(mKeyguardUpdateMonitor, never()).onKeyguardOccludedChanged(anyBoolean());
+ verify(mKeyguardStateController, never()).notifyKeyguardState(anyBoolean(), anyBoolean());
clearInvocations(mKeyguardUpdateMonitor);
+ clearInvocations(mKeyguardStateController);
mStatusBarKeyguardViewManager.setOccluded(true /* occluded */, false /* animated */);
verify(mKeyguardUpdateMonitor).onKeyguardOccludedChanged(true);
+ verify(mKeyguardStateController).notifyKeyguardState(true, true);
clearInvocations(mKeyguardUpdateMonitor);
+ clearInvocations(mKeyguardStateController);
mStatusBarKeyguardViewManager.setOccluded(true /* occluded */, false /* animated */);
verify(mKeyguardUpdateMonitor, never()).onKeyguardOccludedChanged(anyBoolean());
+ verify(mKeyguardStateController, never()).notifyKeyguardState(anyBoolean(), anyBoolean());
}
@Test
@@ -312,6 +317,7 @@ public class StatusBarKeyguardViewManagerTest extends SysuiTestCase {
mStatusBarKeyguardViewManager.setOccluded(true /* occluded */, false /* animated */);
verify(mKeyguardUpdateMonitor).onKeyguardOccludedChanged(true);
+ verify(mKeyguardStateController).notifyKeyguardState(true, true);
}
@Test
@@ -321,6 +327,7 @@ public class StatusBarKeyguardViewManagerTest extends SysuiTestCase {
mStatusBarKeyguardViewManager.setOccluded(true /* occluded */, false /* animated */);
verify(mKeyguardUpdateMonitor).onKeyguardOccludedChanged(true);
+ verify(mKeyguardStateController).notifyKeyguardState(true, true);
}
@Test