diff options
author | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2023-01-08 22:25:17 +0000 |
---|---|---|
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2023-01-08 22:25:17 +0000 |
commit | 068ea566f5fe166fc0f805b5e9497b8c23f411e3 (patch) | |
tree | 9957543ce41cc5f3e00ec06022593b3a4ddbc363 | |
parent | 66669ccda45a65e9bbffa3b54387032e932aea37 (diff) | |
parent | 0d0f74b7db7ab6f864eac6e95d3ec68cb41ae5a3 (diff) | |
download | base-068ea566f5fe166fc0f805b5e9497b8c23f411e3.tar.gz |
Snap for 9467077 from 0d0f74b7db7ab6f864eac6e95d3ec68cb41ae5a3 to tm-qpr2-release
Change-Id: I38b03729fd47e1405c0c72df6122e78ab6c69ede
3 files changed, 44 insertions, 4 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java index bb2141d3fa16..e0def25fd8d3 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java +++ b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java @@ -1458,16 +1458,16 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable, public void maybeHandlePendingLock() { if (mPendingLock) { - // The screen off animation is playing, so if we lock now, the foreground app will - // vanish and the keyguard will jump-cut in. Delay it, until either: + // The screen off animation is playing or is about to be, so if we lock now, the + // foreground app will vanish and the keyguard will jump-cut in. Delay it, until either: // - The screen off animation ends. We will call maybeHandlePendingLock from // the end action in UnlockedScreenOffAnimationController#animateInKeyguard. // - The screen off animation is cancelled by the device waking back up. We will call // maybeHandlePendingLock from KeyguardViewMediator#onStartedWakingUp. - if (mScreenOffAnimationController.isKeyguardShowDelayed()) { + if (mScreenOffAnimationController.shouldDelayKeyguardShow()) { if (DEBUG) { Log.d(TAG, "#maybeHandlePendingLock: not handling because the screen off " - + "animation's isKeyguardShowDelayed() returned true. This should be " + + "animation's shouldDelayKeyguardShow() returned true. This should be " + "handled soon by #onStartedWakingUp, or by the end actions of the " + "screen off animation."); } diff --git a/packages/SystemUI/tests/src/com/android/systemui/keyguard/KeyguardViewMediatorTest.java b/packages/SystemUI/tests/src/com/android/systemui/keyguard/KeyguardViewMediatorTest.java index 5196f4962a6c..9b0d8dbe5a65 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/keyguard/KeyguardViewMediatorTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/keyguard/KeyguardViewMediatorTest.java @@ -444,6 +444,45 @@ public class KeyguardViewMediatorTest extends SysuiTestCase { TestableLooper.get(this).processAllMessages(); } + @Test + @TestableLooper.RunWithLooper(setAsMainLooper = true) + public void testKeyguardDelayedOnGoingToSleep_ifScreenOffAnimationWillPlayButIsntPlayingYet() { + mViewMediator.onSystemReady(); + TestableLooper.get(this).processAllMessages(); + + mViewMediator.setShowingLocked(false); + TestableLooper.get(this).processAllMessages(); + + mViewMediator.onStartedGoingToSleep(OFF_BECAUSE_OF_USER); + TestableLooper.get(this).processAllMessages(); + + when(mScreenOffAnimationController.shouldDelayKeyguardShow()).thenReturn(true); + when(mScreenOffAnimationController.isKeyguardShowDelayed()).thenReturn(false); + mViewMediator.onFinishedGoingToSleep(OFF_BECAUSE_OF_USER, false); + TestableLooper.get(this).processAllMessages(); + + assertFalse(mViewMediator.isShowingAndNotOccluded()); + } + + @Test + @TestableLooper.RunWithLooper(setAsMainLooper = true) + public void testKeyguardNotDelayedOnGoingToSleep_ifScreenOffAnimationWillNotPlay() { + mViewMediator.onSystemReady(); + TestableLooper.get(this).processAllMessages(); + + mViewMediator.setShowingLocked(false); + TestableLooper.get(this).processAllMessages(); + + mViewMediator.onStartedGoingToSleep(OFF_BECAUSE_OF_USER); + TestableLooper.get(this).processAllMessages(); + + when(mScreenOffAnimationController.shouldDelayKeyguardShow()).thenReturn(false); + mViewMediator.onFinishedGoingToSleep(OFF_BECAUSE_OF_USER, false); + TestableLooper.get(this).processAllMessages(); + + assertTrue(mViewMediator.isShowingAndNotOccluded()); + } + private void createAndStartViewMediator() { mViewMediator = new KeyguardViewMediator( mContext, diff --git a/services/companion/java/com/android/server/companion/presence/CompanionDevicePresenceMonitor.java b/services/companion/java/com/android/server/companion/presence/CompanionDevicePresenceMonitor.java index a1e734dead77..b3fad8c41328 100644 --- a/services/companion/java/com/android/server/companion/presence/CompanionDevicePresenceMonitor.java +++ b/services/companion/java/com/android/server/companion/presence/CompanionDevicePresenceMonitor.java @@ -281,6 +281,7 @@ public class CompanionDevicePresenceMonitor implements AssociationStore.OnChange mConnectedBtDevices.remove(id); mNearbyBleDevices.remove(id); mReportedSelfManagedDevices.remove(id); + mSimulated.remove(id); // Do NOT call mCallback.onDeviceDisappeared()! // CompanionDeviceManagerService will know that the association is removed, and will do |