Add UserManagerInternal method to get the main user id. am: 051f571479

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2378889

Change-Id: Iae56d74c01a1b65744b592c73b1009d6e1ae8802
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Oli Lan
2023-01-18 15:43:54 +00:00
committed by Automerger Merge Worker
2 changed files with 11 additions and 0 deletions

View File

@@ -305,4 +305,10 @@ public abstract class UserManagerInternal {
* for users that already existed on-disk from an older version of Android. * for users that already existed on-disk from an older version of Android.
*/ */
public abstract boolean shouldIgnorePrepareStorageErrors(int userId); 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();
} }

View File

@@ -6318,6 +6318,11 @@ public class UserManagerService extends IUserManager.Stub {
return userData != null && userData.getIgnorePrepareStorageErrors(); return userData != null && userData.getIgnorePrepareStorageErrors();
} }
} }
@Override
public @UserIdInt int getMainUserId() {
return UserHandle.USER_SYSTEM;
}
} }
/** /**