Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e4bf1245 authored by Robin Lee's avatar Robin Lee Committed by android-build-merger
Browse files

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

am: 174385a2

* commit '174385a2':
  Check if we're connected before marking a UID blocked

Change-Id: I31b69b3e7bb307c80c472941f57e480888918a34
parents 2c5bcc1b 174385a2
Loading
Loading
Loading
Loading
+15 −6
Original line number Diff line number Diff line
@@ -1055,12 +1055,20 @@ 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) {
        if (!mLockdown) {
            return false;
        }

        if (mNetworkInfo.isConnected()) {
            return !appliesToUid(uid);
        } else {
            for (UidRange uidRange : mBlockedUsers) {
                if (uidRange.contains(uid)) {
                    return true;
@@ -1068,6 +1076,7 @@ public class Vpn {
            }
            return false;
        }
    }

    private native int jniCreate(int mtu);
    private native String jniGetName(int tun);