use of com.android.internal.net.LegacyVpnInfo in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class ConfigDialogFragment method disconnect.
private void disconnect(VpnProfile profile) {
try {
LegacyVpnInfo connected = mService.getLegacyVpnInfo(UserHandle.myUserId());
if (connected != null && profile.key.equals(connected.key)) {
VpnUtils.clearLockdownVpn(getContext());
mService.prepareVpn(VpnConfig.LEGACY_VPN, VpnConfig.LEGACY_VPN, UserHandle.myUserId());
}
} catch (RemoteException e) {
Log.e(TAG, "Failed to disconnect", e);
}
}
use of com.android.internal.net.LegacyVpnInfo in project android_frameworks_base by crdroidandroid.
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;
}
use of com.android.internal.net.LegacyVpnInfo in project android_frameworks_base by ParanoidAndroid.
the class Vpn method getLegacyVpnInfo.
/**
* Return the information of the current ongoing legacy VPN.
*/
public synchronized LegacyVpnInfo getLegacyVpnInfo() {
// Check if the caller is authorized.
enforceControlPermission();
if (mLegacyVpnRunner == null)
return null;
final LegacyVpnInfo info = new LegacyVpnInfo();
info.key = mLegacyVpnRunner.mConfig.user;
info.state = LegacyVpnInfo.stateFromNetworkInfo(mNetworkInfo);
if (mNetworkInfo.isConnected()) {
info.intent = mStatusIntent;
}
return info;
}
use of com.android.internal.net.LegacyVpnInfo in project android_frameworks_base by AOSPA.
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;
}
use of com.android.internal.net.LegacyVpnInfo in project android_frameworks_base by AOSPA.
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;
}
Aggregations