Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5b7fd1af authored by Clara Thomas's avatar Clara Thomas Committed by Android (Google) Code Review
Browse files

Merge "Add the supervision profile type." into main

parents bf2ab13a 44216415
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -11725,6 +11725,7 @@ package android.os {
    field public static final String USER_TYPE_FULL_GUEST = "android.os.usertype.full.GUEST";
    field public static final String USER_TYPE_FULL_SECONDARY = "android.os.usertype.full.SECONDARY";
    field public static final String USER_TYPE_FULL_SYSTEM = "android.os.usertype.full.SYSTEM";
    field @FlaggedApi("android.multiuser.allow_supervising_profile") public static final String USER_TYPE_PROFILE_SUPERVISING = "android.os.usertype.profile.SUPERVISING";
    field public static final String USER_TYPE_SYSTEM_HEADLESS = "android.os.usertype.system.HEADLESS";
  }
+1 −0
Original line number Diff line number Diff line
@@ -1199,6 +1199,7 @@ package android.content.pm {
    method public boolean isProfile();
    method public boolean isQuietModeEnabled();
    method public boolean isRestricted();
    method @FlaggedApi("android.multiuser.allow_supervising_profile") public boolean isSupervisingProfile();
    method public boolean supportsSwitchTo();
    method @Deprecated public boolean supportsSwitchToByUser();
    method public void writeToParcel(android.os.Parcel, int);
+5 −0
Original line number Diff line number Diff line
@@ -410,6 +410,11 @@ public class UserInfo implements Parcelable {
        return UserManager.isUserTypePrivateProfile(userType);
    }

    @FlaggedApi(android.multiuser.Flags.FLAG_ALLOW_SUPERVISING_PROFILE)
    public boolean isSupervisingProfile() {
        return UserManager.isUserTypeSupervisingProfile(userType);
    }

    /** See {@link #FLAG_DISABLED}*/
    @UnsupportedAppUsage
    public boolean isEnabled() {
+7 −0
Original line number Diff line number Diff line
@@ -629,3 +629,10 @@ flag {
    description: "Enable moving content into the Private Space"
    bug: "360066001"
}

flag {
    name: "allow_supervising_profile"
    namespace: "supervision"
    description: "Enables support for new supervising user type"
    bug: "389712089"
}
+29 −0
Original line number Diff line number Diff line
@@ -208,6 +208,23 @@ public class UserManager {
     */
    public static final String USER_TYPE_PROFILE_COMMUNAL = "android.os.usertype.profile.COMMUNAL";

    /**
     * User type representing a user who manages supervision on the device.
     * When any full user on the device is supervised, the credentials for this profile will be
     * required in order to perform certain actions for that user (i.e. those controlled by
     * {@link android.app.supervision.SupervisionManager} or the
     * {@link android.app.role.RoleManager#ROLE_SYSTEM_SUPERVISION supervision role holder}).
     * There can only be one supervising profile per device, and the credentials set for that
     * profile will be used to authorize actions for any supervised user on the device. This is
     * distinct from a managed profile in that it functions only to authorize certain supervised
     * actions; it does not represent the user to which restriction or management is applied.
     * @hide
     */
    @FlaggedApi(android.multiuser.Flags.FLAG_ALLOW_SUPERVISING_PROFILE)
    @SystemApi
    public static final String USER_TYPE_PROFILE_SUPERVISING =
            "android.os.usertype.profile.SUPERVISING";

    /**
     * User type representing a {@link UserHandle#USER_SYSTEM system} user that is <b>not</b> a
     * human user.
@@ -3225,6 +3242,18 @@ public class UserManager {
        return USER_TYPE_PROFILE_PRIVATE.equals(userType);
    }

    /**
     * Returns whether the user type is a
     * {@link UserManager#USER_TYPE_PROFILE_SUPERVISING supervising profile}.
     *
     * @hide
     */
    @FlaggedApi(android.multiuser.Flags.FLAG_ALLOW_SUPERVISING_PROFILE)
    @android.ravenwood.annotation.RavenwoodKeep
    public static boolean isUserTypeSupervisingProfile(@Nullable String userType) {
        return USER_TYPE_PROFILE_SUPERVISING.equals(userType);
    }

    /**
     * @hide
     * @deprecated Use {@link #isRestrictedProfile()}
Loading