Add L2TP secret, L2TP/IPSec PSK support. Fix screen orientation.
* Changes
+ Add L2tpActor, L2tpEditor, L2tpIpsecPskActor.
+ Make L2tpIpsecEditor extend L2tpEditor.
+ Revise the code for saving username. Make
VpnSettings.saveProfileToStorage() static.
+ Fix support for screen orientation change in both VpnSettings and
VpnEditor.
Patch Set 2:
+ Remove Util.isNullOrEmpty(). Use TextUtils.isEmpty() instead.
+ Remove unused imports. Wrap lines longer than 80 chars.
Patch Set 3:
+ Fix all the strings according to UI feedback.
+ Remove all the added actor subclasses and move password to editor.
+ Remove VPN entry in Security & location.
Patch Set 4:
+ Misc string fixes.
Patch Set 5:
+ Add strings for credential storage settings.
+ Changed the error dialog icon.
+ Fix "Remember me" indentation in connect dialog.
Patch Set 6:
+ resolve res/values/strings.xml
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2007 The Android Open Source Project
|
||||
* Copyright (C) 2009 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -25,11 +25,12 @@ import android.preference.ListPreference;
|
||||
import android.preference.Preference;
|
||||
import android.preference.PreferenceGroup;
|
||||
import android.security.Keystore;
|
||||
import android.text.TextUtils;
|
||||
|
||||
/**
|
||||
* The class for editing {@link L2tpIpsecProfile}.
|
||||
*/
|
||||
class L2tpIpsecEditor extends VpnProfileEditor {
|
||||
class L2tpIpsecEditor extends L2tpEditor {
|
||||
private static final String TAG = L2tpIpsecEditor.class.getSimpleName();
|
||||
|
||||
private ListPreference mUserCertificate;
|
||||
@@ -44,23 +45,22 @@ class L2tpIpsecEditor extends VpnProfileEditor {
|
||||
|
||||
@Override
|
||||
protected void loadExtraPreferencesTo(PreferenceGroup subpanel) {
|
||||
super.loadExtraPreferencesTo(subpanel);
|
||||
Context c = subpanel.getContext();
|
||||
subpanel.addPreference(createUserCertificatePreference(c));
|
||||
subpanel.addPreference(createCaCertificatePreference(c));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String validate(Context c) {
|
||||
String result = super.validate(c);
|
||||
if (result != null) {
|
||||
return result;
|
||||
} else if (Util.isNullOrEmpty(mUserCertificate.getValue())) {
|
||||
return c.getString(R.string.vpn_error_user_certificate_not_selected);
|
||||
} else if (Util.isNullOrEmpty(mCaCertificate.getValue())) {
|
||||
return c.getString(R.string.vpn_error_ca_certificate_not_selected);
|
||||
} else {
|
||||
return null;
|
||||
public String validate() {
|
||||
String result = super.validate();
|
||||
if (result == null) {
|
||||
result = validate(mUserCertificate, R.string.vpn_user_certificate);
|
||||
}
|
||||
if (result == null) {
|
||||
result = validate(mCaCertificate, R.string.vpn_ca_certificate);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private Preference createUserCertificatePreference(Context c) {
|
||||
@@ -72,9 +72,13 @@ class L2tpIpsecEditor extends VpnProfileEditor {
|
||||
public boolean onPreferenceChange(
|
||||
Preference pref, Object newValue) {
|
||||
mProfile.setUserCertificate((String) newValue);
|
||||
return onPreferenceChangeCommon(pref, newValue);
|
||||
setSummary(pref, R.string.vpn_user_certificate,
|
||||
(String) newValue);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
setSummary(mUserCertificate, R.string.vpn_user_certificate,
|
||||
mProfile.getUserCertificate());
|
||||
return mUserCertificate;
|
||||
}
|
||||
|
||||
@@ -87,9 +91,13 @@ class L2tpIpsecEditor extends VpnProfileEditor {
|
||||
public boolean onPreferenceChange(
|
||||
Preference pref, Object newValue) {
|
||||
mProfile.setCaCertificate((String) newValue);
|
||||
return onPreferenceChangeCommon(pref, newValue);
|
||||
setSummary(pref, R.string.vpn_ca_certificate,
|
||||
(String) newValue);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
setSummary(mCaCertificate, R.string.vpn_ca_certificate,
|
||||
mProfile.getCaCertificate());
|
||||
return mCaCertificate;
|
||||
}
|
||||
|
||||
@@ -103,13 +111,7 @@ class L2tpIpsecEditor extends VpnProfileEditor {
|
||||
pref.setEntries(keys);
|
||||
pref.setEntryValues(keys);
|
||||
pref.setValue(text);
|
||||
pref.setSummary(checkNull(text, c));
|
||||
pref.setOnPreferenceChangeListener(listener);
|
||||
return pref;
|
||||
}
|
||||
|
||||
private boolean onPreferenceChangeCommon(Preference pref, Object newValue) {
|
||||
pref.setSummary(checkNull(newValue.toString(), pref.getContext()));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user