From 194d7f768748cf6dc0eb7df760b85b9625b9d66f Mon Sep 17 00:00:00 2001 From: Mark Kim Date: Thu, 22 Feb 2024 16:16:11 +0000 Subject: [PATCH] Disable APP_ARCHIVING flag for specific test APP_ARCHIVING flag was introduced to control archiving feature in Settings separately from OS. The broken test was expecting archiving feature flag be disabled but it didn't take into account a newly introduced flag which was automatically rolled out in ag/26270549 Test: InstalledAppCounterTest Bug: n/a Change-Id: I253cf7e6b28c9f1508c3f9fd1104fdb06b8706c2 --- .../settings/applications/InstalledAppCounterTest.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/robotests/src/com/android/settings/applications/InstalledAppCounterTest.java b/tests/robotests/src/com/android/settings/applications/InstalledAppCounterTest.java index 1d76806f873..e2c9573ab7e 100644 --- a/tests/robotests/src/com/android/settings/applications/InstalledAppCounterTest.java +++ b/tests/robotests/src/com/android/settings/applications/InstalledAppCounterTest.java @@ -41,9 +41,11 @@ import android.content.pm.ResolveInfo; import android.content.pm.UserInfo; import android.os.UserHandle; import android.os.UserManager; +import android.platform.test.flag.junit.SetFlagsRule; import org.junit.Before; import org.junit.Ignore; +import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.ArgumentMatcher; @@ -85,6 +87,9 @@ public final class InstalledAppCounterTest { @Mock private PackageManager mPackageManager; + @Rule + public final SetFlagsRule mSetFlagsRule = new SetFlagsRule(); + private int mInstalledAppCount = -1; private ApplicationInfo mApp1; private ApplicationInfo mApp2; @@ -218,6 +223,7 @@ public final class InstalledAppCounterTest { eq(MAIN_USER_ID))).thenReturn(Arrays.asList(mApp2)); mFakeFeatureFlags.setFlag(Flags.FLAG_ARCHIVING, false); + mSetFlagsRule.disableFlags(com.android.settings.flags.Flags.FLAG_APP_ARCHIVING); // Count the number of all apps installed, irrespective of install reason. count(InstalledAppCounter.IGNORE_INSTALL_REASON, mFakeFeatureFlags); assertThat(mInstalledAppCount).isEqualTo(1);