Merge "No-op refactoring of VPN lockdown status check." am: f694edec6f

am: 436343f70d

Change-Id: I4e5609af2b23b333908732a1a12cb6e97815edcc
This commit is contained in:
Junyu Lai
2018-10-25 22:59:57 -07:00
committed by android-build-merger
2 changed files with 6 additions and 4 deletions

View File

@@ -1143,7 +1143,7 @@ public class ConnectivityService extends IConnectivityManager.Stub
}
synchronized (mVpns) {
final Vpn vpn = mVpns.get(UserHandle.getUserId(uid));
if (vpn != null && vpn.isBlockingUid(uid)) {
if (vpn != null && vpn.getLockdown() && vpn.isBlockingUid(uid)) {
return true;
}
}
@@ -1736,7 +1736,7 @@ public class ConnectivityService extends IConnectivityManager.Stub
// list all state depending on the return value of this function has to be recomputed.
// TODO: add a trigger when the always-on VPN sets its blocked UIDs to reevaluate and
// send the necessary onBlockedStatusChanged callbacks.
if (vpn != null && vpn.isBlockingUid(uid)) {
if (vpn != null && vpn.getLockdown() && vpn.isBlockingUid(uid)) {
return true;
}
}

View File

@@ -507,13 +507,15 @@ public class VpnTest {
private static void assertBlocked(Vpn vpn, int... uids) {
for (int uid : uids) {
assertTrue("Uid " + uid + " should be blocked", vpn.isBlockingUid(uid));
final boolean blocked = vpn.getLockdown() && vpn.isBlockingUid(uid);
assertTrue("Uid " + uid + " should be blocked", blocked);
}
}
private static void assertUnblocked(Vpn vpn, int... uids) {
for (int uid : uids) {
assertFalse("Uid " + uid + " should not be blocked", vpn.isBlockingUid(uid));
final boolean blocked = vpn.getLockdown() && vpn.isBlockingUid(uid);
assertFalse("Uid " + uid + " should not be blocked", blocked);
}
}