Merge "Add flag rule to AutoTileManagerTest" into main
diff --git a/packages/SystemUI/tests/src/com/android/systemui/qs/QSTileHostTest.java b/packages/SystemUI/tests/src/com/android/systemui/qs/QSTileHostTest.java
index 3b07913..5245b22 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/qs/QSTileHostTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/qs/QSTileHostTest.java
@@ -27,7 +27,6 @@
import static org.mockito.ArgumentMatchers.anyInt;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.ArgumentMatchers.isNull;
-import static org.mockito.Mockito.clearInvocations;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.verify;
@@ -41,7 +40,6 @@
import android.os.Handler;
import android.os.Looper;
import android.os.UserHandle;
-import android.platform.test.flag.junit.SetFlagsRule;
import android.testing.AndroidTestingRunner;
import android.util.SparseArray;
import android.view.View;
@@ -82,7 +80,6 @@
import com.android.systemui.util.time.FakeSystemClock;
import org.junit.Before;
-import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
@@ -107,10 +104,6 @@
ComponentName.unflattenFromString("TEST_PKG/.TEST_CLS");
private static final String CUSTOM_TILE_SPEC = CustomTile.toSpec(CUSTOM_TILE);
private static final String SETTING = QSHost.TILES_SETTING;
-
- @Rule
- public final SetFlagsRule mSetFlagsRule = new SetFlagsRule();
-
@Mock
private PluginManager mPluginManager;
@Mock
diff --git a/packages/SystemUI/tests/src/com/android/systemui/qs/pipeline/domain/interactor/CurrentTilesInteractorImplTest.kt b/packages/SystemUI/tests/src/com/android/systemui/qs/pipeline/domain/interactor/CurrentTilesInteractorImplTest.kt
index 355ca81..8c896a6 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/qs/pipeline/domain/interactor/CurrentTilesInteractorImplTest.kt
+++ b/packages/SystemUI/tests/src/com/android/systemui/qs/pipeline/domain/interactor/CurrentTilesInteractorImplTest.kt
@@ -21,7 +21,6 @@
import android.content.Intent
import android.content.pm.UserInfo
import android.os.UserHandle
-import android.platform.test.flag.junit.SetFlagsRule
import android.service.quicksettings.Tile
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.filters.SmallTest
@@ -62,7 +61,6 @@
import kotlinx.coroutines.test.runCurrent
import kotlinx.coroutines.test.runTest
import org.junit.Before
-import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
import org.mockito.ArgumentMatchers.anyString
@@ -77,8 +75,6 @@
@OptIn(ExperimentalCoroutinesApi::class)
class CurrentTilesInteractorImplTest : SysuiTestCase() {
- @Rule @JvmField val setFlagsRule = SetFlagsRule()
-
private val tileSpecRepository: TileSpecRepository = FakeTileSpecRepository()
private val userRepository = FakeUserRepository()
private val installedTilesPackageRepository = FakeInstalledTilesComponentRepository()
@@ -109,7 +105,7 @@
fun setup() {
MockitoAnnotations.initMocks(this)
- setFlagsRule.enableFlags(FLAG_QS_NEW_PIPELINE)
+ mSetFlagsRule.enableFlags(FLAG_QS_NEW_PIPELINE)
// TODO(b/299909337): Add test checking the new factory is used when the flag is on
featureFlags.set(Flags.QS_PIPELINE_NEW_TILES, true)
diff --git a/packages/SystemUI/tests/src/com/android/systemui/qs/pipeline/shared/QSPipelineFlagsRepositoryTest.kt b/packages/SystemUI/tests/src/com/android/systemui/qs/pipeline/shared/QSPipelineFlagsRepositoryTest.kt
index 62ca965..2e63708 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/qs/pipeline/shared/QSPipelineFlagsRepositoryTest.kt
+++ b/packages/SystemUI/tests/src/com/android/systemui/qs/pipeline/shared/QSPipelineFlagsRepositoryTest.kt
@@ -1,13 +1,11 @@
package com.android.systemui.qs.pipeline.shared
-import android.platform.test.flag.junit.SetFlagsRule
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.filters.SmallTest
import com.android.systemui.Flags
import com.android.systemui.SysuiTestCase
import com.android.systemui.flags.FakeFeatureFlagsClassic
import com.google.common.truth.Truth.assertThat
-import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
@@ -15,22 +13,20 @@
@RunWith(AndroidJUnit4::class)
class QSPipelineFlagsRepositoryTest : SysuiTestCase() {
- @Rule @JvmField val setFlagsRule = SetFlagsRule()
-
private val fakeFeatureFlagsClassic = FakeFeatureFlagsClassic()
private val underTest = QSPipelineFlagsRepository(fakeFeatureFlagsClassic)
@Test
fun pipelineFlagDisabled() {
- setFlagsRule.disableFlags(Flags.FLAG_QS_NEW_PIPELINE)
+ mSetFlagsRule.disableFlags(Flags.FLAG_QS_NEW_PIPELINE)
assertThat(underTest.pipelineEnabled).isFalse()
}
@Test
fun pipelineFlagEnabled() {
- setFlagsRule.enableFlags(Flags.FLAG_QS_NEW_PIPELINE)
+ mSetFlagsRule.enableFlags(Flags.FLAG_QS_NEW_PIPELINE)
assertThat(underTest.pipelineEnabled).isTrue()
}
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/AutoTileManagerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/AutoTileManagerTest.java
index 1d8a346..84cd518 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/AutoTileManagerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/AutoTileManagerTest.java
@@ -16,6 +16,7 @@
package com.android.systemui.statusbar.phone;
+import static com.android.systemui.Flags.FLAG_QS_NEW_PIPELINE;
import static com.android.systemui.qs.dagger.QSFlagsModule.RBC_AVAILABLE;
import static com.android.systemui.statusbar.phone.AutoTileManager.DEVICE_CONTROLS;
@@ -135,6 +136,8 @@
MockitoAnnotations.initMocks(this);
mSecureSettings = new FakeSettings();
+ mSetFlagsRule.disableFlags(FLAG_QS_NEW_PIPELINE);
+
mContext.getOrCreateTestableResources().addOverride(
R.array.config_quickSettingsAutoAdd,
new String[] {