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

Commit 1fa7680c authored by Xiaohui Chen's avatar Xiaohui Chen
Browse files

Add UserHandle.isSystem() api

This is added in order to deprecate the isOwner() api.

Bug: 24869636
Change-Id: I80a7a5559525faf261b9d9c7a8593e6ff5db4b22
parent 32ab05c8
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -25741,7 +25741,8 @@ package android.os {
    ctor public UserHandle(android.os.Parcel);
    method public int describeContents();
    method public int getIdentifier();
    method public boolean isOwner();
    method public deprecated boolean isOwner();
    method public boolean isSystem();
    method public static int myUserId();
    method public static android.os.UserHandle readFromParcel(android.os.Parcel);
    method public void writeToParcel(android.os.Parcel, int);
+12 −1
Original line number Diff line number Diff line
@@ -270,13 +270,24 @@ public final class UserHandle implements Parcelable {
     * Returns true if this UserHandle refers to the owner user; false otherwise.
     * @return true if this UserHandle refers to the owner user; false otherwise.
     * @hide
     * TODO: find an alternative to this Api.
     * @deprecated please use {@link #isSystem()} or check for
     * {@link android.content.pm.UserInfo#isPrimary()}
     * {@link android.content.pm.UserInfo#isAdmin()} based on your particular use case.
     */
    @SystemApi
    public boolean isOwner() {
        return this.equals(OWNER);
    }

    /**
     * @return true if this UserHandle refers to the system user; false otherwise.
     * @hide
     */
    @SystemApi
    public boolean isSystem() {
        return this.equals(SYSTEM);
    }

    /** @hide */
    public UserHandle(int h) {
        mHandle = h;