summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--packages/SystemUI/multivalentTests/src/com/android/systemui/bouncer/ui/viewmodel/BouncerViewModelTest.kt9
-rw-r--r--packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/KeyguardInteractorTest.kt20
-rw-r--r--packages/SystemUI/multivalentTests/src/com/android/systemui/notifications/ui/viewmodel/NotificationsShadeSceneViewModelTest.kt4
-rw-r--r--packages/SystemUI/multivalentTests/src/com/android/systemui/scene/domain/interactor/SceneBackInteractorTest.kt8
-rw-r--r--packages/SystemUI/multivalentTests/src/com/android/systemui/shade/domain/interactor/PanelExpansionInteractorImplTest.kt6
-rw-r--r--packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/DozeServiceHostCoroutinesTest.kt29
-rw-r--r--packages/SystemUI/tests/src/com/android/keyguard/KeyguardAbsKeyInputViewControllerTest.java3
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/biometrics/ui/viewmodel/PromptViewModelTest.kt42
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/bluetooth/qsdialog/BluetoothTileDialogViewModelTest.kt3
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/keyguard/domain/interactor/KeyguardTransitionScenariosTest.kt39
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/keyguard/ui/viewmodel/KeyguardClockViewModelTest.kt8
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/media/dialog/MediaOutputDialogReceiverTest.java10
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/people/widget/PeopleSpaceWidgetManagerTest.java38
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/shade/NotificationsQSContainerControllerLegacyTest.kt25
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/shade/NotificationsQSContainerControllerTest.kt13
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationShelfTest.kt5
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/CentralSurfacesImplTest.java60
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardClockPositionAlgorithmTest.java6
18 files changed, 176 insertions, 152 deletions
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/bouncer/ui/viewmodel/BouncerViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/bouncer/ui/viewmodel/BouncerViewModelTest.kt
index ecfcc90982c0..a5acf724dcff 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/bouncer/ui/viewmodel/BouncerViewModelTest.kt
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/bouncer/ui/viewmodel/BouncerViewModelTest.kt
@@ -66,15 +66,12 @@ class BouncerViewModelTest : SysuiTestCase() {
private val kosmos = testKosmos()
private val testScope = kosmos.testScope
- private val authenticationInteractor by lazy { kosmos.authenticationInteractor }
- private val bouncerInteractor by lazy { kosmos.bouncerInteractor }
- private val sceneContainerStartable = kosmos.sceneContainerStartable
private lateinit var underTest: BouncerViewModel
@Before
fun setUp() {
- sceneContainerStartable.start()
+ kosmos.sceneContainerStartable.start()
underTest = kosmos.bouncerViewModel
}
@@ -164,11 +161,11 @@ class BouncerViewModelTest : SysuiTestCase() {
assertThat(isInputEnabled).isTrue()
repeat(FakeAuthenticationRepository.MAX_FAILED_AUTH_TRIES_BEFORE_LOCKOUT) {
- bouncerInteractor.authenticate(WRONG_PIN)
+ kosmos.bouncerInteractor.authenticate(WRONG_PIN)
}
assertThat(isInputEnabled).isFalse()
- val lockoutEndMs = authenticationInteractor.lockoutEndTimestamp ?: 0
+ val lockoutEndMs = kosmos.authenticationInteractor.lockoutEndTimestamp ?: 0
advanceTimeBy(lockoutEndMs - testScope.currentTime)
assertThat(isInputEnabled).isTrue()
}
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/KeyguardInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/KeyguardInteractorTest.kt
index cb2d4e07e3a2..73ce851f1781 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/KeyguardInteractorTest.kt
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/KeyguardInteractorTest.kt
@@ -60,17 +60,19 @@ class KeyguardInteractorTest : SysuiTestCase() {
private val kosmos = testKosmos()
private val testScope = kosmos.testScope
- private val repository = kosmos.fakeKeyguardRepository
- private val sceneInteractor = kosmos.sceneInteractor
- private val fromGoneTransitionInteractor = kosmos.fromGoneTransitionInteractor
- private val commandQueue = kosmos.fakeCommandQueue
- private val configRepository = kosmos.fakeConfigurationRepository
- private val bouncerRepository = kosmos.keyguardBouncerRepository
- private val shadeRepository = kosmos.shadeRepository
- private val keyguardTransitionRepository = kosmos.fakeKeyguardTransitionRepository
+ private val repository by lazy { kosmos.fakeKeyguardRepository }
+ private val sceneInteractor by lazy { kosmos.sceneInteractor }
+ private val fromGoneTransitionInteractor by lazy { kosmos.fromGoneTransitionInteractor }
+ private val commandQueue by lazy { kosmos.fakeCommandQueue }
+ private val configRepository by lazy { kosmos.fakeConfigurationRepository }
+ private val bouncerRepository by lazy { kosmos.keyguardBouncerRepository }
+ private val shadeRepository by lazy { kosmos.shadeRepository }
+ private val keyguardTransitionRepository by lazy { kosmos.fakeKeyguardTransitionRepository }
+
private val transitionState: MutableStateFlow<ObservableTransitionState> =
MutableStateFlow(ObservableTransitionState.Idle(Scenes.Gone))
- private val underTest = kosmos.keyguardInteractor
+
+ private val underTest by lazy { kosmos.keyguardInteractor }
@Before
fun setUp() {
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/notifications/ui/viewmodel/NotificationsShadeSceneViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/notifications/ui/viewmodel/NotificationsShadeSceneViewModelTest.kt
index 5661bd388757..9d8ec951dfe7 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/notifications/ui/viewmodel/NotificationsShadeSceneViewModelTest.kt
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/notifications/ui/viewmodel/NotificationsShadeSceneViewModelTest.kt
@@ -51,8 +51,8 @@ class NotificationsShadeSceneViewModelTest : SysuiTestCase() {
private val kosmos = testKosmos()
private val testScope = kosmos.testScope
- private val sceneInteractor = kosmos.sceneInteractor
- private val deviceUnlockedInteractor = kosmos.deviceUnlockedInteractor
+ private val sceneInteractor by lazy { kosmos.sceneInteractor }
+ private val deviceUnlockedInteractor by lazy { kosmos.deviceUnlockedInteractor }
private val underTest = kosmos.notificationsShadeSceneViewModel
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/scene/domain/interactor/SceneBackInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/scene/domain/interactor/SceneBackInteractorTest.kt
index c75e297f23c8..e3108ad1b8f1 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/scene/domain/interactor/SceneBackInteractorTest.kt
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/scene/domain/interactor/SceneBackInteractorTest.kt
@@ -45,11 +45,11 @@ class SceneBackInteractorTest : SysuiTestCase() {
private val kosmos = testKosmos()
private val testScope = kosmos.testScope
- private val sceneInteractor = kosmos.sceneInteractor
- private val sceneContainerStartable = kosmos.sceneContainerStartable
- private val authenticationInteractor = kosmos.authenticationInteractor
+ private val sceneInteractor by lazy { kosmos.sceneInteractor }
+ private val sceneContainerStartable by lazy { kosmos.sceneContainerStartable }
+ private val authenticationInteractor by lazy { kosmos.authenticationInteractor }
- private val underTest = kosmos.sceneBackInteractor
+ private val underTest by lazy { kosmos.sceneBackInteractor }
@Test
@EnableSceneContainer
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/domain/interactor/PanelExpansionInteractorImplTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/domain/interactor/PanelExpansionInteractorImplTest.kt
index e11a8f1e0ba9..851b7b986527 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/domain/interactor/PanelExpansionInteractorImplTest.kt
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/domain/interactor/PanelExpansionInteractorImplTest.kt
@@ -52,9 +52,9 @@ class PanelExpansionInteractorImplTest : SysuiTestCase() {
private val kosmos = testKosmos()
private val testScope = kosmos.testScope
- private val deviceUnlockedInteractor = kosmos.deviceUnlockedInteractor
- private val sceneInteractor = kosmos.sceneInteractor
- private val shadeAnimationInteractor = kosmos.shadeAnimationInteractor
+ private val deviceUnlockedInteractor by lazy { kosmos.deviceUnlockedInteractor }
+ private val sceneInteractor by lazy { kosmos.sceneInteractor }
+ private val shadeAnimationInteractor by lazy { kosmos.shadeAnimationInteractor }
private val transitionState =
MutableStateFlow<ObservableTransitionState>(
ObservableTransitionState.Idle(Scenes.Lockscreen)
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/DozeServiceHostCoroutinesTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/DozeServiceHostCoroutinesTest.kt
index 1cd12f043a72..7bc6948edf31 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/DozeServiceHostCoroutinesTest.kt
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/DozeServiceHostCoroutinesTest.kt
@@ -35,6 +35,7 @@ import com.google.common.truth.Truth.assertThat
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.test.runCurrent
import kotlinx.coroutines.test.runTest
+import org.junit.Before
import org.junit.Test
import org.junit.runner.RunWith
import org.mockito.Mockito.verify
@@ -46,30 +47,32 @@ class DozeServiceHostCoroutinesTest : SysuiTestCase() {
private val kosmos = testKosmos()
private val testScope = kosmos.testScope
- private val sceneContainerRepository = kosmos.sceneContainerRepository
- private val keyguardInteractor = kosmos.keyguardInteractor
+ lateinit var underTest: DozeServiceHost
- val underTest =
- kosmos.dozeServiceHost.apply {
- initialize(
- /* centralSurfaces = */ mock(),
- /* statusBarKeyguardViewManager = */ mock(),
- /* notificationShadeWindowViewController = */ mock(),
- /* ambientIndicationContainer = */ mock(),
- )
- }
+ @Before
+ fun setup() {
+ underTest =
+ kosmos.dozeServiceHost.apply {
+ initialize(
+ /* centralSurfaces = */ mock(),
+ /* statusBarKeyguardViewManager = */ mock(),
+ /* notificationShadeWindowViewController = */ mock(),
+ /* ambientIndicationContainer = */ mock(),
+ )
+ }
+ }
@Test
@EnableSceneContainer
fun startStopDozing() =
testScope.runTest {
- val isDozing by collectLastValue(keyguardInteractor.isDozing)
+ val isDozing by collectLastValue(kosmos.keyguardInteractor.isDozing)
// GIVEN a callback is set
val callback: DozeHost.Callback = mock()
underTest.addCallback(callback)
// AND we are on the lock screen
- sceneContainerRepository.changeScene(Scenes.Lockscreen)
+ kosmos.sceneContainerRepository.changeScene(Scenes.Lockscreen)
// AND dozing is not requested yet
assertThat(underTest.dozingRequested).isFalse()
diff --git a/packages/SystemUI/tests/src/com/android/keyguard/KeyguardAbsKeyInputViewControllerTest.java b/packages/SystemUI/tests/src/com/android/keyguard/KeyguardAbsKeyInputViewControllerTest.java
index 51ceda339778..f9fe5e7e2b62 100644
--- a/packages/SystemUI/tests/src/com/android/keyguard/KeyguardAbsKeyInputViewControllerTest.java
+++ b/packages/SystemUI/tests/src/com/android/keyguard/KeyguardAbsKeyInputViewControllerTest.java
@@ -27,6 +27,7 @@ import static org.mockito.Mockito.verifyZeroInteractions;
import static org.mockito.Mockito.when;
import android.os.SystemClock;
+import android.platform.test.annotations.EnableFlags;
import android.testing.AndroidTestingRunner;
import android.testing.TestableLooper.RunWithLooper;
import android.view.KeyEvent;
@@ -125,8 +126,8 @@ public class KeyguardAbsKeyInputViewControllerTest extends SysuiTestCase {
}
@Test
+ @EnableFlags(Flags.FLAG_REVAMPED_BOUNCER_MESSAGES)
public void withFeatureFlagOn_oldMessage_isHidden() {
- mSetFlagsRule.enableFlags(Flags.FLAG_REVAMPED_BOUNCER_MESSAGES);
KeyguardAbsKeyInputViewController underTest = createTestObject();
underTest.init();
diff --git a/packages/SystemUI/tests/src/com/android/systemui/biometrics/ui/viewmodel/PromptViewModelTest.kt b/packages/SystemUI/tests/src/com/android/systemui/biometrics/ui/viewmodel/PromptViewModelTest.kt
index 97c3c4264855..fa78f0c6ec1d 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/biometrics/ui/viewmodel/PromptViewModelTest.kt
+++ b/packages/SystemUI/tests/src/com/android/systemui/biometrics/ui/viewmodel/PromptViewModelTest.kt
@@ -37,6 +37,7 @@ import android.hardware.biometrics.PromptVerticalListContentView
import android.hardware.face.FaceSensorPropertiesInternal
import android.hardware.fingerprint.FingerprintSensorProperties
import android.hardware.fingerprint.FingerprintSensorPropertiesInternal
+import android.platform.test.annotations.EnableFlags
import android.view.HapticFeedbackConstants
import android.view.MotionEvent
import androidx.test.filters.SmallTest
@@ -1272,8 +1273,8 @@ internal class PromptViewModelTest(private val testCase: TestCase) : SysuiTestCa
}
@Test
+ @EnableFlags(FLAG_BP_TALKBACK)
fun hint_for_talkback_guidance() = runGenericTest {
- mSetFlagsRule.enableFlags(FLAG_BP_TALKBACK)
val hint by collectLastValue(viewModel.accessibilityHint)
// Touches should fall outside of sensor area
@@ -1295,10 +1296,9 @@ internal class PromptViewModelTest(private val testCase: TestCase) : SysuiTestCa
}
@Test
+ @EnableFlags(FLAG_CUSTOM_BIOMETRIC_PROMPT, FLAG_CONSTRAINT_BP)
fun descriptionOverriddenByVerticalListContentView() =
runGenericTest(contentView = promptContentView, description = "test description") {
- mSetFlagsRule.enableFlags(FLAG_CUSTOM_BIOMETRIC_PROMPT)
- mSetFlagsRule.enableFlags(FLAG_CONSTRAINT_BP)
val contentView by collectLastValue(viewModel.contentView)
val description by collectLastValue(viewModel.description)
@@ -1307,13 +1307,12 @@ internal class PromptViewModelTest(private val testCase: TestCase) : SysuiTestCa
}
@Test
+ @EnableFlags(FLAG_CUSTOM_BIOMETRIC_PROMPT, FLAG_CONSTRAINT_BP)
fun descriptionOverriddenByContentViewWithMoreOptionsButton() =
runGenericTest(
contentView = promptContentViewWithMoreOptionsButton,
description = "test description"
) {
- mSetFlagsRule.enableFlags(FLAG_CUSTOM_BIOMETRIC_PROMPT)
- mSetFlagsRule.enableFlags(FLAG_CONSTRAINT_BP)
val contentView by collectLastValue(viewModel.contentView)
val description by collectLastValue(viewModel.description)
@@ -1322,10 +1321,9 @@ internal class PromptViewModelTest(private val testCase: TestCase) : SysuiTestCa
}
@Test
+ @EnableFlags(FLAG_CUSTOM_BIOMETRIC_PROMPT, FLAG_CONSTRAINT_BP)
fun descriptionWithoutContentView() =
runGenericTest(description = "test description") {
- mSetFlagsRule.enableFlags(FLAG_CUSTOM_BIOMETRIC_PROMPT)
- mSetFlagsRule.enableFlags(FLAG_CONSTRAINT_BP)
val contentView by collectLastValue(viewModel.contentView)
val description by collectLastValue(viewModel.description)
@@ -1334,19 +1332,17 @@ internal class PromptViewModelTest(private val testCase: TestCase) : SysuiTestCa
}
@Test
+ @EnableFlags(FLAG_CUSTOM_BIOMETRIC_PROMPT, FLAG_CONSTRAINT_BP)
fun logo_nullIfPkgNameNotFound() =
runGenericTest(packageName = OP_PACKAGE_NAME_CAN_NOT_BE_FOUND) {
- mSetFlagsRule.enableFlags(FLAG_CUSTOM_BIOMETRIC_PROMPT)
- mSetFlagsRule.enableFlags(FLAG_CONSTRAINT_BP)
val logo by collectLastValue(viewModel.logo)
assertThat(logo).isNull()
}
@Test
+ @EnableFlags(FLAG_CUSTOM_BIOMETRIC_PROMPT, FLAG_CONSTRAINT_BP)
fun logo_defaultWithOverrides() =
runGenericTest(packageName = packageNameForLogoWithOverrides) {
- mSetFlagsRule.enableFlags(FLAG_CUSTOM_BIOMETRIC_PROMPT)
- mSetFlagsRule.enableFlags(FLAG_CONSTRAINT_BP)
val logo by collectLastValue(viewModel.logo)
// 1. PM.getApplicationInfo(packageNameForLogoWithOverrides) is set to return
@@ -1357,71 +1353,63 @@ internal class PromptViewModelTest(private val testCase: TestCase) : SysuiTestCa
}
@Test
+ @EnableFlags(FLAG_CUSTOM_BIOMETRIC_PROMPT, FLAG_CONSTRAINT_BP)
fun logo_defaultIsNull() =
runGenericTest(packageName = OP_PACKAGE_NAME_NO_ICON) {
- mSetFlagsRule.enableFlags(FLAG_CUSTOM_BIOMETRIC_PROMPT)
- mSetFlagsRule.enableFlags(FLAG_CONSTRAINT_BP)
val logo by collectLastValue(viewModel.logo)
assertThat(logo).isNull()
}
@Test
+ @EnableFlags(FLAG_CUSTOM_BIOMETRIC_PROMPT, FLAG_CONSTRAINT_BP)
fun logo_default() = runGenericTest {
- mSetFlagsRule.enableFlags(FLAG_CUSTOM_BIOMETRIC_PROMPT)
- mSetFlagsRule.enableFlags(FLAG_CONSTRAINT_BP)
val logo by collectLastValue(viewModel.logo)
assertThat(logo).isEqualTo(defaultLogoIcon)
}
@Test
+ @EnableFlags(FLAG_CUSTOM_BIOMETRIC_PROMPT, FLAG_CONSTRAINT_BP)
fun logo_resSetByApp() =
runGenericTest(logoRes = logoResFromApp) {
- mSetFlagsRule.enableFlags(FLAG_CUSTOM_BIOMETRIC_PROMPT)
- mSetFlagsRule.enableFlags(FLAG_CONSTRAINT_BP)
val logo by collectLastValue(viewModel.logo)
assertThat(logo).isEqualTo(logoFromApp)
}
@Test
+ @EnableFlags(FLAG_CUSTOM_BIOMETRIC_PROMPT, FLAG_CONSTRAINT_BP)
fun logo_bitmapSetByApp() =
runGenericTest(logoBitmap = logoBitmapFromApp) {
- mSetFlagsRule.enableFlags(FLAG_CUSTOM_BIOMETRIC_PROMPT)
- mSetFlagsRule.enableFlags(FLAG_CONSTRAINT_BP)
val logo by collectLastValue(viewModel.logo)
assertThat((logo as BitmapDrawable).bitmap).isEqualTo(logoBitmapFromApp)
}
@Test
+ @EnableFlags(FLAG_CUSTOM_BIOMETRIC_PROMPT, FLAG_CONSTRAINT_BP)
fun logoDescription_emptyIfPkgNameNotFound() =
runGenericTest(packageName = OP_PACKAGE_NAME_CAN_NOT_BE_FOUND) {
- mSetFlagsRule.enableFlags(FLAG_CUSTOM_BIOMETRIC_PROMPT)
- mSetFlagsRule.enableFlags(FLAG_CONSTRAINT_BP)
val logoDescription by collectLastValue(viewModel.logoDescription)
assertThat(logoDescription).isEqualTo("")
}
@Test
+ @EnableFlags(FLAG_CUSTOM_BIOMETRIC_PROMPT, FLAG_CONSTRAINT_BP)
fun logoDescription_defaultIsEmpty() =
runGenericTest(packageName = OP_PACKAGE_NAME_NO_ICON) {
- mSetFlagsRule.enableFlags(FLAG_CUSTOM_BIOMETRIC_PROMPT)
- mSetFlagsRule.enableFlags(FLAG_CONSTRAINT_BP)
val logoDescription by collectLastValue(viewModel.logoDescription)
assertThat(logoDescription).isEqualTo("")
}
@Test
+ @EnableFlags(FLAG_CUSTOM_BIOMETRIC_PROMPT, FLAG_CONSTRAINT_BP)
fun logoDescription_default() = runGenericTest {
- mSetFlagsRule.enableFlags(FLAG_CUSTOM_BIOMETRIC_PROMPT)
- mSetFlagsRule.enableFlags(FLAG_CONSTRAINT_BP)
val logoDescription by collectLastValue(viewModel.logoDescription)
assertThat(logoDescription).isEqualTo(defaultLogoDescription)
}
@Test
+ @EnableFlags(FLAG_CUSTOM_BIOMETRIC_PROMPT, FLAG_CONSTRAINT_BP)
fun logoDescription_setByApp() =
runGenericTest(logoDescription = logoDescriptionFromApp) {
- mSetFlagsRule.enableFlags(FLAG_CUSTOM_BIOMETRIC_PROMPT)
- mSetFlagsRule.enableFlags(FLAG_CONSTRAINT_BP)
val logoDescription by collectLastValue(viewModel.logoDescription)
assertThat(logoDescription).isEqualTo(logoDescriptionFromApp)
}
diff --git a/packages/SystemUI/tests/src/com/android/systemui/bluetooth/qsdialog/BluetoothTileDialogViewModelTest.kt b/packages/SystemUI/tests/src/com/android/systemui/bluetooth/qsdialog/BluetoothTileDialogViewModelTest.kt
index f62a55d02f61..11f74c0b98cb 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/bluetooth/qsdialog/BluetoothTileDialogViewModelTest.kt
+++ b/packages/SystemUI/tests/src/com/android/systemui/bluetooth/qsdialog/BluetoothTileDialogViewModelTest.kt
@@ -17,6 +17,7 @@
package com.android.systemui.bluetooth.qsdialog
import android.bluetooth.BluetoothAdapter
+import android.platform.test.annotations.EnableFlags
import android.testing.AndroidTestingRunner
import android.testing.TestableLooper
import android.view.View
@@ -63,6 +64,7 @@ import org.mockito.junit.MockitoRule
@SmallTest
@RunWith(AndroidTestingRunner::class)
@TestableLooper.RunWithLooper(setAsMainLooper = true)
+@EnableFlags(Flags.FLAG_BLUETOOTH_QS_TILE_DIALOG_AUTO_ON_TOGGLE)
class BluetoothTileDialogViewModelTest : SysuiTestCase() {
@get:Rule val mockitoRule: MockitoRule = MockitoJUnit.rule()
@@ -113,7 +115,6 @@ class BluetoothTileDialogViewModelTest : SysuiTestCase() {
@Before
fun setUp() {
- mSetFlagsRule.enableFlags(Flags.FLAG_BLUETOOTH_QS_TILE_DIALOG_AUTO_ON_TOGGLE)
scheduler = TestCoroutineScheduler()
dispatcher = UnconfinedTestDispatcher(scheduler)
testScope = TestScope(dispatcher)
diff --git a/packages/SystemUI/tests/src/com/android/systemui/keyguard/domain/interactor/KeyguardTransitionScenariosTest.kt b/packages/SystemUI/tests/src/com/android/systemui/keyguard/domain/interactor/KeyguardTransitionScenariosTest.kt
index ef15d21107b0..604ddf33fde7 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/keyguard/domain/interactor/KeyguardTransitionScenariosTest.kt
+++ b/packages/SystemUI/tests/src/com/android/systemui/keyguard/domain/interactor/KeyguardTransitionScenariosTest.kt
@@ -91,33 +91,40 @@ class KeyguardTransitionScenariosTest(flags: FlagsParameterization?) : SysuiTest
}
private val testScope = kosmos.testScope
- private val keyguardRepository = kosmos.fakeKeyguardRepository
- private val bouncerRepository = kosmos.fakeKeyguardBouncerRepository
+ private val keyguardRepository by lazy { kosmos.fakeKeyguardRepository }
+ private val bouncerRepository by lazy { kosmos.fakeKeyguardBouncerRepository }
private var commandQueue = kosmos.fakeCommandQueue
private val shadeTestUtil by lazy { kosmos.shadeTestUtil }
- private val transitionRepository = kosmos.fakeKeyguardTransitionRepository
+ private val transitionRepository by lazy { kosmos.fakeKeyguardTransitionRepository }
private lateinit var featureFlags: FakeFeatureFlags
// Used to verify transition requests for test output
@Mock private lateinit var keyguardSecurityModel: KeyguardSecurityModel
- private val fromLockscreenTransitionInteractor = kosmos.fromLockscreenTransitionInteractor
- private val fromDreamingTransitionInteractor = kosmos.fromDreamingTransitionInteractor
- private val fromDozingTransitionInteractor = kosmos.fromDozingTransitionInteractor
- private val fromOccludedTransitionInteractor = kosmos.fromOccludedTransitionInteractor
- private val fromGoneTransitionInteractor = kosmos.fromGoneTransitionInteractor
- private val fromAodTransitionInteractor = kosmos.fromAodTransitionInteractor
- private val fromAlternateBouncerTransitionInteractor =
+ private val fromLockscreenTransitionInteractor by lazy {
+ kosmos.fromLockscreenTransitionInteractor
+ }
+ private val fromDreamingTransitionInteractor by lazy { kosmos.fromDreamingTransitionInteractor }
+ private val fromDozingTransitionInteractor by lazy { kosmos.fromDozingTransitionInteractor }
+ private val fromOccludedTransitionInteractor by lazy { kosmos.fromOccludedTransitionInteractor }
+ private val fromGoneTransitionInteractor by lazy { kosmos.fromGoneTransitionInteractor }
+ private val fromAodTransitionInteractor by lazy { kosmos.fromAodTransitionInteractor }
+ private val fromAlternateBouncerTransitionInteractor by lazy {
kosmos.fromAlternateBouncerTransitionInteractor
- private val fromPrimaryBouncerTransitionInteractor =
+ }
+ private val fromPrimaryBouncerTransitionInteractor by lazy {
kosmos.fromPrimaryBouncerTransitionInteractor
- private val fromDreamingLockscreenHostedTransitionInteractor =
+ }
+ private val fromDreamingLockscreenHostedTransitionInteractor by lazy {
kosmos.fromDreamingLockscreenHostedTransitionInteractor
- private val fromGlanceableHubTransitionInteractor = kosmos.fromGlanceableHubTransitionInteractor
+ }
+ private val fromGlanceableHubTransitionInteractor by lazy {
+ kosmos.fromGlanceableHubTransitionInteractor
+ }
- private val powerInteractor = kosmos.powerInteractor
- private val communalInteractor = kosmos.communalInteractor
- private val dockManager = kosmos.fakeDockManager
+ private val powerInteractor by lazy { kosmos.powerInteractor }
+ private val communalInteractor by lazy { kosmos.communalInteractor }
+ private val dockManager by lazy { kosmos.fakeDockManager }
companion object {
@JvmStatic
diff --git a/packages/SystemUI/tests/src/com/android/systemui/keyguard/ui/viewmodel/KeyguardClockViewModelTest.kt b/packages/SystemUI/tests/src/com/android/systemui/keyguard/ui/viewmodel/KeyguardClockViewModelTest.kt
index 768d4468de4f..40663ceb2ad2 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/keyguard/ui/viewmodel/KeyguardClockViewModelTest.kt
+++ b/packages/SystemUI/tests/src/com/android/systemui/keyguard/ui/viewmodel/KeyguardClockViewModelTest.kt
@@ -23,6 +23,7 @@ import androidx.test.filters.SmallTest
import com.android.systemui.Flags
import com.android.systemui.SysuiTestCase
import com.android.systemui.coroutines.collectLastValue
+import com.android.systemui.flags.BrokenWithSceneContainer
import com.android.systemui.flags.andSceneContainer
import com.android.systemui.keyguard.data.repository.fakeKeyguardClockRepository
import com.android.systemui.keyguard.data.repository.keyguardClockRepository
@@ -56,7 +57,7 @@ import platform.test.runner.parameterized.Parameters
class KeyguardClockViewModelTest(flags: FlagsParameterization) : SysuiTestCase() {
val kosmos = testKosmos()
val testScope = kosmos.testScope
- val underTest = kosmos.keyguardClockViewModel
+ val underTest by lazy { kosmos.keyguardClockViewModel }
val res = context.resources
@Mock lateinit var clockController: ClockController
@@ -96,6 +97,7 @@ class KeyguardClockViewModelTest(flags: FlagsParameterization) : SysuiTestCase()
}
@Test
+ @BrokenWithSceneContainer(339465026)
fun currentClockLayout_splitShadeOn_clockNotCentered_largeClock_splitShadeLargeClock() =
testScope.runTest {
val currentClockLayout by collectLastValue(underTest.currentClockLayout)
@@ -110,6 +112,7 @@ class KeyguardClockViewModelTest(flags: FlagsParameterization) : SysuiTestCase()
}
@Test
+ @BrokenWithSceneContainer(339465026)
fun currentClockLayout_splitShadeOn_clockNotCentered_smallClock_splitShadeSmallClock() =
testScope.runTest {
val currentClockLayout by collectLastValue(underTest.currentClockLayout)
@@ -124,6 +127,7 @@ class KeyguardClockViewModelTest(flags: FlagsParameterization) : SysuiTestCase()
}
@Test
+ @BrokenWithSceneContainer(339465026)
fun currentClockLayout_singleShade_smallClock_smallClock() =
testScope.runTest {
val currentClockLayout by collectLastValue(underTest.currentClockLayout)
@@ -193,6 +197,7 @@ class KeyguardClockViewModelTest(flags: FlagsParameterization) : SysuiTestCase()
}
@Test
+ @BrokenWithSceneContainer(339465026)
fun testClockSize_dynamicClockSize() =
testScope.runTest {
with(kosmos) {
@@ -216,6 +221,7 @@ class KeyguardClockViewModelTest(flags: FlagsParameterization) : SysuiTestCase()
}
@Test
+ @BrokenWithSceneContainer(339465026)
fun isLargeClockVisible_whenSmallClockSize_isFalse() =
testScope.runTest {
val value by collectLastValue(underTest.isLargeClockVisible)
diff --git a/packages/SystemUI/tests/src/com/android/systemui/media/dialog/MediaOutputDialogReceiverTest.java b/packages/SystemUI/tests/src/com/android/systemui/media/dialog/MediaOutputDialogReceiverTest.java
index 3b6a88af1ee0..5dbfe475fedc 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/media/dialog/MediaOutputDialogReceiverTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/media/dialog/MediaOutputDialogReceiverTest.java
@@ -25,6 +25,8 @@ import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import android.content.Intent;
+import android.platform.test.annotations.DisableFlags;
+import android.platform.test.annotations.EnableFlags;
import android.testing.AndroidTestingRunner;
import androidx.test.filters.SmallTest;
@@ -91,8 +93,8 @@ public class MediaOutputDialogReceiverTest extends SysuiTestCase {
}
@Test
+ @DisableFlags(Flags.FLAG_LEGACY_LE_AUDIO_SHARING)
public void launchMediaOutputBroadcastDialog_flagOff_broadcastDialogFactoryNotCalled() {
- mSetFlagsRule.disableFlags(Flags.FLAG_LEGACY_LE_AUDIO_SHARING);
Intent intent = new Intent(
MediaOutputConstants.ACTION_LAUNCH_MEDIA_OUTPUT_BROADCAST_DIALOG);
intent.putExtra(MediaOutputConstants.EXTRA_PACKAGE_NAME, getContext().getPackageName());
@@ -105,8 +107,8 @@ public class MediaOutputDialogReceiverTest extends SysuiTestCase {
}
@Test
+ @EnableFlags(Flags.FLAG_LEGACY_LE_AUDIO_SHARING)
public void launchMediaOutputBroadcastDialog_ExtraPackageName_BroadcastDialogFactoryCalled() {
- mSetFlagsRule.enableFlags(Flags.FLAG_LEGACY_LE_AUDIO_SHARING);
Intent intent = new Intent(
MediaOutputConstants.ACTION_LAUNCH_MEDIA_OUTPUT_BROADCAST_DIALOG);
intent.putExtra(MediaOutputConstants.EXTRA_PACKAGE_NAME, getContext().getPackageName());
@@ -119,8 +121,8 @@ public class MediaOutputDialogReceiverTest extends SysuiTestCase {
}
@Test
+ @EnableFlags(Flags.FLAG_LEGACY_LE_AUDIO_SHARING)
public void launchMediaOutputBroadcastDialog_WrongExtraKey_DialogBroadcastFactoryNotCalled() {
- mSetFlagsRule.enableFlags(Flags.FLAG_LEGACY_LE_AUDIO_SHARING);
Intent intent = new Intent(
MediaOutputConstants.ACTION_LAUNCH_MEDIA_OUTPUT_BROADCAST_DIALOG);
intent.putExtra("Wrong Package Name Key", getContext().getPackageName());
@@ -133,8 +135,8 @@ public class MediaOutputDialogReceiverTest extends SysuiTestCase {
}
@Test
+ @EnableFlags(Flags.FLAG_LEGACY_LE_AUDIO_SHARING)
public void launchMediaOutputBroadcastDialog_NoExtra_BroadcastDialogFactoryNotCalled() {
- mSetFlagsRule.enableFlags(Flags.FLAG_LEGACY_LE_AUDIO_SHARING);
Intent intent = new Intent(
MediaOutputConstants.ACTION_LAUNCH_MEDIA_OUTPUT_BROADCAST_DIALOG);
mMediaOutputDialogReceiver.onReceive(getContext(), intent);
diff --git a/packages/SystemUI/tests/src/com/android/systemui/people/widget/PeopleSpaceWidgetManagerTest.java b/packages/SystemUI/tests/src/com/android/systemui/people/widget/PeopleSpaceWidgetManagerTest.java
index 890e1e011f22..0998c0c3d32c 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/people/widget/PeopleSpaceWidgetManagerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/people/widget/PeopleSpaceWidgetManagerTest.java
@@ -94,6 +94,8 @@ import android.net.Uri;
import android.os.Bundle;
import android.os.UserHandle;
import android.os.UserManager;
+import android.platform.test.annotations.DisableFlags;
+import android.platform.test.annotations.EnableFlags;
import android.service.notification.ConversationChannelWrapper;
import android.service.notification.StatusBarNotification;
import android.service.notification.ZenModeConfig;
@@ -1576,17 +1578,19 @@ public class PeopleSpaceWidgetManagerTest extends SysuiTestCase {
}
@Test
+ @DisableFlags({
+ android.appwidget.flags.Flags.FLAG_GENERATED_PREVIEWS,
+ android.appwidget.flags.Flags.FLAG_DRAW_DATA_PARCEL
+ })
public void testUpdateGeneratedPreview_flagDisabled() {
- mSetFlagsRule.disableFlags(android.appwidget.flags.Flags.FLAG_GENERATED_PREVIEWS);
- mSetFlagsRule.disableFlags(android.appwidget.flags.Flags.FLAG_DRAW_DATA_PARCEL);
mManager.updateGeneratedPreviewForUser(mUserTracker.getUserHandle());
verify(mAppWidgetManager, times(0)).setWidgetPreview(any(), anyInt(), any());
}
@Test
+ @EnableFlags(android.appwidget.flags.Flags.FLAG_GENERATED_PREVIEWS)
+ @DisableFlags(android.appwidget.flags.Flags.FLAG_DRAW_DATA_PARCEL)
public void testUpdateGeneratedPreview_userLocked() {
- mSetFlagsRule.enableFlags(android.appwidget.flags.Flags.FLAG_GENERATED_PREVIEWS);
- mSetFlagsRule.disableFlags(android.appwidget.flags.Flags.FLAG_DRAW_DATA_PARCEL);
when(mUserManager.isUserUnlocked(mUserTracker.getUserHandle())).thenReturn(false);
mManager.updateGeneratedPreviewForUser(mUserTracker.getUserHandle());
@@ -1594,9 +1598,9 @@ public class PeopleSpaceWidgetManagerTest extends SysuiTestCase {
}
@Test
+ @EnableFlags(android.appwidget.flags.Flags.FLAG_GENERATED_PREVIEWS)
+ @DisableFlags(android.appwidget.flags.Flags.FLAG_DRAW_DATA_PARCEL)
public void testUpdateGeneratedPreview_userUnlocked() {
- mSetFlagsRule.enableFlags(android.appwidget.flags.Flags.FLAG_GENERATED_PREVIEWS);
- mSetFlagsRule.disableFlags(android.appwidget.flags.Flags.FLAG_DRAW_DATA_PARCEL);
when(mUserManager.isUserUnlocked(mUserTracker.getUserHandle())).thenReturn(true);
when(mAppWidgetManager.setWidgetPreview(any(), anyInt(), any())).thenReturn(true);
@@ -1605,9 +1609,9 @@ public class PeopleSpaceWidgetManagerTest extends SysuiTestCase {
}
@Test
+ @EnableFlags(android.appwidget.flags.Flags.FLAG_GENERATED_PREVIEWS)
+ @DisableFlags(android.appwidget.flags.Flags.FLAG_DRAW_DATA_PARCEL)
public void testUpdateGeneratedPreview_doesNotSetTwice() {
- mSetFlagsRule.enableFlags(android.appwidget.flags.Flags.FLAG_GENERATED_PREVIEWS);
- mSetFlagsRule.disableFlags(android.appwidget.flags.Flags.FLAG_DRAW_DATA_PARCEL);
when(mUserManager.isUserUnlocked(mUserTracker.getUserHandle())).thenReturn(true);
when(mAppWidgetManager.setWidgetPreview(any(), anyInt(), any())).thenReturn(true);
@@ -1617,9 +1621,11 @@ public class PeopleSpaceWidgetManagerTest extends SysuiTestCase {
}
@Test
+ @EnableFlags({
+ android.appwidget.flags.Flags.FLAG_GENERATED_PREVIEWS,
+ android.appwidget.flags.Flags.FLAG_DRAW_DATA_PARCEL
+ })
public void testUpdateGeneratedPreviewWithDataParcel_userLocked() throws InterruptedException {
- mSetFlagsRule.enableFlags(android.appwidget.flags.Flags.FLAG_GENERATED_PREVIEWS);
- mSetFlagsRule.enableFlags(android.appwidget.flags.Flags.FLAG_DRAW_DATA_PARCEL);
when(mUserManager.isUserUnlocked(mUserTracker.getUserHandle())).thenReturn(false);
mManager.updateGeneratedPreviewForUser(mUserTracker.getUserHandle());
@@ -1628,10 +1634,12 @@ public class PeopleSpaceWidgetManagerTest extends SysuiTestCase {
}
@Test
+ @EnableFlags({
+ android.appwidget.flags.Flags.FLAG_GENERATED_PREVIEWS,
+ android.appwidget.flags.Flags.FLAG_DRAW_DATA_PARCEL
+ })
public void testUpdateGeneratedPreviewWithDataParcel_userUnlocked()
throws InterruptedException {
- mSetFlagsRule.enableFlags(android.appwidget.flags.Flags.FLAG_GENERATED_PREVIEWS);
- mSetFlagsRule.enableFlags(android.appwidget.flags.Flags.FLAG_DRAW_DATA_PARCEL);
when(mUserManager.isUserUnlocked(mUserTracker.getUserHandle())).thenReturn(true);
when(mAppWidgetManager.setWidgetPreview(any(), anyInt(), any())).thenReturn(true);
@@ -1641,10 +1649,12 @@ public class PeopleSpaceWidgetManagerTest extends SysuiTestCase {
}
@Test
+ @EnableFlags({
+ android.appwidget.flags.Flags.FLAG_GENERATED_PREVIEWS,
+ android.appwidget.flags.Flags.FLAG_DRAW_DATA_PARCEL
+ })
public void testUpdateGeneratedPreviewWithDataParcel_doesNotSetTwice()
throws InterruptedException {
- mSetFlagsRule.enableFlags(android.appwidget.flags.Flags.FLAG_GENERATED_PREVIEWS);
- mSetFlagsRule.enableFlags(android.appwidget.flags.Flags.FLAG_DRAW_DATA_PARCEL);
when(mUserManager.isUserUnlocked(mUserTracker.getUserHandle())).thenReturn(true);
when(mAppWidgetManager.setWidgetPreview(any(), anyInt(), any())).thenReturn(true);
diff --git a/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationsQSContainerControllerLegacyTest.kt b/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationsQSContainerControllerLegacyTest.kt
index 81d0e06df1fc..2c2fcbe75e1b 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationsQSContainerControllerLegacyTest.kt
+++ b/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationsQSContainerControllerLegacyTest.kt
@@ -16,6 +16,8 @@
package com.android.systemui.shade
+import android.platform.test.annotations.DisableFlags
+import android.platform.test.annotations.EnableFlags
import android.testing.AndroidTestingRunner
import android.testing.TestableLooper
import android.view.View
@@ -26,8 +28,8 @@ import androidx.annotation.IdRes
import androidx.constraintlayout.widget.ConstraintLayout
import androidx.constraintlayout.widget.ConstraintSet
import androidx.test.filters.SmallTest
-import com.android.systemui.Flags as AConfigFlags
import com.android.systemui.Flags.FLAG_CENTRALIZED_STATUS_BAR_HEIGHT_FIX
+import com.android.systemui.Flags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT
import com.android.systemui.SysuiTestCase
import com.android.systemui.fragments.FragmentHostManager
import com.android.systemui.fragments.FragmentService
@@ -164,10 +166,10 @@ class NotificationsQSContainerControllerLegacyTest : SysuiTestCase() {
}
@Test
+ @DisableFlags(FLAG_CENTRALIZED_STATUS_BAR_HEIGHT_FIX)
fun testLargeScreen_updateResources_refactorFlagOff_splitShadeHeightIsSetBasedOnResource() {
val headerResourceHeight = 20
val headerHelperHeight = 30
- mSetFlagsRule.disableFlags(FLAG_CENTRALIZED_STATUS_BAR_HEIGHT_FIX)
whenever(largeScreenHeaderHelper.getLargeScreenHeaderHeight())
.thenReturn(headerHelperHeight)
overrideResource(R.bool.config_use_large_screen_shade_header, true)
@@ -187,10 +189,10 @@ class NotificationsQSContainerControllerLegacyTest : SysuiTestCase() {
}
@Test
+ @EnableFlags(FLAG_CENTRALIZED_STATUS_BAR_HEIGHT_FIX)
fun testLargeScreen_updateResources_refactorFlagOn_splitShadeHeightIsSetBasedOnHelper() {
val headerResourceHeight = 20
val headerHelperHeight = 30
- mSetFlagsRule.enableFlags(FLAG_CENTRALIZED_STATUS_BAR_HEIGHT_FIX)
whenever(largeScreenHeaderHelper.getLargeScreenHeaderHeight())
.thenReturn(headerHelperHeight)
overrideResource(R.bool.config_use_large_screen_shade_header, true)
@@ -400,8 +402,8 @@ class NotificationsQSContainerControllerLegacyTest : SysuiTestCase() {
}
@Test
+ @DisableFlags(FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT)
fun testSplitShadeLayout_isAlignedToGuideline() {
- mSetFlagsRule.disableFlags(AConfigFlags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT)
enableSplitShade()
underTest.updateResources()
assertThat(getConstraintSetLayout(R.id.qs_frame).endToEnd).isEqualTo(R.id.qs_edge_guideline)
@@ -410,8 +412,8 @@ class NotificationsQSContainerControllerLegacyTest : SysuiTestCase() {
}
@Test
+ @DisableFlags(FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT)
fun testSinglePaneLayout_childrenHaveEqualMargins() {
- mSetFlagsRule.disableFlags(AConfigFlags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT)
disableSplitShade()
underTest.updateResources()
val qsStartMargin = getConstraintSetLayout(R.id.qs_frame).startMargin
@@ -427,8 +429,8 @@ class NotificationsQSContainerControllerLegacyTest : SysuiTestCase() {
}
@Test
+ @DisableFlags(FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT)
fun testSplitShadeLayout_childrenHaveInsideMarginsOfZero() {
- mSetFlagsRule.disableFlags(AConfigFlags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT)
enableSplitShade()
underTest.updateResources()
assertThat(getConstraintSetLayout(R.id.qs_frame).endMargin).isEqualTo(0)
@@ -445,9 +447,8 @@ class NotificationsQSContainerControllerLegacyTest : SysuiTestCase() {
}
@Test
+ @DisableFlags(FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT, FLAG_CENTRALIZED_STATUS_BAR_HEIGHT_FIX)
fun testLargeScreenLayout_refactorFlagOff_qsAndNotifsTopMarginIsOfHeaderHeightResource() {
- mSetFlagsRule.disableFlags(AConfigFlags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT)
- mSetFlagsRule.disableFlags(FLAG_CENTRALIZED_STATUS_BAR_HEIGHT_FIX)
setLargeScreen()
val largeScreenHeaderResourceHeight = 100
val largeScreenHeaderHelperHeight = 200
@@ -468,9 +469,9 @@ class NotificationsQSContainerControllerLegacyTest : SysuiTestCase() {
}
@Test
+ @DisableFlags(FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT)
+ @EnableFlags(FLAG_CENTRALIZED_STATUS_BAR_HEIGHT_FIX)
fun testLargeScreenLayout_refactorFlagOn_qsAndNotifsTopMarginIsOfHeaderHeightHelper() {
- mSetFlagsRule.disableFlags(AConfigFlags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT)
- mSetFlagsRule.enableFlags(FLAG_CENTRALIZED_STATUS_BAR_HEIGHT_FIX)
setLargeScreen()
val largeScreenHeaderResourceHeight = 100
val largeScreenHeaderHelperHeight = 200
@@ -491,8 +492,8 @@ class NotificationsQSContainerControllerLegacyTest : SysuiTestCase() {
}
@Test
+ @DisableFlags(FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT)
fun testSmallScreenLayout_qsAndNotifsTopMarginIsZero() {
- mSetFlagsRule.disableFlags(AConfigFlags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT)
setSmallScreen()
underTest.updateResources()
assertThat(getConstraintSetLayout(R.id.qs_frame).topMargin).isEqualTo(0)
@@ -512,8 +513,8 @@ class NotificationsQSContainerControllerLegacyTest : SysuiTestCase() {
}
@Test
+ @DisableFlags(FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT)
fun testSinglePaneShadeLayout_isAlignedToParent() {
- mSetFlagsRule.disableFlags(AConfigFlags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT)
disableSplitShade()
underTest.updateResources()
assertThat(getConstraintSetLayout(R.id.qs_frame).endToEnd)
diff --git a/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationsQSContainerControllerTest.kt b/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationsQSContainerControllerTest.kt
index 4ae751b4e7eb..f21def361e40 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationsQSContainerControllerTest.kt
+++ b/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationsQSContainerControllerTest.kt
@@ -16,6 +16,8 @@
package com.android.systemui.shade
+import android.platform.test.annotations.DisableFlags
+import android.platform.test.annotations.EnableFlags
import android.testing.AndroidTestingRunner
import android.testing.TestableLooper
import android.view.View
@@ -27,6 +29,7 @@ import androidx.constraintlayout.widget.ConstraintLayout
import androidx.constraintlayout.widget.ConstraintSet
import androidx.test.filters.SmallTest
import com.android.systemui.Flags.FLAG_CENTRALIZED_STATUS_BAR_HEIGHT_FIX
+import com.android.systemui.Flags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT
import com.android.systemui.SysuiTestCase
import com.android.systemui.fragments.FragmentHostManager
import com.android.systemui.fragments.FragmentService
@@ -67,6 +70,7 @@ import org.mockito.MockitoAnnotations
@RunWith(AndroidTestingRunner::class)
@TestableLooper.RunWithLooper(setAsMainLooper = true)
@SmallTest
+@EnableFlags(FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT)
class NotificationsQSContainerControllerTest : SysuiTestCase() {
private val view = mock<NotificationsQuickSettingsContainer>()
@@ -99,7 +103,6 @@ class NotificationsQSContainerControllerTest : SysuiTestCase() {
MockitoAnnotations.initMocks(this)
fakeSystemClock = FakeSystemClock()
delayableExecutor = FakeExecutor(fakeSystemClock)
- mSetFlagsRule.enableFlags(com.android.systemui.Flags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT)
mContext.ensureTestableResources()
whenever(view.context).thenReturn(mContext)
whenever(view.resources).thenReturn(mContext.resources)
@@ -161,8 +164,8 @@ class NotificationsQSContainerControllerTest : SysuiTestCase() {
}
@Test
+ @DisableFlags(FLAG_CENTRALIZED_STATUS_BAR_HEIGHT_FIX)
fun testLargeScreen_updateResources_refactorFlagOff_splitShadeHeightIsSet_basedOnResource() {
- mSetFlagsRule.disableFlags(FLAG_CENTRALIZED_STATUS_BAR_HEIGHT_FIX)
val helperHeight = 30
val resourceHeight = 20
whenever(largeScreenHeaderHelper.getLargeScreenHeaderHeight()).thenReturn(helperHeight)
@@ -182,8 +185,8 @@ class NotificationsQSContainerControllerTest : SysuiTestCase() {
}
@Test
+ @EnableFlags(FLAG_CENTRALIZED_STATUS_BAR_HEIGHT_FIX)
fun testLargeScreen_updateResources_refactorFlagOn_splitShadeHeightIsSet_basedOnHelper() {
- mSetFlagsRule.enableFlags(FLAG_CENTRALIZED_STATUS_BAR_HEIGHT_FIX)
val helperHeight = 30
val resourceHeight = 20
whenever(largeScreenHeaderHelper.getLargeScreenHeaderHeight()).thenReturn(helperHeight)
@@ -424,8 +427,8 @@ class NotificationsQSContainerControllerTest : SysuiTestCase() {
}
@Test
+ @DisableFlags(FLAG_CENTRALIZED_STATUS_BAR_HEIGHT_FIX)
fun testLargeScreenLayout_refactorFlagOff_qsAndNotifsTopMarginIsOfHeaderResourceHeight() {
- mSetFlagsRule.disableFlags(FLAG_CENTRALIZED_STATUS_BAR_HEIGHT_FIX)
setLargeScreen()
val largeScreenHeaderHelperHeight = 200
val largeScreenHeaderResourceHeight = 100
@@ -444,8 +447,8 @@ class NotificationsQSContainerControllerTest : SysuiTestCase() {
}
@Test
+ @EnableFlags(FLAG_CENTRALIZED_STATUS_BAR_HEIGHT_FIX)
fun testLargeScreenLayout_refactorFlagOn_qsAndNotifsTopMarginIsOfHeaderHelperHeight() {
- mSetFlagsRule.enableFlags(FLAG_CENTRALIZED_STATUS_BAR_HEIGHT_FIX)
setLargeScreen()
val largeScreenHeaderHelperHeight = 200
val largeScreenHeaderResourceHeight = 100
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationShelfTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationShelfTest.kt
index 745d20dd686b..1eed4207541c 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationShelfTest.kt
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationShelfTest.kt
@@ -1,5 +1,6 @@
package com.android.systemui.statusbar.notification.stack
+import android.platform.test.annotations.DisableFlags
import android.service.notification.StatusBarNotification
import android.testing.AndroidTestingRunner
import android.testing.TestableLooper.RunWithLooper
@@ -69,8 +70,8 @@ open class NotificationShelfTest : SysuiTestCase() {
}
@Test
+ @DisableFlags(NotificationIconContainerRefactor.FLAG_NAME)
fun testShadeWidth_BasedOnFractionToShade() {
- mSetFlagsRule.disableFlags(NotificationIconContainerRefactor.FLAG_NAME)
setFractionToShade(0f)
setOnLockscreen(true)
@@ -85,8 +86,8 @@ open class NotificationShelfTest : SysuiTestCase() {
}
@Test
+ @DisableFlags(NotificationIconContainerRefactor.FLAG_NAME)
fun testShelfIsLong_WhenNotOnLockscreen() {
- mSetFlagsRule.disableFlags(NotificationIconContainerRefactor.FLAG_NAME)
setFractionToShade(0f)
setOnLockscreen(false)
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/CentralSurfacesImplTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/CentralSurfacesImplTest.java
index b9312d3ce2be..3afcc17380af 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/CentralSurfacesImplTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/CentralSurfacesImplTest.java
@@ -70,6 +70,8 @@ import android.os.IThermalService;
import android.os.Looper;
import android.os.PowerManager;
import android.os.UserHandle;
+import android.platform.test.annotations.DisableFlags;
+import android.platform.test.annotations.EnableFlags;
import android.service.dreams.IDreamManager;
import android.support.test.metricshelper.MetricsAsserts;
import android.testing.AndroidTestingRunner;
@@ -105,8 +107,6 @@ import com.android.systemui.charging.WiredChargingRippleController;
import com.android.systemui.classifier.FalsingCollectorFake;
import com.android.systemui.classifier.FalsingManagerFake;
import com.android.systemui.colorextraction.SysuiColorExtractor;
-import com.android.systemui.communal.data.repository.CommunalRepository;
-import com.android.systemui.communal.domain.interactor.CommunalInteractor;
import com.android.systemui.communal.shared.model.CommunalScenes;
import com.android.systemui.demomode.DemoModeController;
import com.android.systemui.dump.DumpManager;
@@ -224,6 +224,7 @@ import javax.inject.Provider;
@SmallTest
@RunWith(AndroidTestingRunner.class)
@RunWithLooper(setAsMainLooper = true)
+@EnableFlags(FLAG_LIGHT_REVEAL_MIGRATION)
public class CentralSurfacesImplTest extends SysuiTestCase {
private static final int FOLD_STATE_FOLDED = 0;
@@ -238,8 +239,6 @@ public class CentralSurfacesImplTest extends SysuiTestCase {
private final TestScope mTestScope = mKosmos.getTestScope();
- private final CommunalInteractor mCommunalInteractor = mKosmos.getCommunalInteractor();
- private final CommunalRepository mCommunalRepository = mKosmos.getCommunalRepository();
@Mock private NotificationsController mNotificationsController;
@Mock private LightBarController mLightBarController;
@Mock private StatusBarKeyguardViewManager mStatusBarKeyguardViewManager;
@@ -362,7 +361,6 @@ public class CentralSurfacesImplTest extends SysuiTestCase {
// Set default value to avoid IllegalStateException.
mFeatureFlags.set(SHORTCUT_LIST_SEARCH_LAYOUT, false);
- mSetFlagsRule.enableFlags(FLAG_LIGHT_REVEAL_MIGRATION);
// Turn AOD on and toggle feature flag for jank fixes
mFeatureFlags.set(Flags.ZJ_285570694_LOCKSCREEN_TRANSITION_FROM_AOD, true);
when(mDozeParameters.getAlwaysOn()).thenReturn(true);
@@ -528,7 +526,7 @@ public class CentralSurfacesImplTest extends SysuiTestCase {
mScreenLifecycle,
mWakefulnessLifecycle,
mPowerInteractor,
- mCommunalInteractor,
+ mKosmos.getCommunalInteractor(),
mStatusBarStateController,
Optional.of(mBubbles),
() -> mNoteTaskController,
@@ -878,16 +876,18 @@ public class CentralSurfacesImplTest extends SysuiTestCase {
@Test
public void testEnteringGlanceableHub_updatesScrim() {
// Transition to the glanceable hub.
- mCommunalRepository.setTransitionState(flowOf(new ObservableTransitionState.Idle(
- CommunalScenes.Communal)));
+ mKosmos.getCommunalRepository()
+ .setTransitionState(
+ flowOf(new ObservableTransitionState.Idle(CommunalScenes.Communal)));
mTestScope.getTestScheduler().runCurrent();
// ScrimState also transitions.
verify(mScrimController).transitionTo(ScrimState.GLANCEABLE_HUB);
// Transition away from the glanceable hub.
- mCommunalRepository.setTransitionState(flowOf(new ObservableTransitionState.Idle(
- CommunalScenes.Blank)));
+ mKosmos.getCommunalRepository()
+ .setTransitionState(
+ flowOf(new ObservableTransitionState.Idle(CommunalScenes.Blank)));
mTestScope.getTestScheduler().runCurrent();
// ScrimState goes back to UNLOCKED.
@@ -901,16 +901,18 @@ public class CentralSurfacesImplTest extends SysuiTestCase {
when(mKeyguardUpdateMonitor.isDreaming()).thenReturn(true);
// Transition to the glanceable hub.
- mCommunalRepository.setTransitionState(flowOf(new ObservableTransitionState.Idle(
- CommunalScenes.Communal)));
+ mKosmos.getCommunalRepository()
+ .setTransitionState(
+ flowOf(new ObservableTransitionState.Idle(CommunalScenes.Communal)));
mTestScope.getTestScheduler().runCurrent();
// ScrimState also transitions.
verify(mScrimController).transitionTo(ScrimState.GLANCEABLE_HUB_OVER_DREAM);
// Transition away from the glanceable hub.
- mCommunalRepository.setTransitionState(flowOf(new ObservableTransitionState.Idle(
- CommunalScenes.Blank)));
+ mKosmos.getCommunalRepository()
+ .setTransitionState(
+ flowOf(new ObservableTransitionState.Idle(CommunalScenes.Blank)));
mTestScope.getTestScheduler().runCurrent();
// ScrimState goes back to UNLOCKED.
@@ -1105,18 +1107,16 @@ public class CentralSurfacesImplTest extends SysuiTestCase {
}
@Test
+ @EnableFlags(com.android.systemui.Flags.FLAG_TRUNCATED_STATUS_BAR_ICONS_FIX)
public void updateResources_flagEnabled_doesNotUpdateStatusBarWindowHeight() {
- mSetFlagsRule.enableFlags(com.android.systemui.Flags.FLAG_TRUNCATED_STATUS_BAR_ICONS_FIX);
-
mCentralSurfaces.updateResources();
verify(mStatusBarWindowController, never()).refreshStatusBarHeight();
}
@Test
+ @DisableFlags(com.android.systemui.Flags.FLAG_TRUNCATED_STATUS_BAR_ICONS_FIX)
public void updateResources_flagDisabled_updatesStatusBarWindowHeight() {
- mSetFlagsRule.disableFlags(com.android.systemui.Flags.FLAG_TRUNCATED_STATUS_BAR_ICONS_FIX);
-
mCentralSurfaces.updateResources();
verify(mStatusBarWindowController).refreshStatusBarHeight();
@@ -1151,10 +1151,10 @@ public class CentralSurfacesImplTest extends SysuiTestCase {
}
@Test
+ @EnableFlags(FLAG_KEYBOARD_SHORTCUT_HELPER_REWRITE)
public void dismissKeyboardShortcuts_largeScreen_bothFlagsEnabled_doesNotDismissAny() {
switchToLargeScreen();
mFeatureFlags.set(SHORTCUT_LIST_SEARCH_LAYOUT, true);
- mSetFlagsRule.enableFlags(FLAG_KEYBOARD_SHORTCUT_HELPER_REWRITE);
createCentralSurfaces();
dismissKeyboardShortcuts();
@@ -1163,10 +1163,10 @@ public class CentralSurfacesImplTest extends SysuiTestCase {
}
@Test
+ @DisableFlags(FLAG_KEYBOARD_SHORTCUT_HELPER_REWRITE)
public void dismissKeyboardShortcuts_largeScreen_newFlagsDisabled_dismissesTabletVersion() {
switchToLargeScreen();
mFeatureFlags.set(SHORTCUT_LIST_SEARCH_LAYOUT, true);
- mSetFlagsRule.disableFlags(FLAG_KEYBOARD_SHORTCUT_HELPER_REWRITE);
createCentralSurfaces();
dismissKeyboardShortcuts();
@@ -1175,10 +1175,10 @@ public class CentralSurfacesImplTest extends SysuiTestCase {
}
@Test
+ @DisableFlags(FLAG_KEYBOARD_SHORTCUT_HELPER_REWRITE)
public void dismissKeyboardShortcuts_largeScreen_bothFlagsDisabled_dismissesPhoneVersion() {
switchToLargeScreen();
mFeatureFlags.set(SHORTCUT_LIST_SEARCH_LAYOUT, false);
- mSetFlagsRule.disableFlags(FLAG_KEYBOARD_SHORTCUT_HELPER_REWRITE);
createCentralSurfaces();
dismissKeyboardShortcuts();
@@ -1188,10 +1188,10 @@ public class CentralSurfacesImplTest extends SysuiTestCase {
}
@Test
+ @EnableFlags(FLAG_KEYBOARD_SHORTCUT_HELPER_REWRITE)
public void dismissKeyboardShortcuts_smallScreen_bothFlagsEnabled_doesNotDismissAny() {
switchToSmallScreen();
mFeatureFlags.set(SHORTCUT_LIST_SEARCH_LAYOUT, true);
- mSetFlagsRule.enableFlags(FLAG_KEYBOARD_SHORTCUT_HELPER_REWRITE);
createCentralSurfaces();
dismissKeyboardShortcuts();
@@ -1200,10 +1200,10 @@ public class CentralSurfacesImplTest extends SysuiTestCase {
}
@Test
+ @DisableFlags(FLAG_KEYBOARD_SHORTCUT_HELPER_REWRITE)
public void dismissKeyboardShortcuts_smallScreen_newFlagsDisabled_dismissesPhoneVersion() {
switchToSmallScreen();
mFeatureFlags.set(SHORTCUT_LIST_SEARCH_LAYOUT, true);
- mSetFlagsRule.disableFlags(FLAG_KEYBOARD_SHORTCUT_HELPER_REWRITE);
createCentralSurfaces();
dismissKeyboardShortcuts();
@@ -1213,10 +1213,10 @@ public class CentralSurfacesImplTest extends SysuiTestCase {
}
@Test
+ @DisableFlags(FLAG_KEYBOARD_SHORTCUT_HELPER_REWRITE)
public void dismissKeyboardShortcuts_smallScreen_bothFlagsDisabled_dismissesPhoneVersion() {
switchToSmallScreen();
mFeatureFlags.set(SHORTCUT_LIST_SEARCH_LAYOUT, false);
- mSetFlagsRule.disableFlags(FLAG_KEYBOARD_SHORTCUT_HELPER_REWRITE);
createCentralSurfaces();
dismissKeyboardShortcuts();
@@ -1226,10 +1226,10 @@ public class CentralSurfacesImplTest extends SysuiTestCase {
}
@Test
+ @EnableFlags(FLAG_KEYBOARD_SHORTCUT_HELPER_REWRITE)
public void toggleKeyboardShortcuts_largeScreen_bothFlagsEnabled_doesNotTogglesAny() {
switchToLargeScreen();
mFeatureFlags.set(SHORTCUT_LIST_SEARCH_LAYOUT, true);
- mSetFlagsRule.enableFlags(FLAG_KEYBOARD_SHORTCUT_HELPER_REWRITE);
createCentralSurfaces();
int deviceId = 321;
@@ -1239,10 +1239,10 @@ public class CentralSurfacesImplTest extends SysuiTestCase {
}
@Test
+ @DisableFlags(FLAG_KEYBOARD_SHORTCUT_HELPER_REWRITE)
public void toggleKeyboardShortcuts_largeScreen_newFlagsDisabled_togglesTabletVersion() {
switchToLargeScreen();
mFeatureFlags.set(SHORTCUT_LIST_SEARCH_LAYOUT, true);
- mSetFlagsRule.disableFlags(FLAG_KEYBOARD_SHORTCUT_HELPER_REWRITE);
createCentralSurfaces();
int deviceId = 654;
@@ -1253,10 +1253,10 @@ public class CentralSurfacesImplTest extends SysuiTestCase {
}
@Test
+ @DisableFlags(FLAG_KEYBOARD_SHORTCUT_HELPER_REWRITE)
public void toggleKeyboardShortcuts_largeScreen_bothFlagsDisabled_togglesPhoneVersion() {
switchToLargeScreen();
mFeatureFlags.set(SHORTCUT_LIST_SEARCH_LAYOUT, false);
- mSetFlagsRule.disableFlags(FLAG_KEYBOARD_SHORTCUT_HELPER_REWRITE);
createCentralSurfaces();
int deviceId = 987;
@@ -1267,10 +1267,10 @@ public class CentralSurfacesImplTest extends SysuiTestCase {
}
@Test
+ @EnableFlags(FLAG_KEYBOARD_SHORTCUT_HELPER_REWRITE)
public void toggleKeyboardShortcuts_smallScreen_bothFlagsEnabled_doesNotToggleAny() {
switchToSmallScreen();
mFeatureFlags.set(SHORTCUT_LIST_SEARCH_LAYOUT, true);
- mSetFlagsRule.enableFlags(FLAG_KEYBOARD_SHORTCUT_HELPER_REWRITE);
createCentralSurfaces();
int deviceId = 789;
@@ -1280,10 +1280,10 @@ public class CentralSurfacesImplTest extends SysuiTestCase {
}
@Test
+ @DisableFlags(FLAG_KEYBOARD_SHORTCUT_HELPER_REWRITE)
public void toggleKeyboardShortcuts_smallScreen_newFlagsDisabled_togglesPhoneVersion() {
switchToSmallScreen();
mFeatureFlags.set(SHORTCUT_LIST_SEARCH_LAYOUT, true);
- mSetFlagsRule.disableFlags(FLAG_KEYBOARD_SHORTCUT_HELPER_REWRITE);
createCentralSurfaces();
int deviceId = 456;
@@ -1294,10 +1294,10 @@ public class CentralSurfacesImplTest extends SysuiTestCase {
}
@Test
+ @DisableFlags(FLAG_KEYBOARD_SHORTCUT_HELPER_REWRITE)
public void toggleKeyboardShortcuts_smallScreen_bothFlagsDisabled_togglesPhoneVersion() {
switchToSmallScreen();
mFeatureFlags.set(SHORTCUT_LIST_SEARCH_LAYOUT, false);
- mSetFlagsRule.disableFlags(FLAG_KEYBOARD_SHORTCUT_HELPER_REWRITE);
createCentralSurfaces();
int deviceId = 123;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardClockPositionAlgorithmTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardClockPositionAlgorithmTest.java
index fd295b57379c..e8346933f192 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardClockPositionAlgorithmTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardClockPositionAlgorithmTest.java
@@ -26,6 +26,8 @@ import static org.mockito.ArgumentMatchers.anyInt;
import static org.mockito.Mockito.when;
import android.content.res.Resources;
+import android.platform.test.annotations.DisableFlags;
+import android.platform.test.annotations.EnableFlags;
import android.testing.AndroidTestingRunner;
import androidx.test.filters.SmallTest;
@@ -297,8 +299,8 @@ public class KeyguardClockPositionAlgorithmTest extends SysuiTestCase {
}
@Test
+ @DisableFlags(Flags.FLAG_CENTRALIZED_STATUS_BAR_HEIGHT_FIX)
public void notifPaddingMakesUpToFullMarginInSplitShade_refactorFlagOff_usesResource() {
- mSetFlagsRule.disableFlags(Flags.FLAG_CENTRALIZED_STATUS_BAR_HEIGHT_FIX);
int keyguardSplitShadeTopMargin = 100;
int largeScreenHeaderHeightResource = 70;
when(mResources.getDimensionPixelSize(R.dimen.keyguard_split_shade_top_margin))
@@ -316,8 +318,8 @@ public class KeyguardClockPositionAlgorithmTest extends SysuiTestCase {
}
@Test
+ @EnableFlags(Flags.FLAG_CENTRALIZED_STATUS_BAR_HEIGHT_FIX)
public void notifPaddingMakesUpToFullMarginInSplitShade_refactorFlagOn_usesHelper() {
- mSetFlagsRule.enableFlags(Flags.FLAG_CENTRALIZED_STATUS_BAR_HEIGHT_FIX);
int keyguardSplitShadeTopMargin = 100;
int largeScreenHeaderHeightHelper = 50;
int largeScreenHeaderHeightResource = 70;