Merge "Revert "Block incoming non-VPN packets to apps under fully-routed VPN""
This commit is contained in:
commit
27a60a1aff
2 changed files with 113 additions and 748 deletions
|
|
@ -822,11 +822,6 @@ public final class NetworkCapabilities implements Parcelable {
|
|||
mEstablishingVpnAppUid = uid;
|
||||
}
|
||||
|
||||
/** @hide */
|
||||
public int getEstablishingVpnAppUid() {
|
||||
return mEstablishingVpnAppUid;
|
||||
}
|
||||
|
||||
/**
|
||||
* Value indicating that link bandwidth is unspecified.
|
||||
* @hide
|
||||
|
|
|
|||
|
|
@ -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