Merge "Add instruction video to Screen Magnification a.k.a. Tap to Zoom screen."
diff --git a/res/layout/wifi_dialog.xml b/res/layout/wifi_dialog.xml
index bce8fb0..c5e554d 100644
--- a/res/layout/wifi_dialog.xml
+++ b/res/layout/wifi_dialog.xml
@@ -107,7 +107,7 @@
android:prompt="@string/wifi_eap_method"
android:entries="@array/wifi_eap_method" />
</LinearLayout>
-
+
<LinearLayout android:id="@+id/l_phase2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
@@ -145,6 +145,18 @@
android:prompt="@string/wifi_eap_ca_cert" />
</LinearLayout>
+ <LinearLayout android:id="@+id/no_ca_cert_warning"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:visibility="gone"
+ style="@style/wifi_item" >
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ style="@style/wifi_item_warning"
+ android:text="@string/wifi_do_not_validate_eap_server_warning" />
+ </LinearLayout>
+
<LinearLayout android:id="@+id/l_user_cert"
android:layout_width="match_parent"
android:layout_height="wrap_content"
@@ -301,7 +313,7 @@
android:layout_height="wrap_content"
style="@style/wifi_section"
android:visibility="gone">
- <LinearLayout
+ <LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
style="@style/wifi_item">
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 364a2ea..399db32 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -1636,9 +1636,15 @@
<!-- Hint for unchanged fields -->
<string name="wifi_unchanged">(unchanged)</string>
<!-- Hint for unspecified fields -->
- <string name="wifi_unspecified">(unspecified)</string>
+ <string name="wifi_unspecified">Please select</string>
<!-- Hint for multiple certificates being added to the configuration -->
<string name="wifi_multiple_cert_added">(Multiple certificates added)</string>
+ <!-- Menu option for not providing an EAP user certificate -->
+ <string name="wifi_do_not_provide_eap_user_cert">Do not provide</string>
+ <!-- Menu option for not validating the EAP server -->
+ <string name="wifi_do_not_validate_eap_server">Do not validate</string>
+ <!-- Warning message displayed if user choses not to validate the EAP server -->
+ <string name="wifi_do_not_validate_eap_server_warning">No certificate specified. Your connection will not be private.</string>
<!-- Substring of status line when Wi-Fi Protected Setup (WPS) is available and
string is listed first [CHAR LIMIT=20]-->
<string name="wifi_wps_available_first_item">WPS available</string>
@@ -5299,10 +5305,6 @@
<string name="user_enable_calling_and_sms_confirm_title">Turn on phone calls & SMS?</string>
<!-- Message for confirmation of turning on calls and SMS [CHAR LIMIT=none] -->
<string name="user_enable_calling_and_sms_confirm_message">Call and SMS history will be shared with this user.</string>
- <!-- Title for the emergency info preference [CHAR LIMIT=40] -->
- <string name="emergency_info_title">Emergency information</string>
- <!-- Description of the emergency info preference [CHAR LIMIT=80] -->
- <string name="emergency_info_subtitle">Accessible through lock screen in the emergency dialer</string>
<!-- Application Restrictions screen title [CHAR LIMIT=45] -->
<string name="application_restrictions">Allow apps and content</string>
diff --git a/res/values/styles.xml b/res/values/styles.xml
index 7065265..df5490b 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -204,6 +204,14 @@
<item name="android:textColor">?android:attr/textColorSecondary</item>
</style>
+ <style name="wifi_item_warning">
+ <item name="android:paddingStart">8dip</item>
+ <item name="android:textSize">12sp</item>
+ <item name="android:textAlignment">viewStart</item>
+ <item name="android:textAppearance">@android:style/TextAppearance.Material.Body1</item>
+ <item name="android:textColor">@color/warning</item>
+ </style>
+
<style name="wifi_item_content">
<item name="android:textAlignment">viewStart</item>
<item name="android:textAppearance">@android:style/TextAppearance.Material.Subhead</item>
diff --git a/res/xml/tts_settings.xml b/res/xml/tts_settings.xml
index 3e5e097..dbdf469 100644
--- a/res/xml/tts_settings.xml
+++ b/res/xml/tts_settings.xml
@@ -24,13 +24,16 @@
<PreferenceCategory android:key="tts_general_section"
android:title="@string/tts_general_section_title">
- <ListPreference
+ <com.android.settings.SeekBarPreference
android:key="tts_default_rate"
android:title="@string/tts_default_rate_title"
android:summary="@string/tts_default_rate_summary"
android:persistent="false"
- android:entries="@array/tts_rate_entries"
- android:entryValues="@array/tts_rate_values" />
+ android:defaultValue="50"
+ android:max="400" />
+ <SwitchPreference
+ android:key="tts_default_higher_speech_rate_enabled"
+ android:title="Higher speech rate" />
</PreferenceCategory>
<Preference android:key="tts_play_example"
diff --git a/res/xml/user_settings.xml b/res/xml/user_settings.xml
index ac2685f..4fefc10 100644
--- a/res/xml/user_settings.xml
+++ b/res/xml/user_settings.xml
@@ -35,9 +35,5 @@
android:key="add_users_when_locked"
android:title="@string/user_add_on_lockscreen_menu"
android:summary="@string/user_add_on_lockscreen_menu_summary" />
- <Preference
- android:key="emergency_info"
- android:title="@string/emergency_info_title"
- android:summary="@string/emergency_info_subtitle"/>
</PreferenceCategory>
</PreferenceScreen>
diff --git a/src/com/android/settings/CustomDialogPreference.java b/src/com/android/settings/CustomDialogPreference.java
index edd5416..383163f 100644
--- a/src/com/android/settings/CustomDialogPreference.java
+++ b/src/com/android/settings/CustomDialogPreference.java
@@ -29,7 +29,8 @@
private CustomPreferenceDialogFragment mFragment;
- public CustomDialogPreference(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
+ public CustomDialogPreference(Context context, AttributeSet attrs, int defStyleAttr,
+ int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes);
}
diff --git a/src/com/android/settings/datausage/CellDataPreference.java b/src/com/android/settings/datausage/CellDataPreference.java
index fa333f1..d64bef4 100644
--- a/src/com/android/settings/datausage/CellDataPreference.java
+++ b/src/com/android/settings/datausage/CellDataPreference.java
@@ -48,7 +48,7 @@
private static final String TAG = "CellDataPreference";
- public int mSubId;
+ public int mSubId = SubscriptionManager.INVALID_SUBSCRIPTION_ID;
public boolean mChecked;
public boolean mMultiSimDialog;
private TelephonyManager mTelephonyManager;
@@ -65,8 +65,10 @@
mTelephonyManager = TelephonyManager.from(getContext());
mChecked = state.mChecked;
mMultiSimDialog = state.mMultiSimDialog;
- mSubId = state.mSubId;
- setKey(getKey() + mSubId);
+ if (mSubId == SubscriptionManager.INVALID_SUBSCRIPTION_ID) {
+ mSubId = state.mSubId;
+ setKey(getKey() + mSubId);
+ }
notifyChanged();
}
@@ -110,7 +112,6 @@
@Override
protected void performClick(View view) {
- super.performClick(view);
MetricsLogger.action(getContext(), MetricsEvent.ACTION_CELL_DATA_TOGGLE, !mChecked);
if (mChecked) {
// disabling data; show confirmation dialog which eventually
diff --git a/src/com/android/settings/datausage/DataUsageSummary.java b/src/com/android/settings/datausage/DataUsageSummary.java
index e1936ed..3195641 100644
--- a/src/com/android/settings/datausage/DataUsageSummary.java
+++ b/src/com/android/settings/datausage/DataUsageSummary.java
@@ -138,6 +138,7 @@
TemplatePreferenceCategory category = (TemplatePreferenceCategory)
inflatePreferences(R.xml.data_usage_cellular);
category.setTemplate(getNetworkTemplate(subId), subId, services);
+ category.pushTemplates(services);
}
private void addWifiSection() {
diff --git a/src/com/android/settings/fuelgauge/FakeUid.java b/src/com/android/settings/fuelgauge/FakeUid.java
index 9d3e2ad..d616010 100644
--- a/src/com/android/settings/fuelgauge/FakeUid.java
+++ b/src/com/android/settings/fuelgauge/FakeUid.java
@@ -16,6 +16,7 @@
package com.android.settings.fuelgauge;
+import android.os.BatteryStats;
import android.os.BatteryStats.Timer;
import android.os.BatteryStats.Uid;
import android.util.ArrayMap;
@@ -73,16 +74,6 @@
}
@Override
- public long getWifiControllerActivity(int type, int which) {
- return 0;
- }
-
- @Override
- public long getBluetoothControllerActivity(int type, int which) {
- return 0;
- }
-
- @Override
public void noteWifiRunningLocked(long elapsedRealtime) {
}
@@ -258,4 +249,19 @@
public long getCpuPowerMaUs(int which) {
return 0;
}
+
+ @Override
+ public BatteryStats.ControllerActivityCounter getWifiControllerActivity() {
+ return null;
+ }
+
+ @Override
+ public BatteryStats.ControllerActivityCounter getBluetoothControllerActivity() {
+ return null;
+ }
+
+ @Override
+ public BatteryStats.ControllerActivityCounter getModemControllerActivity() {
+ return null;
+ }
}
diff --git a/src/com/android/settings/inputmethod/InputMethodAndLanguageSettings.java b/src/com/android/settings/inputmethod/InputMethodAndLanguageSettings.java
index 838989e..1318a1b 100644
--- a/src/com/android/settings/inputmethod/InputMethodAndLanguageSettings.java
+++ b/src/com/android/settings/inputmethod/InputMethodAndLanguageSettings.java
@@ -348,7 +348,9 @@
private static String getLocaleNames(Context context) {
final LocaleList locales = LocalePicker.getLocales();
- return LocaleHelper.getDisplayLocaleList(locales, Locale.getDefault());
+ final Locale displayLocale = Locale.getDefault();
+ return LocaleHelper.toSentenceCase(
+ LocaleHelper.getDisplayLocaleList(locales, displayLocale), displayLocale);
}
private void saveInputMethodSelectorVisibility(String value) {
diff --git a/src/com/android/settings/tts/TextToSpeechSettings.java b/src/com/android/settings/tts/TextToSpeechSettings.java
index 2d30ecf..be10dd3 100644
--- a/src/com/android/settings/tts/TextToSpeechSettings.java
+++ b/src/com/android/settings/tts/TextToSpeechSettings.java
@@ -26,7 +26,7 @@
import android.speech.tts.TextToSpeech.EngineInfo;
import android.speech.tts.TtsEngines;
import android.speech.tts.UtteranceProgressListener;
-import android.support.v7.preference.ListPreference;
+import android.support.v14.preference.SwitchPreference;
import android.support.v7.preference.Preference;
import android.support.v7.preference.PreferenceCategory;
import android.text.TextUtils;
@@ -35,6 +35,7 @@
import com.android.internal.logging.MetricsProto.MetricsEvent;
import com.android.settings.R;
+import com.android.settings.SeekBarPreference;
import com.android.settings.SettingsActivity;
import com.android.settings.SettingsPreferenceFragment;
import com.android.settings.tts.TtsEnginePreference.RadioButtonGroupState;
@@ -49,6 +50,7 @@
import static android.provider.Settings.Secure.TTS_DEFAULT_RATE;
import static android.provider.Settings.Secure.TTS_DEFAULT_SYNTH;
+import static android.provider.Settings.Secure.TTS_DEFAULT_HIGHER_SPEECH_RATE_ENABLED;
public class TextToSpeechSettings extends SettingsPreferenceFragment implements
Preference.OnPreferenceChangeListener, Preference.OnPreferenceClickListener,
@@ -63,6 +65,10 @@
/** Preference key for the TTS rate selection dialog. */
private static final String KEY_DEFAULT_RATE = "tts_default_rate";
+ /** Preference key for the TTS advanced speech rate switch. */
+ private static final String KEY_HIGHER_RATE_SWITCH =
+ "tts_default_higher_speech_rate_enabled";
+
/** Preference key for the TTS status field. */
private static final String KEY_STATUS = "tts_status";
@@ -78,14 +84,26 @@
private static final int GET_SAMPLE_TEXT = 1983;
private static final int VOICE_DATA_INTEGRITY_CHECK = 1977;
+ /**
+ * Maximum speech rate values.
+ */
+ private static final int MAX_SPEECH_RATE = 400;
+ private static final int MAX_HIGHER_SPEECH_RATE = 600;
+
private PreferenceCategory mEnginePreferenceCategory;
- private ListPreference mDefaultRatePref;
+ private SeekBarPreference mDefaultRatePref;
+ private SwitchPreference mHigherRateSwitchPref;
private Preference mPlayExample;
private Preference mEngineStatus;
private int mDefaultRate = TextToSpeech.Engine.DEFAULT_RATE;
/**
+ * Whether higher speech rate is enabled.
+ */
+ private boolean mHigherRateSwitch = false;
+
+ /**
* The currently selected engine.
*/
private String mCurrentEngine;
@@ -161,7 +179,8 @@
mEnginePreferenceCategory = (PreferenceCategory) findPreference(
KEY_ENGINE_PREFERENCE_SECTION);
- mDefaultRatePref = (ListPreference) findPreference(KEY_DEFAULT_RATE);
+ mDefaultRatePref = (SeekBarPreference) findPreference(KEY_DEFAULT_RATE);
+ mHigherRateSwitchPref = (SwitchPreference) findPreference(KEY_HIGHER_RATE_SWITCH);
mEngineStatus = findPreference(KEY_STATUS);
updateEngineStatus(R.string.tts_status_checking);
@@ -223,13 +242,25 @@
// Set up the default rate.
try {
mDefaultRate = android.provider.Settings.Secure.getInt(resolver, TTS_DEFAULT_RATE);
+ mHigherRateSwitch = android.provider.Settings.Secure.getInt(resolver,
+ TTS_DEFAULT_HIGHER_SPEECH_RATE_ENABLED) == 1;
} catch (SettingNotFoundException e) {
// Default rate setting not found, initialize it
mDefaultRate = TextToSpeech.Engine.DEFAULT_RATE;
+ mHigherRateSwitch = false;
}
- mDefaultRatePref.setValue(String.valueOf(mDefaultRate));
+ mDefaultRatePref.setProgress(mDefaultRate);
mDefaultRatePref.setOnPreferenceChangeListener(this);
+ mHigherRateSwitchPref.setChecked(mHigherRateSwitch);
+ mHigherRateSwitchPref.setOnPreferenceChangeListener(this);
+
+ if (mHigherRateSwitch) {
+ mDefaultRatePref.setMax(MAX_HIGHER_SPEECH_RATE);
+ } else {
+ mDefaultRatePref.setMax(MAX_SPEECH_RATE);
+ }
+
mCurrentEngine = mTts.getCurrentEngine();
SettingsActivity activity = null;
@@ -447,7 +478,7 @@
public boolean onPreferenceChange(Preference preference, Object objValue) {
if (KEY_DEFAULT_RATE.equals(preference.getKey())) {
// Default rate
- mDefaultRate = Integer.parseInt((String) objValue);
+ mDefaultRate = ((Integer) objValue).intValue();
try {
android.provider.Settings.Secure.putInt(getContentResolver(),
TTS_DEFAULT_RATE, mDefaultRate);
@@ -458,8 +489,21 @@
} catch (NumberFormatException e) {
Log.e(TAG, "could not persist default TTS rate setting", e);
}
+ } else if (KEY_HIGHER_RATE_SWITCH.equals(preference.getKey())) {
+ // Adjust range of speech rate depending on switch setting.
+ mHigherRateSwitch = ((Boolean) objValue).booleanValue();
+ try {
+ android.provider.Settings.Secure.putInt(getContentResolver(),
+ TTS_DEFAULT_HIGHER_SPEECH_RATE_ENABLED, mHigherRateSwitch ? 1 : 0);
+ if (mHigherRateSwitch) {
+ mDefaultRatePref.setMax(MAX_HIGHER_SPEECH_RATE);
+ } else {
+ mDefaultRatePref.setMax(MAX_SPEECH_RATE);
+ }
+ } catch (NumberFormatException e) {
+ Log.e(TAG, "could not persist default higher speech rate setting", e);
+ }
}
-
return true;
}
diff --git a/src/com/android/settings/users/UserSettings.java b/src/com/android/settings/users/UserSettings.java
index bf03ff9..1837a2c 100644
--- a/src/com/android/settings/users/UserSettings.java
+++ b/src/com/android/settings/users/UserSettings.java
@@ -101,7 +101,6 @@
private static final String KEY_USER_LIST = "user_list";
private static final String KEY_USER_ME = "user_me";
private static final String KEY_ADD_USER = "user_add";
- private static final String KEY_EMERGENCY_INFO = "emergency_info";
private static final int MENU_REMOVE_USER = Menu.FIRST;
@@ -135,7 +134,6 @@
private DimmableIconPreference mAddUser;
private PreferenceGroup mLockScreenSettings;
private RestrictedSwitchPreference mAddUserWhenLocked;
- private Preference mEmergencyInfoPreference;
private int mRemovingUserId = -1;
private int mAddedUserId = 0;
private boolean mAddingUser;
@@ -231,8 +229,6 @@
}
mLockScreenSettings = (PreferenceGroup) findPreference("lock_screen_settings");
mAddUserWhenLocked = (RestrictedSwitchPreference) findPreference("add_users_when_locked");
- mEmergencyInfoPreference = findPreference(KEY_EMERGENCY_INFO);
- mEmergencyInfoPreference.setOnPreferenceClickListener(this);
loadProfile();
setHasOptionsMenu(true);
IntentFilter filter = new IntentFilter(Intent.ACTION_USER_REMOVED);
@@ -921,9 +917,6 @@
} else {
onAddUserClicked(USER_TYPE_USER);
}
- } else if (pref == mEmergencyInfoPreference) {
- Intent intent = new Intent("com.android.emergency.EDIT_EMERGENGY_INFO");
- startActivity(intent);
}
return false;
}
diff --git a/src/com/android/settings/wifi/WifiConfigController.java b/src/com/android/settings/wifi/WifiConfigController.java
index 335c40b..3bb1473 100644
--- a/src/com/android/settings/wifi/WifiConfigController.java
+++ b/src/com/android/settings/wifi/WifiConfigController.java
@@ -100,14 +100,14 @@
public static final int WIFI_EAP_METHOD_AKA_PRIME = 6;
/* These values come from "wifi_peap_phase2_entries" resource array */
- public static final int WIFI_PEAP_PHASE2_NONE = 0;
- public static final int WIFI_PEAP_PHASE2_MSCHAPV2 = 1;
+ public static final int WIFI_PEAP_PHASE2_NONE = 0;
+ public static final int WIFI_PEAP_PHASE2_MSCHAPV2 = 1;
public static final int WIFI_PEAP_PHASE2_GTC = 2;
/* Phase2 methods supported by PEAP are limited */
- private final ArrayAdapter<String> PHASE2_PEAP_ADAPTER;
+ private final ArrayAdapter<String> mPhase2PeapAdapter;
/* Full list of phase2 methods */
- private final ArrayAdapter<String> PHASE2_FULL_ADAPTER;
+ private final ArrayAdapter<String> mPhase2FullAdapter;
private final Handler mTextViewChangedHandler;
@@ -115,16 +115,20 @@
private int mAccessPointSecurity;
private TextView mPasswordView;
- private String unspecifiedCert = "unspecified";
- private static final int unspecifiedCertIndex = 0;
- private String multipleCertSet = "multipleCert";
- private static final int multipleCertSetIndex = 1;
+ private String mUnspecifiedCertString;
+ private String mMultipleCertSetString;
+ private static final int UNSPECIFIED_CERT_INDEX = 0;
+ private static final int NO_CERT_INDEX = 1;
+ private static final int MULTIPLE_CERT_SET_INDEX = 2;
+
+ private String mDoNotProvideEapUserCertString;
+ private String mDoNotValidateEapServerString;
private Spinner mSecuritySpinner;
private Spinner mEapMethodSpinner;
private Spinner mEapCaCertSpinner;
private Spinner mPhase2Spinner;
- // Associated with mPhase2Spinner, one of PHASE2_FULL_ADAPTER or PHASE2_PEAP_ADAPTER
+ // Associated with mPhase2Spinner, one of mPhase2FullAdapter or mPhase2PeapAdapter
private ArrayAdapter<String> mPhase2Adapter;
private Spinner mEapUserCertSpinner;
private TextView mEapIdentityView;
@@ -171,18 +175,23 @@
final Resources res = mContext.getResources();
mLevels = res.getStringArray(R.array.wifi_signal);
- PHASE2_PEAP_ADAPTER = new ArrayAdapter<String>(
+ mPhase2PeapAdapter = new ArrayAdapter<String>(
mContext, android.R.layout.simple_spinner_item,
res.getStringArray(R.array.wifi_peap_phase2_entries));
- PHASE2_PEAP_ADAPTER.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
+ mPhase2PeapAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
- PHASE2_FULL_ADAPTER = new ArrayAdapter<String>(
+ mPhase2FullAdapter = new ArrayAdapter<String>(
mContext, android.R.layout.simple_spinner_item,
res.getStringArray(R.array.wifi_phase2_entries));
- PHASE2_FULL_ADAPTER.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
+ mPhase2FullAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
- unspecifiedCert = mContext.getString(R.string.wifi_unspecified);
- multipleCertSet = mContext.getString(R.string.wifi_multiple_cert_added);
+ mUnspecifiedCertString = mContext.getString(R.string.wifi_unspecified);
+ mMultipleCertSetString = mContext.getString(R.string.wifi_multiple_cert_added);
+ mDoNotProvideEapUserCertString =
+ mContext.getString(R.string.wifi_do_not_provide_eap_user_cert);
+ mDoNotValidateEapServerString =
+ mContext.getString(R.string.wifi_do_not_validate_eap_server);
+
mIpSettingsSpinner = (Spinner) mView.findViewById(R.id.ip_settings);
mIpSettingsSpinner.setOnItemSelectedListener(this);
mProxySettingsSpinner = (Spinner) mView.findViewById(R.id.proxy_settings);
@@ -201,10 +210,9 @@
showIpConfigFields();
showProxyFields();
mView.findViewById(R.id.wifi_advanced_toggle).setVisibility(View.VISIBLE);
- ((CheckBox)mView.findViewById(R.id.wifi_advanced_togglebox))
+ ((CheckBox) mView.findViewById(R.id.wifi_advanced_togglebox))
.setOnCheckedChangeListener(this);
-
mConfigUi.setSubmitButton(res.getString(R.string.wifi_save));
} else {
mConfigUi.setTitle(mAccessPoint.getSsid());
@@ -221,7 +229,7 @@
StaticIpConfiguration staticConfig = config.getStaticIpConfiguration();
if (staticConfig != null && staticConfig.ipAddress != null) {
addRow(group, R.string.wifi_ip_address,
- staticConfig.ipAddress.getAddress().getHostAddress());
+ staticConfig.ipAddress.getAddress().getHostAddress());
}
} else {
mIpSettingsSpinner.setSelection(DHCP);
@@ -242,8 +250,9 @@
mProxySettingsSpinner.setSelection(PROXY_NONE);
}
if (config != null && config.isPasspoint()) {
- addRow(group, R.string.passpoint_label, String.format(
- mContext.getString(R.string.passpoint_content), config.providerFriendlyName));
+ addRow(group, R.string.passpoint_label,
+ String.format(mContext.getString(R.string.passpoint_content),
+ config.providerFriendlyName));
}
}
@@ -253,10 +262,10 @@
showIpConfigFields();
showProxyFields();
mView.findViewById(R.id.wifi_advanced_toggle).setVisibility(View.VISIBLE);
- ((CheckBox)mView.findViewById(R.id.wifi_advanced_togglebox))
- .setOnCheckedChangeListener(this);
+ ((CheckBox) mView.findViewById(R.id.wifi_advanced_togglebox))
+ .setOnCheckedChangeListener(this);
if (showAdvancedFields) {
- ((CheckBox)mView.findViewById(R.id.wifi_advanced_togglebox)).setChecked(true);
+ ((CheckBox) mView.findViewById(R.id.wifi_advanced_togglebox)).setChecked(true);
mView.findViewById(R.id.wifi_advanced_fields).setVisibility(View.VISIBLE);
}
}
@@ -340,7 +349,7 @@
group.addView(row);
}
- private String getSignalString(){
+ private String getSignalString() {
final int level = mAccessPoint.getLevel();
return (level > -1 && level < mLevels.length) ? mLevels[level] : null;
@@ -372,27 +381,46 @@
boolean enabled = false;
boolean passwordInvalid = false;
- if (mPasswordView != null &&
- ((mAccessPointSecurity == AccessPoint.SECURITY_WEP && mPasswordView.length() == 0) ||
- (mAccessPointSecurity == AccessPoint.SECURITY_PSK && mPasswordView.length() < 8))) {
+ if (mPasswordView != null
+ && ((mAccessPointSecurity == AccessPoint.SECURITY_WEP
+ && mPasswordView.length() == 0)
+ || (mAccessPointSecurity == AccessPoint.SECURITY_PSK
+ && mPasswordView.length() < 8))) {
passwordInvalid = true;
}
- if ((mSsidView != null && mSsidView.length() == 0) ||
- ((mAccessPoint == null || !mAccessPoint.isSaved()) &&
- passwordInvalid)) {
+ if ((mSsidView != null && mSsidView.length() == 0)
+ || ((mAccessPoint == null || !mAccessPoint.isSaved()) && passwordInvalid)) {
enabled = false;
} else {
enabled = ipAndProxyFieldsAreValid();
}
- if (mEapCaCertSpinner != null &&
- mView.findViewById(R.id.l_ca_cert).getVisibility() != View.GONE &&
- ((String)mEapCaCertSpinner.getSelectedItem()).equals(unspecifiedCert)) {
+ if (mEapCaCertSpinner != null
+ && mView.findViewById(R.id.l_ca_cert).getVisibility() != View.GONE
+ && ((String) mEapCaCertSpinner.getSelectedItem()).equals(mUnspecifiedCertString)) {
+ enabled = false;
+ }
+ if (mEapUserCertSpinner != null
+ && mView.findViewById(R.id.l_user_cert).getVisibility() != View.GONE
+ && ((String) mEapUserCertSpinner.getSelectedItem())
+ .equals(mUnspecifiedCertString)) {
enabled = false;
}
return enabled;
}
+ void showWarningMessageIfAppropriate() {
+ mView.findViewById(R.id.no_ca_cert_warning).setVisibility(View.GONE);
+ if (mEapCaCertSpinner != null
+ && mView.findViewById(R.id.l_ca_cert).getVisibility() != View.GONE
+ && ((String) mEapCaCertSpinner.getSelectedItem())
+ .equals(mDoNotValidateEapServerString)) {
+ // Display warning if user chooses not to validate the EAP server with a user-supplied
+ // CA certificate in an EAP network configuration.
+ mView.findViewById(R.id.no_ca_cert_warning).setVisibility(View.VISIBLE);
+ }
+ }
+
/* package */ WifiConfiguration getConfig() {
if (mMode == WifiConfigUiBase.MODE_VIEW) {
return null;
@@ -427,8 +455,8 @@
int length = mPasswordView.length();
String password = mPasswordView.getText().toString();
// WEP-40, WEP-104, and 256-bit WEP (WEP-232?)
- if ((length == 10 || length == 26 || length == 58) &&
- password.matches("[0-9A-Fa-f]*")) {
+ if ((length == 10 || length == 26 || length == 58)
+ && password.matches("[0-9A-Fa-f]*")) {
config.wepKeys[0] = password;
} else {
config.wepKeys[0] = '"' + password + '"';
@@ -458,7 +486,7 @@
switch (eapMethod) {
case Eap.PEAP:
// PEAP supports limited phase2 values
- // Map the index from the PHASE2_PEAP_ADAPTER to the one used
+ // Map the index from the mPhase2PeapAdapter to the one used
// by the API which has the full list of PEAP methods.
switch(phase2Method) {
case WIFI_PEAP_PHASE2_NONE:
@@ -476,27 +504,36 @@
}
break;
default:
- // The default index from PHASE2_FULL_ADAPTER maps to the API
+ // The default index from mPhase2FullAdapter maps to the API
config.enterpriseConfig.setPhase2Method(phase2Method);
break;
}
String caCert = (String) mEapCaCertSpinner.getSelectedItem();
- if (caCert.equals(unspecifiedCert)) {
+ if (caCert.equals(mUnspecifiedCertString)
+ || caCert.equals(mDoNotValidateEapServerString)) {
+ // Note: |caCert| should not be able to take the value |unspecifiedCert|,
+ // since we prevent such configurations from being saved.
config.enterpriseConfig.setCaCertificateAliases(null);
- } else if (caCert.equals(multipleCertSet)) {
+ } else if (caCert.equals(mMultipleCertSetString)) {
if (mAccessPoint != null) {
if (!mAccessPoint.isSaved()) {
Log.e(TAG, "Multiple certs can only be set when editing saved network");
}
config.enterpriseConfig.setCaCertificateAliases(
- mAccessPoint.getConfig().enterpriseConfig.getCaCertificateAliases());
+ mAccessPoint.getConfig().enterpriseConfig
+ .getCaCertificateAliases());
}
} else {
config.enterpriseConfig.setCaCertificateAliases(new String[] {caCert});
}
String clientCert = (String) mEapUserCertSpinner.getSelectedItem();
- if (clientCert.equals(unspecifiedCert)) clientCert = "";
+ if (clientCert.equals(mUnspecifiedCertString)
+ || clientCert.equals(mDoNotProvideEapUserCertString)) {
+ // Note: |clientCert| should not be able to take the value |unspecifiedCert|,
+ // since we prevent such configurations from being saved.
+ clientCert = "";
+ }
config.enterpriseConfig.setClientCertificateAlias(clientCert);
if (eapMethod == Eap.SIM || eapMethod == Eap.AKA || eapMethod == Eap.AKA_PRIME) {
config.enterpriseConfig.setIdentity("");
@@ -533,9 +570,11 @@
}
private boolean ipAndProxyFieldsAreValid() {
- mIpAssignment = (mIpSettingsSpinner != null &&
- mIpSettingsSpinner.getSelectedItemPosition() == STATIC_IP) ?
- IpAssignment.STATIC : IpAssignment.DHCP;
+ mIpAssignment =
+ (mIpSettingsSpinner != null
+ && mIpSettingsSpinner.getSelectedItemPosition() == STATIC_IP)
+ ? IpAssignment.STATIC
+ : IpAssignment.DHCP;
if (mIpAssignment == IpAssignment.STATIC) {
mStaticIpConfiguration = new StaticIpConfiguration();
@@ -584,7 +623,7 @@
private Inet4Address getIPv4Address(String text) {
try {
return (Inet4Address) NetworkUtils.numericToInetAddress(text);
- } catch (IllegalArgumentException|ClassCastException e) {
+ } catch (IllegalArgumentException | ClassCastException e) {
return null;
}
}
@@ -619,7 +658,7 @@
//Extract a default gateway from IP address
InetAddress netPart = NetworkUtils.getNetworkPart(inetAddr, networkPrefixLength);
byte[] addr = netPart.getAddress();
- addr[addr.length-1] = 1;
+ addr[addr.length - 1] = 1;
mGatewayView.setText(InetAddress.getByAddress(addr).getHostAddress());
} catch (RuntimeException ee) {
} catch (java.net.UnknownHostException u) {
@@ -700,11 +739,14 @@
mEapCaCertSpinner = (Spinner) mView.findViewById(R.id.ca_cert);
mEapCaCertSpinner.setOnItemSelectedListener(this);
mEapUserCertSpinner = (Spinner) mView.findViewById(R.id.user_cert);
+ mEapUserCertSpinner.setOnItemSelectedListener(this);
mEapIdentityView = (TextView) mView.findViewById(R.id.identity);
mEapAnonymousView = (TextView) mView.findViewById(R.id.anonymous);
- loadCertificates(mEapCaCertSpinner, Credentials.CA_CERTIFICATE, false);
- loadCertificates(mEapUserCertSpinner, Credentials.USER_PRIVATE_KEY, false);
+ loadCertificates(mEapCaCertSpinner, Credentials.CA_CERTIFICATE, false,
+ mDoNotValidateEapServerString);
+ loadCertificates(mEapUserCertSpinner, Credentials.USER_PRIVATE_KEY, false,
+ mDoNotProvideEapUserCertString);
// Modifying an existing network
if (mAccessPoint != null && mAccessPoint.isSaved()) {
@@ -736,14 +778,14 @@
}
String[] caCerts = enterpriseConfig.getCaCertificateAliases();
if (caCerts == null) {
- setSelection(mEapCaCertSpinner, unspecifiedCert);
+ setSelection(mEapCaCertSpinner, mUnspecifiedCertString);
} else if (caCerts.length == 1) {
setSelection(mEapCaCertSpinner, caCerts[0]);
} else {
// Reload the cert spinner with an extra "multiple certificates added" item
loadCertificates(mEapCaCertSpinner,
- Credentials.CA_CERTIFICATE, true);
- mEapCaCertSpinner.setSelection(multipleCertSetIndex);
+ Credentials.CA_CERTIFICATE, true, mDoNotValidateEapServerString);
+ mEapCaCertSpinner.setSelection(MULTIPLE_CERT_SET_INDEX);
}
setSelection(mEapUserCertSpinner, enterpriseConfig.getClientCertificateAlias());
mEapIdentityView.setText(enterpriseConfig.getIdentity());
@@ -804,8 +846,8 @@
break;
case WIFI_EAP_METHOD_PEAP:
// Reset adapter if needed
- if (mPhase2Adapter != PHASE2_PEAP_ADAPTER) {
- mPhase2Adapter = PHASE2_PEAP_ADAPTER;
+ if (mPhase2Adapter != mPhase2PeapAdapter) {
+ mPhase2Adapter = mPhase2PeapAdapter;
mPhase2Spinner.setAdapter(mPhase2Adapter);
}
mView.findViewById(R.id.l_phase2).setVisibility(View.VISIBLE);
@@ -814,8 +856,8 @@
break;
case WIFI_EAP_METHOD_TTLS:
// Reset adapter if needed
- if (mPhase2Adapter != PHASE2_FULL_ADAPTER) {
- mPhase2Adapter = PHASE2_FULL_ADAPTER;
+ if (mPhase2Adapter != mPhase2FullAdapter) {
+ mPhase2Adapter = mPhase2FullAdapter;
mPhase2Spinner.setAdapter(mPhase2Adapter);
}
mView.findViewById(R.id.l_phase2).setVisibility(View.VISIBLE);
@@ -847,12 +889,12 @@
private void setCaCertInvisible() {
mView.findViewById(R.id.l_ca_cert).setVisibility(View.GONE);
- mEapCaCertSpinner.setSelection(unspecifiedCertIndex);
+ mEapCaCertSpinner.setSelection(UNSPECIFIED_CERT_INDEX);
}
private void setUserCertInvisible() {
mView.findViewById(R.id.l_user_cert).setVisibility(View.GONE);
- mEapUserCertSpinner.setSelection(unspecifiedCertIndex);
+ mEapUserCertSpinner.setSelection(UNSPECIFIED_CERT_INDEX);
}
private void setAnonymousIdentInvisible() {
@@ -976,13 +1018,15 @@
}
}
- private void loadCertificates(Spinner spinner, String prefix, boolean showMultipleCerts) {
+ private void loadCertificates(
+ Spinner spinner, String prefix, boolean showMultipleCerts, String noCertificateString) {
final Context context = mConfigUi.getContext();
ArrayList<String> certs = new ArrayList<String>();
- certs.add(unspecifiedCert);
+ certs.add(UNSPECIFIED_CERT_INDEX, mUnspecifiedCertString);
+ certs.add(NO_CERT_INDEX, noCertificateString);
if (showMultipleCerts) {
- certs.add(multipleCertSet);
+ certs.add(MULTIPLE_CERT_SET_INDEX, mMultipleCertSetString);
}
certs.addAll(
Arrays.asList(KeyStore.getInstance().list(prefix, android.os.Process.WIFI_UID)));
@@ -1056,12 +1100,11 @@
public void onCheckedChanged(CompoundButton view, boolean isChecked) {
if (view.getId() == R.id.show_password) {
int pos = mPasswordView.getSelectionEnd();
- mPasswordView.setInputType(
- InputType.TYPE_CLASS_TEXT | (isChecked ?
- InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD :
- InputType.TYPE_TEXT_VARIATION_PASSWORD));
+ mPasswordView.setInputType(InputType.TYPE_CLASS_TEXT
+ | (isChecked ? InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD
+ : InputType.TYPE_TEXT_VARIATION_PASSWORD));
if (pos >= 0) {
- ((EditText)mPasswordView).setSelection(pos);
+ ((EditText) mPasswordView).setSelection(pos);
}
} else if (view.getId() == R.id.wifi_advanced_togglebox) {
if (isChecked) {
@@ -1084,6 +1127,7 @@
} else {
showIpConfigFields();
}
+ showWarningMessageIfAppropriate();
enableSubmitIfAppropriate();
}
@@ -1097,11 +1141,10 @@
*/
public void updatePassword() {
TextView passwdView = (TextView) mView.findViewById(R.id.password);
- passwdView.setInputType(
- InputType.TYPE_CLASS_TEXT |
- (((CheckBox) mView.findViewById(R.id.show_password)).isChecked() ?
- InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD :
- InputType.TYPE_TEXT_VARIATION_PASSWORD));
+ passwdView.setInputType(InputType.TYPE_CLASS_TEXT
+ | (((CheckBox) mView.findViewById(R.id.show_password)).isChecked()
+ ? InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD
+ : InputType.TYPE_TEXT_VARIATION_PASSWORD));
}
public AccessPoint getAccessPoint() {