Vpn settings per vpn

This CL adds a setting for each VPN
- When no_config_vpn user restriction is applied, user can't change anything in the page
- Launch the subsetting activity in the corresponding user to unlock keystore and force work challenge
- Show dialog when user replace always-on-VPN package
- When forget VPN, unset always-on-vpn

TODO: show per-VPN status in VPN list

Change-Id: Ica360ea44117db6a4ecfaed1eec6c188189c246c
This commit is contained in:
Victor Chang
2016-03-11 19:44:56 +00:00
parent e580f94079
commit 16da2aa450
8 changed files with 397 additions and 20 deletions

View File

@@ -71,14 +71,9 @@ public class LockdownConfigFragment extends DialogFragment {
dialog.show(parent.getFragmentManager(), TAG_LOCKDOWN);
}
private static String getStringOrNull(KeyStore keyStore, String key) {
final byte[] value = keyStore.get(key);
return value == null ? null : new String(value);
}
private void initProfiles(KeyStore keyStore, Resources res) {
final ConnectivityManager cm = ConnectivityManager.from(getActivity());
final String lockdownKey = getStringOrNull(keyStore, Credentials.LOCKDOWN_VPN);
final String lockdownKey = VpnUtils.getLockdownVpn();
final String alwaysOnPackage = cm.getAlwaysOnVpnPackageForUser(UserHandle.myUserId());
// Legacy VPN has a separate always-on mechanism which takes over the whole device, so