Merge "Check if we\'re connected before marking a UID blocked" into nyc-dev am: 33154deb70 am: 6c3cb2c392

am: 642d137d8c

* commit '642d137d8c924d32e9c92effd77db89644f438c4':
  Check if we're connected before marking a UID blocked

Change-Id: Iac1d2387efe0bfebf4c77a76f0cbb977036c6ed1
This commit is contained in:
Robin Lee
2016-05-27 03:08:11 +00:00
committed by android-build-merger

View File

@@ -1055,18 +1055,27 @@ public class Vpn {
}
/**
* @return {@code true} if the set of users blocked whilst waiting for VPN to connect includes
* the UID {@param uid}, {@code false} otherwise.
* @return {@code true} if {@param uid} is blocked by an always-on VPN.
* 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
*/
public synchronized boolean isBlockingUid(int uid) {
for (UidRange uidRange : mBlockedUsers) {
if (uidRange.contains(uid)) {
return true;
}
if (!mLockdown) {
return false;
}
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);