summaryrefslogtreecommitdiff
path: root/services/tests/servicestests
diff options
context:
space:
mode:
Diffstat (limited to 'services/tests/servicestests')
-rw-r--r--services/tests/servicestests/res/xml/usertypes_test_profile.xml1
-rw-r--r--services/tests/servicestests/src/com/android/server/pm/UserManagerServiceUserPropertiesTest.java6
-rw-r--r--services/tests/servicestests/src/com/android/server/pm/UserManagerServiceUserTypeTest.java18
-rw-r--r--services/tests/servicestests/src/com/android/server/pm/UserManagerTest.java2
-rw-r--r--services/tests/servicestests/src/com/android/server/power/batterysaver/BatterySaverPolicyTest.java5
5 files changed, 25 insertions, 7 deletions
diff --git a/services/tests/servicestests/res/xml/usertypes_test_profile.xml b/services/tests/servicestests/res/xml/usertypes_test_profile.xml
index 26d681bb27ef..e21dc5fbbd34 100644
--- a/services/tests/servicestests/res/xml/usertypes_test_profile.xml
+++ b/services/tests/servicestests/res/xml/usertypes_test_profile.xml
@@ -41,6 +41,7 @@
showInSettings='23'
inheritDevicePolicy='450'
deleteAppWithParent='false'
+ crossProfileContentSharingStrategy='0'
/>
</profile-type>
<profile-type name='custom.test.1' max-allowed-per-parent='14' />
diff --git a/services/tests/servicestests/src/com/android/server/pm/UserManagerServiceUserPropertiesTest.java b/services/tests/servicestests/src/com/android/server/pm/UserManagerServiceUserPropertiesTest.java
index 29ff7732da7e..76164dde3535 100644
--- a/services/tests/servicestests/src/com/android/server/pm/UserManagerServiceUserPropertiesTest.java
+++ b/services/tests/servicestests/src/com/android/server/pm/UserManagerServiceUserPropertiesTest.java
@@ -69,6 +69,7 @@ public class UserManagerServiceUserPropertiesTest {
.setMediaSharedWithParent(false)
.setCredentialShareableWithParent(true)
.setDeleteAppWithParent(false)
+ .setCrossProfileContentSharingStrategy(0)
.build();
final UserProperties actualProps = new UserProperties(defaultProps);
actualProps.setShowInLauncher(14);
@@ -82,6 +83,7 @@ public class UserManagerServiceUserPropertiesTest {
actualProps.setMediaSharedWithParent(true);
actualProps.setCredentialShareableWithParent(false);
actualProps.setDeleteAppWithParent(true);
+ actualProps.setCrossProfileContentSharingStrategy(1);
// Write the properties to xml.
final ByteArrayOutputStream baos = new ByteArrayOutputStream();
@@ -188,6 +190,8 @@ public class UserManagerServiceUserPropertiesTest {
copy::isMediaSharedWithParent, true);
assertEqualGetterOrThrows(orig::isCredentialShareableWithParent,
copy::isCredentialShareableWithParent, true);
+ assertEqualGetterOrThrows(orig::getCrossProfileContentSharingStrategy,
+ copy::getCrossProfileContentSharingStrategy, true);
}
/**
@@ -242,5 +246,7 @@ public class UserManagerServiceUserPropertiesTest {
assertThat(expected.isCredentialShareableWithParent())
.isEqualTo(actual.isCredentialShareableWithParent());
assertThat(expected.getDeleteAppWithParent()).isEqualTo(actual.getDeleteAppWithParent());
+ assertThat(expected.getCrossProfileContentSharingStrategy())
+ .isEqualTo(actual.getCrossProfileContentSharingStrategy());
}
}
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 fe2bf38f65ea..6528f972deeb 100644
--- a/services/tests/servicestests/src/com/android/server/pm/UserManagerServiceUserTypeTest.java
+++ b/services/tests/servicestests/src/com/android/server/pm/UserManagerServiceUserTypeTest.java
@@ -93,7 +93,8 @@ public class UserManagerServiceUserTypeTest {
.setShowInSharingSurfaces(20)
.setShowInQuietMode(30)
.setInheritDevicePolicy(340)
- .setDeleteAppWithParent(true);
+ .setDeleteAppWithParent(true)
+ .setCrossProfileContentSharingStrategy(1);
final UserTypeDetails type = new UserTypeDetails.Builder()
.setName("a.name")
@@ -167,6 +168,8 @@ public class UserManagerServiceUserTypeTest {
assertEquals(340, type.getDefaultUserPropertiesReference()
.getInheritDevicePolicy());
assertTrue(type.getDefaultUserPropertiesReference().getDeleteAppWithParent());
+ assertEquals(1, type.getDefaultUserPropertiesReference()
+ .getCrossProfileContentSharingStrategy());
assertEquals(23, type.getBadgeLabel(0));
assertEquals(24, type.getBadgeLabel(1));
@@ -221,6 +224,8 @@ public class UserManagerServiceUserTypeTest {
assertEquals(UserProperties.SHOW_IN_LAUNCHER_SEPARATE, props.getShowInSharingSurfaces());
assertEquals(UserProperties.SHOW_IN_QUIET_MODE_PAUSED,
props.getShowInQuietMode());
+ assertEquals(UserProperties.CROSS_PROFILE_CONTENT_SHARING_NO_DELEGATION,
+ props.getCrossProfileContentSharingStrategy());
assertFalse(type.hasBadge());
}
@@ -312,8 +317,8 @@ public class UserManagerServiceUserTypeTest {
.setDeleteAppWithParent(true)
.setShowInSharingSurfaces(22)
.setShowInQuietMode(24)
- .setDeleteAppWithParent(true);
-
+ .setDeleteAppWithParent(true)
+ .setCrossProfileContentSharingStrategy(1);
final ArrayMap<String, UserTypeDetails.Builder> builders = new ArrayMap<>();
builders.put(userTypeAosp1, new UserTypeDetails.Builder()
@@ -357,6 +362,8 @@ public class UserManagerServiceUserTypeTest {
assertEquals(24,
aospType.getDefaultUserPropertiesReference().getShowInQuietMode());
assertTrue(aospType.getDefaultUserPropertiesReference().getDeleteAppWithParent());
+ assertEquals(1, aospType.getDefaultUserPropertiesReference()
+ .getCrossProfileContentSharingStrategy());
// userTypeAosp2 should be modified.
aospType = builders.get(userTypeAosp2).createUserTypeDetails();
@@ -403,8 +410,9 @@ public class UserManagerServiceUserTypeTest {
aospType.getDefaultUserPropertiesReference().getShowInQuietMode());
assertEquals(450, aospType.getDefaultUserPropertiesReference()
.getInheritDevicePolicy());
- assertFalse(aospType.getDefaultUserPropertiesReference()
- .getDeleteAppWithParent());
+ assertFalse(aospType.getDefaultUserPropertiesReference().getDeleteAppWithParent());
+ assertEquals(0, aospType.getDefaultUserPropertiesReference()
+ .getCrossProfileContentSharingStrategy());
// userTypeOem1 should be created.
UserTypeDetails.Builder customType = builders.get(userTypeOem1);
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 6997530d1a9d..e511c79812ac 100644
--- a/services/tests/servicestests/src/com/android/server/pm/UserManagerTest.java
+++ b/services/tests/servicestests/src/com/android/server/pm/UserManagerTest.java
@@ -207,6 +207,8 @@ public final class UserManagerTest {
.isEqualTo(cloneUserProperties.isMediaSharedWithParent());
assertThat(typeProps.isCredentialShareableWithParent())
.isEqualTo(cloneUserProperties.isCredentialShareableWithParent());
+ assertThat(typeProps.getCrossProfileContentSharingStrategy())
+ .isEqualTo(cloneUserProperties.getCrossProfileContentSharingStrategy());
assertThrows(SecurityException.class, cloneUserProperties::getDeleteAppWithParent);
compareDrawables(mUserManager.getUserBadge(),
diff --git a/services/tests/servicestests/src/com/android/server/power/batterysaver/BatterySaverPolicyTest.java b/services/tests/servicestests/src/com/android/server/power/batterysaver/BatterySaverPolicyTest.java
index 3102639ff148..29e3d58696e6 100644
--- a/services/tests/servicestests/src/com/android/server/power/batterysaver/BatterySaverPolicyTest.java
+++ b/services/tests/servicestests/src/com/android/server/power/batterysaver/BatterySaverPolicyTest.java
@@ -116,7 +116,7 @@ public class BatterySaverPolicyTest extends AndroidTestCase {
testServiceDefaultValue_On(ServiceType.NULL);
}
- @Suppress
+ @Suppress // TODO: b/317823111 - Remove once test fixed.
@SmallTest
public void testGetBatterySaverPolicy_PolicyVibration_DefaultValueCorrect() {
testServiceDefaultValue_On(ServiceType.VIBRATION);
@@ -202,7 +202,7 @@ public class BatterySaverPolicyTest extends AndroidTestCase {
testServiceDefaultValue_On(ServiceType.QUICK_DOZE);
}
- @Suppress
+ @Suppress // TODO: b/317823111 - Remove once test fixed.
@SmallTest
public void testUpdateConstants_getCorrectData() {
mBatterySaverPolicy.updateConstantsLocked(BATTERY_SAVER_CONSTANTS, "");
@@ -302,6 +302,7 @@ public class BatterySaverPolicyTest extends AndroidTestCase {
}
}
+ @Suppress // TODO: b/317823111 - Remove once test fixed.
public void testSetPolicyLevel_Adaptive() {
mBatterySaverPolicy.setPolicyLevel(POLICY_LEVEL_ADAPTIVE);