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

Commit 051f5714 authored by Oli Lan's avatar Oli Lan
Browse files

Add UserManagerInternal method to get the main user id.

This adds a method to get the id of the main user on the device.

Currently this always returns the id of the system user.

Bug: 256624031
Test: atest VpnManagerServiceTest (with topic)
Merged-In: Ib36f3b372f9bf33cbb097c4af63eb43515ac835b
Change-Id: I4aa0feb68083460c6aef917337e8bfc09a6788d4
parent ab810ba1
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -305,4 +305,10 @@ public abstract class UserManagerInternal {
     * for users that already existed on-disk from an older version of Android.
     */
    public abstract boolean shouldIgnorePrepareStorageErrors(int userId);

    /**
     * Returns the user id of the main user, or {@link android.os.UserHandle#USER_NULL} if there is
     * no main user.
     */
    public abstract @UserIdInt int getMainUserId();
}
+5 −0
Original line number Diff line number Diff line
@@ -6359,6 +6359,11 @@ public class UserManagerService extends IUserManager.Stub {
                return userData != null && userData.getIgnorePrepareStorageErrors();
            }
        }

        @Override
        public @UserIdInt int getMainUserId() {
            return UserHandle.USER_SYSTEM;
        }
    }

    /**