Make some of the UID-based VPN code reusable

By changing some member refs into arguments and having one of the
functions create the UID range instead of adding to mVpnUsers.

This will be useful for other layers of UID filtering like having
UIDs explicitly blocked from the VPN.

Deleted one broken line of code that cleared the status intent when
a restricted profile is removed. Other than that, this commit shouldn't
change any behaviour. If it does, that's a bug.

Bug: 26694104
Change-Id: Ieb656835d3282a8ba63cc3f12a80bfae166bcf44
This commit is contained in:
Robin Lee 2016-05-09 12:32:27 +01:00
commit 722ee0bb43

View file

@ -48,6 +48,17 @@ public final class UidRange implements Parcelable {
return start / PER_USER_RANGE;
}
public boolean contains(int uid) {
return start <= uid && uid <= stop;
}
/**
* @return {@code true} if this range contains every UID contained by the {@param other} range.
*/
public boolean containsRange(UidRange other) {
return start <= other.start && other.stop <= stop;
}
@Override
public int hashCode() {
int result = 17;