summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/api/system-current.txt3
-rw-r--r--core/api/test-current.txt8
-rw-r--r--core/java/android/content/pm/UserProperties.java182
-rw-r--r--services/core/java/com/android/server/pm/UserTypeFactory.java4
-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
8 files changed, 199 insertions, 25 deletions
diff --git a/core/api/system-current.txt b/core/api/system-current.txt
index b75ef2eaa555..29406dd98d4a 100644
--- a/core/api/system-current.txt
+++ b/core/api/system-current.txt
@@ -4116,12 +4116,15 @@ package android.content.pm {
public final class UserProperties implements android.os.Parcelable {
method public int describeContents();
+ method public int getCrossProfileContentSharingStrategy();
method public int getShowInQuietMode();
method public int getShowInSharingSurfaces();
method public boolean isCredentialShareableWithParent();
method public boolean isMediaSharedWithParent();
method public void writeToParcel(@NonNull android.os.Parcel, int);
field @NonNull public static final android.os.Parcelable.Creator<android.content.pm.UserProperties> CREATOR;
+ field public static final int CROSS_PROFILE_CONTENT_SHARING_DELEGATE_FROM_PARENT = 1; // 0x1
+ field public static final int CROSS_PROFILE_CONTENT_SHARING_NO_DELEGATION = 0; // 0x0
field public static final int SHOW_IN_QUIET_MODE_DEFAULT = 2; // 0x2
field public static final int SHOW_IN_QUIET_MODE_HIDDEN = 1; // 0x1
field public static final int SHOW_IN_QUIET_MODE_PAUSED = 0; // 0x0
diff --git a/core/api/test-current.txt b/core/api/test-current.txt
index 7e4bd12c597d..a3bd4bff5836 100644
--- a/core/api/test-current.txt
+++ b/core/api/test-current.txt
@@ -1107,6 +1107,14 @@ package android.content.pm {
field public static final int SHOW_IN_LAUNCHER_WITH_PARENT = 0; // 0x0
}
+ public static final class UserProperties.Builder {
+ ctor public UserProperties.Builder();
+ method @NonNull public android.content.pm.UserProperties build();
+ method @NonNull public android.content.pm.UserProperties.Builder setCrossProfileContentSharingStrategy(int);
+ method @NonNull public android.content.pm.UserProperties.Builder setShowInQuietMode(int);
+ method @NonNull public android.content.pm.UserProperties.Builder setShowInSharingSurfaces(int);
+ }
+
}
package android.content.res {
diff --git a/core/java/android/content/pm/UserProperties.java b/core/java/android/content/pm/UserProperties.java
index e85b289ca497..74c4e6fa290c 100644
--- a/core/java/android/content/pm/UserProperties.java
+++ b/core/java/android/content/pm/UserProperties.java
@@ -66,6 +66,9 @@ public final class UserProperties implements Parcelable {
"credentialShareableWithParent";
private static final String ATTR_DELETE_APP_WITH_PARENT = "deleteAppWithParent";
+ private static final String ATTR_CROSS_PROFILE_CONTENT_SHARING_STRATEGY =
+ "crossProfileContentSharingStrategy";
+
/** Index values of each property (to indicate whether they are present in this object). */
@IntDef(prefix = "INDEX_", value = {
INDEX_SHOW_IN_LAUNCHER,
@@ -83,6 +86,7 @@ public final class UserProperties implements Parcelable {
INDEX_SHOW_IN_QUIET_MODE,
INDEX_SHOW_IN_SHARING_SURFACES,
INDEX_AUTH_ALWAYS_REQUIRED_TO_DISABLE_QUIET_MODE,
+ INDEX_CROSS_PROFILE_CONTENT_SHARING_STRATEGY
})
@Retention(RetentionPolicy.SOURCE)
private @interface PropertyIndex {
@@ -102,6 +106,7 @@ public final class UserProperties implements Parcelable {
private static final int INDEX_SHOW_IN_QUIET_MODE = 12;
private static final int INDEX_AUTH_ALWAYS_REQUIRED_TO_DISABLE_QUIET_MODE = 13;
private static final int INDEX_SHOW_IN_SHARING_SURFACES = 14;
+ private static final int INDEX_CROSS_PROFILE_CONTENT_SHARING_STRATEGY = 15;
/** A bit set, mapping each PropertyIndex to whether it is present (1) or absent (0). */
private long mPropertiesPresent = 0;
@@ -362,6 +367,45 @@ public final class UserProperties implements Parcelable {
*/
@SuppressLint("UnflaggedApi") // b/306636213
public static final int SHOW_IN_SHARING_SURFACES_NO = SHOW_IN_LAUNCHER_NO;
+ /**
+ * Possible values for cross profile content sharing strategy for this profile.
+ *
+ * @hide
+ */
+ @IntDef(prefix = {"CROSS_PROFILE_CONTENT_SHARING_STRATEGY_"}, value = {
+ CROSS_PROFILE_CONTENT_SHARING_NO_DELEGATION,
+ CROSS_PROFILE_CONTENT_SHARING_DELEGATE_FROM_PARENT
+ })
+ @Retention(RetentionPolicy.SOURCE)
+ public @interface CrossProfileContentSharingStrategy {
+ }
+
+ /**
+ * Signifies that cross-profile content sharing strategy, both to and from this profile, should
+ * not be delegated to any other user/profile.
+ * For ex:
+ * If this property is set for a profile, content sharing applications (such as Android
+ * Sharesheet), should not delegate the decision to share content between that profile and
+ * another profile to whether content sharing is allowed between any other profile/user related
+ * to those profiles. They should instead decide, based upon whether content sharing is
+ * specifically allowed between the two profiles in question.
+ */
+ @SuppressLint("UnflaggedApi") // b/306636213
+ public static final int CROSS_PROFILE_CONTENT_SHARING_NO_DELEGATION = 0;
+
+ /**
+ * Signifies that cross-profile content sharing strategy, both to and from this profile, should
+ * be based upon the strategy used by the parent user of the profile.
+ * For ex:
+ * If this property is set for a profile A, content sharing applications (such as Android
+ * Sharesheet), should share content between profile A and profile B, based upon whether content
+ * sharing is allowed between the parent of profile A and profile B.
+ * If it's also set for profile B, then decision should, in turn be made by considering content
+ * sharing strategy between the parents of both profiles.
+ */
+ @SuppressLint("UnflaggedApi") // b/306636213
+ public static final int CROSS_PROFILE_CONTENT_SHARING_DELEGATE_FROM_PARENT = 1;
+
/**
* Creates a UserProperties (intended for the SystemServer) that stores a reference to the given
@@ -417,6 +461,7 @@ public final class UserProperties implements Parcelable {
setCredentialShareableWithParent(orig.isCredentialShareableWithParent());
setShowInQuietMode(orig.getShowInQuietMode());
setShowInSharingSurfaces(orig.getShowInSharingSurfaces());
+ setCrossProfileContentSharingStrategy(orig.getCrossProfileContentSharingStrategy());
}
/**
@@ -727,8 +772,7 @@ public final class UserProperties implements Parcelable {
private @CrossProfileIntentFilterAccessControlLevel int mCrossProfileIntentFilterAccessControl;
/**
- * Returns the user's {@link CrossProfileIntentResolutionStrategy}. If not explicitly
- * configured, default value is {@link #CROSS_PROFILE_INTENT_RESOLUTION_STRATEGY_DEFAULT}.
+ * Returns the user's {@link CrossProfileIntentResolutionStrategy}.
* @return user's {@link CrossProfileIntentResolutionStrategy}.
*
* @hide
@@ -743,11 +787,8 @@ public final class UserProperties implements Parcelable {
throw new SecurityException("You don't have permission to query "
+ "crossProfileIntentResolutionStrategy");
}
- /**
- * Sets {@link CrossProfileIntentResolutionStrategy} for the user.
- * @param val resolution strategy for user
- * @hide
- */
+
+ /** @hide */
public void setCrossProfileIntentResolutionStrategy(
@CrossProfileIntentResolutionStrategy int val) {
this.mCrossProfileIntentResolutionStrategy = val;
@@ -755,6 +796,39 @@ public final class UserProperties implements Parcelable {
}
private @CrossProfileIntentResolutionStrategy int mCrossProfileIntentResolutionStrategy;
+ /**
+ * Returns the user's {@link CrossProfileContentSharingStrategy}.
+ *
+ * Content sharing applications, such as Android Sharesheet allow sharing of content
+ * (an image, for ex.) between profiles, based upon cross-profile access checks between the
+ * originating and destined profile.
+ * In some cases however, we may want another user (such as profile parent) to serve as the
+ * delegated user to be used for such checks.
+ * To effect the same, clients can fetch this property and accordingly replace the
+ * originating/destined profile by another user for cross-profile access checks.
+ *
+ * @return user's {@link CrossProfileContentSharingStrategy}.
+ */
+ @SuppressLint("UnflaggedApi") // b/306636213
+ public @CrossProfileContentSharingStrategy int getCrossProfileContentSharingStrategy() {
+ if (isPresent(INDEX_CROSS_PROFILE_CONTENT_SHARING_STRATEGY)) {
+ return mCrossProfileContentSharingStrategy;
+ }
+ if (mDefaultProperties != null) {
+ return mDefaultProperties.mCrossProfileContentSharingStrategy;
+ }
+ throw new SecurityException("You don't have permission to query "
+ + "crossProfileContentSharingStrategy");
+ }
+
+ /** @hide */
+ public void setCrossProfileContentSharingStrategy(
+ @CrossProfileContentSharingStrategy int val) {
+ this.mCrossProfileContentSharingStrategy = val;
+ setPresent(INDEX_CROSS_PROFILE_CONTENT_SHARING_STRATEGY);
+ }
+ private @CrossProfileContentSharingStrategy int mCrossProfileContentSharingStrategy;
+
@Override
public String toString() {
@@ -775,6 +849,7 @@ public final class UserProperties implements Parcelable {
+ ", mMediaSharedWithParent=" + isMediaSharedWithParent()
+ ", mCredentialShareableWithParent=" + isCredentialShareableWithParent()
+ ", mDeleteAppWithParent=" + getDeleteAppWithParent()
+ + ", mCrossProfileContentSharingStrategy=" + getCrossProfileContentSharingStrategy()
+ "}";
}
@@ -801,6 +876,8 @@ public final class UserProperties implements Parcelable {
pw.println(prefix + " mCredentialShareableWithParent="
+ isCredentialShareableWithParent());
pw.println(prefix + " mDeleteAppWithParent=" + getDeleteAppWithParent());
+ pw.println(prefix + " mCrossProfileContentSharingStrategy="
+ + getCrossProfileContentSharingStrategy());
}
/**
@@ -873,6 +950,8 @@ public final class UserProperties implements Parcelable {
case ATTR_DELETE_APP_WITH_PARENT:
setDeleteAppWithParent(parser.getAttributeBoolean(i));
break;
+ case ATTR_CROSS_PROFILE_CONTENT_SHARING_STRATEGY:
+ setCrossProfileContentSharingStrategy(parser.getAttributeInt(i));
default:
Slog.w(LOG_TAG, "Skipping unknown property " + attributeName);
}
@@ -939,6 +1018,10 @@ public final class UserProperties implements Parcelable {
serializer.attributeBoolean(null, ATTR_DELETE_APP_WITH_PARENT,
mDeleteAppWithParent);
}
+ if (isPresent(INDEX_CROSS_PROFILE_CONTENT_SHARING_STRATEGY)) {
+ serializer.attributeInt(null, ATTR_CROSS_PROFILE_CONTENT_SHARING_STRATEGY,
+ mCrossProfileContentSharingStrategy);
+ }
}
// For use only with an object that has already had any permission-lacking fields stripped out.
@@ -958,6 +1041,7 @@ public final class UserProperties implements Parcelable {
dest.writeBoolean(mMediaSharedWithParent);
dest.writeBoolean(mCredentialShareableWithParent);
dest.writeBoolean(mDeleteAppWithParent);
+ dest.writeInt(mCrossProfileContentSharingStrategy);
}
/**
@@ -981,6 +1065,7 @@ public final class UserProperties implements Parcelable {
mMediaSharedWithParent = source.readBoolean();
mCredentialShareableWithParent = source.readBoolean();
mDeleteAppWithParent = source.readBoolean();
+ mCrossProfileContentSharingStrategy = source.readInt();
}
@Override
@@ -1003,6 +1088,8 @@ public final class UserProperties implements Parcelable {
* Intended for building default values (and so all properties are present in the built object).
* @hide
*/
+ @TestApi
+ @SuppressLint("UnflaggedApi") // b/306636213
public static final class Builder {
// UserProperties fields and their default values.
private @ShowInLauncher int mShowInLauncher = SHOW_IN_LAUNCHER_WITH_PARENT;
@@ -1023,56 +1110,85 @@ public final class UserProperties implements Parcelable {
private boolean mMediaSharedWithParent = false;
private boolean mCredentialShareableWithParent = false;
private boolean mDeleteAppWithParent = false;
+ private @CrossProfileContentSharingStrategy int mCrossProfileContentSharingStrategy =
+ CROSS_PROFILE_CONTENT_SHARING_NO_DELEGATION;
+ /**
+ * @hide
+ */
+ @SuppressLint("UnflaggedApi") // b/306636213
+ @TestApi
+ public Builder() {}
+
+ /** @hide */
public Builder setShowInLauncher(@ShowInLauncher int showInLauncher) {
mShowInLauncher = showInLauncher;
return this;
}
+ /** @hide */
public Builder setStartWithParent(boolean startWithParent) {
mStartWithParent = startWithParent;
return this;
}
- /** Sets the value for {@link #mShowInSettings} */
+ /** Sets the value for {@link #mShowInSettings}
+ * @hide
+ */
public Builder setShowInSettings(@ShowInSettings int showInSettings) {
mShowInSettings = showInSettings;
return this;
}
- /** Sets the value for {@link #mShowInQuietMode} */
+ /** Sets the value for {@link #mShowInQuietMode}
+ * @hide
+ */
+ @TestApi
+ @SuppressLint("UnflaggedApi") // b/306636213
+ @NonNull
public Builder setShowInQuietMode(@ShowInQuietMode int showInQuietMode) {
mShowInQuietMode = showInQuietMode;
return this;
}
- /** Sets the value for {@link #mShowInSharingSurfaces}. */
+ /** Sets the value for {@link #mShowInSharingSurfaces}.
+ * @hide
+ */
+ @TestApi
+ @SuppressLint("UnflaggedApi") // b/306636213
+ @NonNull
public Builder setShowInSharingSurfaces(@ShowInSharingSurfaces int showInSharingSurfaces) {
mShowInSharingSurfaces = showInSharingSurfaces;
return this;
}
-
- /** Sets the value for {@link #mInheritDevicePolicy}*/
+ /** Sets the value for {@link #mInheritDevicePolicy}
+ * @hide
+ */
public Builder setInheritDevicePolicy(
@InheritDevicePolicy int inheritRestrictionsDevicePolicy) {
mInheritDevicePolicy = inheritRestrictionsDevicePolicy;
return this;
}
+ /** @hide */
public Builder setUseParentsContacts(boolean useParentsContacts) {
mUseParentsContacts = useParentsContacts;
return this;
}
- /** Sets the value for {@link #mUpdateCrossProfileIntentFiltersOnOTA} */
+ /** Sets the value for {@link #mUpdateCrossProfileIntentFiltersOnOTA}
+ * @hide
+ */
public Builder setUpdateCrossProfileIntentFiltersOnOTA(boolean
updateCrossProfileIntentFiltersOnOTA) {
mUpdateCrossProfileIntentFiltersOnOTA = updateCrossProfileIntentFiltersOnOTA;
return this;
}
- /** Sets the value for {@link #mCrossProfileIntentFilterAccessControl} */
+ /** Sets the value for {@link #mCrossProfileIntentFilterAccessControl}
+ * @hide
+ */
public Builder setCrossProfileIntentFilterAccessControl(
@CrossProfileIntentFilterAccessControlLevel int
crossProfileIntentFilterAccessControl) {
@@ -1080,30 +1196,55 @@ public final class UserProperties implements Parcelable {
return this;
}
- /** Sets the value for {@link #mCrossProfileIntentResolutionStrategy} */
+ /** Sets the value for {@link #mCrossProfileIntentResolutionStrategy}
+ * @hide
+ */
public Builder setCrossProfileIntentResolutionStrategy(@CrossProfileIntentResolutionStrategy
int crossProfileIntentResolutionStrategy) {
mCrossProfileIntentResolutionStrategy = crossProfileIntentResolutionStrategy;
return this;
}
+ /** @hide */
public Builder setMediaSharedWithParent(boolean mediaSharedWithParent) {
mMediaSharedWithParent = mediaSharedWithParent;
return this;
}
+ /** @hide */
public Builder setCredentialShareableWithParent(boolean credentialShareableWithParent) {
mCredentialShareableWithParent = credentialShareableWithParent;
return this;
}
- /** Sets the value for {@link #mDeleteAppWithParent}*/
+
+ /** Sets the value for {@link #mDeleteAppWithParent}
+ * @hide
+ */
public Builder setDeleteAppWithParent(boolean deleteAppWithParent) {
mDeleteAppWithParent = deleteAppWithParent;
return this;
}
- /** Builds a UserProperties object with *all* values populated. */
+ /** Sets the value for {@link #mCrossProfileContentSharingStrategy}
+ * @hide
+ */
+
+ @TestApi
+ @SuppressLint("UnflaggedApi") // b/306636213
+ @NonNull
+ public Builder setCrossProfileContentSharingStrategy(@CrossProfileContentSharingStrategy
+ int crossProfileContentSharingStrategy) {
+ mCrossProfileContentSharingStrategy = crossProfileContentSharingStrategy;
+ return this;
+ }
+
+ /** Builds a UserProperties object with *all* values populated.
+ * @hide
+ */
+ @TestApi
+ @SuppressLint("UnflaggedApi") // b/306636213
+ @NonNull
public UserProperties build() {
return new UserProperties(
mShowInLauncher,
@@ -1118,7 +1259,8 @@ public final class UserProperties implements Parcelable {
mCrossProfileIntentResolutionStrategy,
mMediaSharedWithParent,
mCredentialShareableWithParent,
- mDeleteAppWithParent);
+ mDeleteAppWithParent,
+ mCrossProfileContentSharingStrategy);
}
} // end Builder
@@ -1135,7 +1277,8 @@ public final class UserProperties implements Parcelable {
@CrossProfileIntentResolutionStrategy int crossProfileIntentResolutionStrategy,
boolean mediaSharedWithParent,
boolean credentialShareableWithParent,
- boolean deleteAppWithParent) {
+ boolean deleteAppWithParent,
+ @CrossProfileContentSharingStrategy int crossProfileContentSharingStrategy) {
mDefaultProperties = null;
setShowInLauncher(showInLauncher);
setStartWithParent(startWithParent);
@@ -1150,5 +1293,6 @@ public final class UserProperties implements Parcelable {
setMediaSharedWithParent(mediaSharedWithParent);
setCredentialShareableWithParent(credentialShareableWithParent);
setDeleteAppWithParent(deleteAppWithParent);
+ setCrossProfileContentSharingStrategy(crossProfileContentSharingStrategy);
}
}
diff --git a/services/core/java/com/android/server/pm/UserTypeFactory.java b/services/core/java/com/android/server/pm/UserTypeFactory.java
index aa1ae2fed0db..c77dc07e2ebc 100644
--- a/services/core/java/com/android/server/pm/UserTypeFactory.java
+++ b/services/core/java/com/android/server/pm/UserTypeFactory.java
@@ -155,7 +155,9 @@ public final class UserTypeFactory {
UserProperties.SHOW_IN_SHARING_SURFACES_WITH_PARENT)
.setMediaSharedWithParent(true)
.setCredentialShareableWithParent(true)
- .setDeleteAppWithParent(true));
+ .setDeleteAppWithParent(true)
+ .setCrossProfileContentSharingStrategy(UserProperties
+ .CROSS_PROFILE_CONTENT_SHARING_DELEGATE_FROM_PARENT));
}
/**
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(),