Show a disclaimer about enabling vpn lockdown

Lockdown is now the default option, not best-effort mode. It's easier
to shoot oneself in the foot now so we'll show a warning to explain that
before switching it on.

Bug: 29052115
Bug: 29076208
Test: com.android.settings.vpn2.AppSettingsTest
Change-Id: Ia6845e6a7d57baa5476b8a021fb1255fd74aabea
This commit is contained in:
Robin Lee
2016-07-05 10:21:28 +01:00
parent 0cff709a0d
commit b6f787c4df
6 changed files with 263 additions and 92 deletions

View File

@@ -158,7 +158,7 @@ public class AppDialogFragment extends InstrumentedDialogFragment implements App
}
final int userId = getUserId();
try {
if (mPackageInfo.packageName.equals(getConnectedPackage(mService, userId))) {
if (mPackageInfo.packageName.equals(VpnUtils.getConnectedPackage(mService, userId))) {
mService.setAlwaysOnVpnPackage(userId, null, /* lockdownEnabled */ false);
mService.prepareVpn(mPackageInfo.packageName, VpnConfig.LEGACY_VPN, userId);
}
@@ -176,10 +176,4 @@ public class AppDialogFragment extends InstrumentedDialogFragment implements App
private int getUserId() {
return UserHandle.getUserId(mPackageInfo.applicationInfo.uid);
}
private static String getConnectedPackage(IConnectivityManager service, final int userId)
throws RemoteException {
final VpnConfig config = service.getVpnConfig(userId);
return config != null ? config.user : null;
}
}