diff options
| author | Jeff Davidson <jpd@google.com> | 2016-02-10 14:15:42 -0800 |
|---|---|---|
| committer | Jeff Davidson <jpd@google.com> | 2016-02-10 15:20:33 -0800 |
| commit | 48aa86bd0b30815f4c02561f713bd33b032ef2b7 (patch) | |
| tree | 4929769bfe7639c00d14df51549f72fe75ef2ed3 /core/java/android/os/UserHandle.java | |
| parent | f61a847881ad251593e15e322dae39cc9bd1cd10 (diff) | |
Expose APIs to analyze UIDs in UserHandle/Process.
Clients of the NetworkStatsManager public APIs may get UIDs belonging
to other users, and UIDs which don't actually represent applications.
These APIs allow clients to understand whether a given ID belongs to
the same user as themselves, and whether an ID represents an
application or something else (e.g. a system UID).
Change-Id: Ia56d5891521ce98e5594c41da8f9d756819deb66
Diffstat (limited to 'core/java/android/os/UserHandle.java')
| -rw-r--r-- | core/java/android/os/UserHandle.java | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/core/java/android/os/UserHandle.java b/core/java/android/os/UserHandle.java index 24666fe71724..b3f44536214b 100644 --- a/core/java/android/os/UserHandle.java +++ b/core/java/android/os/UserHandle.java @@ -130,6 +130,15 @@ public final class UserHandle implements Parcelable { } /** + * Returns the user for a given uid. + * @param uid A uid for an application running in a particular user. + * @return A {@link UserHandle} for that user. + */ + public static UserHandle getUserHandleForUid(int uid) { + return of(getUserId(uid)); + } + + /** * Returns the user id for a given uid. * @hide */ |
