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
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
@@ -6359,6 +6359,11 @@ public class UserManagerService extends IUserManager.Stub {
|
||||
return userData != null && userData.getIgnorePrepareStorageErrors();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public @UserIdInt int getMainUserId() {
|
||||
return UserHandle.USER_SYSTEM;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user