am 628431de: Fix bug 1956707 in which setting the default language has no effect. Use the current Locale upon initialization of the TTS engine. Retrieve the default engine value from the TextToSpeech.Engine class instead of a hard-coded value in TextToSpeechSettings.
Merge commit '628431de91689b62a19e5fde0ed3b546bba7da74'
* commit '628431de91689b62a19e5fde0ed3b546bba7da74':
Fix bug 1956707 in which setting the default language has no effect.
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 61f099c..c71cab9 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -891,11 +891,11 @@
<string name="screen_timeout_summary">Adjust the delay before the screen automatically turns off</string>
<!-- Sound & display settings screen, compatibility mode check box label -->
- <string name="compatibility_mode_title">Compatibility Mode</string>
+ <string name="compatibility_mode_title">Compatibility mode</string>
<!-- Sound & display settings screen, compatibility mode option summary text when check box is selected -->
- <string name="compatibility_mode_summary_on">Run older apps in Compatibility mode. This require rebooting. </string>
+ <string name="compatibility_mode_summary_on">Run older applications in Compatibility mode. This requires a reboot. </string>
<!-- Sound & display settings screen, compatibility mode option summary text when check box is clear -->
- <string name="compatibility_mode_summary_off">Run older apps in Compatibility mode. This require rebooting. </string>
+ <string name="compatibility_mode_summary_off">Run older applications in Compatibility mode. This requires a reboot. </string>
<!-- SIM lock settings title -->
<string name="sim_lock_settings">SIM card lock settings</string>
@@ -1149,6 +1149,12 @@
<string name="location_street_level">When locating, accurate to street level (deselect to conserve battery)</string>
<!-- Security & location settings screen, setting summary when Enable GPS satellites check box is clear -->
<string name="location_gps_disabled">Locate to street-level (requires more battery plus view of sky)</string>
+ <!-- Security & location settings screen, setting check box label if Assisted GPS should be enabled -->
+ <string name="assisted_gps">Enable assisted GPS</string>
+ <!-- Security & location settings screen, setting summary when Assisted GPS check box is selected -->
+ <string name="assisted_gps_enabled">Use server to assist GPS (deselect to reduce network usage)</string>
+ <!-- Security & location settings screen, setting summary when Assisted GPS check box is clear -->
+ <string name="assisted_gps_disabled">Use server to assist GPS (select to improve GPS performance)</string>
<!-- Setting title for allow sending location to google -->
<string name="use_location_title">Share with Google</string>
<!-- Title of dialog to user requesting use of location information to improve services -->
@@ -1379,7 +1385,7 @@
<string name="computing_size">Computing\u2026</string>
<string name="invalid_size_value">Unable to compute package size</string>
<!-- String displayed when list is empty -->
- <string name="empty_list_msg">You do not have any third-party apps installed.</string>
+ <string name="empty_list_msg">You do not have any third-party applications installed.</string>
<!-- Manage applications, version string displayed in app snippet -->
<string name="version_text">version <xliff:g id="version_num">%1$s</xliff:g></string>
@@ -1814,6 +1820,8 @@
<!-- Power Control Widget -->
<string name="gadget_title">Power Control</string>
+ <string name="gadget_toggle_wifi">Updating Wi-Fi setting</string>
+ <string name="gadget_toggle_bluetooth">Updating Bluetooth setting</string>
<string name="vpn_settings_activity_title">VPN settings</string>
diff --git a/res/xml/security_settings.xml b/res/xml/security_settings.xml
index 8dd9d89..5b90dba 100644
--- a/res/xml/security_settings.xml
+++ b/res/xml/security_settings.xml
@@ -33,6 +33,12 @@
android:summaryOff="@string/location_gps_disabled"/>
<CheckBoxPreference
+ android:key="assisted_gps"
+ android:title="@string/assisted_gps"
+ android:summaryOn="@string/assisted_gps_enabled"
+ android:summaryOff="@string/assisted_gps_disabled"/>
+
+ <CheckBoxPreference
android:key="use_location"
android:title="@string/use_location_title"
android:persistent="false"
diff --git a/src/com/android/settings/ApnPreference.java b/src/com/android/settings/ApnPreference.java
index 74fb902..710eda2 100644
--- a/src/com/android/settings/ApnPreference.java
+++ b/src/com/android/settings/ApnPreference.java
@@ -107,7 +107,7 @@
return getKey().equals(mSelectedKey);
}
- public void setChecked(boolean checked) {
+ public void setChecked() {
mSelectedKey = getKey();
}
diff --git a/src/com/android/settings/ApnSettings.java b/src/com/android/settings/ApnSettings.java
index 2624990..00ef3a7 100644
--- a/src/com/android/settings/ApnSettings.java
+++ b/src/com/android/settings/ApnSettings.java
@@ -178,7 +178,7 @@
pref.setSelectable(selectable);
if (selectable) {
if ((mSelectedKey != null) && mSelectedKey.equals(key)) {
- pref.setChecked(true);
+ pref.setChecked();
}
apnList.addPreference(pref);
} else {
diff --git a/src/com/android/settings/BandMode.java b/src/com/android/settings/BandMode.java
index 1297cad..a8c7833 100644
--- a/src/com/android/settings/BandMode.java
+++ b/src/com/android/settings/BandMode.java
@@ -97,7 +97,7 @@
}
};
- private class BandListItem {
+ static private class BandListItem {
private int mBandMode = Phone.BM_UNSPECIFIED;
public BandListItem(int bm) {
diff --git a/src/com/android/settings/BatteryInfo.java b/src/com/android/settings/BatteryInfo.java
index eb7ddb4..4c25570 100644
--- a/src/com/android/settings/BatteryInfo.java
+++ b/src/com/android/settings/BatteryInfo.java
@@ -67,7 +67,7 @@
*/
private final String tenthsToFixedString(int x) {
int tens = x / 10;
- return new String("" + tens + "." + (x - 10*tens));
+ return Integer.toString(tens) + "." + (x - 10 * tens);
}
/**
diff --git a/src/com/android/settings/LanguageSettings.java b/src/com/android/settings/LanguageSettings.java
index cbab390..4b805ed 100644
--- a/src/com/android/settings/LanguageSettings.java
+++ b/src/com/android/settings/LanguageSettings.java
@@ -54,8 +54,6 @@
private String mLastInputMethodId;
private String mLastTickedInputMethodId;
- private String mRootDirectory;
-
static public String getInputMethodIdFromKey(String key) {
return key;
}
diff --git a/src/com/android/settings/ManageApplications.java b/src/com/android/settings/ManageApplications.java
index 1595de1..e5b2134 100644
--- a/src/com/android/settings/ManageApplications.java
+++ b/src/com/android/settings/ManageApplications.java
@@ -426,15 +426,20 @@
public void onGetStatsCompleted(PackageStats pStats, boolean pSucceeded) {
AppInfo appInfo = null;
Bundle data = new Bundle();
- data.putString(ATTR_PKG_NAME, pStats.packageName);
- if(pSucceeded && pStats != null) {
- if (localLOGV) Log.i(TAG, "onGetStatsCompleted::"+pStats.packageName+", ("+
- pStats.cacheSize+","+
- pStats.codeSize+", "+pStats.dataSize);
- data.putParcelable(ATTR_APP_PKG_STATS, pStats);
- } else {
+ if (pStats != null) {
+ data.putString(ATTR_PKG_NAME, pStats.packageName);
+ if(pSucceeded) {
+ if (localLOGV) Log.i(TAG, "onGetStatsCompleted::"+pStats.packageName+", ("+
+ pStats.cacheSize+","+
+ pStats.codeSize+", "+pStats.dataSize);
+ data.putParcelable(ATTR_APP_PKG_STATS, pStats);
+ }
+ }
+
+ if(!pSucceeded || pStats == null) {
Log.w(TAG, "Invalid package stats from PackageManager");
}
+
//post message to Handler
Message msg = mHandler.obtainMessage(mMsgId, data);
msg.setData(data);
@@ -705,7 +710,7 @@
// internal structure used to track added and deleted packages when
// the activity has focus
- class AddRemoveInfo {
+ static class AddRemoveInfo {
String pkgName;
boolean add;
public AddRemoveInfo(String pPkgName, boolean pAdd) {
diff --git a/src/com/android/settings/RadioInfo.java b/src/com/android/settings/RadioInfo.java
index 257122b..27d8c7e 100644
--- a/src/com/android/settings/RadioInfo.java
+++ b/src/com/android/settings/RadioInfo.java
@@ -256,21 +256,21 @@
}
};
- private class OemCommands {
+ static private class OemCommands {
- public final int OEM_QXDM_SDLOG_DEFAULT_FILE_SIZE = 32;
- public final int OEM_QXDM_SDLOG_DEFAULT_MASK = 0;
- public final int OEM_QXDM_SDLOG_DEFAULT_MAX_INDEX = 8;
+ public static final int OEM_QXDM_SDLOG_DEFAULT_FILE_SIZE = 32;
+ public static final int OEM_QXDM_SDLOG_DEFAULT_MASK = 0;
+ public static final int OEM_QXDM_SDLOG_DEFAULT_MAX_INDEX = 8;
- final int SIZE_OF_INT = 4;
- final int OEM_FEATURE_ENABLE = 1;
- final int OEM_FEATURE_DISABLE = 0;
- final int OEM_SIMPE_FEAUTURE_LEN = 1;
+ static final int SIZE_OF_INT = 4;
+ static final int OEM_FEATURE_ENABLE = 1;
+ static final int OEM_FEATURE_DISABLE = 0;
+ static final int OEM_SIMPE_FEAUTURE_LEN = 1;
- final int OEM_QXDM_SDLOG_FUNCTAG = 0x00010000;
- final int OEM_QXDM_SDLOG_LEN = 4;
- final int OEM_PS_AUTO_ATTACH_FUNCTAG = 0x00020000;
- final int OEM_CIPHERING_FUNCTAG = 0x00020001;
+ static final int OEM_QXDM_SDLOG_FUNCTAG = 0x00010000;
+ static final int OEM_QXDM_SDLOG_LEN = 4;
+ static final int OEM_PS_AUTO_ATTACH_FUNCTAG = 0x00020000;
+ static final int OEM_CIPHERING_FUNCTAG = 0x00020001;
/**
* The OEM interface to store QXDM to SD.
@@ -958,8 +958,7 @@
private void displayQxdmEnableResult() {
String status = mQxdmLogEnabled ? "Start QXDM Log" : "Stop QXDM Log";
- DialogInterface mProgressPanel = new AlertDialog.
- Builder(this).setMessage(status).show();
+ new AlertDialog.Builder(this).setMessage(status).show();
mHandler.postDelayed(
new Runnable() {
diff --git a/src/com/android/settings/SdCardSettings.java b/src/com/android/settings/SdCardSettings.java
index 637babe..67f3550 100644
--- a/src/com/android/settings/SdCardSettings.java
+++ b/src/com/android/settings/SdCardSettings.java
@@ -108,48 +108,41 @@
} catch (RemoteException ex) {
}
- String scanVolume = null; // this no longer exists: SystemProperties.get(MediaScanner.CURRENT_VOLUME_PROPERTY, "");
- boolean scanning = "external".equals(scanVolume);
+ String status = Environment.getExternalStorageState();
+ boolean readOnly = false;
- if (scanning) {
- setLayout(mScanningLayout);
- } else {
- String status = Environment.getExternalStorageState();
- boolean readOnly = false;
+ if (status.equals(Environment.MEDIA_MOUNTED_READ_ONLY)) {
+ status = Environment.MEDIA_MOUNTED;
+ readOnly = true;
+ }
- if (status.equals(Environment.MEDIA_MOUNTED_READ_ONLY)) {
- status = Environment.MEDIA_MOUNTED;
- readOnly = true;
+ if (status.equals(Environment.MEDIA_MOUNTED)) {
+ try {
+ File path = Environment.getExternalStorageDirectory();
+ StatFs stat = new StatFs(path.getPath());
+ long blockSize = stat.getBlockSize();
+ long totalBlocks = stat.getBlockCount();
+ long availableBlocks = stat.getAvailableBlocks();
+
+ mTotalSize.setText(formatSize(totalBlocks * blockSize));
+ mUsedSize.setText(formatSize((totalBlocks - availableBlocks) * blockSize));
+ mAvailableSize.setText(formatSize(availableBlocks * blockSize));
+ } catch (IllegalArgumentException e) {
+ // this can occur if the SD card is removed, but we haven't received the
+ // ACTION_MEDIA_REMOVED Intent yet.
+ status = Environment.MEDIA_REMOVED;
}
- if (status.equals(Environment.MEDIA_MOUNTED)) {
- try {
- File path = Environment.getExternalStorageDirectory();
- StatFs stat = new StatFs(path.getPath());
- long blockSize = stat.getBlockSize();
- long totalBlocks = stat.getBlockCount();
- long availableBlocks = stat.getAvailableBlocks();
-
- mTotalSize.setText(formatSize(totalBlocks * blockSize));
- mUsedSize.setText(formatSize((totalBlocks - availableBlocks) * blockSize));
- mAvailableSize.setText(formatSize(availableBlocks * blockSize));
- } catch (IllegalArgumentException e) {
- // this can occur if the SD card is removed, but we haven't received the
- // ACTION_MEDIA_REMOVED Intent yet.
- status = Environment.MEDIA_REMOVED;
- }
-
- mReadOnlyStatus.setVisibility(readOnly ? View.VISIBLE : View.GONE);
- setLayout(mMountedLayout);
- } else if (status.equals(Environment.MEDIA_UNMOUNTED)) {
- setLayout(mUnmountedLayout);
- } else if (status.equals(Environment.MEDIA_REMOVED)) {
- setLayout(mRemovedLayout);
- } else if (status.equals(Environment.MEDIA_SHARED)) {
- setLayout(mSharedLayout);
- } else if (status.equals(Environment.MEDIA_BAD_REMOVAL)) {
- setLayout(mBadRemovalLayout);
- }
+ mReadOnlyStatus.setVisibility(readOnly ? View.VISIBLE : View.GONE);
+ setLayout(mMountedLayout);
+ } else if (status.equals(Environment.MEDIA_UNMOUNTED)) {
+ setLayout(mUnmountedLayout);
+ } else if (status.equals(Environment.MEDIA_REMOVED)) {
+ setLayout(mRemovedLayout);
+ } else if (status.equals(Environment.MEDIA_SHARED)) {
+ setLayout(mSharedLayout);
+ } else if (status.equals(Environment.MEDIA_BAD_REMOVAL)) {
+ setLayout(mBadRemovalLayout);
}
}
@@ -191,8 +184,6 @@
}
};
-
- private int mStatus;
private IMountService mMountService;
private CheckBox mMassStorage;
diff --git a/src/com/android/settings/SecuritySettings.java b/src/com/android/settings/SecuritySettings.java
index 4947c2b..f579b78 100644
--- a/src/com/android/settings/SecuritySettings.java
+++ b/src/com/android/settings/SecuritySettings.java
@@ -79,6 +79,7 @@
private static final String LOCATION_CATEGORY = "location_category";
private static final String LOCATION_NETWORK = "location_network";
private static final String LOCATION_GPS = "location_gps";
+ private static final String ASSISTED_GPS = "assisted_gps";
// Credential storage
public static final String ACTION_ADD_CREDENTIAL =
@@ -109,6 +110,7 @@
private CheckBoxPreference mNetwork;
private CheckBoxPreference mGps;
+ private CheckBoxPreference mAssistedGps;
// These provide support for receiving notification when Location Manager settings change.
// This is necessary because the Network Location Provider can change settings
@@ -131,6 +133,7 @@
mNetwork = (CheckBoxPreference) getPreferenceScreen().findPreference(LOCATION_NETWORK);
mGps = (CheckBoxPreference) getPreferenceScreen().findPreference(LOCATION_GPS);
+ mAssistedGps = (CheckBoxPreference) getPreferenceScreen().findPreference(ASSISTED_GPS);
mUseLocation = (CheckBoxPreference) getPreferenceScreen().findPreference(USE_LOCATION);
// Vendor specific
@@ -297,8 +300,13 @@
Settings.Secure.setLocationProviderEnabled(getContentResolver(),
LocationManager.NETWORK_PROVIDER, mNetwork.isChecked());
} else if (preference == mGps) {
+ boolean enabled = mGps.isChecked();
Settings.Secure.setLocationProviderEnabled(getContentResolver(),
- LocationManager.GPS_PROVIDER, mGps.isChecked());
+ LocationManager.GPS_PROVIDER, enabled);
+ mAssistedGps.setEnabled(enabled);
+ } else if (preference == mAssistedGps) {
+ Settings.Secure.putInt(getContentResolver(), Settings.Secure.ASSISTED_GPS_ENABLED,
+ mAssistedGps.isChecked() ? 1 : 0);
} else if (preference == mUseLocation) {
//normally called on the toggle click
if (mUseLocation.isChecked()) {
@@ -340,10 +348,14 @@
*/
private void updateToggles() {
ContentResolver res = getContentResolver();
+ boolean gpsEnabled = Settings.Secure.isLocationProviderEnabled(
+ res, LocationManager.GPS_PROVIDER);
mNetwork.setChecked(Settings.Secure.isLocationProviderEnabled(
res, LocationManager.NETWORK_PROVIDER));
- mGps.setChecked(Settings.Secure.isLocationProviderEnabled(
- res, LocationManager.GPS_PROVIDER));
+ mGps.setChecked(gpsEnabled);
+ mAssistedGps.setChecked(Settings.Secure.getInt(res,
+ Settings.Secure.ASSISTED_GPS_ENABLED, 2) == 1);
+ mAssistedGps.setEnabled(gpsEnabled);
mUseLocation.setChecked(Settings.Secure.getInt(res,
Settings.Secure.USE_LOCATION_FOR_SERVICES, 2) == 1);
}
diff --git a/src/com/android/settings/UsageStats.java b/src/com/android/settings/UsageStats.java
index 89caa54..fcb6990 100755
--- a/src/com/android/settings/UsageStats.java
+++ b/src/com/android/settings/UsageStats.java
@@ -187,7 +187,7 @@
holder.launchCount.setText(String.valueOf(pkgStats.launchCount));
holder.usageTime.setText(String.valueOf(pkgStats.usageTime)+" ms");
} else {
- Log.w(TAG, "No usage stats info for package:"+pkgStats.packageName);
+ Log.w(TAG, "No usage stats info for package:" + position);
}
return convertView;
}
diff --git a/src/com/android/settings/ZoneList.java b/src/com/android/settings/ZoneList.java
index 2877f00..aaaf989 100644
--- a/src/com/android/settings/ZoneList.java
+++ b/src/com/android/settings/ZoneList.java
@@ -160,7 +160,7 @@
try {
XmlResourceParser xrp = getResources().getXml(R.xml.timezones);
while (xrp.next() != XmlResourceParser.START_TAG)
- ;
+ continue;
xrp.next();
while (xrp.getEventType() != XmlResourceParser.END_TAG) {
while (xrp.getEventType() != XmlResourceParser.START_TAG) {
diff --git a/src/com/android/settings/bluetooth/BluetoothDiscoverableEnabler.java b/src/com/android/settings/bluetooth/BluetoothDiscoverableEnabler.java
index 58fb569..665fba4 100644
--- a/src/com/android/settings/bluetooth/BluetoothDiscoverableEnabler.java
+++ b/src/com/android/settings/bluetooth/BluetoothDiscoverableEnabler.java
@@ -38,20 +38,20 @@
*/
public class BluetoothDiscoverableEnabler implements Preference.OnPreferenceChangeListener {
private static final String TAG = "BluetoothDiscoverableEnabler";
-
+
private static final String SYSTEM_PROPERTY_DISCOVERABLE_TIMEOUT =
"debug.bt.discoverable_time";
- private static final int DISCOVERABLE_TIMEOUT = 120;
+ private static final int DISCOVERABLE_TIMEOUT = 120;
private static final String SHARED_PREFERENCES_KEY_DISCOVERABLE_END_TIMESTAMP =
"discoverable_end_timestamp";
-
+
private final Context mContext;
private final Handler mUiHandler;
private final CheckBoxPreference mCheckBoxPreference;
-
+
private final LocalBluetoothManager mLocalManager;
-
+
private final BroadcastReceiver mReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
@@ -66,17 +66,17 @@
private final Runnable mUpdateCountdownSummaryRunnable = new Runnable() {
public void run() {
- updateCountdownSummary();
- }
+ updateCountdownSummary();
+ }
};
public BluetoothDiscoverableEnabler(Context context, CheckBoxPreference checkBoxPreference) {
mContext = context;
mUiHandler = new Handler();
mCheckBoxPreference = checkBoxPreference;
-
+
checkBoxPreference.setPersistent(false);
-
+
mLocalManager = LocalBluetoothManager.getInstance(context);
if (mLocalManager == null) {
// Bluetooth not supported
@@ -92,30 +92,30 @@
IntentFilter filter = new IntentFilter(BluetoothIntent.SCAN_MODE_CHANGED_ACTION);
mContext.registerReceiver(mReceiver, filter);
mCheckBoxPreference.setOnPreferenceChangeListener(this);
-
+
handleModeChanged(mLocalManager.getBluetoothManager().getScanMode());
}
-
+
public void pause() {
if (mLocalManager == null) {
return;
}
-
+
mUiHandler.removeCallbacks(mUpdateCountdownSummaryRunnable);
mCheckBoxPreference.setOnPreferenceChangeListener(null);
mContext.unregisterReceiver(mReceiver);
}
-
+
public boolean onPreferenceChange(Preference preference, Object value) {
// Turn on/off BT discoverability
setEnabled((Boolean) value);
-
+
return true;
}
-
+
private void setEnabled(final boolean enable) {
BluetoothDevice manager = mLocalManager.getBluetoothManager();
-
+
if (enable) {
int timeout = getDiscoverableTimeout();
@@ -126,7 +126,7 @@
long endTimestamp = System.currentTimeMillis() + timeout * 1000;
persistDiscoverableEndTimestamp(endTimestamp);
-
+
manager.setScanMode(BluetoothDevice.SCAN_MODE_CONNECTABLE_DISCOVERABLE);
} else {
manager.setScanMode(BluetoothDevice.SCAN_MODE_CONNECTABLE);
@@ -138,7 +138,7 @@
if (timeout <= 0) {
timeout = DISCOVERABLE_TIMEOUT;
}
-
+
return timeout;
}
@@ -147,44 +147,44 @@
editor.putLong(SHARED_PREFERENCES_KEY_DISCOVERABLE_END_TIMESTAMP, endTimestamp);
editor.commit();
}
-
+
private void handleModeChanged(int mode) {
if (mode == BluetoothDevice.SCAN_MODE_CONNECTABLE_DISCOVERABLE) {
mCheckBoxPreference.setChecked(true);
updateCountdownSummary();
-
+
} else {
mCheckBoxPreference.setChecked(false);
}
}
-
+
private void updateCountdownSummary() {
int mode = mLocalManager.getBluetoothManager().getScanMode();
if (mode != BluetoothDevice.SCAN_MODE_CONNECTABLE_DISCOVERABLE) {
return;
}
-
+
long currentTimestamp = System.currentTimeMillis();
long endTimestamp = mLocalManager.getSharedPreferences().getLong(
SHARED_PREFERENCES_KEY_DISCOVERABLE_END_TIMESTAMP, 0);
-
+
if (currentTimestamp > endTimestamp) {
// We're still in discoverable mode, but maybe there isn't a timeout.
mCheckBoxPreference.setSummaryOn(null);
return;
}
-
+
String formattedTimeLeft = String.valueOf((endTimestamp - currentTimestamp) / 1000);
-
+
mCheckBoxPreference.setSummaryOn(
mContext.getResources().getString(R.string.bluetooth_is_discoverable,
formattedTimeLeft));
-
+
synchronized (this) {
mUiHandler.removeCallbacks(mUpdateCountdownSummaryRunnable);
mUiHandler.postDelayed(mUpdateCountdownSummaryRunnable, 1000);
}
}
-
-
+
+
}
diff --git a/src/com/android/settings/bluetooth/BluetoothEventRedirector.java b/src/com/android/settings/bluetooth/BluetoothEventRedirector.java
index af64c98..55b2b77 100644
--- a/src/com/android/settings/bluetooth/BluetoothEventRedirector.java
+++ b/src/com/android/settings/bluetooth/BluetoothEventRedirector.java
@@ -17,6 +17,7 @@
package com.android.settings.bluetooth;
import android.bluetooth.BluetoothA2dp;
+import android.bluetooth.BluetoothClass;
import android.bluetooth.BluetoothDevice;
import android.bluetooth.BluetoothError;
import android.bluetooth.BluetoothHeadset;
@@ -37,39 +38,41 @@
public class BluetoothEventRedirector {
private static final String TAG = "BluetoothEventRedirector";
private static final boolean V = LocalBluetoothManager.V;
-
+
private LocalBluetoothManager mManager;
-
+
private BroadcastReceiver mBroadcastReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
if (V) {
Log.v(TAG, "Received " + intent.getAction());
}
-
+
String action = intent.getAction();
String address = intent.getStringExtra(BluetoothIntent.ADDRESS);
-
+
if (action.equals(BluetoothIntent.BLUETOOTH_STATE_CHANGED_ACTION)) {
int state = intent.getIntExtra(BluetoothIntent.BLUETOOTH_STATE,
BluetoothError.ERROR);
mManager.setBluetoothStateInt(state);
} else if (action.equals(BluetoothIntent.DISCOVERY_STARTED_ACTION)) {
mManager.onScanningStateChanged(true);
-
+
} else if (action.equals(BluetoothIntent.DISCOVERY_COMPLETED_ACTION)) {
mManager.onScanningStateChanged(false);
-
+
} else if (action.equals(BluetoothIntent.REMOTE_DEVICE_FOUND_ACTION)) {
short rssi = intent.getShortExtra(BluetoothIntent.RSSI, Short.MIN_VALUE);
- mManager.getLocalDeviceManager().onDeviceAppeared(address, rssi);
-
+ int btClass = intent.getIntExtra(BluetoothIntent.CLASS, BluetoothClass.ERROR);
+ String name = intent.getStringExtra(BluetoothIntent.NAME);
+ mManager.getLocalDeviceManager().onDeviceAppeared(address, rssi, btClass, name);
+
} else if (action.equals(BluetoothIntent.REMOTE_DEVICE_DISAPPEARED_ACTION)) {
mManager.getLocalDeviceManager().onDeviceDisappeared(address);
-
+
} else if (action.equals(BluetoothIntent.REMOTE_NAME_UPDATED_ACTION)) {
mManager.getLocalDeviceManager().onDeviceNameUpdated(address);
-
+
} else if (action.equals(BluetoothIntent.BOND_STATE_CHANGED_ACTION)) {
int bondState = intent.getIntExtra(BluetoothIntent.BOND_STATE,
BluetoothError.ERROR);
@@ -82,7 +85,7 @@
mManager.getLocalDeviceManager().onBondingError(address, reason);
}
}
-
+
} else if (action.equals(BluetoothIntent.HEADSET_STATE_CHANGED_ACTION)) {
int newState = intent.getIntExtra(BluetoothIntent.HEADSET_STATE, 0);
int oldState = intent.getIntExtra(BluetoothIntent.HEADSET_PREVIOUS_STATE, 0);
@@ -107,7 +110,7 @@
} else if (action.equals(BluetoothIntent.REMOTE_DEVICE_CLASS_UPDATED_ACTION)) {
mManager.getLocalDeviceManager().onBtClassChanged(address);
-
+
}
}
};
@@ -118,29 +121,29 @@
public void start() {
IntentFilter filter = new IntentFilter();
-
+
// Bluetooth on/off broadcasts
filter.addAction(BluetoothIntent.BLUETOOTH_STATE_CHANGED_ACTION);
-
+
// Discovery broadcasts
filter.addAction(BluetoothIntent.DISCOVERY_STARTED_ACTION);
filter.addAction(BluetoothIntent.DISCOVERY_COMPLETED_ACTION);
filter.addAction(BluetoothIntent.REMOTE_DEVICE_DISAPPEARED_ACTION);
filter.addAction(BluetoothIntent.REMOTE_DEVICE_FOUND_ACTION);
filter.addAction(BluetoothIntent.REMOTE_NAME_UPDATED_ACTION);
-
+
// Pairing broadcasts
filter.addAction(BluetoothIntent.BOND_STATE_CHANGED_ACTION);
-
+
// Fine-grained state broadcasts
filter.addAction(BluetoothA2dp.SINK_STATE_CHANGED_ACTION);
filter.addAction(BluetoothIntent.HEADSET_STATE_CHANGED_ACTION);
filter.addAction(BluetoothIntent.REMOTE_DEVICE_CLASS_UPDATED_ACTION);
-
+
mManager.getContext().registerReceiver(mBroadcastReceiver, filter);
}
-
+
public void stop() {
- mManager.getContext().unregisterReceiver(mBroadcastReceiver);
+ mManager.getContext().unregisterReceiver(mBroadcastReceiver);
}
}
diff --git a/src/com/android/settings/bluetooth/LocalBluetoothDevice.java b/src/com/android/settings/bluetooth/LocalBluetoothDevice.java
index 5259d7b..862a9bd 100644
--- a/src/com/android/settings/bluetooth/LocalBluetoothDevice.java
+++ b/src/com/android/settings/bluetooth/LocalBluetoothDevice.java
@@ -82,7 +82,7 @@
CONNECT, DISCONNECT,
}
- class BluetoothJob {
+ static class BluetoothJob {
final BluetoothCommand command; // CONNECT, DISCONNECT
final LocalBluetoothDevice device;
final Profile profile; // HEADSET, A2DP, etc
@@ -96,7 +96,7 @@
this.profile = profile;
this.timeSent = 0;
}
-
+
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
@@ -147,7 +147,7 @@
}
}
}
-
+
private boolean pruneQueue(BluetoothJob job) {
boolean removedStaleItems = false;
long now = System.currentTimeMillis();
@@ -186,7 +186,7 @@
private boolean processCommand(BluetoothJob job) {
boolean successful = false;
if (job.timeSent == 0) {
- job.timeSent = System.currentTimeMillis();
+ job.timeSent = System.currentTimeMillis();
switch (job.command) {
case CONNECT:
successful = connectInt(job.device, job.profile);
@@ -349,7 +349,7 @@
}
};
- AlertDialog ad = new AlertDialog.Builder(context)
+ new AlertDialog.Builder(context)
.setTitle(getName())
.setMessage(message)
.setPositiveButton(android.R.string.ok, disconnectListener)
@@ -363,7 +363,6 @@
// Reset the only-show-one-error-dialog tracking variable
mIsConnectingErrorPossible = true;
- Context context = mLocalManager.getContext();
boolean hasAtLeastOnePreferredProfile = false;
for (Profile profile : mProfiles) {
LocalBluetoothProfileManager profileManager =
@@ -385,7 +384,6 @@
// Reset the only-show-one-error-dialog tracking variable
mIsConnectingErrorPossible = true;
- Context context = mLocalManager.getContext();
for (Profile profile : mProfiles) {
LocalBluetoothProfileManager profileManager =
LocalBluetoothProfileManager.getProfileManager(mLocalManager, profile);
@@ -450,7 +448,7 @@
public void unpair() {
synchronized (workQueue) {
// Remove any pending commands for this device
- boolean processNow = false;
+ boolean processNow = false;
Iterator<BluetoothJob> it = workQueue.iterator();
while (it.hasNext()) {
BluetoothJob job = it.next();
@@ -480,8 +478,6 @@
}
private void fillData() {
- BluetoothDevice manager = mLocalManager.getBluetoothManager();
-
fetchName();
fetchBtClass();
@@ -498,6 +494,17 @@
return mName;
}
+ public void setName(String name) {
+ if (!mName.equals(name)) {
+ if (TextUtils.isEmpty(name)) {
+ mName = mAddress;
+ } else {
+ mName = name;
+ }
+ dispatchAttributesChanged();
+ }
+ }
+
public void refreshName() {
fetchName();
dispatchAttributesChanged();
@@ -571,23 +578,19 @@
}
public int getBtClassDrawable() {
-
- // First try looking at profiles
- if (mProfiles.contains(Profile.A2DP)) {
- return R.drawable.ic_bt_headphones_a2dp;
- } else if (mProfiles.contains(Profile.HEADSET)) {
- return R.drawable.ic_bt_headset_hfp;
- }
-
- // Fallback on class
switch (BluetoothClass.Device.Major.getDeviceMajor(mBtClass)) {
case BluetoothClass.Device.Major.COMPUTER:
return R.drawable.ic_bt_laptop;
case BluetoothClass.Device.Major.PHONE:
return R.drawable.ic_bt_cellphone;
+ }
- default:
+ if (mProfiles.contains(Profile.A2DP)) {
+ return R.drawable.ic_bt_headphones_a2dp;
+ } else if (mProfiles.contains(Profile.HEADSET)) {
+ return R.drawable.ic_bt_headset_hfp;
+ } else {
return 0;
}
}
@@ -611,6 +614,14 @@
dispatchAttributesChanged();
}
+ public void setBtClass(int btClass) {
+ if (mBtClass != btClass && btClass != BluetoothClass.ERROR) {
+ mBtClass = btClass;
+ LocalBluetoothProfileManager.fill(mBtClass, mProfiles);
+ dispatchAttributesChanged();
+ }
+ }
+
public int getSummary() {
// TODO: clean up
int oneOffSummary = getOneOffSummary();
@@ -726,7 +737,6 @@
break;
case CONTEXT_ITEM_UNPAIR:
- mLocalManager.getBluetoothManager().disconnectRemoteDeviceAcl(mAddress);
unpair();
break;
diff --git a/src/com/android/settings/bluetooth/LocalBluetoothDeviceManager.java b/src/com/android/settings/bluetooth/LocalBluetoothDeviceManager.java
index 2c70fd2..819d482 100644
--- a/src/com/android/settings/bluetooth/LocalBluetoothDeviceManager.java
+++ b/src/com/android/settings/bluetooth/LocalBluetoothDeviceManager.java
@@ -34,7 +34,7 @@
final LocalBluetoothManager mLocalManager;
final List<Callback> mCallbacks;
-
+
final List<LocalBluetoothDevice> mDevices = new ArrayList<LocalBluetoothDevice>();
public LocalBluetoothDeviceManager(LocalBluetoothManager localManager) {
@@ -47,7 +47,7 @@
BluetoothDevice manager = mLocalManager.getBluetoothManager();
String[] bondedAddresses = manager.listBonds();
if (bondedAddresses == null) return false;
-
+
boolean deviceAdded = false;
for (String address : bondedAddresses) {
LocalBluetoothDevice device = findDevice(address);
@@ -58,55 +58,58 @@
deviceAdded = true;
}
}
-
+
return deviceAdded;
}
-
+
public synchronized List<LocalBluetoothDevice> getDevicesCopy() {
return new ArrayList<LocalBluetoothDevice>(mDevices);
}
-
+
void onBluetoothStateChanged(boolean enabled) {
if (enabled) {
readPairedDevices();
}
}
- public synchronized void onDeviceAppeared(String address, short rssi) {
+ public synchronized void onDeviceAppeared(String address, short rssi, int btClass,
+ String name) {
boolean deviceAdded = false;
-
+
LocalBluetoothDevice device = findDevice(address);
if (device == null) {
device = new LocalBluetoothDevice(mLocalManager.getContext(), address);
mDevices.add(device);
deviceAdded = true;
}
-
+
device.setRssi(rssi);
+ device.setBtClass(btClass);
+ device.setName(name);
device.setVisible(true);
-
+
if (deviceAdded) {
dispatchDeviceAdded(device);
}
}
-
+
public synchronized void onDeviceDisappeared(String address) {
LocalBluetoothDevice device = findDevice(address);
if (device == null) return;
-
+
device.setVisible(false);
checkForDeviceRemoval(device);
}
-
+
private void checkForDeviceRemoval(LocalBluetoothDevice device) {
if (device.getBondState() == BluetoothDevice.BOND_NOT_BONDED &&
!device.isVisible()) {
// If device isn't paired, remove it altogether
mDevices.remove(device);
dispatchDeviceDeleted(device);
- }
+ }
}
-
+
public synchronized void onDeviceNameUpdated(String address) {
LocalBluetoothDevice device = findDevice(address);
if (device != null) {
@@ -115,21 +118,21 @@
}
public synchronized LocalBluetoothDevice findDevice(String address) {
-
+
for (int i = mDevices.size() - 1; i >= 0; i--) {
LocalBluetoothDevice device = mDevices.get(i);
-
+
if (device.getAddress().equals(address)) {
return device;
}
}
-
+
return null;
}
-
+
/**
* Attempts to get the name of a remote device, otherwise returns the address.
- *
+ *
* @param address The address.
* @return The name, or if unavailable, the address.
*/
@@ -137,17 +140,17 @@
LocalBluetoothDevice device = findDevice(address);
return device != null ? device.getName() : address;
}
-
+
private void dispatchDeviceAdded(LocalBluetoothDevice device) {
synchronized (mCallbacks) {
for (Callback callback : mCallbacks) {
callback.onDeviceAdded(device);
}
}
-
+
// TODO: divider between prev paired/connected and scanned
}
-
+
private void dispatchDeviceDeleted(LocalBluetoothDevice device) {
synchronized (mCallbacks) {
for (Callback callback : mCallbacks) {
@@ -176,7 +179,7 @@
/**
* Called when there is a bonding error.
- *
+ *
* @param address The address of the remote device.
* @param reason The reason, one of the error reasons from
* BluetoothDevice.UNBOND_REASON_*
@@ -199,7 +202,7 @@
}
mLocalManager.showError(address, R.string.bluetooth_error_title, errorMsg);
}
-
+
public synchronized void onProfileStateChanged(String address, Profile profile,
int newProfileState) {
LocalBluetoothDevice device = findDevice(address);
@@ -208,11 +211,11 @@
device.onProfileStateChanged(profile, newProfileState);
device.refresh();
}
-
+
public synchronized void onConnectingError(String address) {
LocalBluetoothDevice device = findDevice(address);
if (device == null) return;
-
+
/*
* Go through the device's delegate so we don't spam the user with
* errors connecting to different profiles, and instead make sure the
@@ -220,10 +223,10 @@
*/
device.showConnectingError();
}
-
+
public synchronized void onScanningStateChanged(boolean started) {
if (!started) return;
-
+
// If starting a new scan, clear old visibility
for (int i = mDevices.size() - 1; i >= 0; i--) {
LocalBluetoothDevice device = mDevices.get(i);
@@ -231,7 +234,7 @@
checkForDeviceRemoval(device);
}
}
-
+
public synchronized void onBtClassChanged(String address) {
LocalBluetoothDevice device = findDevice(address);
if (device != null) {
diff --git a/src/com/android/settings/bluetooth/LocalBluetoothManager.java b/src/com/android/settings/bluetooth/LocalBluetoothManager.java
index 2e84338..a6e9d50 100644
--- a/src/com/android/settings/bluetooth/LocalBluetoothManager.java
+++ b/src/com/android/settings/bluetooth/LocalBluetoothManager.java
@@ -42,15 +42,15 @@
public class LocalBluetoothManager {
private static final String TAG = "LocalBluetoothManager";
static final boolean V = Config.LOGV;
- static final boolean D = Config.LOGD && false;
-
+ static final boolean D = Config.LOGD;
+
private static final String SHARED_PREFERENCES_NAME = "bluetooth_settings";
-
+
private static LocalBluetoothManager INSTANCE;
/** Used when obtaining a reference to the singleton instance. */
private static Object INSTANCE_LOCK = new Object();
private boolean mInitialized;
-
+
private Context mContext;
/** If a BT-related activity is in the foreground, this will be it. */
private Activity mForegroundActivity;
@@ -61,24 +61,24 @@
private LocalBluetoothDeviceManager mLocalDeviceManager;
private BluetoothEventRedirector mEventRedirector;
private BluetoothA2dp mBluetoothA2dp;
-
+
private int mState = BluetoothError.ERROR;
private List<Callback> mCallbacks = new ArrayList<Callback>();
-
+
private static final int SCAN_EXPIRATION_MS = 5 * 60 * 1000; // 5 mins
private long mLastScan;
-
+
public static LocalBluetoothManager getInstance(Context context) {
synchronized (INSTANCE_LOCK) {
if (INSTANCE == null) {
INSTANCE = new LocalBluetoothManager();
}
-
+
if (!INSTANCE.init(context)) {
return null;
}
-
+
return INSTANCE;
}
}
@@ -86,15 +86,15 @@
private boolean init(Context context) {
if (mInitialized) return true;
mInitialized = true;
-
+
// This will be around as long as this process is
mContext = context.getApplicationContext();
-
+
mManager = (BluetoothDevice) context.getSystemService(Context.BLUETOOTH_SERVICE);
if (mManager == null) {
return false;
}
-
+
mLocalDeviceManager = new LocalBluetoothDeviceManager(this);
mEventRedirector = new BluetoothEventRedirector(this);
@@ -104,11 +104,11 @@
return true;
}
-
+
public BluetoothDevice getBluetoothManager() {
return mManager;
}
-
+
public Context getContext() {
return mContext;
}
@@ -116,7 +116,7 @@
public Activity getForegroundActivity() {
return mForegroundActivity;
}
-
+
public void setForegroundActivity(Activity activity) {
if (mErrorDialog != null) {
mErrorDialog.dismiss();
@@ -124,31 +124,31 @@
}
mForegroundActivity = activity;
}
-
+
public SharedPreferences getSharedPreferences() {
return mContext.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_PRIVATE);
}
-
+
public LocalBluetoothDeviceManager getLocalDeviceManager() {
return mLocalDeviceManager;
}
-
+
List<Callback> getCallbacks() {
return mCallbacks;
}
-
+
public void registerCallback(Callback callback) {
synchronized (mCallbacks) {
mCallbacks.add(callback);
}
}
-
+
public void unregisterCallback(Callback callback) {
synchronized (mCallbacks) {
mCallbacks.remove(callback);
}
}
-
+
public void startScanning(boolean force) {
if (mManager.isDiscovering()) {
/*
@@ -156,7 +156,7 @@
* Note: we only call the callbacks, not the same path as if the
* scanning state had really changed (in that case the device
* manager would clear its list of unpaired scanned devices).
- */
+ */
dispatchScanningStateChanged(true);
} else {
if (!force) {
@@ -176,22 +176,22 @@
}
}
}
-
- if (mManager.startDiscovery(true)) {
+
+ if (mManager.startDiscovery()) {
mLastScan = System.currentTimeMillis();
}
}
}
-
+
public int getBluetoothState() {
-
+
if (mState == BluetoothError.ERROR) {
syncBluetoothState();
}
-
+
return mState;
}
-
+
void setBluetoothStateInt(int state) {
mState = state;
if (state == BluetoothDevice.BLUETOOTH_STATE_ON ||
@@ -199,7 +199,7 @@
mLocalDeviceManager.onBluetoothStateChanged(state == BluetoothDevice.BLUETOOTH_STATE_ON);
}
}
-
+
private void syncBluetoothState() {
int bluetoothState;
@@ -218,7 +218,7 @@
boolean wasSetStateSuccessful = enabled
? mManager.enable()
: mManager.disable();
-
+
if (wasSetStateSuccessful) {
setBluetoothStateInt(enabled
? BluetoothDevice.BLUETOOTH_STATE_TURNING_ON
@@ -229,11 +229,11 @@
"setBluetoothEnabled call, manager didn't return success for enabled: "
+ enabled);
}
-
+
syncBluetoothState();
}
}
-
+
/**
* @param started True if scanning started, false if scanning finished.
*/
@@ -242,7 +242,7 @@
mLocalDeviceManager.onScanningStateChanged(started);
dispatchScanningStateChanged(started);
}
-
+
private void dispatchScanningStateChanged(boolean started) {
synchronized (mCallbacks) {
for (Callback callback : mCallbacks) {
@@ -267,7 +267,7 @@
.setPositiveButton(android.R.string.ok, null)
.show();
} else {
- // Fallback on a toast
+ // Fallback on a toast
Toast.makeText(mContext, message, Toast.LENGTH_SHORT).show();
}
}
@@ -277,5 +277,5 @@
void onDeviceAdded(LocalBluetoothDevice device);
void onDeviceDeleted(LocalBluetoothDevice device);
}
-
+
}
diff --git a/src/com/android/settings/deviceinfo/Status.java b/src/com/android/settings/deviceinfo/Status.java
index a165754..4b1cbbf 100644
--- a/src/com/android/settings/deviceinfo/Status.java
+++ b/src/com/android/settings/deviceinfo/Status.java
@@ -375,7 +375,6 @@
void updateTimes() {
long at = SystemClock.uptimeMillis() / 1000;
long ut = SystemClock.elapsedRealtime() / 1000;
- long st = ut - at;
if (ut == 0) {
ut = 1;
diff --git a/src/com/android/settings/quicklaunch/QuickLaunchSettings.java b/src/com/android/settings/quicklaunch/QuickLaunchSettings.java
index 40316b5..fb9fbcd 100644
--- a/src/com/android/settings/quicklaunch/QuickLaunchSettings.java
+++ b/src/com/android/settings/quicklaunch/QuickLaunchSettings.java
@@ -226,8 +226,7 @@
Log.w(TAG, "Result from bookmark picker does not have an intent.");
return;
}
-
- String title = data.getStringExtra(BookmarkPicker.EXTRA_TITLE);
+
char shortcut = data.getCharExtra(BookmarkPicker.EXTRA_SHORTCUT, (char) 0);
updateShortcut(shortcut, data);
diff --git a/src/com/android/settings/widget/SettingsAppWidgetProvider.java b/src/com/android/settings/widget/SettingsAppWidgetProvider.java
index d8747c9..caffea2 100644
--- a/src/com/android/settings/widget/SettingsAppWidgetProvider.java
+++ b/src/com/android/settings/widget/SettingsAppWidgetProvider.java
@@ -36,6 +36,7 @@
import android.provider.Settings;
import android.util.Log;
import android.widget.RemoteViews;
+import android.widget.Toast;
import com.android.settings.R;
import com.android.settings.bluetooth.LocalBluetoothManager;
@@ -175,7 +176,8 @@
views.setImageViewResource(R.id.btn_bluetooth, R.drawable.widget_btn_bluetooth);
break;
case STATE_INTERMEDIATE:
- views.setImageViewResource(R.id.btn_bluetooth, R.drawable.widget_btn_bluetooth_gray);
+ views.setImageViewResource(R.id.btn_bluetooth,
+ R.drawable.widget_btn_bluetooth_gray);
break;
}
}
@@ -187,7 +189,8 @@
* @param appWidgetId
* @return
*/
- private static PendingIntent getLaunchPendingIntent(Context context, int appWidgetId, int buttonId) {
+ private static PendingIntent getLaunchPendingIntent(Context context, int appWidgetId,
+ int buttonId) {
Intent launchIntent = new Intent();
launchIntent.setClass(context, SettingsAppWidgetProvider.class);
launchIntent.addCategory(Intent.CATEGORY_ALTERNATIVE);
@@ -256,6 +259,7 @@
} else if (wifiState == STATE_DISABLED) {
wifiManager.setWifiEnabled(true);
}
+ Toast.makeText(context, R.string.gadget_toggle_wifi, Toast.LENGTH_SHORT).show();
}
/**
@@ -265,7 +269,8 @@
* @return true if enabled
*/
private static boolean getBackgroundDataState(Context context) {
- ConnectivityManager connManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
+ ConnectivityManager connManager =
+ (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
return connManager.getBackgroundDataSetting();
}
@@ -275,16 +280,11 @@
* @param context
*/
private void toggleBackgroundData(Context context) {
- ConnectivityManager connManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
+ ConnectivityManager connManager =
+ (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
boolean sync = getBackgroundDataState(context);
connManager.setBackgroundDataSetting(!sync);
-
- IContentService contentService = ContentResolver.getContentService();
- try {
- contentService.setListenForNetworkTickles(!sync);
- } catch (RemoteException e) {
- Log.d(TAG, "toggleBackgroundData: " + e);
- }
+ ContentResolver.setMasterSyncAutomatically(!sync);
}
/**
@@ -306,7 +306,8 @@
private void toggleGps(Context context) {
ContentResolver resolver = context.getContentResolver();
boolean enabled = getGpsState(context);
- Settings.Secure.setLocationProviderEnabled(resolver, LocationManager.GPS_PROVIDER, !enabled);
+ Settings.Secure.setLocationProviderEnabled(resolver, LocationManager.GPS_PROVIDER,
+ !enabled);
}
/**
@@ -399,5 +400,6 @@
} else if (state == STATE_DISABLED) {
mLocalBluetoothManager.setBluetoothEnabled(true);
}
+ Toast.makeText(context, R.string.gadget_toggle_bluetooth, Toast.LENGTH_SHORT).show();
}
}
diff --git a/src/com/android/settings/wifi/AccessPointDialog.java b/src/com/android/settings/wifi/AccessPointDialog.java
index c9f511b..3a179a0 100644
--- a/src/com/android/settings/wifi/AccessPointDialog.java
+++ b/src/com/android/settings/wifi/AccessPointDialog.java
@@ -439,12 +439,12 @@
}
private void updatePasswordCaption(String security) {
-
- if (mPasswordText != null && security != null
- && security.equals(AccessPointState.WEP)) {
- mPasswordText.setText(R.string.please_type_hex_key);
- } else {
- mPasswordText.setText(R.string.please_type_passphrase);
+ if (mPasswordText != null) {
+ if (security != null && security.equals(AccessPointState.WEP)) {
+ mPasswordText.setText(R.string.please_type_hex_key);
+ } else {
+ mPasswordText.setText(R.string.please_type_passphrase);
+ }
}
}
diff --git a/src/com/android/settings/wifi/AccessPointPreference.java b/src/com/android/settings/wifi/AccessPointPreference.java
index 10e0947..6dd5492 100644
--- a/src/com/android/settings/wifi/AccessPointPreference.java
+++ b/src/com/android/settings/wifi/AccessPointPreference.java
@@ -33,14 +33,11 @@
// Signal strength indicator
private static final int UI_SIGNAL_LEVELS = 4;
- private WifiSettings mWifiSettings;
-
private AccessPointState mState;
public AccessPointPreference(WifiSettings wifiSettings, AccessPointState state) {
super(wifiSettings, null);
- mWifiSettings = wifiSettings;
mState = state;
setWidgetLayoutResource(R.layout.preference_widget_wifi_signal);
diff --git a/src/com/android/settings/wifi/AdvancedSettings.java b/src/com/android/settings/wifi/AdvancedSettings.java
index 323d5c7..f48e017 100644
--- a/src/com/android/settings/wifi/AdvancedSettings.java
+++ b/src/com/android/settings/wifi/AdvancedSettings.java
@@ -141,7 +141,7 @@
try {
int numChannels = Integer.parseInt((String) newValue);
WifiManager wifiManager = (WifiManager) getSystemService(WIFI_SERVICE);
- if (!wifiManager.setNumAllowedChannels(numChannels)) {
+ if (!wifiManager.setNumAllowedChannels(numChannels, true)) {
Toast.makeText(this, R.string.wifi_setting_num_channels_error,
Toast.LENGTH_SHORT).show();
}
diff --git a/src/com/android/settings/wifi/WifiLayer.java b/src/com/android/settings/wifi/WifiLayer.java
index 5d896aa..ce518e1 100644
--- a/src/com/android/settings/wifi/WifiLayer.java
+++ b/src/com/android/settings/wifi/WifiLayer.java
@@ -774,7 +774,9 @@
* We pass null for security since we have a network ID (i.e., it's
* not a wildcard), and rely on it matching.
*/
- return findApLocked(wifiInfo.getNetworkId(), wifiInfo.getBSSID(), ssid, null);
+ synchronized (this) {
+ return findApLocked(wifiInfo.getNetworkId(), wifiInfo.getBSSID(), ssid, null);
+ }
} else {
return null;
}
@@ -1013,8 +1015,10 @@
* We pass null for security since we have a network ID (i.e., it's
* not a wildcard), and rely on it matching.
*/
- ap = findApLocked(wifiInfo.getNetworkId(), wifiInfo.getBSSID(), wifiInfo
- .getSSID(), null);
+ synchronized (this) {
+ ap = findApLocked(wifiInfo.getNetworkId(), wifiInfo.getBSSID(), wifiInfo
+ .getSSID(), null);
+ }
}
if (ap != null) {
diff --git a/src/com/android/settings/wifi/WifiSettings.java b/src/com/android/settings/wifi/WifiSettings.java
index a015534..d283fb3 100644
--- a/src/com/android/settings/wifi/WifiSettings.java
+++ b/src/com/android/settings/wifi/WifiSettings.java
@@ -373,8 +373,8 @@
}
mDialog = dialog;
- dialog.setOnDismissListener(this);
if (dialog != null) {
+ dialog.setOnDismissListener(this);
dialog.show();
}
}