Loading packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/KeyguardStatusBarViewControllerTest.kt +192 −285 Original line number Diff line number Diff line Loading @@ -24,7 +24,6 @@ import android.platform.test.annotations.EnableFlags import android.provider.Settings import android.testing.TestableLooper import android.testing.TestableLooper.RunWithLooper import android.testing.ViewUtils import android.view.LayoutInflater import android.view.View import androidx.test.ext.junit.runners.AndroidJUnit4 Loading Loading @@ -90,7 +89,6 @@ import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Assert import org.junit.Before import org.junit.Ignore import org.junit.Test import org.junit.runner.RunWith import org.mockito.ArgumentCaptor Loading Loading @@ -508,7 +506,6 @@ class KeyguardStatusBarViewControllerTest : SysuiTestCase() { assertThat(keyguardStatusBarView.visibility).isEqualTo(View.VISIBLE) } @Ignore("b/419321603") @Test @DisableSceneContainer fun updateViewState_panelExpandedHeightZero_viewHidden() { Loading Loading @@ -846,38 +843,27 @@ class KeyguardStatusBarViewControllerTest : SysuiTestCase() { assertThat(keyguardStatusBarView.visibility).isEqualTo(View.INVISIBLE) } @Ignore("b/425280318") @DisableSceneContainer @DisableFlags(Flags.FLAG_GLANCEABLE_HUB_V2) fun animateToGlanceableHub_v2Disabled_affectsAlpha() = testScope.runTest { try { controller.init() val transitionAlphaAmount = .5f ViewUtils.attachView(keyguardStatusBarView) looper.processAllMessages() updateStateToKeyguard() kosmos.fakeCommunalSceneRepository.instantlyTransitionTo(CommunalScenes.Communal) runCurrent() controller.updateCommunalAlphaTransition(transitionAlphaAmount) assertThat(keyguardStatusBarView.visibility).isEqualTo(View.VISIBLE) assertThat(keyguardStatusBarView.alpha).isEqualTo(transitionAlphaAmount) } finally { ViewUtils.detachView(keyguardStatusBarView) } } @Ignore("b/425280318") @DisableSceneContainer @DisableFlags(Flags.FLAG_GLANCEABLE_HUB_V2) fun animateToGlanceableHub_v2Disabled_alphaResetOnCommunalNotShowing() = testScope.runTest { try { controller.init() ViewUtils.attachView(keyguardStatusBarView) looper.processAllMessages() updateStateToKeyguard() // Verify status bar is fully visible on lockscreen Loading @@ -896,9 +882,6 @@ class KeyguardStatusBarViewControllerTest : SysuiTestCase() { runCurrent() assertThat(keyguardStatusBarView.visibility).isEqualTo(View.VISIBLE) assertThat(keyguardStatusBarView.alpha).isNotEqualTo(.5f) } finally { ViewUtils.detachView(keyguardStatusBarView) } } @Test Loading @@ -906,10 +889,7 @@ class KeyguardStatusBarViewControllerTest : SysuiTestCase() { @DisableFlags(Flags.FLAG_GLANCEABLE_HUB_V2) fun statusBar_isHidden_goneToGlanceableHubV2Disabled() = testScope.runTest { try { controller.init() ViewUtils.attachView(keyguardStatusBarView) looper.processAllMessages() // Keyguard is showing and start transitioning to communal updateStateToKeyguard() Loading @@ -921,10 +901,7 @@ class KeyguardStatusBarViewControllerTest : SysuiTestCase() { goneToGlanceableHubTransitionStep(0.0f, STARTED), goneToGlanceableHubTransitionStep(.1f), ) kosmos.fakeKeyguardTransitionRepository.sendTransitionSteps( transitionSteps, testScope, ) kosmos.fakeKeyguardTransitionRepository.sendTransitionSteps(transitionSteps, testScope) // Verify status bar is not visible assertThat(keyguardStatusBarView.alpha).isEqualTo(0f) Loading @@ -940,9 +917,6 @@ class KeyguardStatusBarViewControllerTest : SysuiTestCase() { assertThat(keyguardStatusBarView.alpha).isEqualTo(0f) assertThat(keyguardStatusBarView.visibility).isEqualTo(View.INVISIBLE) } finally { ViewUtils.detachView(keyguardStatusBarView) } } @Test Loading @@ -950,10 +924,7 @@ class KeyguardStatusBarViewControllerTest : SysuiTestCase() { @EnableFlags(Flags.FLAG_GLANCEABLE_HUB_V2) fun statusBar_fullyVisible_goneToGlanceableHubV2Enabled() = testScope.runTest { try { controller.init() ViewUtils.attachView(keyguardStatusBarView) looper.processAllMessages() // Keyguard is showing and start transitioning to communal updateStateToKeyguard() Loading Loading @@ -986,9 +957,6 @@ class KeyguardStatusBarViewControllerTest : SysuiTestCase() { assertThat(keyguardStatusBarView.alpha).isEqualTo(1f) assertThat(keyguardStatusBarView.visibility).isEqualTo(View.VISIBLE) } finally { ViewUtils.detachView(keyguardStatusBarView) } } @Test Loading @@ -996,11 +964,8 @@ class KeyguardStatusBarViewControllerTest : SysuiTestCase() { @DisableFlags(Flags.FLAG_GLANCEABLE_HUB_V2) fun dragDownShadeOverGlanceableHub_v2Disabled_alphaRemainsZero() = testScope.runTest { try { controller.init() ViewUtils.attachView(keyguardStatusBarView) looper.processAllMessages() updateStateToKeyguard() // Verify status bar is fully visible on lockscreen Loading @@ -1019,21 +984,14 @@ class KeyguardStatusBarViewControllerTest : SysuiTestCase() { controller.updateViewState() assertThat(keyguardStatusBarView.visibility).isEqualTo(View.INVISIBLE) assertThat(keyguardStatusBarView.alpha).isEqualTo(0f) } finally { ViewUtils.detachView(keyguardStatusBarView) } } @Ignore("b/425280318") @DisableSceneContainer @EnableFlags(Flags.FLAG_GLANCEABLE_HUB_V2) fun animateToGlanceableHub_v2Enabled_alphaDoesNotChange() = testScope.runTest { try { controller.init() ViewUtils.attachView(keyguardStatusBarView) looper.processAllMessages() updateStateToKeyguard() // Verify status bar is fully visible on lockscreen Loading @@ -1045,19 +1003,13 @@ class KeyguardStatusBarViewControllerTest : SysuiTestCase() { runCurrent() assertThat(keyguardStatusBarView.visibility).isEqualTo(View.VISIBLE) assertThat(keyguardStatusBarView.alpha).isEqualTo(1f) } finally { ViewUtils.detachView(keyguardStatusBarView) } } @Test @DisableSceneContainer fun lockscreenToDreaming_affectsAlpha() = testScope.runTest { try { controller.init() ViewUtils.attachView(keyguardStatusBarView) looper.processAllMessages() updateStateToKeyguard() val transitionSteps = Loading @@ -1065,10 +1017,7 @@ class KeyguardStatusBarViewControllerTest : SysuiTestCase() { lockscreenToDreamTransitionStep(0.0f, STARTED), lockscreenToDreamTransitionStep(.1f), ) kosmos.fakeKeyguardTransitionRepository.sendTransitionSteps( transitionSteps, testScope, ) kosmos.fakeKeyguardTransitionRepository.sendTransitionSteps(transitionSteps, testScope) assertThat(keyguardStatusBarView.alpha).isIn(Range.open(0f, 1f)) assertThat(keyguardStatusBarView.visibility).isEqualTo(View.VISIBLE) Loading @@ -1083,19 +1032,13 @@ class KeyguardStatusBarViewControllerTest : SysuiTestCase() { assertThat(keyguardStatusBarView.alpha).isEqualTo(0f) assertThat(keyguardStatusBarView.visibility).isEqualTo(View.INVISIBLE) } finally { ViewUtils.detachView(keyguardStatusBarView) } } @Test @DisableSceneContainer fun dreamingToLockscreen_affectsAlpha() = testScope.runTest { try { controller.init() ViewUtils.attachView(keyguardStatusBarView) looper.processAllMessages() updateStateToKeyguard() val transitionSteps = Loading @@ -1103,26 +1046,17 @@ class KeyguardStatusBarViewControllerTest : SysuiTestCase() { dreamToLockscreenTransitionStep(0.0f, STARTED), dreamToLockscreenTransitionStep(.3f), ) kosmos.fakeKeyguardTransitionRepository.sendTransitionSteps( transitionSteps, testScope, ) kosmos.fakeKeyguardTransitionRepository.sendTransitionSteps(transitionSteps, testScope) assertThat(keyguardStatusBarView.alpha).isIn(Range.open(0f, 1f)) assertThat(keyguardStatusBarView.visibility).isEqualTo(View.VISIBLE) } finally { ViewUtils.detachView(keyguardStatusBarView) } } @Test @DisableSceneContainer fun dreamingToLockscreen_resetAlphaOnFinished() = testScope.runTest { try { controller.init() ViewUtils.attachView(keyguardStatusBarView) looper.processAllMessages() updateStateToKeyguard() val transitionSteps = Loading @@ -1130,10 +1064,7 @@ class KeyguardStatusBarViewControllerTest : SysuiTestCase() { dreamToLockscreenTransitionStep(0.0f, STARTED), dreamToLockscreenTransitionStep(.3f), ) kosmos.fakeKeyguardTransitionRepository.sendTransitionSteps( transitionSteps, testScope, ) kosmos.fakeKeyguardTransitionRepository.sendTransitionSteps(transitionSteps, testScope) val explicitAlpha = keyguardStatusBarView.alpha assertThat(explicitAlpha).isIn(Range.open(0f, 1f)) Loading @@ -1145,43 +1076,28 @@ class KeyguardStatusBarViewControllerTest : SysuiTestCase() { assertThat(keyguardStatusBarView.alpha).isNotEqualTo(explicitAlpha) assertThat(keyguardStatusBarView.visibility).isEqualTo(View.VISIBLE) } finally { ViewUtils.detachView(keyguardStatusBarView) } } @Test @DisableSceneContainer fun goneToDreaming_affectsAlpha() = testScope.runTest { try { controller.init() ViewUtils.attachView(keyguardStatusBarView) looper.processAllMessages() updateStateToKeyguard() val transitionSteps = listOf(goneToDreamTransitionStep(0.0f, STARTED), goneToDreamTransitionStep(.1f)) kosmos.fakeKeyguardTransitionRepository.sendTransitionSteps( transitionSteps, testScope, ) kosmos.fakeKeyguardTransitionRepository.sendTransitionSteps(transitionSteps, testScope) assertThat(keyguardStatusBarView.alpha).isEqualTo(0f) assertThat(keyguardStatusBarView.visibility).isEqualTo(View.INVISIBLE) } finally { ViewUtils.detachView(keyguardStatusBarView) } } @Test @DisableSceneContainer fun resetAlpha_onTransitionToDreamingInterrupted() = testScope.runTest { try { controller.init() ViewUtils.attachView(keyguardStatusBarView) looper.processAllMessages() updateStateToKeyguard() // Transition to dreaming Loading @@ -1190,10 +1106,7 @@ class KeyguardStatusBarViewControllerTest : SysuiTestCase() { lockscreenToDreamTransitionStep(0.0f, STARTED), lockscreenToDreamTransitionStep(.1f), ) kosmos.fakeKeyguardTransitionRepository.sendTransitionSteps( transitionSteps, testScope, ) kosmos.fakeKeyguardTransitionRepository.sendTransitionSteps(transitionSteps, testScope) val explicitAlphaByDream = keyguardStatusBarView.alpha assertThat(keyguardStatusBarView.visibility).isEqualTo(View.VISIBLE) Loading @@ -1207,16 +1120,10 @@ class KeyguardStatusBarViewControllerTest : SysuiTestCase() { dreamToAodTransitionStep(.5f), dreamToAodTransitionStep(1f, FINISHED), ) kosmos.fakeKeyguardTransitionRepository.sendTransitionSteps( transitionSteps, testScope, ) kosmos.fakeKeyguardTransitionRepository.sendTransitionSteps(transitionSteps, testScope) assertThat(keyguardStatusBarView.alpha).isNotEqualTo(explicitAlphaByDream) assertThat(keyguardStatusBarView.visibility).isEqualTo(View.INVISIBLE) } finally { ViewUtils.detachView(keyguardStatusBarView) } } /** Loading Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/KeyguardStatusBarViewControllerTest.kt +192 −285 Original line number Diff line number Diff line Loading @@ -24,7 +24,6 @@ import android.platform.test.annotations.EnableFlags import android.provider.Settings import android.testing.TestableLooper import android.testing.TestableLooper.RunWithLooper import android.testing.ViewUtils import android.view.LayoutInflater import android.view.View import androidx.test.ext.junit.runners.AndroidJUnit4 Loading Loading @@ -90,7 +89,6 @@ import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Assert import org.junit.Before import org.junit.Ignore import org.junit.Test import org.junit.runner.RunWith import org.mockito.ArgumentCaptor Loading Loading @@ -508,7 +506,6 @@ class KeyguardStatusBarViewControllerTest : SysuiTestCase() { assertThat(keyguardStatusBarView.visibility).isEqualTo(View.VISIBLE) } @Ignore("b/419321603") @Test @DisableSceneContainer fun updateViewState_panelExpandedHeightZero_viewHidden() { Loading Loading @@ -846,38 +843,27 @@ class KeyguardStatusBarViewControllerTest : SysuiTestCase() { assertThat(keyguardStatusBarView.visibility).isEqualTo(View.INVISIBLE) } @Ignore("b/425280318") @DisableSceneContainer @DisableFlags(Flags.FLAG_GLANCEABLE_HUB_V2) fun animateToGlanceableHub_v2Disabled_affectsAlpha() = testScope.runTest { try { controller.init() val transitionAlphaAmount = .5f ViewUtils.attachView(keyguardStatusBarView) looper.processAllMessages() updateStateToKeyguard() kosmos.fakeCommunalSceneRepository.instantlyTransitionTo(CommunalScenes.Communal) runCurrent() controller.updateCommunalAlphaTransition(transitionAlphaAmount) assertThat(keyguardStatusBarView.visibility).isEqualTo(View.VISIBLE) assertThat(keyguardStatusBarView.alpha).isEqualTo(transitionAlphaAmount) } finally { ViewUtils.detachView(keyguardStatusBarView) } } @Ignore("b/425280318") @DisableSceneContainer @DisableFlags(Flags.FLAG_GLANCEABLE_HUB_V2) fun animateToGlanceableHub_v2Disabled_alphaResetOnCommunalNotShowing() = testScope.runTest { try { controller.init() ViewUtils.attachView(keyguardStatusBarView) looper.processAllMessages() updateStateToKeyguard() // Verify status bar is fully visible on lockscreen Loading @@ -896,9 +882,6 @@ class KeyguardStatusBarViewControllerTest : SysuiTestCase() { runCurrent() assertThat(keyguardStatusBarView.visibility).isEqualTo(View.VISIBLE) assertThat(keyguardStatusBarView.alpha).isNotEqualTo(.5f) } finally { ViewUtils.detachView(keyguardStatusBarView) } } @Test Loading @@ -906,10 +889,7 @@ class KeyguardStatusBarViewControllerTest : SysuiTestCase() { @DisableFlags(Flags.FLAG_GLANCEABLE_HUB_V2) fun statusBar_isHidden_goneToGlanceableHubV2Disabled() = testScope.runTest { try { controller.init() ViewUtils.attachView(keyguardStatusBarView) looper.processAllMessages() // Keyguard is showing and start transitioning to communal updateStateToKeyguard() Loading @@ -921,10 +901,7 @@ class KeyguardStatusBarViewControllerTest : SysuiTestCase() { goneToGlanceableHubTransitionStep(0.0f, STARTED), goneToGlanceableHubTransitionStep(.1f), ) kosmos.fakeKeyguardTransitionRepository.sendTransitionSteps( transitionSteps, testScope, ) kosmos.fakeKeyguardTransitionRepository.sendTransitionSteps(transitionSteps, testScope) // Verify status bar is not visible assertThat(keyguardStatusBarView.alpha).isEqualTo(0f) Loading @@ -940,9 +917,6 @@ class KeyguardStatusBarViewControllerTest : SysuiTestCase() { assertThat(keyguardStatusBarView.alpha).isEqualTo(0f) assertThat(keyguardStatusBarView.visibility).isEqualTo(View.INVISIBLE) } finally { ViewUtils.detachView(keyguardStatusBarView) } } @Test Loading @@ -950,10 +924,7 @@ class KeyguardStatusBarViewControllerTest : SysuiTestCase() { @EnableFlags(Flags.FLAG_GLANCEABLE_HUB_V2) fun statusBar_fullyVisible_goneToGlanceableHubV2Enabled() = testScope.runTest { try { controller.init() ViewUtils.attachView(keyguardStatusBarView) looper.processAllMessages() // Keyguard is showing and start transitioning to communal updateStateToKeyguard() Loading Loading @@ -986,9 +957,6 @@ class KeyguardStatusBarViewControllerTest : SysuiTestCase() { assertThat(keyguardStatusBarView.alpha).isEqualTo(1f) assertThat(keyguardStatusBarView.visibility).isEqualTo(View.VISIBLE) } finally { ViewUtils.detachView(keyguardStatusBarView) } } @Test Loading @@ -996,11 +964,8 @@ class KeyguardStatusBarViewControllerTest : SysuiTestCase() { @DisableFlags(Flags.FLAG_GLANCEABLE_HUB_V2) fun dragDownShadeOverGlanceableHub_v2Disabled_alphaRemainsZero() = testScope.runTest { try { controller.init() ViewUtils.attachView(keyguardStatusBarView) looper.processAllMessages() updateStateToKeyguard() // Verify status bar is fully visible on lockscreen Loading @@ -1019,21 +984,14 @@ class KeyguardStatusBarViewControllerTest : SysuiTestCase() { controller.updateViewState() assertThat(keyguardStatusBarView.visibility).isEqualTo(View.INVISIBLE) assertThat(keyguardStatusBarView.alpha).isEqualTo(0f) } finally { ViewUtils.detachView(keyguardStatusBarView) } } @Ignore("b/425280318") @DisableSceneContainer @EnableFlags(Flags.FLAG_GLANCEABLE_HUB_V2) fun animateToGlanceableHub_v2Enabled_alphaDoesNotChange() = testScope.runTest { try { controller.init() ViewUtils.attachView(keyguardStatusBarView) looper.processAllMessages() updateStateToKeyguard() // Verify status bar is fully visible on lockscreen Loading @@ -1045,19 +1003,13 @@ class KeyguardStatusBarViewControllerTest : SysuiTestCase() { runCurrent() assertThat(keyguardStatusBarView.visibility).isEqualTo(View.VISIBLE) assertThat(keyguardStatusBarView.alpha).isEqualTo(1f) } finally { ViewUtils.detachView(keyguardStatusBarView) } } @Test @DisableSceneContainer fun lockscreenToDreaming_affectsAlpha() = testScope.runTest { try { controller.init() ViewUtils.attachView(keyguardStatusBarView) looper.processAllMessages() updateStateToKeyguard() val transitionSteps = Loading @@ -1065,10 +1017,7 @@ class KeyguardStatusBarViewControllerTest : SysuiTestCase() { lockscreenToDreamTransitionStep(0.0f, STARTED), lockscreenToDreamTransitionStep(.1f), ) kosmos.fakeKeyguardTransitionRepository.sendTransitionSteps( transitionSteps, testScope, ) kosmos.fakeKeyguardTransitionRepository.sendTransitionSteps(transitionSteps, testScope) assertThat(keyguardStatusBarView.alpha).isIn(Range.open(0f, 1f)) assertThat(keyguardStatusBarView.visibility).isEqualTo(View.VISIBLE) Loading @@ -1083,19 +1032,13 @@ class KeyguardStatusBarViewControllerTest : SysuiTestCase() { assertThat(keyguardStatusBarView.alpha).isEqualTo(0f) assertThat(keyguardStatusBarView.visibility).isEqualTo(View.INVISIBLE) } finally { ViewUtils.detachView(keyguardStatusBarView) } } @Test @DisableSceneContainer fun dreamingToLockscreen_affectsAlpha() = testScope.runTest { try { controller.init() ViewUtils.attachView(keyguardStatusBarView) looper.processAllMessages() updateStateToKeyguard() val transitionSteps = Loading @@ -1103,26 +1046,17 @@ class KeyguardStatusBarViewControllerTest : SysuiTestCase() { dreamToLockscreenTransitionStep(0.0f, STARTED), dreamToLockscreenTransitionStep(.3f), ) kosmos.fakeKeyguardTransitionRepository.sendTransitionSteps( transitionSteps, testScope, ) kosmos.fakeKeyguardTransitionRepository.sendTransitionSteps(transitionSteps, testScope) assertThat(keyguardStatusBarView.alpha).isIn(Range.open(0f, 1f)) assertThat(keyguardStatusBarView.visibility).isEqualTo(View.VISIBLE) } finally { ViewUtils.detachView(keyguardStatusBarView) } } @Test @DisableSceneContainer fun dreamingToLockscreen_resetAlphaOnFinished() = testScope.runTest { try { controller.init() ViewUtils.attachView(keyguardStatusBarView) looper.processAllMessages() updateStateToKeyguard() val transitionSteps = Loading @@ -1130,10 +1064,7 @@ class KeyguardStatusBarViewControllerTest : SysuiTestCase() { dreamToLockscreenTransitionStep(0.0f, STARTED), dreamToLockscreenTransitionStep(.3f), ) kosmos.fakeKeyguardTransitionRepository.sendTransitionSteps( transitionSteps, testScope, ) kosmos.fakeKeyguardTransitionRepository.sendTransitionSteps(transitionSteps, testScope) val explicitAlpha = keyguardStatusBarView.alpha assertThat(explicitAlpha).isIn(Range.open(0f, 1f)) Loading @@ -1145,43 +1076,28 @@ class KeyguardStatusBarViewControllerTest : SysuiTestCase() { assertThat(keyguardStatusBarView.alpha).isNotEqualTo(explicitAlpha) assertThat(keyguardStatusBarView.visibility).isEqualTo(View.VISIBLE) } finally { ViewUtils.detachView(keyguardStatusBarView) } } @Test @DisableSceneContainer fun goneToDreaming_affectsAlpha() = testScope.runTest { try { controller.init() ViewUtils.attachView(keyguardStatusBarView) looper.processAllMessages() updateStateToKeyguard() val transitionSteps = listOf(goneToDreamTransitionStep(0.0f, STARTED), goneToDreamTransitionStep(.1f)) kosmos.fakeKeyguardTransitionRepository.sendTransitionSteps( transitionSteps, testScope, ) kosmos.fakeKeyguardTransitionRepository.sendTransitionSteps(transitionSteps, testScope) assertThat(keyguardStatusBarView.alpha).isEqualTo(0f) assertThat(keyguardStatusBarView.visibility).isEqualTo(View.INVISIBLE) } finally { ViewUtils.detachView(keyguardStatusBarView) } } @Test @DisableSceneContainer fun resetAlpha_onTransitionToDreamingInterrupted() = testScope.runTest { try { controller.init() ViewUtils.attachView(keyguardStatusBarView) looper.processAllMessages() updateStateToKeyguard() // Transition to dreaming Loading @@ -1190,10 +1106,7 @@ class KeyguardStatusBarViewControllerTest : SysuiTestCase() { lockscreenToDreamTransitionStep(0.0f, STARTED), lockscreenToDreamTransitionStep(.1f), ) kosmos.fakeKeyguardTransitionRepository.sendTransitionSteps( transitionSteps, testScope, ) kosmos.fakeKeyguardTransitionRepository.sendTransitionSteps(transitionSteps, testScope) val explicitAlphaByDream = keyguardStatusBarView.alpha assertThat(keyguardStatusBarView.visibility).isEqualTo(View.VISIBLE) Loading @@ -1207,16 +1120,10 @@ class KeyguardStatusBarViewControllerTest : SysuiTestCase() { dreamToAodTransitionStep(.5f), dreamToAodTransitionStep(1f, FINISHED), ) kosmos.fakeKeyguardTransitionRepository.sendTransitionSteps( transitionSteps, testScope, ) kosmos.fakeKeyguardTransitionRepository.sendTransitionSteps(transitionSteps, testScope) assertThat(keyguardStatusBarView.alpha).isNotEqualTo(explicitAlphaByDream) assertThat(keyguardStatusBarView.visibility).isEqualTo(View.INVISIBLE) } finally { ViewUtils.detachView(keyguardStatusBarView) } } /** Loading