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

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

Change-Id: I9fb10b4098e33563b94222bba5aaa91520fd4acb
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Oli Lan
2023-01-18 16:14:00 +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.
*/
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

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