Create new system API in UserHandle to get uid
For the incoming connectivity mainline, it need to compute the intersection of a set of uids and appIds for the permission control. As @UserIdInt values are internal implementation details of the OS, any mainline modules should use strongly-typed UserHandle arguments. Thus, create a new API that accepts UserHandle and appId to get the computed uid. Bug: 170598012 Test: atest FrameworksNetTests Change-Id: I046546d2c5c76eac7a251e63e4234776975bf2bc
This commit is contained in:
@@ -294,6 +294,19 @@ public final class UserHandle implements Parcelable {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the uid that is composed from the userHandle and the appId.
|
||||
*
|
||||
* @param userHandle the UserHandle to compose the uid
|
||||
* @param appId the AppId to compose the uid
|
||||
* @return the uid that is composed from the userHandle and the appId
|
||||
* @hide
|
||||
*/
|
||||
@SystemApi
|
||||
public static int getUid(@NonNull UserHandle userHandle, @AppIdInt int appId) {
|
||||
return getUid(userHandle.getIdentifier(), appId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the app id (or base uid) for a given uid, stripping out the user id from it.
|
||||
* @hide
|
||||
|
||||
Reference in New Issue
Block a user