Merge "Expose APIs to analyze UIDs in UserHandle/Process." into nyc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
7f036f8bce
@@ -29062,6 +29062,7 @@ package android.os {
|
||||
method public static final int getThreadPriority(int) throws java.lang.IllegalArgumentException;
|
||||
method public static final int getUidForName(java.lang.String);
|
||||
method public static final boolean is64Bit();
|
||||
method public static boolean isApplicationUid(int);
|
||||
method public static final void killProcess(int);
|
||||
method public static final int myPid();
|
||||
method public static final int myTid();
|
||||
@@ -29242,6 +29243,7 @@ package android.os {
|
||||
public final class UserHandle implements android.os.Parcelable {
|
||||
ctor public UserHandle(android.os.Parcel);
|
||||
method public int describeContents();
|
||||
method public static android.os.UserHandle getUserHandleForUid(int);
|
||||
method public static android.os.UserHandle readFromParcel(android.os.Parcel);
|
||||
method public void writeToParcel(android.os.Parcel, int);
|
||||
method public static void writeToParcel(android.os.UserHandle, android.os.Parcel);
|
||||
|
||||
@@ -31355,6 +31355,7 @@ package android.os {
|
||||
method public static final int getThreadPriority(int) throws java.lang.IllegalArgumentException;
|
||||
method public static final int getUidForName(java.lang.String);
|
||||
method public static final boolean is64Bit();
|
||||
method public static boolean isApplicationUid(int);
|
||||
method public static final void killProcess(int);
|
||||
method public static final int myPid();
|
||||
method public static final int myTid();
|
||||
@@ -31581,6 +31582,7 @@ package android.os {
|
||||
ctor public UserHandle(android.os.Parcel);
|
||||
method public int describeContents();
|
||||
method public int getIdentifier();
|
||||
method public static android.os.UserHandle getUserHandleForUid(int);
|
||||
method public deprecated boolean isOwner();
|
||||
method public boolean isSystem();
|
||||
method public static int myUserId();
|
||||
|
||||
@@ -29071,6 +29071,7 @@ package android.os {
|
||||
method public static final int getThreadPriority(int) throws java.lang.IllegalArgumentException;
|
||||
method public static final int getUidForName(java.lang.String);
|
||||
method public static final boolean is64Bit();
|
||||
method public static boolean isApplicationUid(int);
|
||||
method public static final void killProcess(int);
|
||||
method public static final int myPid();
|
||||
method public static final int myTid();
|
||||
@@ -29252,6 +29253,7 @@ package android.os {
|
||||
ctor public UserHandle(android.os.Parcel);
|
||||
method public int describeContents();
|
||||
method public static int getAppId(int);
|
||||
method public static android.os.UserHandle getUserHandleForUid(int);
|
||||
method public static android.os.UserHandle readFromParcel(android.os.Parcel);
|
||||
method public void writeToParcel(android.os.Parcel, int);
|
||||
method public static void writeToParcel(android.os.UserHandle, android.os.Parcel);
|
||||
|
||||
@@ -822,6 +822,16 @@ public class Process {
|
||||
return UserHandle.of(UserHandle.getUserId(myUid()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether the given uid belongs to an application.
|
||||
* @param uid A kernel uid.
|
||||
* @return Whether the uid corresponds to an application sandbox running in
|
||||
* a specific user.
|
||||
*/
|
||||
public static boolean isApplicationUid(int uid) {
|
||||
return UserHandle.isApp(uid);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether the current process is in an isolated sandbox.
|
||||
* @hide
|
||||
|
||||
@@ -129,6 +129,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
|
||||
|
||||
Reference in New Issue
Block a user