Loading services/tests/servicestests/src/com/android/server/devicepolicy/DevicePolicyConstantsTest.java +21 −19 Original line number Diff line number Diff line Loading @@ -15,33 +15,33 @@ */ package com.android.server.devicepolicy; import android.test.AndroidTestCase; import static com.google.common.truth.Truth.assertThat; import android.test.suitebuilder.annotation.SmallTest; import org.junit.Test; /** * Test for {@link DevicePolicyConstants}. * m FrameworksServicesTests && adb install \ -r ${ANDROID_PRODUCT_OUT}/data/app/FrameworksServicesTests/FrameworksServicesTests.apk && adb shell am instrument -e class com.android.server.devicepolicy.DevicePolicyConstantsTest \ -w com.android.frameworks.servicestests -w com.android.frameworks.servicestests/androidx.test.runner.AndroidJUnitRunner * <p>Run this test with: * * {@code atest FrameworksServicesTests:com.android.server.devicepolicy.DevicePolicyConstantsTest} */ @SmallTest public class DevicePolicyConstantsTest extends AndroidTestCase { public class DevicePolicyConstantsTest { private static final String TAG = "DevicePolicyConstantsTest"; @Test public void testDefaultValues() throws Exception { final DevicePolicyConstants constants = DevicePolicyConstants.loadFromString(""); assertEquals(1 * 60 * 60, constants.DAS_DIED_SERVICE_RECONNECT_BACKOFF_SEC); assertEquals(24 * 60 * 60, constants.DAS_DIED_SERVICE_RECONNECT_MAX_BACKOFF_SEC); assertEquals(2.0, constants.DAS_DIED_SERVICE_RECONNECT_BACKOFF_INCREASE); assertThat(constants.DAS_DIED_SERVICE_RECONNECT_BACKOFF_SEC).isEqualTo(1 * 60 * 60); assertThat(constants.DAS_DIED_SERVICE_RECONNECT_MAX_BACKOFF_SEC).isEqualTo(24 * 60 * 60); assertThat(constants.DAS_DIED_SERVICE_RECONNECT_BACKOFF_INCREASE).isWithin(1.0e-10).of(2.0); } @Test public void testCustomValues() throws Exception { final DevicePolicyConstants constants = DevicePolicyConstants.loadFromString( "das_died_service_reconnect_backoff_sec=10," Loading @@ -49,11 +49,13 @@ public class DevicePolicyConstantsTest extends AndroidTestCase { + "das_died_service_reconnect_max_backoff_sec=15" ); assertEquals(10, constants.DAS_DIED_SERVICE_RECONNECT_BACKOFF_SEC); assertEquals(15, constants.DAS_DIED_SERVICE_RECONNECT_MAX_BACKOFF_SEC); assertEquals(1.25, constants.DAS_DIED_SERVICE_RECONNECT_BACKOFF_INCREASE); assertThat(constants.DAS_DIED_SERVICE_RECONNECT_BACKOFF_SEC).isEqualTo(10); assertThat(constants.DAS_DIED_SERVICE_RECONNECT_MAX_BACKOFF_SEC).isEqualTo(15); assertThat(constants.DAS_DIED_SERVICE_RECONNECT_BACKOFF_INCREASE).isWithin(1.0e-10) .of(1.25); } @Test public void testMinMax() throws Exception { final DevicePolicyConstants constants = DevicePolicyConstants.loadFromString( "das_died_service_reconnect_backoff_sec=3," Loading @@ -61,8 +63,8 @@ public class DevicePolicyConstantsTest extends AndroidTestCase { + "das_died_service_reconnect_max_backoff_sec=1" ); assertEquals(5, constants.DAS_DIED_SERVICE_RECONNECT_BACKOFF_SEC); assertEquals(5, constants.DAS_DIED_SERVICE_RECONNECT_MAX_BACKOFF_SEC); assertEquals(1.0, constants.DAS_DIED_SERVICE_RECONNECT_BACKOFF_INCREASE); assertThat(constants.DAS_DIED_SERVICE_RECONNECT_BACKOFF_SEC).isEqualTo(5); assertThat(constants.DAS_DIED_SERVICE_RECONNECT_MAX_BACKOFF_SEC).isEqualTo(5); assertThat(constants.DAS_DIED_SERVICE_RECONNECT_BACKOFF_INCREASE).isWithin(1.0e-10).of(1.0); } } services/tests/servicestests/src/com/android/server/devicepolicy/DevicePolicyEventLoggerTest.java +10 −11 Original line number Diff line number Diff line Loading @@ -46,8 +46,8 @@ public class DevicePolicyEventLoggerTest { .setTimePeriod(1234L); assertThat(eventLogger.getEventId()).isEqualTo(5); assertThat(eventLogger.getBoolean()).isTrue(); assertThat(eventLogger.getStringArray()) .isEqualTo(new String[] {"string1", "string2", "string3"}); assertThat(eventLogger.getStringArray()).asList() .containsExactly("string1", "string2", "string3"); assertThat(eventLogger.getAdminPackageName()).isEqualTo("com.test.package"); assertThat(eventLogger.getInt()).isEqualTo(4321); assertThat(eventLogger.getTimePeriod()).isEqualTo(1234L); Loading @@ -57,23 +57,22 @@ public class DevicePolicyEventLoggerTest { public void testStrings() { assertThat(DevicePolicyEventLogger .createEvent(0) .setStrings("string1", "string2", "string3").getStringArray()) .isEqualTo(new String[] {"string1", "string2", "string3"}); .setStrings("string1", "string2", "string3").getStringArray()).asList() .containsExactly("string1", "string2", "string3").inOrder(); assertThat(DevicePolicyEventLogger .createEvent(0) .setStrings("string1", new String[] {"string2", "string3"}).getStringArray()) .isEqualTo(new String[] {"string1", "string2", "string3"}); .asList().containsExactly("string1", "string2", "string3").inOrder(); assertThat(DevicePolicyEventLogger .createEvent(0) .setStrings("string1", "string2", new String[] {"string3"}).getStringArray()) .isEqualTo(new String[] {"string1", "string2", "string3"}); .asList().containsExactly("string1", "string2", "string3").inOrder(); assertThat(DevicePolicyEventLogger .createEvent(0) .setStrings((String) null).getStringArray()) .isEqualTo(new String[] {null}); .setStrings((String) null).getStringArray()).asList() .containsExactly((String) null); assertThat(DevicePolicyEventLogger .createEvent(0) Loading Loading @@ -106,8 +105,8 @@ public class DevicePolicyEventLoggerTest { .createEvent(0); assertThat(eventLogger.getEventId()).isEqualTo(0); assertThat(eventLogger.getBoolean()).isFalse(); assertThat(eventLogger.getStringArray()).isEqualTo(null); assertThat(eventLogger.getAdminPackageName()).isEqualTo(null); assertThat(eventLogger.getStringArray()).isNull(); assertThat(eventLogger.getAdminPackageName()).isNull(); assertThat(eventLogger.getInt()).isEqualTo(0); assertThat(eventLogger.getTimePeriod()).isEqualTo(0L); } Loading services/tests/servicestests/src/com/android/server/devicepolicy/DevicePolicyManagerServiceMigrationTest.java +83 −64 Original line number Diff line number Diff line Loading @@ -20,7 +20,9 @@ import static android.os.UserHandle.USER_SYSTEM; import static com.android.server.devicepolicy.DpmTestUtils.writeInputStreamToFile; import static com.android.server.pm.PackageManagerService.PLATFORM_PACKAGE_NAME; import static org.junit.Assert.assertArrayEquals; import static com.google.common.truth.Truth.assertThat; import static com.google.common.truth.Truth.assertWithMessage; import static org.mockito.ArgumentMatchers.anyBoolean; import static org.mockito.Matchers.any; import static org.mockito.Matchers.anyInt; Loading @@ -43,17 +45,23 @@ import android.platform.test.annotations.Presubmit; import android.provider.Settings; import androidx.test.filters.SmallTest; import androidx.test.runner.AndroidJUnit4; import com.android.frameworks.servicestests.R; import com.android.server.LocalServices; import com.android.server.SystemService; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import java.io.File; import java.util.HashMap; import java.util.Map; import java.util.Set; @Presubmit @RunWith(AndroidJUnit4.class) public class DevicePolicyManagerServiceMigrationTest extends DpmTestBase { private static final String USER_TYPE_EMPTY = ""; Loading @@ -63,9 +71,8 @@ public class DevicePolicyManagerServiceMigrationTest extends DpmTestBase { private DpmMockContext mContext; @Override protected void setUp() throws Exception { super.setUp(); @Before public void setUp() throws Exception { mContext = getContext(); Loading @@ -77,6 +84,7 @@ public class DevicePolicyManagerServiceMigrationTest extends DpmTestBase { .thenReturn(true); } @Test public void testMigration() throws Exception { final File user10dir = getServices().addUser(10, 0, USER_TYPE_EMPTY); final File user11dir = getServices().addUser(11, 0, Loading Loading @@ -160,19 +168,19 @@ public class DevicePolicyManagerServiceMigrationTest extends DpmTestBase { mContext.binder.restoreCallingIdentity(ident); } assertTrue(dpms.mOwners.hasDeviceOwner()); assertFalse(dpms.mOwners.hasProfileOwner(USER_SYSTEM)); assertTrue(dpms.mOwners.hasProfileOwner(10)); assertTrue(dpms.mOwners.hasProfileOwner(11)); assertFalse(dpms.mOwners.hasProfileOwner(12)); assertThat(dpms.mOwners.hasDeviceOwner()).isTrue(); assertThat(dpms.mOwners.hasProfileOwner(USER_SYSTEM)).isFalse(); assertThat(dpms.mOwners.hasProfileOwner(10)).isTrue(); assertThat(dpms.mOwners.hasProfileOwner(11)).isTrue(); assertThat(dpms.mOwners.hasProfileOwner(12)).isFalse(); // Now all information should be migrated. assertFalse(dpms.mOwners.getDeviceOwnerUserRestrictionsNeedsMigration()); assertFalse(dpms.mOwners.getProfileOwnerUserRestrictionsNeedsMigration( USER_SYSTEM)); assertFalse(dpms.mOwners.getProfileOwnerUserRestrictionsNeedsMigration(10)); assertFalse(dpms.mOwners.getProfileOwnerUserRestrictionsNeedsMigration(11)); assertFalse(dpms.mOwners.getProfileOwnerUserRestrictionsNeedsMigration(12)); assertThat(dpms.mOwners.getDeviceOwnerUserRestrictionsNeedsMigration()).isFalse(); assertThat(dpms.mOwners.getProfileOwnerUserRestrictionsNeedsMigration(USER_SYSTEM)) .isFalse(); assertThat(dpms.mOwners.getProfileOwnerUserRestrictionsNeedsMigration(10)).isFalse(); assertThat(dpms.mOwners.getProfileOwnerUserRestrictionsNeedsMigration(11)).isFalse(); assertThat(dpms.mOwners.getProfileOwnerUserRestrictionsNeedsMigration(12)).isFalse(); // Check the new base restrictions. DpmTestUtils.assertRestrictions( Loading Loading @@ -221,6 +229,7 @@ public class DevicePolicyManagerServiceMigrationTest extends DpmTestBase { dpms.getProfileOwnerAdminLocked(11).ensureUserRestrictions()); } @Test public void testMigration2_profileOwnerOnUser0() throws Exception { setUpPackageManagerForAdmin(admin2, DpmMockContext.CALLER_SYSTEM_USER_UID); Loading Loading @@ -271,13 +280,13 @@ public class DevicePolicyManagerServiceMigrationTest extends DpmTestBase { } finally { mContext.binder.restoreCallingIdentity(ident); } assertFalse(dpms.mOwners.hasDeviceOwner()); assertTrue(dpms.mOwners.hasProfileOwner(USER_SYSTEM)); assertThat(dpms.mOwners.hasDeviceOwner()).isFalse(); assertThat(dpms.mOwners.hasProfileOwner(USER_SYSTEM)).isTrue(); // Now all information should be migrated. assertFalse(dpms.mOwners.getDeviceOwnerUserRestrictionsNeedsMigration()); assertFalse(dpms.mOwners.getProfileOwnerUserRestrictionsNeedsMigration( USER_SYSTEM)); assertThat(dpms.mOwners.getDeviceOwnerUserRestrictionsNeedsMigration()).isFalse(); assertThat(dpms.mOwners.getProfileOwnerUserRestrictionsNeedsMigration(USER_SYSTEM)) .isFalse(); // Check the new base restrictions. DpmTestUtils.assertRestrictions( Loading @@ -297,6 +306,7 @@ public class DevicePolicyManagerServiceMigrationTest extends DpmTestBase { } // Test setting default restrictions for managed profile. @Test public void testMigration3_managedProfileOwner() throws Exception { // Create a managed profile user. final File user10dir = getServices().addUser(10, 0, Loading Loading @@ -339,8 +349,8 @@ public class DevicePolicyManagerServiceMigrationTest extends DpmTestBase { mContext.binder.restoreCallingIdentity(ident); } assertFalse(dpms.mOwners.hasDeviceOwner()); assertTrue(dpms.mOwners.hasProfileOwner(10)); assertThat(dpms.mOwners.hasDeviceOwner()).isFalse(); assertThat(dpms.mOwners.hasProfileOwner(10)).isTrue(); // Check that default restrictions were applied. DpmTestUtils.assertRestrictions( Loading @@ -352,11 +362,12 @@ public class DevicePolicyManagerServiceMigrationTest extends DpmTestBase { final Set<String> alreadySet = dpms.getProfileOwnerAdminLocked(10).defaultEnabledRestrictionsAlreadySet; assertEquals(alreadySet.size(), 1); assertTrue(alreadySet.contains(UserManager.DISALLOW_BLUETOOTH_SHARING)); assertThat(alreadySet).hasSize(1); assertThat(alreadySet.contains(UserManager.DISALLOW_BLUETOOTH_SHARING)).isTrue(); } @SmallTest @Test public void testCompMigrationUnAffiliated_skipped() throws Exception { prepareAdmin1AsDo(); prepareAdminAnotherPackageAsPo(COPE_PROFILE_USER_ID); Loading @@ -364,10 +375,11 @@ public class DevicePolicyManagerServiceMigrationTest extends DpmTestBase { final DevicePolicyManagerServiceTestable dpms = bootDpmsUp(); // DO should still be DO since no migration should happen. assertTrue(dpms.mOwners.hasDeviceOwner()); assertThat(dpms.mOwners.hasDeviceOwner()).isTrue(); } @SmallTest @Test public void testCompMigrationAffiliated() throws Exception { prepareAdmin1AsDo(); prepareAdmin1AsPo(COPE_PROFILE_USER_ID, Build.VERSION_CODES.R); Loading @@ -378,48 +390,54 @@ public class DevicePolicyManagerServiceMigrationTest extends DpmTestBase { final DevicePolicyManagerServiceTestable dpms = bootDpmsUp(); // DO should cease to be DO. assertFalse(dpms.mOwners.hasDeviceOwner()); assertThat(dpms.mOwners.hasDeviceOwner()).isFalse(); final DpmMockContext poContext = new DpmMockContext(getServices(), mRealTestContext); poContext.binder.callingUid = UserHandle.getUid(COPE_PROFILE_USER_ID, COPE_ADMIN1_APP_ID); runAsCaller(poContext, dpms, dpm -> { assertEquals("Password history policy wasn't migrated to PO parent instance", 33, dpm.getParentProfileInstance(admin1).getPasswordHistoryLength(admin1)); assertEquals("Password history policy was put into non-parent PO instance", 0, dpm.getPasswordHistoryLength(admin1)); assertTrue("Screen capture restriction wasn't migrated to PO parent instance", dpm.getParentProfileInstance(admin1).getScreenCaptureDisabled(admin1)); assertArrayEquals("Accounts with management disabled weren't migrated to PO parent", new String[] {"com.google-primary"}, dpm.getParentProfileInstance(admin1).getAccountTypesWithManagementDisabled()); assertArrayEquals("Accounts with management disabled for profile were lost", new String[] {"com.google-profile"}, dpm.getAccountTypesWithManagementDisabled()); assertTrue("User restriction wasn't migrated to PO parent instance", dpm.getParentProfileInstance(admin1).getUserRestrictions(admin1) .containsKey(UserManager.DISALLOW_BLUETOOTH)); assertFalse("User restriction was put into non-parent PO instance", dpm.getUserRestrictions(admin1).containsKey(UserManager.DISALLOW_BLUETOOTH)); assertTrue("User restriction wasn't migrated to PO parent instance", dpms.getProfileOwnerAdminLocked(COPE_PROFILE_USER_ID) .getParentActiveAdmin() .getEffectiveRestrictions() .containsKey(UserManager.DISALLOW_CONFIG_DATE_TIME)); assertFalse("User restriction was put into non-parent PO instance", dpms.getProfileOwnerAdminLocked(COPE_PROFILE_USER_ID) .getEffectiveRestrictions() .containsKey(UserManager.DISALLOW_CONFIG_DATE_TIME)); assertEquals("Personal apps suspension wasn't migrated", DevicePolicyManager.PERSONAL_APPS_NOT_SUSPENDED, dpm.getPersonalAppsSuspendedReasons(admin1)); assertWithMessage("Password history policy wasn't migrated to PO parent instance") .that(dpm.getParentProfileInstance(admin1).getPasswordHistoryLength(admin1)) .isEqualTo(33); assertWithMessage("Password history policy was put into non-parent PO instance") .that(dpm.getPasswordHistoryLength(admin1)).isEqualTo(0); assertWithMessage("Screen capture restriction wasn't migrated to PO parent instance") .that(dpm.getParentProfileInstance(admin1).getScreenCaptureDisabled(admin1)) .isTrue(); assertWithMessage("Accounts with management disabled weren't migrated to PO parent") .that(dpm.getParentProfileInstance(admin1) .getAccountTypesWithManagementDisabled()).asList() .containsExactly("com.google-primary"); assertWithMessage("Accounts with management disabled for profile were lost") .that(dpm.getAccountTypesWithManagementDisabled()).asList() .containsExactly("com.google-profile"); assertWithMessage("User restriction wasn't migrated to PO parent instance") .that(dpm.getParentProfileInstance(admin1).getUserRestrictions(admin1).keySet()) .contains(UserManager.DISALLOW_BLUETOOTH); assertWithMessage("User restriction was put into non-parent PO instance").that( dpm.getUserRestrictions(admin1).keySet()) .doesNotContain(UserManager.DISALLOW_BLUETOOTH); assertWithMessage("User restriction wasn't migrated to PO parent instance") .that(dpms.getProfileOwnerAdminLocked(COPE_PROFILE_USER_ID) .getParentActiveAdmin().getEffectiveRestrictions().keySet()) .contains(UserManager.DISALLOW_CONFIG_DATE_TIME); assertWithMessage("User restriction was put into non-parent PO instance") .that(dpms.getProfileOwnerAdminLocked(COPE_PROFILE_USER_ID) .getEffectiveRestrictions().keySet()) .doesNotContain(UserManager.DISALLOW_CONFIG_DATE_TIME); assertWithMessage("Personal apps suspension wasn't migrated") .that(dpm.getPersonalAppsSuspendedReasons(admin1)) .isEqualTo(DevicePolicyManager.PERSONAL_APPS_NOT_SUSPENDED); }); } @SmallTest @Test public void testCompMigration_keepSuspendedAppsWhenDpcIsRPlus() throws Exception { prepareAdmin1AsDo(); prepareAdmin1AsPo(COPE_PROFILE_USER_ID, Build.VERSION_CODES.R); Loading @@ -445,13 +463,14 @@ public class DevicePolicyManagerServiceMigrationTest extends DpmTestBase { poContext.binder.callingUid = UserHandle.getUid(COPE_PROFILE_USER_ID, COPE_ADMIN1_APP_ID); runAsCaller(poContext, dpms, dpm -> { assertEquals("Personal apps suspension wasn't migrated", DevicePolicyManager.PERSONAL_APPS_SUSPENDED_EXPLICITLY, dpm.getPersonalAppsSuspendedReasons(admin1)); assertWithMessage("Personal apps suspension wasn't migrated") .that(dpm.getPersonalAppsSuspendedReasons(admin1)) .isEqualTo(DevicePolicyManager.PERSONAL_APPS_SUSPENDED_EXPLICITLY); }); } @SmallTest @Test public void testCompMigration_unsuspendAppsWhenDpcNotRPlus() throws Exception { prepareAdmin1AsDo(); prepareAdmin1AsPo(COPE_PROFILE_USER_ID, Build.VERSION_CODES.Q); Loading @@ -470,9 +489,9 @@ public class DevicePolicyManagerServiceMigrationTest extends DpmTestBase { poContext.binder.callingUid = UserHandle.getUid(COPE_PROFILE_USER_ID, COPE_ADMIN1_APP_ID); runAsCaller(poContext, dpms, dpm -> { assertEquals("Personal apps weren't unsuspended", DevicePolicyManager.PERSONAL_APPS_NOT_SUSPENDED, dpm.getPersonalAppsSuspendedReasons(admin1)); assertWithMessage("Personal apps weren't unsuspended") .that(dpm.getPersonalAppsSuspendedReasons(admin1)) .isEqualTo(DevicePolicyManager.PERSONAL_APPS_NOT_SUSPENDED); }); } Loading services/tests/servicestests/src/com/android/server/devicepolicy/DevicePolicyManagerTest.java +906 −670 File changed.File size exceeds preview limit. View original file View changed file services/tests/servicestests/src/com/android/server/devicepolicy/DpmTestBase.java +23 −21 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ package com.android.server.devicepolicy; import static com.google.common.truth.Truth.assertThat; import static org.mockito.ArgumentMatchers.anyBoolean; import static org.mockito.ArgumentMatchers.anyLong; import static org.mockito.ArgumentMatchers.anyString; Loading @@ -35,18 +37,28 @@ import android.content.pm.PackageInfo; import android.content.pm.PackageManager; import android.content.pm.ResolveInfo; import android.os.UserHandle; import android.test.AndroidTestCase; import androidx.test.InstrumentationRegistry; import org.junit.Before; import java.io.InputStream; import java.util.List; public abstract class DpmTestBase extends AndroidTestCase { /** * Temporary copy of DpmTestBase using JUnit 4 - once all tests extend it, it should be renamed * back to DpmTestBase (with the temporary methods removed. * */ public abstract class DpmTestBase { public static final String TAG = "DpmTest"; protected Context mRealTestContext; protected final Context mRealTestContext = InstrumentationRegistry.getTargetContext(); protected DpmMockContext mMockContext; private MockSystemServices mServices; // Attributes below are public so they don't need to be prefixed with m public ComponentName admin1; public ComponentName admin2; public ComponentName admin3; Loading @@ -54,12 +66,8 @@ public abstract class DpmTestBase extends AndroidTestCase { public ComponentName adminNoPerm; public ComponentName delegateCertInstaller; @Override protected void setUp() throws Exception { super.setUp(); mRealTestContext = super.getContext(); @Before public void setFixtures() throws Exception { mServices = new MockSystemServices(mRealTestContext, "test-data"); mMockContext = new DpmMockContext(mServices, mRealTestContext); Loading @@ -74,8 +82,7 @@ public abstract class DpmTestBase extends AndroidTestCase { mockSystemPropertiesToReturnDefault(); } @Override public DpmMockContext getContext() { protected DpmMockContext getContext() { return mMockContext; } Loading Loading @@ -136,20 +143,15 @@ public abstract class DpmTestBase extends AndroidTestCase { final PackageInfo pi = DpmTestUtils.cloneParcelable( mRealTestContext.getPackageManager().getPackageInfo( mRealTestContext.getPackageName(), 0)); assertTrue(pi.applicationInfo.flags != 0); assertThat(pi.applicationInfo.flags).isNotEqualTo(0); if (ai != null) { pi.applicationInfo = ai; } doReturn(pi).when(mServices.ipackageManager).getPackageInfo( eq(packageName), eq(0), eq(userId)); doReturn(pi).when(mServices.ipackageManager).getPackageInfo(packageName, 0, userId); doReturn(ai.uid).when(mServices.packageManager).getPackageUidAsUser( eq(packageName), eq(userId)); doReturn(ai.uid).when(mServices.packageManager).getPackageUidAsUser(packageName, userId); } protected void markDelegatedCertInstallerAsInstalled() throws Exception { Loading Loading @@ -230,8 +232,8 @@ public abstract class DpmTestBase extends AndroidTestCase { mRealTestContext.getPackageManager().queryBroadcastReceivers( resolveIntent, PackageManager.GET_META_DATA); assertNotNull(realResolveInfo); assertEquals(1, realResolveInfo.size()); assertThat(realResolveInfo).isNotNull(); assertThat(realResolveInfo).hasSize(1); // We need to change AI, so set a clone. realResolveInfo.set(0, DpmTestUtils.cloneParcelable(realResolveInfo.get(0))); Loading Loading
services/tests/servicestests/src/com/android/server/devicepolicy/DevicePolicyConstantsTest.java +21 −19 Original line number Diff line number Diff line Loading @@ -15,33 +15,33 @@ */ package com.android.server.devicepolicy; import android.test.AndroidTestCase; import static com.google.common.truth.Truth.assertThat; import android.test.suitebuilder.annotation.SmallTest; import org.junit.Test; /** * Test for {@link DevicePolicyConstants}. * m FrameworksServicesTests && adb install \ -r ${ANDROID_PRODUCT_OUT}/data/app/FrameworksServicesTests/FrameworksServicesTests.apk && adb shell am instrument -e class com.android.server.devicepolicy.DevicePolicyConstantsTest \ -w com.android.frameworks.servicestests -w com.android.frameworks.servicestests/androidx.test.runner.AndroidJUnitRunner * <p>Run this test with: * * {@code atest FrameworksServicesTests:com.android.server.devicepolicy.DevicePolicyConstantsTest} */ @SmallTest public class DevicePolicyConstantsTest extends AndroidTestCase { public class DevicePolicyConstantsTest { private static final String TAG = "DevicePolicyConstantsTest"; @Test public void testDefaultValues() throws Exception { final DevicePolicyConstants constants = DevicePolicyConstants.loadFromString(""); assertEquals(1 * 60 * 60, constants.DAS_DIED_SERVICE_RECONNECT_BACKOFF_SEC); assertEquals(24 * 60 * 60, constants.DAS_DIED_SERVICE_RECONNECT_MAX_BACKOFF_SEC); assertEquals(2.0, constants.DAS_DIED_SERVICE_RECONNECT_BACKOFF_INCREASE); assertThat(constants.DAS_DIED_SERVICE_RECONNECT_BACKOFF_SEC).isEqualTo(1 * 60 * 60); assertThat(constants.DAS_DIED_SERVICE_RECONNECT_MAX_BACKOFF_SEC).isEqualTo(24 * 60 * 60); assertThat(constants.DAS_DIED_SERVICE_RECONNECT_BACKOFF_INCREASE).isWithin(1.0e-10).of(2.0); } @Test public void testCustomValues() throws Exception { final DevicePolicyConstants constants = DevicePolicyConstants.loadFromString( "das_died_service_reconnect_backoff_sec=10," Loading @@ -49,11 +49,13 @@ public class DevicePolicyConstantsTest extends AndroidTestCase { + "das_died_service_reconnect_max_backoff_sec=15" ); assertEquals(10, constants.DAS_DIED_SERVICE_RECONNECT_BACKOFF_SEC); assertEquals(15, constants.DAS_DIED_SERVICE_RECONNECT_MAX_BACKOFF_SEC); assertEquals(1.25, constants.DAS_DIED_SERVICE_RECONNECT_BACKOFF_INCREASE); assertThat(constants.DAS_DIED_SERVICE_RECONNECT_BACKOFF_SEC).isEqualTo(10); assertThat(constants.DAS_DIED_SERVICE_RECONNECT_MAX_BACKOFF_SEC).isEqualTo(15); assertThat(constants.DAS_DIED_SERVICE_RECONNECT_BACKOFF_INCREASE).isWithin(1.0e-10) .of(1.25); } @Test public void testMinMax() throws Exception { final DevicePolicyConstants constants = DevicePolicyConstants.loadFromString( "das_died_service_reconnect_backoff_sec=3," Loading @@ -61,8 +63,8 @@ public class DevicePolicyConstantsTest extends AndroidTestCase { + "das_died_service_reconnect_max_backoff_sec=1" ); assertEquals(5, constants.DAS_DIED_SERVICE_RECONNECT_BACKOFF_SEC); assertEquals(5, constants.DAS_DIED_SERVICE_RECONNECT_MAX_BACKOFF_SEC); assertEquals(1.0, constants.DAS_DIED_SERVICE_RECONNECT_BACKOFF_INCREASE); assertThat(constants.DAS_DIED_SERVICE_RECONNECT_BACKOFF_SEC).isEqualTo(5); assertThat(constants.DAS_DIED_SERVICE_RECONNECT_MAX_BACKOFF_SEC).isEqualTo(5); assertThat(constants.DAS_DIED_SERVICE_RECONNECT_BACKOFF_INCREASE).isWithin(1.0e-10).of(1.0); } }
services/tests/servicestests/src/com/android/server/devicepolicy/DevicePolicyEventLoggerTest.java +10 −11 Original line number Diff line number Diff line Loading @@ -46,8 +46,8 @@ public class DevicePolicyEventLoggerTest { .setTimePeriod(1234L); assertThat(eventLogger.getEventId()).isEqualTo(5); assertThat(eventLogger.getBoolean()).isTrue(); assertThat(eventLogger.getStringArray()) .isEqualTo(new String[] {"string1", "string2", "string3"}); assertThat(eventLogger.getStringArray()).asList() .containsExactly("string1", "string2", "string3"); assertThat(eventLogger.getAdminPackageName()).isEqualTo("com.test.package"); assertThat(eventLogger.getInt()).isEqualTo(4321); assertThat(eventLogger.getTimePeriod()).isEqualTo(1234L); Loading @@ -57,23 +57,22 @@ public class DevicePolicyEventLoggerTest { public void testStrings() { assertThat(DevicePolicyEventLogger .createEvent(0) .setStrings("string1", "string2", "string3").getStringArray()) .isEqualTo(new String[] {"string1", "string2", "string3"}); .setStrings("string1", "string2", "string3").getStringArray()).asList() .containsExactly("string1", "string2", "string3").inOrder(); assertThat(DevicePolicyEventLogger .createEvent(0) .setStrings("string1", new String[] {"string2", "string3"}).getStringArray()) .isEqualTo(new String[] {"string1", "string2", "string3"}); .asList().containsExactly("string1", "string2", "string3").inOrder(); assertThat(DevicePolicyEventLogger .createEvent(0) .setStrings("string1", "string2", new String[] {"string3"}).getStringArray()) .isEqualTo(new String[] {"string1", "string2", "string3"}); .asList().containsExactly("string1", "string2", "string3").inOrder(); assertThat(DevicePolicyEventLogger .createEvent(0) .setStrings((String) null).getStringArray()) .isEqualTo(new String[] {null}); .setStrings((String) null).getStringArray()).asList() .containsExactly((String) null); assertThat(DevicePolicyEventLogger .createEvent(0) Loading Loading @@ -106,8 +105,8 @@ public class DevicePolicyEventLoggerTest { .createEvent(0); assertThat(eventLogger.getEventId()).isEqualTo(0); assertThat(eventLogger.getBoolean()).isFalse(); assertThat(eventLogger.getStringArray()).isEqualTo(null); assertThat(eventLogger.getAdminPackageName()).isEqualTo(null); assertThat(eventLogger.getStringArray()).isNull(); assertThat(eventLogger.getAdminPackageName()).isNull(); assertThat(eventLogger.getInt()).isEqualTo(0); assertThat(eventLogger.getTimePeriod()).isEqualTo(0L); } Loading
services/tests/servicestests/src/com/android/server/devicepolicy/DevicePolicyManagerServiceMigrationTest.java +83 −64 Original line number Diff line number Diff line Loading @@ -20,7 +20,9 @@ import static android.os.UserHandle.USER_SYSTEM; import static com.android.server.devicepolicy.DpmTestUtils.writeInputStreamToFile; import static com.android.server.pm.PackageManagerService.PLATFORM_PACKAGE_NAME; import static org.junit.Assert.assertArrayEquals; import static com.google.common.truth.Truth.assertThat; import static com.google.common.truth.Truth.assertWithMessage; import static org.mockito.ArgumentMatchers.anyBoolean; import static org.mockito.Matchers.any; import static org.mockito.Matchers.anyInt; Loading @@ -43,17 +45,23 @@ import android.platform.test.annotations.Presubmit; import android.provider.Settings; import androidx.test.filters.SmallTest; import androidx.test.runner.AndroidJUnit4; import com.android.frameworks.servicestests.R; import com.android.server.LocalServices; import com.android.server.SystemService; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import java.io.File; import java.util.HashMap; import java.util.Map; import java.util.Set; @Presubmit @RunWith(AndroidJUnit4.class) public class DevicePolicyManagerServiceMigrationTest extends DpmTestBase { private static final String USER_TYPE_EMPTY = ""; Loading @@ -63,9 +71,8 @@ public class DevicePolicyManagerServiceMigrationTest extends DpmTestBase { private DpmMockContext mContext; @Override protected void setUp() throws Exception { super.setUp(); @Before public void setUp() throws Exception { mContext = getContext(); Loading @@ -77,6 +84,7 @@ public class DevicePolicyManagerServiceMigrationTest extends DpmTestBase { .thenReturn(true); } @Test public void testMigration() throws Exception { final File user10dir = getServices().addUser(10, 0, USER_TYPE_EMPTY); final File user11dir = getServices().addUser(11, 0, Loading Loading @@ -160,19 +168,19 @@ public class DevicePolicyManagerServiceMigrationTest extends DpmTestBase { mContext.binder.restoreCallingIdentity(ident); } assertTrue(dpms.mOwners.hasDeviceOwner()); assertFalse(dpms.mOwners.hasProfileOwner(USER_SYSTEM)); assertTrue(dpms.mOwners.hasProfileOwner(10)); assertTrue(dpms.mOwners.hasProfileOwner(11)); assertFalse(dpms.mOwners.hasProfileOwner(12)); assertThat(dpms.mOwners.hasDeviceOwner()).isTrue(); assertThat(dpms.mOwners.hasProfileOwner(USER_SYSTEM)).isFalse(); assertThat(dpms.mOwners.hasProfileOwner(10)).isTrue(); assertThat(dpms.mOwners.hasProfileOwner(11)).isTrue(); assertThat(dpms.mOwners.hasProfileOwner(12)).isFalse(); // Now all information should be migrated. assertFalse(dpms.mOwners.getDeviceOwnerUserRestrictionsNeedsMigration()); assertFalse(dpms.mOwners.getProfileOwnerUserRestrictionsNeedsMigration( USER_SYSTEM)); assertFalse(dpms.mOwners.getProfileOwnerUserRestrictionsNeedsMigration(10)); assertFalse(dpms.mOwners.getProfileOwnerUserRestrictionsNeedsMigration(11)); assertFalse(dpms.mOwners.getProfileOwnerUserRestrictionsNeedsMigration(12)); assertThat(dpms.mOwners.getDeviceOwnerUserRestrictionsNeedsMigration()).isFalse(); assertThat(dpms.mOwners.getProfileOwnerUserRestrictionsNeedsMigration(USER_SYSTEM)) .isFalse(); assertThat(dpms.mOwners.getProfileOwnerUserRestrictionsNeedsMigration(10)).isFalse(); assertThat(dpms.mOwners.getProfileOwnerUserRestrictionsNeedsMigration(11)).isFalse(); assertThat(dpms.mOwners.getProfileOwnerUserRestrictionsNeedsMigration(12)).isFalse(); // Check the new base restrictions. DpmTestUtils.assertRestrictions( Loading Loading @@ -221,6 +229,7 @@ public class DevicePolicyManagerServiceMigrationTest extends DpmTestBase { dpms.getProfileOwnerAdminLocked(11).ensureUserRestrictions()); } @Test public void testMigration2_profileOwnerOnUser0() throws Exception { setUpPackageManagerForAdmin(admin2, DpmMockContext.CALLER_SYSTEM_USER_UID); Loading Loading @@ -271,13 +280,13 @@ public class DevicePolicyManagerServiceMigrationTest extends DpmTestBase { } finally { mContext.binder.restoreCallingIdentity(ident); } assertFalse(dpms.mOwners.hasDeviceOwner()); assertTrue(dpms.mOwners.hasProfileOwner(USER_SYSTEM)); assertThat(dpms.mOwners.hasDeviceOwner()).isFalse(); assertThat(dpms.mOwners.hasProfileOwner(USER_SYSTEM)).isTrue(); // Now all information should be migrated. assertFalse(dpms.mOwners.getDeviceOwnerUserRestrictionsNeedsMigration()); assertFalse(dpms.mOwners.getProfileOwnerUserRestrictionsNeedsMigration( USER_SYSTEM)); assertThat(dpms.mOwners.getDeviceOwnerUserRestrictionsNeedsMigration()).isFalse(); assertThat(dpms.mOwners.getProfileOwnerUserRestrictionsNeedsMigration(USER_SYSTEM)) .isFalse(); // Check the new base restrictions. DpmTestUtils.assertRestrictions( Loading @@ -297,6 +306,7 @@ public class DevicePolicyManagerServiceMigrationTest extends DpmTestBase { } // Test setting default restrictions for managed profile. @Test public void testMigration3_managedProfileOwner() throws Exception { // Create a managed profile user. final File user10dir = getServices().addUser(10, 0, Loading Loading @@ -339,8 +349,8 @@ public class DevicePolicyManagerServiceMigrationTest extends DpmTestBase { mContext.binder.restoreCallingIdentity(ident); } assertFalse(dpms.mOwners.hasDeviceOwner()); assertTrue(dpms.mOwners.hasProfileOwner(10)); assertThat(dpms.mOwners.hasDeviceOwner()).isFalse(); assertThat(dpms.mOwners.hasProfileOwner(10)).isTrue(); // Check that default restrictions were applied. DpmTestUtils.assertRestrictions( Loading @@ -352,11 +362,12 @@ public class DevicePolicyManagerServiceMigrationTest extends DpmTestBase { final Set<String> alreadySet = dpms.getProfileOwnerAdminLocked(10).defaultEnabledRestrictionsAlreadySet; assertEquals(alreadySet.size(), 1); assertTrue(alreadySet.contains(UserManager.DISALLOW_BLUETOOTH_SHARING)); assertThat(alreadySet).hasSize(1); assertThat(alreadySet.contains(UserManager.DISALLOW_BLUETOOTH_SHARING)).isTrue(); } @SmallTest @Test public void testCompMigrationUnAffiliated_skipped() throws Exception { prepareAdmin1AsDo(); prepareAdminAnotherPackageAsPo(COPE_PROFILE_USER_ID); Loading @@ -364,10 +375,11 @@ public class DevicePolicyManagerServiceMigrationTest extends DpmTestBase { final DevicePolicyManagerServiceTestable dpms = bootDpmsUp(); // DO should still be DO since no migration should happen. assertTrue(dpms.mOwners.hasDeviceOwner()); assertThat(dpms.mOwners.hasDeviceOwner()).isTrue(); } @SmallTest @Test public void testCompMigrationAffiliated() throws Exception { prepareAdmin1AsDo(); prepareAdmin1AsPo(COPE_PROFILE_USER_ID, Build.VERSION_CODES.R); Loading @@ -378,48 +390,54 @@ public class DevicePolicyManagerServiceMigrationTest extends DpmTestBase { final DevicePolicyManagerServiceTestable dpms = bootDpmsUp(); // DO should cease to be DO. assertFalse(dpms.mOwners.hasDeviceOwner()); assertThat(dpms.mOwners.hasDeviceOwner()).isFalse(); final DpmMockContext poContext = new DpmMockContext(getServices(), mRealTestContext); poContext.binder.callingUid = UserHandle.getUid(COPE_PROFILE_USER_ID, COPE_ADMIN1_APP_ID); runAsCaller(poContext, dpms, dpm -> { assertEquals("Password history policy wasn't migrated to PO parent instance", 33, dpm.getParentProfileInstance(admin1).getPasswordHistoryLength(admin1)); assertEquals("Password history policy was put into non-parent PO instance", 0, dpm.getPasswordHistoryLength(admin1)); assertTrue("Screen capture restriction wasn't migrated to PO parent instance", dpm.getParentProfileInstance(admin1).getScreenCaptureDisabled(admin1)); assertArrayEquals("Accounts with management disabled weren't migrated to PO parent", new String[] {"com.google-primary"}, dpm.getParentProfileInstance(admin1).getAccountTypesWithManagementDisabled()); assertArrayEquals("Accounts with management disabled for profile were lost", new String[] {"com.google-profile"}, dpm.getAccountTypesWithManagementDisabled()); assertTrue("User restriction wasn't migrated to PO parent instance", dpm.getParentProfileInstance(admin1).getUserRestrictions(admin1) .containsKey(UserManager.DISALLOW_BLUETOOTH)); assertFalse("User restriction was put into non-parent PO instance", dpm.getUserRestrictions(admin1).containsKey(UserManager.DISALLOW_BLUETOOTH)); assertTrue("User restriction wasn't migrated to PO parent instance", dpms.getProfileOwnerAdminLocked(COPE_PROFILE_USER_ID) .getParentActiveAdmin() .getEffectiveRestrictions() .containsKey(UserManager.DISALLOW_CONFIG_DATE_TIME)); assertFalse("User restriction was put into non-parent PO instance", dpms.getProfileOwnerAdminLocked(COPE_PROFILE_USER_ID) .getEffectiveRestrictions() .containsKey(UserManager.DISALLOW_CONFIG_DATE_TIME)); assertEquals("Personal apps suspension wasn't migrated", DevicePolicyManager.PERSONAL_APPS_NOT_SUSPENDED, dpm.getPersonalAppsSuspendedReasons(admin1)); assertWithMessage("Password history policy wasn't migrated to PO parent instance") .that(dpm.getParentProfileInstance(admin1).getPasswordHistoryLength(admin1)) .isEqualTo(33); assertWithMessage("Password history policy was put into non-parent PO instance") .that(dpm.getPasswordHistoryLength(admin1)).isEqualTo(0); assertWithMessage("Screen capture restriction wasn't migrated to PO parent instance") .that(dpm.getParentProfileInstance(admin1).getScreenCaptureDisabled(admin1)) .isTrue(); assertWithMessage("Accounts with management disabled weren't migrated to PO parent") .that(dpm.getParentProfileInstance(admin1) .getAccountTypesWithManagementDisabled()).asList() .containsExactly("com.google-primary"); assertWithMessage("Accounts with management disabled for profile were lost") .that(dpm.getAccountTypesWithManagementDisabled()).asList() .containsExactly("com.google-profile"); assertWithMessage("User restriction wasn't migrated to PO parent instance") .that(dpm.getParentProfileInstance(admin1).getUserRestrictions(admin1).keySet()) .contains(UserManager.DISALLOW_BLUETOOTH); assertWithMessage("User restriction was put into non-parent PO instance").that( dpm.getUserRestrictions(admin1).keySet()) .doesNotContain(UserManager.DISALLOW_BLUETOOTH); assertWithMessage("User restriction wasn't migrated to PO parent instance") .that(dpms.getProfileOwnerAdminLocked(COPE_PROFILE_USER_ID) .getParentActiveAdmin().getEffectiveRestrictions().keySet()) .contains(UserManager.DISALLOW_CONFIG_DATE_TIME); assertWithMessage("User restriction was put into non-parent PO instance") .that(dpms.getProfileOwnerAdminLocked(COPE_PROFILE_USER_ID) .getEffectiveRestrictions().keySet()) .doesNotContain(UserManager.DISALLOW_CONFIG_DATE_TIME); assertWithMessage("Personal apps suspension wasn't migrated") .that(dpm.getPersonalAppsSuspendedReasons(admin1)) .isEqualTo(DevicePolicyManager.PERSONAL_APPS_NOT_SUSPENDED); }); } @SmallTest @Test public void testCompMigration_keepSuspendedAppsWhenDpcIsRPlus() throws Exception { prepareAdmin1AsDo(); prepareAdmin1AsPo(COPE_PROFILE_USER_ID, Build.VERSION_CODES.R); Loading @@ -445,13 +463,14 @@ public class DevicePolicyManagerServiceMigrationTest extends DpmTestBase { poContext.binder.callingUid = UserHandle.getUid(COPE_PROFILE_USER_ID, COPE_ADMIN1_APP_ID); runAsCaller(poContext, dpms, dpm -> { assertEquals("Personal apps suspension wasn't migrated", DevicePolicyManager.PERSONAL_APPS_SUSPENDED_EXPLICITLY, dpm.getPersonalAppsSuspendedReasons(admin1)); assertWithMessage("Personal apps suspension wasn't migrated") .that(dpm.getPersonalAppsSuspendedReasons(admin1)) .isEqualTo(DevicePolicyManager.PERSONAL_APPS_SUSPENDED_EXPLICITLY); }); } @SmallTest @Test public void testCompMigration_unsuspendAppsWhenDpcNotRPlus() throws Exception { prepareAdmin1AsDo(); prepareAdmin1AsPo(COPE_PROFILE_USER_ID, Build.VERSION_CODES.Q); Loading @@ -470,9 +489,9 @@ public class DevicePolicyManagerServiceMigrationTest extends DpmTestBase { poContext.binder.callingUid = UserHandle.getUid(COPE_PROFILE_USER_ID, COPE_ADMIN1_APP_ID); runAsCaller(poContext, dpms, dpm -> { assertEquals("Personal apps weren't unsuspended", DevicePolicyManager.PERSONAL_APPS_NOT_SUSPENDED, dpm.getPersonalAppsSuspendedReasons(admin1)); assertWithMessage("Personal apps weren't unsuspended") .that(dpm.getPersonalAppsSuspendedReasons(admin1)) .isEqualTo(DevicePolicyManager.PERSONAL_APPS_NOT_SUSPENDED); }); } Loading
services/tests/servicestests/src/com/android/server/devicepolicy/DevicePolicyManagerTest.java +906 −670 File changed.File size exceeds preview limit. View original file View changed file
services/tests/servicestests/src/com/android/server/devicepolicy/DpmTestBase.java +23 −21 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ package com.android.server.devicepolicy; import static com.google.common.truth.Truth.assertThat; import static org.mockito.ArgumentMatchers.anyBoolean; import static org.mockito.ArgumentMatchers.anyLong; import static org.mockito.ArgumentMatchers.anyString; Loading @@ -35,18 +37,28 @@ import android.content.pm.PackageInfo; import android.content.pm.PackageManager; import android.content.pm.ResolveInfo; import android.os.UserHandle; import android.test.AndroidTestCase; import androidx.test.InstrumentationRegistry; import org.junit.Before; import java.io.InputStream; import java.util.List; public abstract class DpmTestBase extends AndroidTestCase { /** * Temporary copy of DpmTestBase using JUnit 4 - once all tests extend it, it should be renamed * back to DpmTestBase (with the temporary methods removed. * */ public abstract class DpmTestBase { public static final String TAG = "DpmTest"; protected Context mRealTestContext; protected final Context mRealTestContext = InstrumentationRegistry.getTargetContext(); protected DpmMockContext mMockContext; private MockSystemServices mServices; // Attributes below are public so they don't need to be prefixed with m public ComponentName admin1; public ComponentName admin2; public ComponentName admin3; Loading @@ -54,12 +66,8 @@ public abstract class DpmTestBase extends AndroidTestCase { public ComponentName adminNoPerm; public ComponentName delegateCertInstaller; @Override protected void setUp() throws Exception { super.setUp(); mRealTestContext = super.getContext(); @Before public void setFixtures() throws Exception { mServices = new MockSystemServices(mRealTestContext, "test-data"); mMockContext = new DpmMockContext(mServices, mRealTestContext); Loading @@ -74,8 +82,7 @@ public abstract class DpmTestBase extends AndroidTestCase { mockSystemPropertiesToReturnDefault(); } @Override public DpmMockContext getContext() { protected DpmMockContext getContext() { return mMockContext; } Loading Loading @@ -136,20 +143,15 @@ public abstract class DpmTestBase extends AndroidTestCase { final PackageInfo pi = DpmTestUtils.cloneParcelable( mRealTestContext.getPackageManager().getPackageInfo( mRealTestContext.getPackageName(), 0)); assertTrue(pi.applicationInfo.flags != 0); assertThat(pi.applicationInfo.flags).isNotEqualTo(0); if (ai != null) { pi.applicationInfo = ai; } doReturn(pi).when(mServices.ipackageManager).getPackageInfo( eq(packageName), eq(0), eq(userId)); doReturn(pi).when(mServices.ipackageManager).getPackageInfo(packageName, 0, userId); doReturn(ai.uid).when(mServices.packageManager).getPackageUidAsUser( eq(packageName), eq(userId)); doReturn(ai.uid).when(mServices.packageManager).getPackageUidAsUser(packageName, userId); } protected void markDelegatedCertInstallerAsInstalled() throws Exception { Loading Loading @@ -230,8 +232,8 @@ public abstract class DpmTestBase extends AndroidTestCase { mRealTestContext.getPackageManager().queryBroadcastReceivers( resolveIntent, PackageManager.GET_META_DATA); assertNotNull(realResolveInfo); assertEquals(1, realResolveInfo.size()); assertThat(realResolveInfo).isNotNull(); assertThat(realResolveInfo).hasSize(1); // We need to change AI, so set a clone. realResolveInfo.set(0, DpmTestUtils.cloneParcelable(realResolveInfo.get(0))); Loading