diff options
44 files changed, 158 insertions, 112 deletions
diff --git a/core/java/android/content/pm/TEST_MAPPING b/core/java/android/content/pm/TEST_MAPPING index cc4782ad4a79..aa5780695d75 100644 --- a/core/java/android/content/pm/TEST_MAPPING +++ b/core/java/android/content/pm/TEST_MAPPING @@ -10,6 +10,9 @@ "path": "frameworks/base/services/tests/PackageManagerComponentOverrideTests" }, { + "path": "frameworks/base/services/tests/servicestests/src/com/android/server/pm" + }, + { "path": "cts/tests/tests/packageinstaller" }, { diff --git a/services/core/java/com/android/server/pm/TEST_MAPPING b/services/core/java/com/android/server/pm/TEST_MAPPING index d54acb7d6bd6..a5a8d5ce9bd4 100644 --- a/services/core/java/com/android/server/pm/TEST_MAPPING +++ b/services/core/java/com/android/server/pm/TEST_MAPPING @@ -24,20 +24,6 @@ "name": "CtsMatchFlagTestCases" }, { - "name": "FrameworksServicesTests", - "options": [ - { - "include-filter": "com.android.server.pm." - }, - { - "include-annotation": "android.platform.test.annotations.Presubmit" - }, - { - "exclude-annotation": "androidx.test.filters.FlakyTest" - } - ] - }, - { "name": "FrameworksMockingServicesTests", "options": [ { @@ -46,45 +32,6 @@ ] }, { - "name": "FrameworksServicesTests", - "file_patterns": ["(/|^)ShortcutService\\.java"], - "options": [ - { - "include-filter": "com.android.server.pm.ShortcutManagerTest1" - }, - { - "include-filter": "com.android.server.pm.ShortcutManagerTest2" - }, - { - "include-filter": "com.android.server.pm.ShortcutManagerTest3" - }, - { - "include-filter": "com.android.server.pm.ShortcutManagerTest4" - }, - { - "include-filter": "com.android.server.pm.ShortcutManagerTest5" - }, - { - "include-filter": "com.android.server.pm.ShortcutManagerTest6" - }, - { - "include-filter": "com.android.server.pm.ShortcutManagerTest7" - }, - { - "include-filter": "com.android.server.pm.ShortcutManagerTest8" - }, - { - "include-filter": "com.android.server.pm.ShortcutManagerTest9" - }, - { - "include-filter": "com.android.server.pm.ShortcutManagerTest10" - }, - { - "include-filter": "com.android.server.pm.ShortcutManagerTest11" - } - ] - }, - { "name": "CtsShortcutHostTestCases", "file_patterns": ["(/|^)ShortcutService\\.java"] }, @@ -188,47 +135,6 @@ }, { "name": "PackageManagerServiceHostTests" - }, - { - "name": "FrameworksServicesTests", - "options": [ - { - "install-arg": "-t" - }, - { - "include-filter": "com.android.server.pm.UserDataPreparerTest" - }, - { - "include-filter": "com.android.server.pm.UserLifecycleStressTest" - }, - { - "include-filter": "com.android.server.pm.UserManagerServiceCreateProfileTest" - }, - { - "include-filter": "com.android.server.pm.UserManagerServiceIdRecyclingTest" - }, - { - "include-filter": "com.android.server.pm.UserManagerServiceTest" - }, - { - "include-filter": "com.android.server.pm.UserManagerServiceUserInfoTest" - }, - { - "include-filter": "com.android.server.pm.UserManagerServiceUserTypeTest" - }, - { - "include-filter": "com.android.server.pm.UserManagerTest" - }, - { - "include-filter": "com.android.server.pm.UserRestrictionsUtilsTest" - }, - { - "include-filter": "com.android.server.pm.UserSystemPackageInstallerTest" - }, - { - "include-filter": "com.android.server.pm.parsing.SystemPartitionParseTest" - } - ] } ], "imports": [ diff --git a/services/tests/servicestests/src/com/android/server/pm/BundleUtilsTest.java b/services/tests/servicestests/src/com/android/server/pm/BundleUtilsTest.java index 764c504eeede..6245f829fc5a 100644 --- a/services/tests/servicestests/src/com/android/server/pm/BundleUtilsTest.java +++ b/services/tests/servicestests/src/com/android/server/pm/BundleUtilsTest.java @@ -22,8 +22,9 @@ import static com.android.server.devicepolicy.DpmTestUtils.newRestrictions; import static com.google.common.truth.Truth.assertThat; import android.os.Bundle; -import android.test.suitebuilder.annotation.SmallTest; +import android.platform.test.annotations.Presubmit; +import androidx.test.filters.SmallTest; import androidx.test.runner.AndroidJUnit4; import com.android.server.BundleUtils; @@ -35,6 +36,7 @@ import org.junit.runner.RunWith; * Build/Install/Run: * atest com.android.server.pm.BundleUtilsTest */ +@Presubmit @SmallTest @RunWith(AndroidJUnit4.class) public class BundleUtilsTest { diff --git a/services/tests/servicestests/src/com/android/server/pm/CompatibilityModeTest.java b/services/tests/servicestests/src/com/android/server/pm/CompatibilityModeTest.java index b228c839c849..54ab133d760e 100644 --- a/services/tests/servicestests/src/com/android/server/pm/CompatibilityModeTest.java +++ b/services/tests/servicestests/src/com/android/server/pm/CompatibilityModeTest.java @@ -32,6 +32,7 @@ import android.content.pm.ApplicationInfo; import android.content.pm.parsing.PackageInfoWithoutStateUtils; import android.content.pm.parsing.ParsingPackageUtils; import android.os.Build; +import android.platform.test.annotations.Presubmit; import com.android.server.pm.parsing.pkg.PackageImpl; import com.android.server.pm.pkg.PackageUserStateImpl; @@ -40,6 +41,7 @@ import org.junit.After; import org.junit.Before; import org.junit.Test; +@Presubmit public class CompatibilityModeTest { private boolean mCompatibilityModeEnabled;; diff --git a/services/tests/servicestests/src/com/android/server/pm/KeySetManagerServiceTest.java b/services/tests/servicestests/src/com/android/server/pm/KeySetManagerServiceTest.java index 96318632da98..6b6d84af5f60 100644 --- a/services/tests/servicestests/src/com/android/server/pm/KeySetManagerServiceTest.java +++ b/services/tests/servicestests/src/com/android/server/pm/KeySetManagerServiceTest.java @@ -20,6 +20,7 @@ package com.android.server.pm; import static android.content.pm.parsing.ParsingPackageUtils.parsePublicKey; import android.content.pm.Signature; +import android.platform.test.annotations.Presubmit; import android.test.AndroidTestCase; import android.util.ArrayMap; import android.util.ArraySet; @@ -33,6 +34,7 @@ import java.io.IOException; import java.security.PublicKey; import java.security.cert.CertificateException; +@Presubmit public class KeySetManagerServiceTest extends AndroidTestCase { private WatchedArrayMap<String, PackageSetting> mPackagesMap; diff --git a/services/tests/servicestests/src/com/android/server/pm/ModuleInfoProviderTest.java b/services/tests/servicestests/src/com/android/server/pm/ModuleInfoProviderTest.java index 6a9ef8a2b7bd..9ea7907ef4d0 100644 --- a/services/tests/servicestests/src/com/android/server/pm/ModuleInfoProviderTest.java +++ b/services/tests/servicestests/src/com/android/server/pm/ModuleInfoProviderTest.java @@ -21,6 +21,7 @@ import static org.mockito.MockitoAnnotations.initMocks; import android.content.Context; import android.content.pm.ModuleInfo; import android.content.pm.PackageManager; +import android.platform.test.annotations.Presubmit; import android.test.InstrumentationTestCase; import com.android.frameworks.servicestests.R; @@ -30,6 +31,7 @@ import org.mockito.Mock; import java.util.Collections; import java.util.List; +@Presubmit public class ModuleInfoProviderTest extends InstrumentationTestCase { @Mock private ApexManager mApexManager; diff --git a/services/tests/servicestests/src/com/android/server/pm/PackageManagerServiceTest.java b/services/tests/servicestests/src/com/android/server/pm/PackageManagerServiceTest.java index 5e2da2039ca1..b81a4efaba37 100644 --- a/services/tests/servicestests/src/com/android/server/pm/PackageManagerServiceTest.java +++ b/services/tests/servicestests/src/com/android/server/pm/PackageManagerServiceTest.java @@ -37,6 +37,7 @@ import android.content.pm.PackageManagerInternal; import android.os.Bundle; import android.os.UserHandle; import android.os.UserManager; +import android.platform.test.annotations.Postsubmit; import android.util.SparseArray; import androidx.test.InstrumentationRegistry; @@ -69,6 +70,7 @@ import java.util.regex.Pattern; // atest PackageManagerServiceTest // runtest -c com.android.server.pm.PackageManagerServiceTest frameworks-services // bit FrameworksServicesTests:com.android.server.pm.PackageManagerServiceTest +@Postsubmit @RunWith(AndroidJUnit4.class) public class PackageManagerServiceTest { diff --git a/services/tests/servicestests/src/com/android/server/pm/PackageManagerSettingsTests.java b/services/tests/servicestests/src/com/android/server/pm/PackageManagerSettingsTests.java index ab37e9bf6deb..a9a3469d52cc 100644 --- a/services/tests/servicestests/src/com/android/server/pm/PackageManagerSettingsTests.java +++ b/services/tests/servicestests/src/com/android/server/pm/PackageManagerSettingsTests.java @@ -47,6 +47,7 @@ import android.os.BaseBundle; import android.os.PersistableBundle; import android.os.Process; import android.os.UserHandle; +import android.platform.test.annotations.Presubmit; import android.util.ArraySet; import android.util.AtomicFile; import android.util.Log; @@ -91,6 +92,7 @@ import java.util.Set; import java.util.UUID; import java.util.concurrent.CountDownLatch; +@Presubmit @RunWith(AndroidJUnit4.class) @SmallTest public class PackageManagerSettingsTests { diff --git a/services/tests/servicestests/src/com/android/server/pm/PackageSignaturesTest.java b/services/tests/servicestests/src/com/android/server/pm/PackageSignaturesTest.java index b6d4b31b2c78..7e4474fd849c 100644 --- a/services/tests/servicestests/src/com/android/server/pm/PackageSignaturesTest.java +++ b/services/tests/servicestests/src/com/android/server/pm/PackageSignaturesTest.java @@ -24,6 +24,7 @@ import static org.junit.Assert.fail; import android.content.Context; import android.content.pm.Signature; import android.content.pm.SigningDetails; +import android.platform.test.annotations.Presubmit; import android.util.TypedXmlPullParser; import android.util.Xml; @@ -44,6 +45,7 @@ import java.util.HashSet; import java.util.Map; import java.util.Set; +@Presubmit @RunWith(AndroidJUnit4.class) public class PackageSignaturesTest { private static final String TEST_RESOURCES_FOLDER = "PackageSignaturesTest"; diff --git a/services/tests/servicestests/src/com/android/server/pm/PackageUserStateTest.java b/services/tests/servicestests/src/com/android/server/pm/PackageUserStateTest.java index c9f3cb248a3a..828d419c02ff 100644 --- a/services/tests/servicestests/src/com/android/server/pm/PackageUserStateTest.java +++ b/services/tests/servicestests/src/com/android/server/pm/PackageUserStateTest.java @@ -28,6 +28,7 @@ import android.content.pm.PackageManager; import android.content.pm.SuspendDialogInfo; import android.content.pm.overlay.OverlayPaths; import android.os.PersistableBundle; +import android.platform.test.annotations.Presubmit; import android.util.ArrayMap; import android.util.ArraySet; @@ -41,6 +42,7 @@ import com.android.server.pm.pkg.SuspendParams; import org.junit.Test; import org.junit.runner.RunWith; +@Presubmit @RunWith(AndroidJUnit4.class) @SmallTest public class PackageUserStateTest { diff --git a/services/tests/servicestests/src/com/android/server/pm/PackageVerificationStateTest.java b/services/tests/servicestests/src/com/android/server/pm/PackageVerificationStateTest.java index 1fff4f084fc4..ecf7803e7a0f 100644 --- a/services/tests/servicestests/src/com/android/server/pm/PackageVerificationStateTest.java +++ b/services/tests/servicestests/src/com/android/server/pm/PackageVerificationStateTest.java @@ -18,8 +18,10 @@ package com.android.server.pm; import android.content.pm.PackageManager; import android.content.pm.PackageManagerInternal; +import android.platform.test.annotations.Presubmit; import android.test.AndroidTestCase; +@Presubmit public class PackageVerificationStateTest extends AndroidTestCase { private static final int REQUIRED_UID = 1948; diff --git a/services/tests/servicestests/src/com/android/server/pm/RestrictionsSetTest.java b/services/tests/servicestests/src/com/android/server/pm/RestrictionsSetTest.java index b73c9ea949b8..e7adf7b757f1 100644 --- a/services/tests/servicestests/src/com/android/server/pm/RestrictionsSetTest.java +++ b/services/tests/servicestests/src/com/android/server/pm/RestrictionsSetTest.java @@ -28,6 +28,7 @@ import static org.junit.Assert.assertTrue; import android.os.Bundle; import android.os.UserHandle; import android.os.UserManager; +import android.platform.test.annotations.Presubmit; import androidx.test.runner.AndroidJUnit4; @@ -37,6 +38,7 @@ import org.junit.runner.RunWith; import java.util.List; /** Test for {@link RestrictionsSet}. */ +@Presubmit @RunWith(AndroidJUnit4.class) public class RestrictionsSetTest { diff --git a/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest1.java b/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest1.java index ec5228fec3f3..32a88bd22986 100644 --- a/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest1.java +++ b/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest1.java @@ -95,13 +95,15 @@ import android.os.Handler; import android.os.Looper; import android.os.Process; import android.os.UserHandle; -import android.test.suitebuilder.annotation.SmallTest; +import android.platform.test.annotations.Presubmit; import android.util.Log; import android.util.SparseArray; import android.util.TypedXmlPullParser; import android.util.TypedXmlSerializer; import android.util.Xml; +import androidx.test.filters.SmallTest; + import com.android.frameworks.servicestests.R; import com.android.server.pm.ShortcutService.ConfigConstants; import com.android.server.pm.ShortcutService.FileOutputStreamWithPath; @@ -135,6 +137,7 @@ import java.util.function.BiConsumer; adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest1 \ -w com.android.frameworks.servicestests/androidx.test.runner.AndroidJUnitRunner */ +@Presubmit @SmallTest public class ShortcutManagerTest1 extends BaseShortcutManagerTest { diff --git a/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest10.java b/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest10.java index e92c849b50b6..57ada9b9c499 100644 --- a/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest10.java +++ b/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest10.java @@ -15,10 +15,13 @@ */ package com.android.server.pm; -import static com.android.server.pm.shortcutmanagertest.ShortcutManagerTestUtils - .assertExpectException; +import static com.android.server.pm.shortcutmanagertest.ShortcutManagerTestUtils.assertExpectException; import static com.android.server.pm.shortcutmanagertest.ShortcutManagerTestUtils.list; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + import android.content.ComponentName; import android.content.Intent; import android.content.pm.LauncherActivityInfo; @@ -26,9 +29,9 @@ import android.content.pm.LauncherApps.PinItemRequest; import android.content.pm.ShortcutInfo; import android.content.pm.ShortcutManager; import android.os.Process; -import android.test.suitebuilder.annotation.SmallTest; +import android.platform.test.annotations.Presubmit; -import static org.mockito.Mockito.*; +import androidx.test.filters.SmallTest; /** * Tests for {@link ShortcutManager#createShortcutResultIntent(ShortcutInfo)} and relevant APIs. @@ -39,6 +42,7 @@ import static org.mockito.Mockito.*; adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest10 \ -w com.android.frameworks.servicestests/androidx.test.runner.AndroidJUnitRunner */ +@Presubmit @SmallTest public class ShortcutManagerTest10 extends BaseShortcutManagerTest { diff --git a/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest11.java b/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest11.java index c8a405284468..98fa2d68fb73 100644 --- a/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest11.java +++ b/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest11.java @@ -30,6 +30,7 @@ import android.content.pm.LauncherApps.ShortcutChangeCallback; import android.content.pm.LauncherApps.ShortcutQuery; import android.content.pm.ShortcutInfo; import android.os.test.TestLooper; +import android.platform.test.annotations.Presubmit; import com.android.server.pm.ShortcutService.ConfigConstants; @@ -42,6 +43,7 @@ import java.util.List; * atest -c com.android.server.pm.ShortcutManagerTest11 */ +@Presubmit public class ShortcutManagerTest11 extends BaseShortcutManagerTest { private static final ShortcutQuery QUERY_MATCH_ALL = createShortcutQuery( diff --git a/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest2.java b/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest2.java index 90a127701505..408d2c525f70 100644 --- a/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest2.java +++ b/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest2.java @@ -43,8 +43,10 @@ import android.graphics.drawable.Icon; import android.net.Uri; import android.os.PersistableBundle; import android.os.UserHandle; +import android.platform.test.annotations.Presubmit; import android.test.MoreAsserts; -import android.test.suitebuilder.annotation.SmallTest; + +import androidx.test.filters.SmallTest; import com.android.frameworks.servicestests.R; import com.android.server.pm.ShortcutUser.PackageWithUser; @@ -64,6 +66,7 @@ import java.util.Locale; adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest2 \ -w com.android.frameworks.servicestests/androidx.test.runner.AndroidJUnitRunner */ +@Presubmit @SmallTest public class ShortcutManagerTest2 extends BaseShortcutManagerTest { // ShortcutInfo tests diff --git a/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest3.java b/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest3.java index ba26f7930dcb..43e527c3d706 100644 --- a/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest3.java +++ b/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest3.java @@ -21,7 +21,9 @@ import static com.android.server.pm.shortcutmanagertest.ShortcutManagerTestUtils import android.content.ComponentName; import android.content.pm.ShortcutInfo; -import android.test.suitebuilder.annotation.SmallTest; +import android.platform.test.annotations.Presubmit; + +import androidx.test.filters.SmallTest; import com.android.frameworks.servicestests.R; import com.android.server.pm.ShortcutService.ConfigConstants; @@ -31,6 +33,7 @@ import java.util.Set; /** * Tests related to shortcut rank auto-adjustment. */ +@Presubmit @SmallTest public class ShortcutManagerTest3 extends BaseShortcutManagerTest { diff --git a/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest4.java b/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest4.java index 7546c43c24d7..11a2a8a39a46 100644 --- a/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest4.java +++ b/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest4.java @@ -24,15 +24,17 @@ import static com.android.server.pm.shortcutmanagertest.ShortcutManagerTestUtils import android.content.Intent; import android.os.Bundle; import android.os.PersistableBundle; -import android.test.suitebuilder.annotation.SmallTest; +import android.platform.test.annotations.Presubmit; import android.util.Xml; +import androidx.test.filters.SmallTest; import androidx.test.runner.AndroidJUnit4; import org.junit.Assume; import org.junit.Test; import org.junit.runner.RunWith; +@Presubmit @SmallTest @RunWith(AndroidJUnit4.class) public class ShortcutManagerTest4 extends BaseShortcutManagerTest { @@ -134,4 +136,4 @@ public class ShortcutManagerTest4 extends BaseShortcutManagerTest { }); }); } -}
\ No newline at end of file +} diff --git a/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest5.java b/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest5.java index 203b2caff22c..400d3a891a8d 100644 --- a/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest5.java +++ b/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest5.java @@ -25,7 +25,9 @@ import android.content.pm.PackageInfo; import android.content.pm.ShortcutServiceInternal; import android.content.res.XmlResourceParser; import android.os.Looper; -import android.test.suitebuilder.annotation.SmallTest; +import android.platform.test.annotations.Presubmit; + +import androidx.test.filters.SmallTest; import com.android.server.LocalServices; @@ -38,6 +40,7 @@ import java.util.Set; * All the tests here actually talks to the real IPackageManager, so we can't test complicated * cases. Instead we just make sure they all work reasonably without at least crashing. */ +@Presubmit @SmallTest public class ShortcutManagerTest5 extends BaseShortcutManagerTest { private ShortcutService mShortcutService; diff --git a/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest6.java b/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest6.java index 63df4bc2edc4..6c10bfd274da 100644 --- a/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest6.java +++ b/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest6.java @@ -15,12 +15,15 @@ */ package com.android.server.pm; -import android.test.suitebuilder.annotation.SmallTest; +import android.platform.test.annotations.Presubmit; + +import androidx.test.filters.SmallTest; /** * Tests for {@link ShortcutService#hasShortcutHostPermissionInner}, which includes * {@link ShortcutService#getDefaultLauncher}. */ +@Presubmit @SmallTest public class ShortcutManagerTest6 extends BaseShortcutManagerTest { public void testHasShortcutHostPermissionInner_with3pLauncher_complicated() { diff --git a/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest7.java b/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest7.java index b21b04979424..b2fd8aa7d405 100644 --- a/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest7.java +++ b/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest7.java @@ -33,7 +33,9 @@ import android.os.ParcelFileDescriptor; import android.os.Process; import android.os.RemoteException; import android.os.ResultReceiver; -import android.test.suitebuilder.annotation.SmallTest; +import android.platform.test.annotations.Presubmit; + +import androidx.test.filters.SmallTest; import com.android.frameworks.servicestests.R; import com.android.server.pm.ShortcutService.ConfigConstants; @@ -48,6 +50,7 @@ import java.util.concurrent.atomic.AtomicInteger; * * Launcher related commands are tested in */ +@Presubmit @SmallTest public class ShortcutManagerTest7 extends BaseShortcutManagerTest { diff --git a/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest8.java b/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest8.java index 58e00f20374e..2293808a5d64 100644 --- a/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest8.java +++ b/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest8.java @@ -40,11 +40,13 @@ import android.content.pm.ShortcutInfo; import android.content.pm.ShortcutManager; import android.graphics.drawable.Icon; import android.os.UserHandle; +import android.platform.test.annotations.Presubmit; import android.test.MoreAsserts; -import android.test.suitebuilder.annotation.SmallTest; import android.util.Log; import android.util.Pair; +import androidx.test.filters.SmallTest; + import com.android.frameworks.servicestests.R; import org.mockito.ArgumentCaptor; @@ -63,6 +65,7 @@ import org.mockito.ArgumentCaptor; * - Reading icons from requested shortcuts. * - Invalid pre-approved token. */ +@Presubmit @SmallTest public class ShortcutManagerTest8 extends BaseShortcutManagerTest { private ShortcutRequestPinProcessor mProcessor; diff --git a/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest9.java b/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest9.java index 55b4b936133d..a47a8df51c9f 100644 --- a/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest9.java +++ b/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest9.java @@ -32,7 +32,9 @@ import android.content.IntentSender; import android.content.pm.LauncherApps; import android.content.pm.LauncherApps.PinItemRequest; import android.os.UserHandle; -import android.test.suitebuilder.annotation.SmallTest; +import android.platform.test.annotations.Presubmit; + +import androidx.test.filters.SmallTest; import org.mockito.ArgumentCaptor; @@ -46,6 +48,7 @@ import org.mockito.ArgumentCaptor; adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest9 \ -w com.android.frameworks.servicestests/androidx.test.runner.AndroidJUnitRunner */ +@Presubmit @SmallTest public class ShortcutManagerTest9 extends BaseShortcutManagerTest { diff --git a/services/tests/servicestests/src/com/android/server/pm/SuspendDialogInfoTest.java b/services/tests/servicestests/src/com/android/server/pm/SuspendDialogInfoTest.java index 826a8d446e1d..4af91c6881bb 100644 --- a/services/tests/servicestests/src/com/android/server/pm/SuspendDialogInfoTest.java +++ b/services/tests/servicestests/src/com/android/server/pm/SuspendDialogInfoTest.java @@ -24,6 +24,7 @@ import static org.junit.Assert.assertNotEquals; import static org.junit.Assert.assertNull; import android.content.pm.SuspendDialogInfo; +import android.platform.test.annotations.Presubmit; import androidx.test.filters.SmallTest; import androidx.test.runner.AndroidJUnit4; @@ -31,6 +32,7 @@ import androidx.test.runner.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; +@Presubmit @RunWith(AndroidJUnit4.class) @SmallTest public class SuspendDialogInfoTest { diff --git a/services/tests/servicestests/src/com/android/server/pm/TEST_MAPPING b/services/tests/servicestests/src/com/android/server/pm/TEST_MAPPING new file mode 100644 index 000000000000..85a73bb22009 --- /dev/null +++ b/services/tests/servicestests/src/com/android/server/pm/TEST_MAPPING @@ -0,0 +1,41 @@ +{ + "presubmit": [ + { + "name": "FrameworksServicesTests", + "options": [ + { + "include-filter": "com.android.server.pm." + }, + { + "include-annotation": "android.platform.test.annotations.Presubmit" + }, + { + "exclude-annotation": "androidx.test.filters.FlakyTest" + }, + { + "exclude-annotation": "org.junit.Ignore" + } + ] + } + ], + "postsubmit": [ + { + "name": "FrameworksServicesTests", + "options": [ + { + "include-filter": "com.android.server.pm." + }, + { + "include-annotation": "android.platform.test.annotations.Postsubmit" + }, + { + "exclude-annotation": "androidx.test.filters.FlakyTest" + }, + { + "exclude-annotation": "org.junit.Ignore" + } + ] + } + ] +} + diff --git a/services/tests/servicestests/src/com/android/server/pm/UserLifecycleStressTest.java b/services/tests/servicestests/src/com/android/server/pm/UserLifecycleStressTest.java index 7916bd37060e..a4afe09c98a4 100644 --- a/services/tests/servicestests/src/com/android/server/pm/UserLifecycleStressTest.java +++ b/services/tests/servicestests/src/com/android/server/pm/UserLifecycleStressTest.java @@ -24,6 +24,7 @@ import android.content.Context; import android.content.pm.UserInfo; import android.os.RemoteException; import android.os.UserManager; +import android.platform.test.annotations.Postsubmit; import android.util.Log; import androidx.test.InstrumentationRegistry; @@ -42,6 +43,7 @@ import java.util.concurrent.TimeUnit; * To run the test: * bit FrameworksServicesTests:com.android.server.pm.UserLifecycleStressTest */ +@Postsubmit @RunWith(AndroidJUnit4.class) @LargeTest public class UserLifecycleStressTest { diff --git a/services/tests/servicestests/src/com/android/server/pm/UserManagerServiceCreateProfileTest.java b/services/tests/servicestests/src/com/android/server/pm/UserManagerServiceCreateProfileTest.java index 35c513f3de8e..fdf94bec8c18 100644 --- a/services/tests/servicestests/src/com/android/server/pm/UserManagerServiceCreateProfileTest.java +++ b/services/tests/servicestests/src/com/android/server/pm/UserManagerServiceCreateProfileTest.java @@ -27,6 +27,7 @@ import android.os.Looper; import android.os.ServiceSpecificException; import android.os.UserHandle; import android.os.UserManager; +import android.platform.test.annotations.Postsubmit; import androidx.test.InstrumentationRegistry; import androidx.test.filters.MediumTest; @@ -48,6 +49,7 @@ import java.util.List; * runtest -c com.android.server.pm.UserManagerServiceCreateProfileTest frameworks-services * </pre> */ +@Postsubmit @RunWith(AndroidJUnit4.class) @MediumTest public class UserManagerServiceCreateProfileTest { diff --git a/services/tests/servicestests/src/com/android/server/pm/UserManagerServiceIdRecyclingTest.java b/services/tests/servicestests/src/com/android/server/pm/UserManagerServiceIdRecyclingTest.java index b0423bfd19af..1f4c9f8cd343 100644 --- a/services/tests/servicestests/src/com/android/server/pm/UserManagerServiceIdRecyclingTest.java +++ b/services/tests/servicestests/src/com/android/server/pm/UserManagerServiceIdRecyclingTest.java @@ -23,6 +23,7 @@ import static org.junit.Assert.fail; import android.app.PropertyInvalidatedCache; import android.content.pm.UserInfo; import android.os.Looper; +import android.platform.test.annotations.Postsubmit; import androidx.test.InstrumentationRegistry; import androidx.test.filters.MediumTest; @@ -45,6 +46,7 @@ import java.util.LinkedHashSet; * -w com.android.frameworks.servicestests/androidx.test.runner.AndroidJUnitRunner * </pre> */ +@Postsubmit @RunWith(AndroidJUnit4.class) @MediumTest public class UserManagerServiceIdRecyclingTest { diff --git a/services/tests/servicestests/src/com/android/server/pm/UserManagerServiceTest.java b/services/tests/servicestests/src/com/android/server/pm/UserManagerServiceTest.java index 6c1c019f504e..34b40c716b4f 100644 --- a/services/tests/servicestests/src/com/android/server/pm/UserManagerServiceTest.java +++ b/services/tests/servicestests/src/com/android/server/pm/UserManagerServiceTest.java @@ -22,18 +22,20 @@ import android.os.FileUtils; import android.os.Parcelable; import android.os.UserHandle; import android.os.UserManager; +import android.platform.test.annotations.Postsubmit; import android.support.test.uiautomator.UiDevice; import android.test.AndroidTestCase; -import android.test.suitebuilder.annotation.SmallTest; import android.text.TextUtils; import android.util.AtomicFile; import androidx.test.InstrumentationRegistry; +import androidx.test.filters.SmallTest; import java.io.File; import java.io.IOException; import java.util.Arrays; +@Postsubmit @SmallTest public class UserManagerServiceTest extends AndroidTestCase { private static String[] STRING_ARRAY = new String[] {"<tag", "<![CDATA["}; diff --git a/services/tests/servicestests/src/com/android/server/pm/UserManagerServiceUserInfoTest.java b/services/tests/servicestests/src/com/android/server/pm/UserManagerServiceUserInfoTest.java index dfc25e0c7cb6..92fddc76343d 100644 --- a/services/tests/servicestests/src/com/android/server/pm/UserManagerServiceUserInfoTest.java +++ b/services/tests/servicestests/src/com/android/server/pm/UserManagerServiceUserInfoTest.java @@ -46,6 +46,7 @@ import android.os.Looper; import android.os.Parcel; import android.os.UserHandle; import android.os.UserManager; +import android.platform.test.annotations.Presubmit; import android.text.TextUtils; import androidx.test.InstrumentationRegistry; @@ -69,6 +70,7 @@ import java.util.List; * runtest -c com.android.server.pm.UserManagerServiceUserInfoTest frameworks-services * </pre> */ +@Presubmit @RunWith(AndroidJUnit4.class) @MediumTest public class UserManagerServiceUserInfoTest { diff --git a/services/tests/servicestests/src/com/android/server/pm/UserManagerServiceUserTypeTest.java b/services/tests/servicestests/src/com/android/server/pm/UserManagerServiceUserTypeTest.java index f1acc6679877..971b036f7d0e 100644 --- a/services/tests/servicestests/src/com/android/server/pm/UserManagerServiceUserTypeTest.java +++ b/services/tests/servicestests/src/com/android/server/pm/UserManagerServiceUserTypeTest.java @@ -39,6 +39,7 @@ import android.content.res.Resources; import android.content.res.XmlResourceParser; import android.os.Bundle; import android.os.UserManager; +import android.platform.test.annotations.Presubmit; import android.util.ArrayMap; import androidx.test.InstrumentationRegistry; @@ -58,6 +59,7 @@ import java.util.List; * * <p>Run with: atest UserManagerServiceUserTypeTest */ +@Presubmit @RunWith(AndroidJUnit4.class) @MediumTest public class UserManagerServiceUserTypeTest { diff --git a/services/tests/servicestests/src/com/android/server/pm/UserManagerTest.java b/services/tests/servicestests/src/com/android/server/pm/UserManagerTest.java index ea0c07313cc5..cf6165fdbd79 100644 --- a/services/tests/servicestests/src/com/android/server/pm/UserManagerTest.java +++ b/services/tests/servicestests/src/com/android/server/pm/UserManagerTest.java @@ -35,14 +35,15 @@ import android.content.res.Resources; import android.os.Bundle; import android.os.UserHandle; import android.os.UserManager; +import android.platform.test.annotations.Postsubmit; import android.provider.Settings; import android.test.suitebuilder.annotation.LargeTest; import android.test.suitebuilder.annotation.MediumTest; -import android.test.suitebuilder.annotation.SmallTest; import android.util.Slog; import androidx.annotation.Nullable; import androidx.test.InstrumentationRegistry; +import androidx.test.filters.SmallTest; import androidx.test.runner.AndroidJUnit4; import com.google.common.collect.Range; @@ -63,6 +64,7 @@ import java.util.stream.Collectors; import javax.annotation.concurrent.GuardedBy; /** Test {@link UserManager} functionality. */ +@Postsubmit @RunWith(AndroidJUnit4.class) public final class UserManagerTest { // Taken from UserManagerService diff --git a/services/tests/servicestests/src/com/android/server/pm/UserRestrictionsUtilsTest.java b/services/tests/servicestests/src/com/android/server/pm/UserRestrictionsUtilsTest.java index ddf0cd0e9235..07a5303c9d65 100644 --- a/services/tests/servicestests/src/com/android/server/pm/UserRestrictionsUtilsTest.java +++ b/services/tests/servicestests/src/com/android/server/pm/UserRestrictionsUtilsTest.java @@ -22,10 +22,12 @@ import static com.android.server.devicepolicy.DpmTestUtils.newRestrictions; import android.os.Bundle; import android.os.UserHandle; import android.os.UserManager; +import android.platform.test.annotations.Presubmit; import android.test.AndroidTestCase; -import android.test.suitebuilder.annotation.SmallTest; import android.util.SparseArray; +import androidx.test.filters.SmallTest; + /** * Tests for {@link com.android.server.pm.UserRestrictionsUtils}. * @@ -37,6 +39,7 @@ import android.util.SparseArray; -w com.android.frameworks.servicestests/androidx.test.runner.AndroidJUnitRunner * </pre> */ +@Presubmit @SmallTest public class UserRestrictionsUtilsTest extends AndroidTestCase { public void testNonNull() { diff --git a/services/tests/servicestests/src/com/android/server/pm/UserSystemPackageInstallerTest.java b/services/tests/servicestests/src/com/android/server/pm/UserSystemPackageInstallerTest.java index b11bb85e8278..ba7a10350f0b 100644 --- a/services/tests/servicestests/src/com/android/server/pm/UserSystemPackageInstallerTest.java +++ b/services/tests/servicestests/src/com/android/server/pm/UserSystemPackageInstallerTest.java @@ -43,6 +43,7 @@ import android.content.pm.UserInfo; import android.os.Looper; import android.os.SystemProperties; import android.os.UserManager; +import android.platform.test.annotations.Postsubmit; import android.support.test.uiautomator.UiDevice; import android.util.ArrayMap; import android.util.ArraySet; @@ -76,6 +77,7 @@ import java.util.Set; * atest com.android.server.pm.UserSystemPackageInstallerTest * </pre> */ +@Postsubmit @RunWith(AndroidJUnit4.class) @MediumTest public class UserSystemPackageInstallerTest { diff --git a/services/tests/servicestests/src/com/android/server/pm/WatchedIntentHandlingTest.java b/services/tests/servicestests/src/com/android/server/pm/WatchedIntentHandlingTest.java index b2c300255aef..95af1e1ef16a 100644 --- a/services/tests/servicestests/src/com/android/server/pm/WatchedIntentHandlingTest.java +++ b/services/tests/servicestests/src/com/android/server/pm/WatchedIntentHandlingTest.java @@ -20,6 +20,7 @@ import static org.junit.Assert.assertTrue; import android.content.ComponentName; import android.content.IntentFilter; +import android.platform.test.annotations.Presubmit; import androidx.test.filters.SmallTest; @@ -29,6 +30,7 @@ import org.junit.Test; import java.util.Iterator; +@Presubmit @SmallTest public class WatchedIntentHandlingTest { diff --git a/services/tests/servicestests/src/com/android/server/pm/dex/ArtStatsLogUtilsTest.java b/services/tests/servicestests/src/com/android/server/pm/dex/ArtStatsLogUtilsTest.java index fdb6e9f5f4ce..a16ecb1c708c 100644 --- a/services/tests/servicestests/src/com/android/server/pm/dex/ArtStatsLogUtilsTest.java +++ b/services/tests/servicestests/src/com/android/server/pm/dex/ArtStatsLogUtilsTest.java @@ -18,6 +18,8 @@ package com.android.server.pm.dex; import static org.mockito.Mockito.inOrder; +import android.platform.test.annotations.Presubmit; + import com.android.internal.art.ArtStatsLog; import com.android.server.pm.dex.ArtStatsLogUtils.ArtStatsLogger; @@ -44,6 +46,7 @@ import java.util.zip.ZipOutputStream; * * Run with "atest ArtStatsLogUtilsTest". */ +@Presubmit @RunWith(JUnit4.class) public final class ArtStatsLogUtilsTest { private static final String TAG = ArtStatsLogUtilsTest.class.getSimpleName(); diff --git a/services/tests/servicestests/src/com/android/server/pm/dex/DexMetadataHelperTest.java b/services/tests/servicestests/src/com/android/server/pm/dex/DexMetadataHelperTest.java index 2a7a2ffa7dbf..b7b55ba16fb2 100644 --- a/services/tests/servicestests/src/com/android/server/pm/dex/DexMetadataHelperTest.java +++ b/services/tests/servicestests/src/com/android/server/pm/dex/DexMetadataHelperTest.java @@ -30,6 +30,7 @@ import android.content.pm.parsing.PackageLite; import android.content.pm.parsing.result.ParseResult; import android.content.pm.parsing.result.ParseTypeImpl; import android.os.FileUtils; +import android.platform.test.annotations.Presubmit; import androidx.test.InstrumentationRegistry; import androidx.test.filters.SmallTest; @@ -61,6 +62,7 @@ import java.util.Map; import java.util.zip.ZipEntry; import java.util.zip.ZipOutputStream; +@Presubmit @SmallTest @RunWith(AndroidJUnit4.class) public class DexMetadataHelperTest { diff --git a/services/tests/servicestests/src/com/android/server/pm/dex/DexoptOptionsTests.java b/services/tests/servicestests/src/com/android/server/pm/dex/DexoptOptionsTests.java index bc84e350a329..d5893c8d0b9f 100644 --- a/services/tests/servicestests/src/com/android/server/pm/dex/DexoptOptionsTests.java +++ b/services/tests/servicestests/src/com/android/server/pm/dex/DexoptOptionsTests.java @@ -23,6 +23,8 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; +import android.platform.test.annotations.Presubmit; + import androidx.test.filters.SmallTest; import androidx.test.runner.AndroidJUnit4; @@ -32,6 +34,7 @@ import com.android.server.pm.PackageManagerServiceCompilerMapping; import org.junit.Test; import org.junit.runner.RunWith; +@Presubmit @RunWith(AndroidJUnit4.class) @SmallTest public class DexoptOptionsTests { diff --git a/services/tests/servicestests/src/com/android/server/pm/dex/DexoptUtilsTest.java b/services/tests/servicestests/src/com/android/server/pm/dex/DexoptUtilsTest.java index 34cefec4655b..1dcb0b7eb159 100644 --- a/services/tests/servicestests/src/com/android/server/pm/dex/DexoptUtilsTest.java +++ b/services/tests/servicestests/src/com/android/server/pm/dex/DexoptUtilsTest.java @@ -24,6 +24,7 @@ import static org.junit.Assert.fail; import android.content.pm.SharedLibraryInfo; import android.content.pm.parsing.ParsingPackage; +import android.platform.test.annotations.Presubmit; import android.util.SparseArray; import androidx.test.filters.SmallTest; @@ -46,6 +47,7 @@ import java.util.Arrays; import java.util.Collections; import java.util.List; +@Presubmit @RunWith(AndroidJUnit4.class) @SmallTest public class DexoptUtilsTest { diff --git a/services/tests/servicestests/src/com/android/server/pm/dex/DynamicCodeLoggerTests.java b/services/tests/servicestests/src/com/android/server/pm/dex/DynamicCodeLoggerTests.java index 7992ba33c8da..d55f96782084 100644 --- a/services/tests/servicestests/src/com/android/server/pm/dex/DynamicCodeLoggerTests.java +++ b/services/tests/servicestests/src/com/android/server/pm/dex/DynamicCodeLoggerTests.java @@ -31,6 +31,7 @@ import android.content.pm.IPackageManager; import android.content.pm.PackageInfo; import android.os.UserHandle; import android.os.storage.StorageManager; +import android.platform.test.annotations.Presubmit; import androidx.test.filters.SmallTest; import androidx.test.runner.AndroidJUnit4; @@ -51,6 +52,7 @@ import org.mockito.junit.MockitoRule; import org.mockito.quality.Strictness; import org.mockito.stubbing.Stubber; +@Presubmit @RunWith(AndroidJUnit4.class) @SmallTest public class DynamicCodeLoggerTests { diff --git a/services/tests/servicestests/src/com/android/server/pm/dex/PackageDexUsageTests.java b/services/tests/servicestests/src/com/android/server/pm/dex/PackageDexUsageTests.java index 3450710f60a0..c98e7c3c49e7 100644 --- a/services/tests/servicestests/src/com/android/server/pm/dex/PackageDexUsageTests.java +++ b/services/tests/servicestests/src/com/android/server/pm/dex/PackageDexUsageTests.java @@ -28,6 +28,7 @@ import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; import android.os.Build; +import android.platform.test.annotations.Presubmit; import androidx.test.filters.SmallTest; import androidx.test.runner.AndroidJUnit4; @@ -49,6 +50,7 @@ import java.util.List; import java.util.Map; import java.util.Set; +@Presubmit @RunWith(AndroidJUnit4.class) @SmallTest public class PackageDexUsageTests { diff --git a/services/tests/servicestests/src/com/android/server/pm/dex/PackageDynamicCodeLoadingTests.java b/services/tests/servicestests/src/com/android/server/pm/dex/PackageDynamicCodeLoadingTests.java index f4cdc8cd4d9a..e075379284f0 100644 --- a/services/tests/servicestests/src/com/android/server/pm/dex/PackageDynamicCodeLoadingTests.java +++ b/services/tests/servicestests/src/com/android/server/pm/dex/PackageDynamicCodeLoadingTests.java @@ -30,6 +30,8 @@ import static org.testng.Assert.assertThrows; import static java.nio.charset.StandardCharsets.UTF_8; +import android.platform.test.annotations.Presubmit; + import androidx.test.filters.SmallTest; import androidx.test.runner.AndroidJUnit4; @@ -50,6 +52,7 @@ import java.util.Map; import java.util.Objects; import java.util.Set; +@Presubmit @RunWith(AndroidJUnit4.class) @SmallTest public class PackageDynamicCodeLoadingTests { diff --git a/services/tests/servicestests/src/com/android/server/pm/parsing/PackageParsingDeferErrorTest.kt b/services/tests/servicestests/src/com/android/server/pm/parsing/PackageParsingDeferErrorTest.kt index c4aa8622c4a1..f53042183af8 100644 --- a/services/tests/servicestests/src/com/android/server/pm/parsing/PackageParsingDeferErrorTest.kt +++ b/services/tests/servicestests/src/com/android/server/pm/parsing/PackageParsingDeferErrorTest.kt @@ -21,6 +21,7 @@ import android.content.Context import android.content.pm.parsing.ParsingPackage import android.content.pm.parsing.ParsingPackageUtils import android.content.pm.parsing.result.ParseResult +import android.platform.test.annotations.Presubmit import androidx.test.InstrumentationRegistry import com.android.frameworks.servicestests.R import com.google.common.truth.Truth.assertThat @@ -36,6 +37,7 @@ import org.junit.rules.TemporaryFolder * * This verifies these failures when the APK targets R. */ +@Presubmit class PackageParsingDeferErrorTest { companion object { diff --git a/services/tests/servicestests/src/com/android/server/pm/permission/LegacyPermissionManagerServiceTest.java b/services/tests/servicestests/src/com/android/server/pm/permission/LegacyPermissionManagerServiceTest.java index 3261dfaa95c9..3551af83aa47 100644 --- a/services/tests/servicestests/src/com/android/server/pm/permission/LegacyPermissionManagerServiceTest.java +++ b/services/tests/servicestests/src/com/android/server/pm/permission/LegacyPermissionManagerServiceTest.java @@ -31,6 +31,7 @@ import android.content.pm.ApplicationInfo; import android.content.pm.PackageManager; import android.os.Build; import android.os.Process; +import android.platform.test.annotations.Presubmit; import androidx.test.InstrumentationRegistry; import androidx.test.runner.AndroidJUnit4; @@ -41,6 +42,7 @@ import org.junit.runner.RunWith; import org.mockito.Mock; import org.mockito.MockitoAnnotations; +@Presubmit @RunWith(AndroidJUnit4.class) public class LegacyPermissionManagerServiceTest { private static final int SYSTEM_UID = 1000; |