summaryrefslogtreecommitdiff
path: root/core/java
diff options
context:
space:
mode:
authorChiachang Wang <chiachangwang@google.com>2021-02-08 04:30:03 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2021-02-08 04:30:03 +0000
commit8927357b276872ffb57018a53e7d674008820282 (patch)
treed4e13b25400142e9288bbf7674b87a5dadad0011 /core/java
parentfe5578dc35309959b4c97d88a61dd7d5b9d8ed8a (diff)
parentaf6494310dba8d51669c35dcf75809849a4f3b36 (diff)
Merge "Create new system API in UserHandle to get uid" am: af6494310d
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1573942 MUST ONLY BE SUBMITTED BY AUTOMERGER Change-Id: Ia8303c08be1e76ff48e60965518de4d469dc0352
Diffstat (limited to 'core/java')
-rw-r--r--core/java/android/os/UserHandle.java13
1 files changed, 13 insertions, 0 deletions
diff --git a/core/java/android/os/UserHandle.java b/core/java/android/os/UserHandle.java
index bef876f92a01..3d539a604b46 100644
--- a/core/java/android/os/UserHandle.java
+++ b/core/java/android/os/UserHandle.java
@@ -295,6 +295,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
*/