Merge change I2abbb876 into eclair
* changes:
New widgets
diff --git a/res/values/arrays.xml b/res/values/arrays.xml
index 5191d83..2981b12 100644
--- a/res/values/arrays.xml
+++ b/res/values/arrays.xml
@@ -79,12 +79,11 @@
<item>1 minute</item>
<item>2 minutes</item>
<item>10 minutes</item>
- <!-- Choosing this means the screen will only turn off after the user manually does so. There will be no inactivity check. -->
- <item>Never timeout</item>
+ <item>30 minutes</item>
</string-array>
<!-- Do not translate. -->
- <string-array name="screen_timeout_values">
+ <string-array name="screen_timeout_values" translatable="false">
<!-- Do not translate. -->
<item>15000</item>
<!-- Do not translate. -->
@@ -96,7 +95,7 @@
<!-- Do not translate. -->
<item>600000</item>
<!-- Do not translate. -->
- <item>-1</item>
+ <item>1800000</item>
</string-array>
<!-- TTS settings -->
@@ -288,8 +287,27 @@
</string-array>
<string-array translatable="false" name="special_locale_names">
- <item>中文(简体)</item>
+ <item>中文 (简体)</item>
<item>中文 (繁體)</item>
</string-array>
+ <!-- Authentication Types used in APN editor -->
+ <string-array name="apn_auth_entries">
+ <item>None</item>
+ <item>PAP</item>
+ <item>CHAP</item>
+ <item>PAP or CHAP</item>
+ </string-array>
+
+ <string-array translatable="false" name="apn_auth_values">
+ <!-- Do not translate. -->
+ <item>0</item>
+ <!-- Do not translate. -->
+ <item>1</item>
+ <!-- Do not translate. -->
+ <item>2</item>
+ <!-- Do not translate. -->
+ <item>3</item>
+ </string-array>
+
</resources>
diff --git a/res/xml/apn_editor.xml b/res/xml/apn_editor.xml
index 4ff801f..3835a2c 100644
--- a/res/xml/apn_editor.xml
+++ b/res/xml/apn_editor.xml
@@ -101,6 +101,12 @@
android:singleLine="true"
android:inputType="number"
/>
+ <ListPreference
+ android:title="@string/apn_auth_type"
+ android:key="auth_type"
+ android:entries="@array/apn_auth_entries"
+ android:entryValues="@array/apn_auth_values"
+ />
<EditTextPreference
android:title="@string/apn_type"
android:dialogTitle="@string/apn_type"
diff --git a/res/xml/wifi_access_points.xml b/res/xml/wifi_access_points.xml
new file mode 100644
index 0000000..281093c
--- /dev/null
+++ b/res/xml/wifi_access_points.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- 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.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
+ android:title="@string/wifi_settings_category">
+
+ <com.android.settings.ProgressCategory
+ android:key="access_points"
+ android:title="@string/wifi_access_points"
+ android:persistent="false" />
+
+ <Preference
+ android:key="add_other_network"
+ android:title="@string/wifi_add_other_network"
+ android:persistent="false" />
+
+</PreferenceScreen>
diff --git a/res/xml/wifi_settings.xml b/res/xml/wifi_settings.xml
index 9101e46..8a76674 100644
--- a/res/xml/wifi_settings.xml
+++ b/res/xml/wifi_settings.xml
@@ -33,7 +33,7 @@
<com.android.settings.ProgressCategory
android:key="access_points"
android:dependency="wifi_enabled"
- android:title="@string/wifi_access_points"
+ android:title="@string/wifi_access_points"
android:persistent="false" />
<Preference
@@ -42,4 +42,4 @@
android:title="@string/wifi_add_other_network"
android:persistent="false" />
-</PreferenceScreen>
+</PreferenceScreen>
diff --git a/src/com/android/settings/ApnEditor.java b/src/com/android/settings/ApnEditor.java
index 0bd91a8..0e7ab5e 100644
--- a/src/com/android/settings/ApnEditor.java
+++ b/src/com/android/settings/ApnEditor.java
@@ -27,28 +27,31 @@
import android.os.Bundle;
import android.os.SystemProperties;
import android.preference.EditTextPreference;
+import android.preference.ListPreference;
import android.preference.Preference;
import android.preference.PreferenceActivity;
import android.provider.Telephony;
-import com.android.internal.telephony.TelephonyProperties;
import android.util.Log;
import android.view.KeyEvent;
import android.view.Menu;
import android.view.MenuItem;
+import com.android.internal.telephony.TelephonyProperties;
-public class ApnEditor extends PreferenceActivity
- implements SharedPreferences.OnSharedPreferenceChangeListener {
-
+
+public class ApnEditor extends PreferenceActivity
+ implements SharedPreferences.OnSharedPreferenceChangeListener,
+ Preference.OnPreferenceChangeListener {
private final static String TAG = ApnEditor.class.getSimpleName();
-
+
private final static String SAVED_POS = "pos";
-
+ private final static String KEY_AUTH_TYPE = "auth_type";
+
private static final int MENU_DELETE = Menu.FIRST;
private static final int MENU_SAVE = Menu.FIRST + 1;
private static final int MENU_CANCEL = Menu.FIRST + 2;
-
+
private static String sNotSet;
private EditTextPreference mName;
private EditTextPreference mApn;
@@ -62,16 +65,18 @@
private EditTextPreference mMnc;
private EditTextPreference mMmsProxy;
private EditTextPreference mMmsPort;
+ private ListPreference mAuthType;
private EditTextPreference mApnType;
+
private String mCurMnc;
private String mCurMcc;
-
+
private Uri mUri;
private Cursor mCursor;
private boolean mNewApn;
private boolean mFirstTime;
private Resources mRes;
-
+
/**
* Standard projection for the interesting columns of a normal note.
*/
@@ -90,9 +95,10 @@
Telephony.Carriers.NUMERIC, // 11
Telephony.Carriers.MMSPROXY,// 12
Telephony.Carriers.MMSPORT, // 13
- Telephony.Carriers.TYPE, // 14
+ Telephony.Carriers.AUTH_TYPE, // 14
+ Telephony.Carriers.TYPE, // 15
};
-
+
private static final int ID_INDEX = 0;
private static final int NAME_INDEX = 1;
private static final int APN_INDEX = 2;
@@ -106,8 +112,10 @@
private static final int MNC_INDEX = 10;
private static final int MMSPROXY_INDEX = 12;
private static final int MMSPORT_INDEX = 13;
- private static final int TYPE_INDEX = 14;
-
+ private static final int AUTH_TYPE_INDEX = 14;
+ private static final int TYPE_INDEX = 15;
+
+
@Override
protected void onCreate(Bundle icicle) {
super.onCreate(icicle);
@@ -128,21 +136,24 @@
mMcc = (EditTextPreference) findPreference("apn_mcc");
mMnc = (EditTextPreference) findPreference("apn_mnc");
mApnType = (EditTextPreference) findPreference("apn_type");
-
+
+ mAuthType = (ListPreference) findPreference("auth_type");
+ mAuthType.setOnPreferenceChangeListener(this);
+
mRes = getResources();
-
+
final Intent intent = getIntent();
final String action = intent.getAction();
mFirstTime = icicle == null;
-
+
if (action.equals(Intent.ACTION_EDIT)) {
mUri = intent.getData();
} else if (action.equals(Intent.ACTION_INSERT)) {
if (mFirstTime) {
mUri = getContentResolver().insert(intent.getData(), new ContentValues());
} else {
- mUri = ContentUris.withAppendedId(Telephony.Carriers.CONTENT_URI,
+ mUri = ContentUris.withAppendedId(Telephony.Carriers.CONTENT_URI,
icicle.getInt(SAVED_POS));
}
mNewApn = true;
@@ -155,7 +166,7 @@
finish();
return;
}
-
+
// The new entry was created, so assume all will end well and
// set the result to be returned.
setResult(RESULT_OK, (new Intent()).setAction(mUri.toString()));
@@ -167,7 +178,7 @@
mCursor = managedQuery(mUri, sProjection, null, null);
mCursor.moveToFirst();
-
+
fillUi();
}
@@ -176,15 +187,15 @@
super.onResume();
getPreferenceScreen().getSharedPreferences().registerOnSharedPreferenceChangeListener(this);
}
-
+
@Override
public void onPause() {
getPreferenceScreen().getSharedPreferences().unregisterOnSharedPreferenceChangeListener(this);
- super.onPause();
+ super.onPause();
}
-
+
private void fillUi() {
- if (mFirstTime) {
+ if (mFirstTime) {
mFirstTime = false;
// Fill in all the values from the db in both text editor and summary
mName.setText(mCursor.getString(NAME_INDEX));
@@ -201,7 +212,7 @@
mMnc.setText(mCursor.getString(MNC_INDEX));
mApnType.setText(mCursor.getString(TYPE_INDEX));
if (mNewApn) {
- String numeric =
+ String numeric =
SystemProperties.get(TelephonyProperties.PROPERTY_ICC_OPERATOR_NUMERIC);
// MCC is first 3 chars and then in 2 - 3 chars of MNC
if (numeric != null && numeric.length() > 4) {
@@ -216,8 +227,13 @@
mCurMcc = mcc;
}
}
+ int authVal = mCursor.getInt(AUTH_TYPE_INDEX);
+ if (authVal != -1) {
+ mAuthType.setValueIndex(authVal);
+ }
+
}
-
+
mName.setSummary(checkNull(mName.getText()));
mApn.setSummary(checkNull(mApn.getText()));
mProxy.setSummary(checkNull(mProxy.getText()));
@@ -231,6 +247,33 @@
mMcc.setSummary(checkNull(mMcc.getText()));
mMnc.setSummary(checkNull(mMnc.getText()));
mApnType.setSummary(checkNull(mApnType.getText()));
+
+ String authVal = mAuthType.getValue();
+ if (authVal != null) {
+ int authValIndex = Integer.parseInt(authVal);
+ mAuthType.setValueIndex(authValIndex);
+
+ String []values = mRes.getStringArray(R.array.apn_auth_entries);
+ mAuthType.setSummary(values[authValIndex]);
+ } else {
+ mAuthType.setSummary(sNotSet);
+ }
+ }
+
+ public boolean onPreferenceChange(Preference preference, Object newValue) {
+ String key = preference.getKey();
+ if (KEY_AUTH_TYPE.equals(key)) {
+ try {
+ int index = Integer.parseInt((String) newValue);
+ mAuthType.setValueIndex(index);
+
+ String []values = mRes.getStringArray(R.array.apn_auth_entries);
+ mAuthType.setSummary(values[index]);
+ } catch (NumberFormatException e) {
+ return false;
+ }
+ }
+ return true;
}
@Override
@@ -268,7 +311,7 @@
}
return super.onOptionsItemSelected(item);
}
-
+
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
switch (keyCode) {
@@ -288,7 +331,7 @@
validateAndSave(true);
icicle.putInt(SAVED_POS, mCursor.getInt(ID_INDEX));
}
-
+
/**
* Check the key fields' validity and save if valid.
* @param force save even if the fields are not valid, if the app is
@@ -300,7 +343,7 @@
String apn = checkNotSet(mApn.getText());
String mcc = checkNotSet(mMcc.getText());
String mnc = checkNotSet(mMnc.getText());
-
+
String errorMsg = null;
if (name.length() < 1) {
errorMsg = mRes.getString(R.string.error_name_empty);
@@ -311,20 +354,20 @@
} else if ((mnc.length() & 0xFFFE) != 2) {
errorMsg = mRes.getString(R.string.error_mnc_not23);
}
-
+
if (errorMsg != null && !force) {
showErrorMessage(errorMsg);
return false;
}
-
+
if (!mCursor.moveToFirst()) {
Log.w(TAG,
"Could not go to the first row in the Cursor when saving data.");
return false;
}
-
+
ContentValues values = new ContentValues();
-
+
values.put(Telephony.Carriers.NAME, name);
values.put(Telephony.Carriers.APN, apn);
values.put(Telephony.Carriers.PROXY, checkNotSet(mProxy.getText()));
@@ -334,22 +377,28 @@
values.put(Telephony.Carriers.USER, checkNotSet(mUser.getText()));
values.put(Telephony.Carriers.SERVER, checkNotSet(mServer.getText()));
values.put(Telephony.Carriers.PASSWORD, checkNotSet(mPassword.getText()));
- values.put(Telephony.Carriers.MMSC, checkNotSet(mMmsc.getText()));
+ values.put(Telephony.Carriers.MMSC, checkNotSet(mMmsc.getText()));
+
+ String authVal = mAuthType.getValue();
+ if (authVal != null) {
+ values.put(Telephony.Carriers.AUTH_TYPE, Integer.parseInt(authVal));
+ }
+
values.put(Telephony.Carriers.TYPE, checkNotSet(mApnType.getText()));
values.put(Telephony.Carriers.MCC, mcc);
values.put(Telephony.Carriers.MNC, mnc);
-
+
values.put(Telephony.Carriers.NUMERIC, mcc + mnc);
-
+
if (mCurMnc != null && mCurMcc != null) {
if (mCurMnc.equals(mnc) && mCurMcc.equals(mcc)) {
values.put(Telephony.Carriers.CURRENT, 1);
}
}
-
+
getContentResolver().update(mUri, values, null, null);
-
+
return true;
}
@@ -365,7 +414,7 @@
getContentResolver().delete(mUri, null, null);
finish();
}
-
+
private String starify(String value) {
if (value == null || value.length() == 0) {
return sNotSet;
@@ -377,7 +426,7 @@
return new String(password);
}
}
-
+
private String checkNull(String value) {
if (value == null || value.length() == 0) {
return sNotSet;
@@ -385,7 +434,7 @@
return value;
}
}
-
+
private String checkNotSet(String value) {
if (value == null || value.equals(sNotSet)) {
return "";
@@ -393,7 +442,7 @@
return value;
}
}
-
+
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
Preference pref = findPreference(key);
if (pref != null) {
diff --git a/src/com/android/settings/wifi/WifiSettings.java b/src/com/android/settings/wifi/WifiSettings.java
index 361f159..cac77e3 100644
--- a/src/com/android/settings/wifi/WifiSettings.java
+++ b/src/com/android/settings/wifi/WifiSettings.java
@@ -51,11 +51,11 @@
DialogInterface.OnDismissListener {
private static final String TAG = "WifiSettings";
-
+
//============================
// Preference/activity member variables
//============================
-
+
private static final String INSTANCE_KEY_DIALOG_BUNDLE =
"com.android.settings.wifi.WifiSettings:dialogBundle";
/*
@@ -64,43 +64,44 @@
* dialog management only creates once.
*/
private Dialog mDialog;
-
+
+ private static final String KEY_ONLY_ACCESS_POINTS = "only_access_points";
private static final String KEY_ADD_OTHER_NETWORK = "add_other_network";
private static final int CONTEXT_MENU_ID_CONNECT = Menu.FIRST;
private static final int CONTEXT_MENU_ID_FORGET = Menu.FIRST + 1;
private static final int CONTEXT_MENU_ID_CHANGE_PASSWORD = Menu.FIRST + 2;
- private static final int MENU_ID_SCAN = Menu.FIRST;
- private static final int MENU_ID_ADVANCED = Menu.FIRST + 1;
-
+ private static final int MENU_ID_SCAN = Menu.FIRST;
+ private static final int MENU_ID_ADVANCED = Menu.FIRST + 1;
+
private static final String KEY_WIFI_ENABLED = "wifi_enabled";
private static final String KEY_OPEN_NETWORK_NOTIFICATIONS_ENABLED =
"open_network_notifications_enabled";
private static final String KEY_ACCESS_POINTS = "access_points";
-
+
private ProgressCategory mApCategory;
private CheckBoxPreference mWifiEnabled;
private WifiEnabler mWifiEnabler;
- private CheckBoxPreference mOpenNetworkNotificationsEnabled;
+ private CheckBoxPreference mOpenNetworkNotificationsEnabled;
private Preference mAddOtherNetwork;
-
+
private WeakHashMap<AccessPointState, AccessPointPreference> mAps;
private KeyStore mKeyStore = KeyStore.getInstance();
private AccessPointState mResumeState = null;
private int mResumeMode;
-
+
//============================
// Wifi member variables
//============================
-
+
private WifiLayer mWifiLayer;
-
+
//============================
// Activity lifecycle
//============================
-
+
public WifiSettings() {
mAps = new WeakHashMap<AccessPointState, AccessPointPreference>();
mWifiLayer = new WifiLayer(this, this);
@@ -116,15 +117,23 @@
onCreatedWifi();
mWifiLayer.onCreatedCallback();
}
-
+
+ private int getPreferenceResource() {
+ if (getIntent().getBooleanExtra(KEY_ONLY_ACCESS_POINTS, false)) {
+ return R.xml.wifi_access_points;
+ } else {
+ return R.xml.wifi_settings;
+ }
+ }
+
/**
* Shouldn't have any dependency on the wifi layer.
*/
private void onCreatePreferences() {
- addPreferencesFromResource(R.xml.wifi_settings);
-
+ addPreferencesFromResource(getPreferenceResource());
+
final PreferenceScreen preferenceScreen = getPreferenceScreen();
-
+
mApCategory = (ProgressCategory) preferenceScreen.findPreference(KEY_ACCESS_POINTS);
// We don't want the ordering to be the order preferences are added,
// instead we want*:
@@ -133,29 +142,33 @@
// 3) preferred, APs out of range
// * this ordering logic is in AccessPointPreference's compareTo
mApCategory.setOrderingAsAdded(false);
-
- mWifiEnabled = (CheckBoxPreference) preferenceScreen.findPreference(KEY_WIFI_ENABLED);
- mWifiEnabler = new WifiEnabler(this, (WifiManager) getSystemService(WIFI_SERVICE),
- mWifiEnabled);
-
- mOpenNetworkNotificationsEnabled = (CheckBoxPreference) preferenceScreen
- .findPreference(KEY_OPEN_NETWORK_NOTIFICATIONS_ENABLED);
- mOpenNetworkNotificationsEnabled.setChecked(Settings.Secure.getInt(getContentResolver(),
- Settings.Secure.WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON, 0) == 1);
-
+
+ if (!getIntent().getBooleanExtra(KEY_ONLY_ACCESS_POINTS, false)) {
+ mWifiEnabled = (CheckBoxPreference) preferenceScreen.findPreference(KEY_WIFI_ENABLED);
+ mWifiEnabler = new WifiEnabler(this, (WifiManager) getSystemService(WIFI_SERVICE),
+ mWifiEnabled);
+
+ mOpenNetworkNotificationsEnabled = (CheckBoxPreference) preferenceScreen
+ .findPreference(KEY_OPEN_NETWORK_NOTIFICATIONS_ENABLED);
+ mOpenNetworkNotificationsEnabled.setChecked(Settings.Secure.getInt(getContentResolver(),
+ Settings.Secure.WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON, 0) == 1);
+ }
+
mAddOtherNetwork = preferenceScreen.findPreference(KEY_ADD_OTHER_NETWORK);
-
+
registerForContextMenu(getListView());
}
private void onCreatedWifi() {
}
-
+
@Override
protected void onResume() {
super.onResume();
mWifiLayer.onResume();
- mWifiEnabler.resume();
+ if (mWifiEnabler != null) {
+ mWifiEnabler.resume();
+ }
// do what we should have after keystore is unlocked.
if (mResumeState != null) {
if (mKeyStore.test() == KeyStore.NO_ERROR) {
@@ -176,13 +189,15 @@
protected void onPause() {
super.onPause();
mWifiLayer.onPause();
- mWifiEnabler.pause();
+ if (mWifiEnabler != null) {
+ mWifiEnabler.pause();
+ }
}
@Override
protected void onDestroy() {
super.onDestroy();
-
+
if (mDialog != null) {
mDialog.dismiss();
}
@@ -191,31 +206,31 @@
@Override
public boolean onCreateOptionsMenu(Menu menu) {
super.onCreateOptionsMenu(menu);
-
+
menu.add(0, MENU_ID_SCAN, 0, R.string.scan_wifi)
.setIcon(R.drawable.ic_menu_scan_network);
-
+
menu.add(0, MENU_ID_ADVANCED, 0, R.string.wifi_menu_advanced)
.setIcon(android.R.drawable.ic_menu_manage);
-
+
return true;
}
-
+
@Override
public boolean onOptionsItemSelected(MenuItem item) {
super.onOptionsItemSelected(item);
-
+
switch (item.getItemId()) {
case MENU_ID_SCAN:
mWifiLayer.attemptScan();
return true;
-
+
case MENU_ID_ADVANCED:
Intent intent = new Intent(this, AdvancedSettings.class);
startActivity(intent);
return true;
-
+
default:
return false;
}
@@ -224,7 +239,7 @@
@Override
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
-
+
if (mDialog != null) {
Bundle dialogBundle = mDialog.onSaveInstanceState();
outState.putBundle(INSTANCE_KEY_DIALOG_BUNDLE, dialogBundle);
@@ -234,7 +249,7 @@
@Override
protected void onRestoreInstanceState(Bundle state) {
super.onRestoreInstanceState(state);
-
+
Bundle dialogBundle = state.getBundle(INSTANCE_KEY_DIALOG_BUNDLE);
if (dialogBundle != null) {
mDialog = new AccessPointDialog(this, mWifiLayer);
@@ -256,21 +271,21 @@
@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
super.onCreateContextMenu(menu, v, menuInfo);
-
+
AccessPointState state = getStateFromMenuInfo(menuInfo);
if (state == null) {
return;
}
-
+
menu.setHeaderTitle(state.getHumanReadableSsid());
-
+
if (state.isConnectable()) {
menu.add(0, CONTEXT_MENU_ID_CONNECT, 0, R.string.wifi_context_menu_connect);
}
-
+
if (state.isForgetable()) {
menu.add(0, CONTEXT_MENU_ID_FORGET, 1, R.string.wifi_context_menu_forget);
-
+
if (state.hasPassword()) {
menu.add(0, CONTEXT_MENU_ID_CHANGE_PASSWORD, 2,
R.string.wifi_context_menu_change_password);
@@ -287,19 +302,19 @@
}
switch (item.getItemId()) {
-
+
case CONTEXT_MENU_ID_CONNECT:
connectToNetwork(state);
return true;
-
+
case CONTEXT_MENU_ID_FORGET:
mWifiLayer.forgetNetwork(state);
return true;
-
+
case CONTEXT_MENU_ID_CHANGE_PASSWORD:
showAccessPointDialog(state, AccessPointDialog.MODE_CONFIGURE);
return true;
-
+
default:
return false;
}
@@ -317,12 +332,12 @@
mWifiLayer.connectToNetwork(state);
}
}
-
+
private AccessPointState getStateFromMenuInfo(ContextMenuInfo menuInfo) {
if ((menuInfo == null) || !(menuInfo instanceof AdapterContextMenuInfo)) {
return null;
}
-
+
AdapterContextMenuInfo adapterMenuInfo = (AdapterContextMenuInfo) menuInfo;
Preference pref = (Preference) getPreferenceScreen().getRootAdapter().getItem(
adapterMenuInfo.position);
@@ -332,11 +347,11 @@
return ((AccessPointPreference) pref).getAccessPointState();
}
-
+
//============================
// Preference callbacks
//============================
-
+
@Override
public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) {
super.onPreferenceTreeClick(preferenceScreen, preference);
@@ -351,10 +366,10 @@
AccessPointState state = ((AccessPointPreference) preference).getAccessPointState();
showAccessPointDialog(state, AccessPointDialog.MODE_INFO);
}
-
+
return false;
}
-
+
//============================
// Wifi-related
//============================
@@ -372,7 +387,7 @@
mResumeMode = AccessPointDialog.MODE_CONFIGURE;
showDialog(dialog);
}
-
+
public void showAccessPointDialog(AccessPointState state, int mode) {
if (state.isEnterprise() && mKeyStore.test() != KeyStore.NO_ERROR) {
Credentials.getInstance().unlock(this);
@@ -391,14 +406,14 @@
if (mDialog != null) {
mDialog.dismiss();
}
-
+
mDialog = dialog;
if (dialog != null) {
dialog.setOnDismissListener(this);
dialog.show();
}
}
-
+
//============================
// Wifi callbacks
//============================
@@ -409,36 +424,36 @@
public void onScanningStatusChanged(boolean started) {
mApCategory.setProgress(started);
- }
+ }
public void onAccessPointSetChanged(AccessPointState ap, boolean added) {
AccessPointPreference pref = mAps.get(ap);
-
+
if (WifiLayer.LOGV) {
Log.v(TAG, "onAccessPointSetChanged with " + ap + " and "
+ (added ? "added" : "removed") + ", found pref " + pref);
}
-
+
if (added) {
-
+
if (pref == null) {
pref = new AccessPointPreference(this, ap);
mAps.put(ap, pref);
} else {
pref.setEnabled(true);
}
-
+
mApCategory.addPreference(pref);
-
+
} else {
mAps.remove(ap);
-
+
if (pref != null) {
mApCategory.removePreference(pref);
}
-
+
}
}
@@ -459,8 +474,8 @@
// If we're already showing a dialog, ignore this request
return;
}
-
+
showAccessPointDialog(ap, AccessPointDialog.MODE_RETRY_PASSWORD);
}
-
+
}