diff options
Diffstat (limited to 'packages/SystemUI/tests/src')
4 files changed, 54 insertions, 6 deletions
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 34ea91b94414..1c8241433172 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/keyguard/KeyguardViewMediatorTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/keyguard/KeyguardViewMediatorTest.java @@ -602,6 +602,9 @@ public class KeyguardViewMediatorTest extends SysuiTestCase { @Test public void testWakeAndUnlockingOverDream() { + // Ensure ordering unlock and wake is enabled. + createAndStartViewMediator(true); + // Send signal to wake mViewMediator.onWakeAndUnlocking(true); @@ -631,6 +634,9 @@ public class KeyguardViewMediatorTest extends SysuiTestCase { @Test public void testWakeAndUnlockingOverDream_signalAuthenticateIfStillShowing() { + // Ensure ordering unlock and wake is enabled. + createAndStartViewMediator(true); + // Send signal to wake mViewMediator.onWakeAndUnlocking(true); @@ -787,6 +793,15 @@ public class KeyguardViewMediatorTest extends SysuiTestCase { } private void createAndStartViewMediator() { + createAndStartViewMediator(false); + } + + private void createAndStartViewMediator(boolean orderUnlockAndWake) { + if (orderUnlockAndWake) { + mContext.getOrCreateTestableResources().addOverride( + com.android.internal.R.bool.config_orderUnlockAndWake, orderUnlockAndWake); + } + mViewMediator = new KeyguardViewMediator( mContext, mUiEventLogger, diff --git a/packages/SystemUI/tests/src/com/android/systemui/keyguard/ResourceTrimmerTest.kt b/packages/SystemUI/tests/src/com/android/systemui/keyguard/ResourceTrimmerTest.kt index 644736899b6c..c175ec3a96ff 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/keyguard/ResourceTrimmerTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/keyguard/ResourceTrimmerTest.kt @@ -18,6 +18,7 @@ import com.android.systemui.keyguard.shared.model.TransitionStep import com.android.systemui.keyguard.shared.model.WakeSleepReason import com.android.systemui.keyguard.shared.model.WakefulnessModel import com.android.systemui.keyguard.shared.model.WakefulnessState +import com.android.systemui.util.mockito.any import com.android.systemui.utils.GlobalWindowManager import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.TestScope @@ -227,6 +228,9 @@ class ResourceTrimmerTest : SysuiTestCase() { keyguardTransitionRepository.sendTransitionStep( TransitionStep(KeyguardState.LOCKSCREEN, KeyguardState.GONE) ) - verifyNoMoreInteractions(globalWindowManager) + // Memory hidden should still be called. + verify(globalWindowManager, times(1)) + .trimMemory(ComponentCallbacks2.TRIM_MEMORY_UI_HIDDEN) + verify(globalWindowManager, times(0)).trimCaches(any()) } } diff --git a/packages/SystemUI/tests/src/com/android/systemui/shared/clocks/ClockRegistryTest.kt b/packages/SystemUI/tests/src/com/android/systemui/shared/clocks/ClockRegistryTest.kt index 04c93cb71e42..0c6926849c4c 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/shared/clocks/ClockRegistryTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/shared/clocks/ClockRegistryTest.kt @@ -224,6 +224,25 @@ class ClockRegistryTest : SysuiTestCase() { } @Test + fun activeClockId_changeAfterPluginConnected() { + val plugin1 = FakeClockPlugin() + .addClock("clock_1", "clock 1") + .addClock("clock_2", "clock 2") + + val plugin2 = FakeClockPlugin() + .addClock("clock_3", "clock 3", { mockClock }) + .addClock("clock_4", "clock 4") + + registry.applySettings(ClockSettings("clock_3", null)) + + pluginListener.onPluginLoaded(plugin1, mockContext, mockPluginLifecycle) + assertEquals(DEFAULT_CLOCK_ID, registry.activeClockId) + + pluginListener.onPluginLoaded(plugin2, mockContext, mockPluginLifecycle) + assertEquals("clock_3", registry.activeClockId) + } + + @Test fun createDefaultClock_pluginDisconnected() { val plugin1 = FakeClockPlugin() .addClock("clock_1", "clock 1") diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/BiometricsUnlockControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/BiometricsUnlockControllerTest.java index 7acf398955fb..2131f9d55ca8 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/BiometricsUnlockControllerTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/BiometricsUnlockControllerTest.java @@ -124,7 +124,7 @@ public class BiometricsUnlockControllerTest extends SysuiTestCase { @Before public void setUp() { MockitoAnnotations.initMocks(this); - TestableResources res = getContext().getOrCreateTestableResources(); + when(mKeyguardStateController.isShowing()).thenReturn(true); when(mUpdateMonitor.isDeviceInteractive()).thenReturn(true); when(mKeyguardStateController.isFaceAuthEnabled()).thenReturn(true); @@ -134,7 +134,15 @@ public class BiometricsUnlockControllerTest extends SysuiTestCase { when(mAuthController.isUdfpsFingerDown()).thenReturn(false); when(mVibratorHelper.hasVibrator()).thenReturn(true); mDependency.injectTestDependency(NotificationMediaManager.class, mMediaManager); - mBiometricUnlockController = new BiometricUnlockController(mDozeScrimController, + mBiometricUnlockController = createController(false); + when(mUpdateMonitor.getStrongAuthTracker()).thenReturn(mStrongAuthTracker); + } + + BiometricUnlockController createController(boolean orderUnlockAndWake) { + TestableResources res = getContext().getOrCreateTestableResources(); + res.addOverride(com.android.internal.R.bool.config_orderUnlockAndWake, orderUnlockAndWake); + BiometricUnlockController biometricUnlockController = new BiometricUnlockController( + mDozeScrimController, mKeyguardViewMediator, mNotificationShadeWindowController, mKeyguardStateController, mHandler, mUpdateMonitor, res.getResources(), mKeyguardBypassController, @@ -144,9 +152,10 @@ public class BiometricsUnlockControllerTest extends SysuiTestCase { mSessionTracker, mLatencyTracker, mScreenOffAnimationController, mVibratorHelper, mSystemClock ); - mBiometricUnlockController.setKeyguardViewController(mStatusBarKeyguardViewManager); - mBiometricUnlockController.addListener(mBiometricUnlockEventsListener); - when(mUpdateMonitor.getStrongAuthTracker()).thenReturn(mStrongAuthTracker); + biometricUnlockController.setKeyguardViewController(mStatusBarKeyguardViewManager); + biometricUnlockController.addListener(mBiometricUnlockEventsListener); + + return biometricUnlockController; } @Test @@ -549,6 +558,7 @@ public class BiometricsUnlockControllerTest extends SysuiTestCase { } @Test public void onSideFingerprintSuccess_dreaming_unlockNoWake() { + mBiometricUnlockController = createController(true); when(mAuthController.isSfpsEnrolled(anyInt())).thenReturn(true); when(mWakefulnessLifecycle.getLastWakeReason()) .thenReturn(PowerManager.WAKE_REASON_POWER_BUTTON); |