Use UserHandle#getIdentifier to get the userid
UidRange uses PER_USER_RANGE to calculate and get the userid, but PER_USER_RANGE is a hidden API, so use getIdentifier to get the userid instead. Bug: 170598012 Test: atest FrameworksNetTests:UidRangeTest Change-Id: I06ab0f2da8a33d2b718bbc3a609d3d6a5fe0a095
This commit is contained in:
@@ -52,12 +52,12 @@ public final class UidRange implements Parcelable {
|
|||||||
|
|
||||||
/** Returns the smallest user Id which is contained in this UidRange */
|
/** Returns the smallest user Id which is contained in this UidRange */
|
||||||
public int getStartUser() {
|
public int getStartUser() {
|
||||||
return start / PER_USER_RANGE;
|
return UserHandle.getUserHandleForUid(start).getIdentifier();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Returns the largest user Id which is contained in this UidRange */
|
/** Returns the largest user Id which is contained in this UidRange */
|
||||||
public int getEndUser() {
|
public int getEndUser() {
|
||||||
return stop / PER_USER_RANGE;
|
return UserHandle.getUserHandleForUid(stop).getIdentifier();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean contains(int uid) {
|
public boolean contains(int uid) {
|
||||||
|
|||||||
Reference in New Issue
Block a user