Merge "Revert "Block incoming non-VPN packets to apps under fully-routed VPN"" am: 01bfd9e510
am: f7fe1ac9c4
Change-Id: I3e1c408fcfc14db8b2586a79416233ffe9e1173d
This commit is contained in:
commit
f2654ce048
1 changed files with 113 additions and 748 deletions
|
|
@ -21,8 +21,6 @@ import static android.os.UserHandle.PER_USER_RANGE;
|
|||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* An inclusive range of UIDs.
|
||||
*
|
||||
|
|
@ -44,16 +42,10 @@ public final class UidRange implements Parcelable {
|
|||
return new UidRange(userId * PER_USER_RANGE, (userId + 1) * PER_USER_RANGE - 1);
|
||||
}
|
||||
|
||||
/** Returns the smallest user Id which is contained in this UidRange */
|
||||
public int getStartUser() {
|
||||
return start / PER_USER_RANGE;
|
||||
}
|
||||
|
||||
/** Returns the largest user Id which is contained in this UidRange */
|
||||
public int getEndUser() {
|
||||
return stop / PER_USER_RANGE;
|
||||
}
|
||||
|
||||
public boolean contains(int uid) {
|
||||
return start <= uid && uid <= stop;
|
||||
}
|
||||
|
|
@ -125,23 +117,4 @@ public final class UidRange implements Parcelable {
|
|||
return new UidRange[size];
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns whether any of the UidRange in the collection contains the specified uid
|
||||
*
|
||||
* @param ranges The collection of UidRange to check
|
||||
* @param uid the uid in question
|
||||
* @return {@code true} if the uid is contained within the ranges, {@code false} otherwise
|
||||
*
|
||||
* @see UidRange#contains(int)
|
||||
*/
|
||||
public static boolean containsUid(Collection<UidRange> ranges, int uid) {
|
||||
if (ranges == null) return false;
|
||||
for (UidRange range : ranges) {
|
||||
if (range.contains(uid)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue