summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/api/test-current.txt2
-rw-r--r--core/java/android/content/pm/UserInfo.java5
-rw-r--r--services/core/java/com/android/server/pm/UserManagerService.java4
3 files changed, 6 insertions, 5 deletions
diff --git a/core/api/test-current.txt b/core/api/test-current.txt
index 74a444059452..a3ebe6e72712 100644
--- a/core/api/test-current.txt
+++ b/core/api/test-current.txt
@@ -1082,7 +1082,7 @@ package android.content.pm {
method public android.os.UserHandle getUserHandle();
method public boolean isAdmin();
method public boolean isCloneProfile();
- method public boolean isCommunalProfile();
+ method @FlaggedApi("android.multiuser.support_communal_profile") public boolean isCommunalProfile();
method public boolean isDemo();
method public boolean isEnabled();
method public boolean isEphemeral();
diff --git a/core/java/android/content/pm/UserInfo.java b/core/java/android/content/pm/UserInfo.java
index be586c3fb5c5..8fd78bd4276c 100644
--- a/core/java/android/content/pm/UserInfo.java
+++ b/core/java/android/content/pm/UserInfo.java
@@ -16,8 +16,6 @@
package android.content.pm;
-import static android.os.Flags.FLAG_ALLOW_PRIVATE_PROFILE;
-
import android.annotation.FlaggedApi;
import android.annotation.IntDef;
import android.annotation.NonNull;
@@ -389,11 +387,12 @@ public class UserInfo implements Parcelable {
return UserManager.isUserTypeCloneProfile(userType);
}
+ @FlaggedApi(android.multiuser.Flags.FLAG_SUPPORT_COMMUNAL_PROFILE)
public boolean isCommunalProfile() {
return UserManager.isUserTypeCommunalProfile(userType);
}
- @FlaggedApi(FLAG_ALLOW_PRIVATE_PROFILE)
+ @FlaggedApi(android.os.Flags.FLAG_ALLOW_PRIVATE_PROFILE)
public boolean isPrivateProfile() {
return UserManager.isUserTypePrivateProfile(userType);
}
diff --git a/services/core/java/com/android/server/pm/UserManagerService.java b/services/core/java/com/android/server/pm/UserManagerService.java
index 3430bb4dd7c2..534f17601b86 100644
--- a/services/core/java/com/android/server/pm/UserManagerService.java
+++ b/services/core/java/com/android/server/pm/UserManagerService.java
@@ -1282,7 +1282,9 @@ public class UserManagerService extends IUserManager.Stub {
*/
private boolean isSameUserOrProfileGroupOrTargetIsCommunal(UserInfo asker, UserInfo target) {
if (asker.id == target.id) return true;
- if (target.isCommunalProfile()) return true;
+ if (android.multiuser.Flags.supportCommunalProfile()) {
+ if (target.isCommunalProfile()) return true;
+ }
return (asker.profileGroupId != UserInfo.NO_PROFILE_GROUP_ID
&& asker.profileGroupId == target.profileGroupId);
}