Merge "Check if we're connected before marking a UID blocked" into nyc-dev
This commit is contained in:
@@ -1055,18 +1055,27 @@ public class Vpn {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {@code true} if the set of users blocked whilst waiting for VPN to connect includes
|
* @return {@code true} if {@param uid} is blocked by an always-on VPN.
|
||||||
* the UID {@param uid}, {@code false} otherwise.
|
* A UID is blocked if it's included in one of the mBlockedUsers ranges and the VPN is
|
||||||
|
* not connected, or if the VPN is connected but does not apply to the UID.
|
||||||
*
|
*
|
||||||
* @see #mBlockedUsers
|
* @see #mBlockedUsers
|
||||||
*/
|
*/
|
||||||
public synchronized boolean isBlockingUid(int uid) {
|
public synchronized boolean isBlockingUid(int uid) {
|
||||||
for (UidRange uidRange : mBlockedUsers) {
|
if (!mLockdown) {
|
||||||
if (uidRange.contains(uid)) {
|
return false;
|
||||||
return true;
|
}
|
||||||
}
|
|
||||||
|
if (mNetworkInfo.isConnected()) {
|
||||||
|
return !appliesToUid(uid);
|
||||||
|
} else {
|
||||||
|
for (UidRange uidRange : mBlockedUsers) {
|
||||||
|
if (uidRange.contains(uid)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private native int jniCreate(int mtu);
|
private native int jniCreate(int mtu);
|
||||||
|
|||||||
Reference in New Issue
Block a user