Implement always-on VPN separate lockdown setting
Allows Settings to control whether always-on VPN is required for the connection to complete, or if it is offered on a best-efforts basis. Change-Id: I5eb273a99e7559adc66b05e647c9130a819f99d4 Test: runtest -x tests/app/src/com/android/settings/vpn2/VpnTests.java Fix: 32420810
This commit is contained in:
@@ -134,9 +134,9 @@ public class ConfigDialogFragment extends InstrumentedDialogFragment implements
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConfirmLockdown(Bundle options, boolean isEnabled) {
|
||||
public void onConfirmLockdown(Bundle options, boolean isAlwaysOn, boolean isLockdown) {
|
||||
VpnProfile profile = (VpnProfile) options.getParcelable(ARG_PROFILE);
|
||||
connect(profile, isEnabled);
|
||||
connect(profile, isAlwaysOn);
|
||||
dismiss();
|
||||
}
|
||||
|
||||
@@ -149,14 +149,15 @@ public class ConfigDialogFragment extends InstrumentedDialogFragment implements
|
||||
// Possibly throw up a dialog to explain lockdown VPN.
|
||||
final boolean shouldLockdown = dialog.isVpnAlwaysOn();
|
||||
final boolean shouldConnect = shouldLockdown || !dialog.isEditing();
|
||||
final boolean wasAlwaysOn = VpnUtils.isAlwaysOnOrLegacyLockdownActive(mContext);
|
||||
final boolean wasLockdown = VpnUtils.isAnyLockdownActive(mContext);
|
||||
try {
|
||||
final boolean replace = VpnUtils.isVpnActive(mContext);
|
||||
if (shouldConnect && !isConnected(profile) &&
|
||||
ConfirmLockdownFragment.shouldShow(replace, wasAlwaysOn, shouldLockdown)) {
|
||||
ConfirmLockdownFragment.shouldShow(replace, wasLockdown, shouldLockdown)) {
|
||||
final Bundle opts = new Bundle();
|
||||
opts.putParcelable(ARG_PROFILE, profile);
|
||||
ConfirmLockdownFragment.show(this, replace, wasAlwaysOn, shouldLockdown, opts);
|
||||
ConfirmLockdownFragment.show(this, replace, /* alwaysOn */ shouldLockdown,
|
||||
/* from */ wasLockdown, /* to */ shouldLockdown, opts);
|
||||
} else if (shouldConnect) {
|
||||
connect(profile, shouldLockdown);
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user