Search in sources :

Example 1 with LegacyVpnInfo

use of com.android.internal.net.LegacyVpnInfo in project platform_frameworks_base by android.

the class SecurityControllerImpl method updateState.

private void updateState() {
    // Find all users with an active VPN
    SparseArray<VpnConfig> vpns = new SparseArray<>();
    try {
        for (UserInfo user : mUserManager.getUsers()) {
            VpnConfig cfg = mConnectivityManagerService.getVpnConfig(user.id);
            if (cfg == null) {
                continue;
            } else if (cfg.legacy) {
                // Legacy VPNs should do nothing if the network is disconnected. Third-party
                // VPN warnings need to continue as traffic can still go to the app.
                LegacyVpnInfo legacyVpn = mConnectivityManagerService.getLegacyVpnInfo(user.id);
                if (legacyVpn == null || legacyVpn.state != LegacyVpnInfo.STATE_CONNECTED) {
                    continue;
                }
            }
            vpns.put(user.id, cfg);
        }
    } catch (RemoteException rme) {
        // Roll back to previous state
        Log.e(TAG, "Unable to list active VPNs", rme);
        return;
    }
    mCurrentVpns = vpns;
}
Also used : SparseArray(android.util.SparseArray) VpnConfig(com.android.internal.net.VpnConfig) LegacyVpnInfo(com.android.internal.net.LegacyVpnInfo) UserInfo(android.content.pm.UserInfo) RemoteException(android.os.RemoteException)

Example 2 with LegacyVpnInfo

use of com.android.internal.net.LegacyVpnInfo in project platform_frameworks_base by android.

the class Vpn method getLegacyVpnInfoPrivileged.

/**
     * Return the information of the current ongoing legacy VPN.
     * Callers are responsible for checking permissions if needed.
     */
public synchronized LegacyVpnInfo getLegacyVpnInfoPrivileged() {
    if (mLegacyVpnRunner == null)
        return null;
    final LegacyVpnInfo info = new LegacyVpnInfo();
    info.key = mConfig.user;
    info.state = LegacyVpnInfo.stateFromNetworkInfo(mNetworkInfo);
    if (mNetworkInfo.isConnected()) {
        info.intent = mStatusIntent;
    }
    return info;
}
Also used : LegacyVpnInfo(com.android.internal.net.LegacyVpnInfo)

Example 3 with LegacyVpnInfo

use of com.android.internal.net.LegacyVpnInfo in project android_frameworks_base by DirtyUnicorns.

the class SecurityControllerImpl method updateState.

private void updateState() {
    // Find all users with an active VPN
    SparseArray<VpnConfig> vpns = new SparseArray<>();
    try {
        for (UserInfo user : mUserManager.getUsers()) {
            VpnConfig cfg = mConnectivityManagerService.getVpnConfig(user.id);
            if (cfg == null) {
                continue;
            } else if (cfg.legacy) {
                // Legacy VPNs should do nothing if the network is disconnected. Third-party
                // VPN warnings need to continue as traffic can still go to the app.
                LegacyVpnInfo legacyVpn = mConnectivityManagerService.getLegacyVpnInfo(user.id);
                if (legacyVpn == null || legacyVpn.state != LegacyVpnInfo.STATE_CONNECTED) {
                    continue;
                }
            }
            vpns.put(user.id, cfg);
        }
    } catch (RemoteException rme) {
        // Roll back to previous state
        Log.e(TAG, "Unable to list active VPNs", rme);
        return;
    }
    mCurrentVpns = vpns;
}
Also used : SparseArray(android.util.SparseArray) VpnConfig(com.android.internal.net.VpnConfig) LegacyVpnInfo(com.android.internal.net.LegacyVpnInfo) UserInfo(android.content.pm.UserInfo) RemoteException(android.os.RemoteException)

Example 4 with LegacyVpnInfo

use of com.android.internal.net.LegacyVpnInfo in project android_frameworks_base by ResurrectionRemix.

the class SecurityControllerImpl method updateState.

private void updateState() {
    // Find all users with an active VPN
    SparseArray<VpnConfig> vpns = new SparseArray<>();
    try {
        for (UserInfo user : mUserManager.getUsers()) {
            VpnConfig cfg = mConnectivityManagerService.getVpnConfig(user.id);
            if (cfg == null) {
                continue;
            } else if (cfg.legacy) {
                // Legacy VPNs should do nothing if the network is disconnected. Third-party
                // VPN warnings need to continue as traffic can still go to the app.
                LegacyVpnInfo legacyVpn = mConnectivityManagerService.getLegacyVpnInfo(user.id);
                if (legacyVpn == null || legacyVpn.state != LegacyVpnInfo.STATE_CONNECTED) {
                    continue;
                }
            }
            vpns.put(user.id, cfg);
        }
    } catch (RemoteException rme) {
        // Roll back to previous state
        Log.e(TAG, "Unable to list active VPNs", rme);
        return;
    }
    mCurrentVpns = vpns;
}
Also used : SparseArray(android.util.SparseArray) VpnConfig(com.android.internal.net.VpnConfig) LegacyVpnInfo(com.android.internal.net.LegacyVpnInfo) UserInfo(android.content.pm.UserInfo) RemoteException(android.os.RemoteException)

Example 5 with LegacyVpnInfo

use of com.android.internal.net.LegacyVpnInfo in project android_frameworks_base by ResurrectionRemix.

the class Vpn method getLegacyVpnInfoPrivileged.

/**
     * Return the information of the current ongoing legacy VPN.
     * Callers are responsible for checking permissions if needed.
     */
public synchronized LegacyVpnInfo getLegacyVpnInfoPrivileged() {
    if (mLegacyVpnRunner == null)
        return null;
    final LegacyVpnInfo info = new LegacyVpnInfo();
    info.key = mConfig.user;
    info.state = LegacyVpnInfo.stateFromNetworkInfo(mNetworkInfo);
    if (mNetworkInfo.isConnected()) {
        info.intent = mStatusIntent;
    }
    return info;
}
Also used : LegacyVpnInfo(com.android.internal.net.LegacyVpnInfo)

Aggregations

LegacyVpnInfo (com.android.internal.net.LegacyVpnInfo)14 RemoteException (android.os.RemoteException)6 UserInfo (android.content.pm.UserInfo)5 SparseArray (android.util.SparseArray)5 VpnConfig (com.android.internal.net.VpnConfig)5 Bundle (android.os.Bundle)1 InstrumentationTestRunner (android.test.InstrumentationTestRunner)1 File (java.io.File)1 FileInputStream (java.io.FileInputStream)1 InputStream (java.io.InputStream)1 Map (java.util.Map)1