summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/com/android/settings/ApnPreference.java2
-rw-r--r--src/com/android/settings/ApnSettings.java2
-rw-r--r--src/com/android/settings/BandMode.java2
-rw-r--r--src/com/android/settings/BatteryInfo.java2
-rw-r--r--src/com/android/settings/LanguageSettings.java2
-rw-r--r--src/com/android/settings/ManageApplications.java21
-rw-r--r--src/com/android/settings/RadioInfo.java27
-rw-r--r--src/com/android/settings/SdCardSettings.java75
-rw-r--r--src/com/android/settings/SecuritySettings.java18
-rwxr-xr-xsrc/com/android/settings/UsageStats.java2
-rw-r--r--src/com/android/settings/ZoneList.java2
-rw-r--r--src/com/android/settings/bluetooth/BluetoothDiscoverableEnabler.java56
-rw-r--r--src/com/android/settings/bluetooth/BluetoothEventRedirector.java41
-rw-r--r--src/com/android/settings/bluetooth/LocalBluetoothDevice.java36
-rw-r--r--src/com/android/settings/bluetooth/LocalBluetoothDeviceManager.java61
-rw-r--r--src/com/android/settings/bluetooth/LocalBluetoothManager.java70
-rw-r--r--src/com/android/settings/deviceinfo/Status.java1
-rw-r--r--src/com/android/settings/quicklaunch/QuickLaunchSettings.java3
-rw-r--r--src/com/android/settings/widget/SettingsAppWidgetProvider.java8
-rw-r--r--src/com/android/settings/wifi/AccessPointDialog.java12
-rw-r--r--src/com/android/settings/wifi/AccessPointPreference.java3
-rw-r--r--src/com/android/settings/wifi/AdvancedSettings.java2
-rw-r--r--src/com/android/settings/wifi/WifiLayer.java10
-rw-r--r--src/com/android/settings/wifi/WifiSettings.java2
24 files changed, 239 insertions, 221 deletions
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 @@ public class ApnPreference extends Preference implements
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 @@ public class ApnSettings extends PreferenceActivity implements
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 @@ public class BandMode extends Activity {
}
};
- 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 @@ public class BatteryInfo extends Activity {
*/
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 @@ public class LanguageSettings extends PreferenceActivity {
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 class ManageApplications extends ListActivity implements
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 @@ public class ManageApplications extends ListActivity implements
// 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 @@ public class RadioInfo extends Activity {
}
};
- 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 @@ public class RadioInfo extends Activity {
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 @@ public class SdCardSettings extends Activity
} catch (RemoteException ex) {
}
- String scanVolume = null; // this no longer exists: SystemProperties.get(MediaScanner.CURRENT_VOLUME_PROPERTY, "");
- boolean scanning = "external".equals(scanVolume);
-
- 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;
- }
+ 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)) {
- 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);
+ 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);
}
}
@@ -191,8 +184,6 @@ public class SdCardSettings extends Activity
}
};
-
- 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 73578c7..8069c7c 100644
--- a/src/com/android/settings/SecuritySettings.java
+++ b/src/com/android/settings/SecuritySettings.java
@@ -78,6 +78,7 @@ public class SecuritySettings extends PreferenceActivity implements
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 =
@@ -108,6 +109,7 @@ public class SecuritySettings extends PreferenceActivity implements
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
@@ -130,6 +132,7 @@ public class SecuritySettings extends PreferenceActivity implements
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
@@ -295,8 +298,13 @@ public class SecuritySettings extends PreferenceActivity implements
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()) {
@@ -338,10 +346,14 @@ public class SecuritySettings extends PreferenceActivity implements
*/
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 @@ public class UsageStats extends Activity implements OnItemSelectedListener {
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 @@ public class ZoneList extends ListActivity {
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 @@ import android.preference.CheckBoxPreference;
*/
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 @@ public class BluetoothDiscoverableEnabler implements Preference.OnPreferenceChan
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 @@ public class BluetoothDiscoverableEnabler implements Preference.OnPreferenceChan
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 @@ public class BluetoothDiscoverableEnabler implements Preference.OnPreferenceChan
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 @@ public class BluetoothDiscoverableEnabler implements Preference.OnPreferenceChan
if (timeout <= 0) {
timeout = DISCOVERABLE_TIMEOUT;
}
-
+
return timeout;
}
@@ -147,44 +147,44 @@ public class BluetoothDiscoverableEnabler implements Preference.OnPreferenceChan
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 @@ import com.android.settings.bluetooth.LocalBluetoothProfileManager.Profile;
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 @@ public class BluetoothEventRedirector {
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 @@ public class BluetoothEventRedirector {
} else if (action.equals(BluetoothIntent.REMOTE_DEVICE_CLASS_UPDATED_ACTION)) {
mManager.getLocalDeviceManager().onBtClassChanged(address);
-
+
}
}
};
@@ -118,29 +121,29 @@ public class BluetoothEventRedirector {
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..53ba44f 100644
--- a/src/com/android/settings/bluetooth/LocalBluetoothDevice.java
+++ b/src/com/android/settings/bluetooth/LocalBluetoothDevice.java
@@ -82,7 +82,7 @@ public class LocalBluetoothDevice implements Comparable<LocalBluetoothDevice> {
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 @@ public class LocalBluetoothDevice implements Comparable<LocalBluetoothDevice> {
this.profile = profile;
this.timeSent = 0;
}
-
+
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
@@ -147,7 +147,7 @@ public class LocalBluetoothDevice implements Comparable<LocalBluetoothDevice> {
}
}
}
-
+
private boolean pruneQueue(BluetoothJob job) {
boolean removedStaleItems = false;
long now = System.currentTimeMillis();
@@ -186,7 +186,7 @@ public class LocalBluetoothDevice implements Comparable<LocalBluetoothDevice> {
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 @@ public class LocalBluetoothDevice implements Comparable<LocalBluetoothDevice> {
}
};
- AlertDialog ad = new AlertDialog.Builder(context)
+ new AlertDialog.Builder(context)
.setTitle(getName())
.setMessage(message)
.setPositiveButton(android.R.string.ok, disconnectListener)
@@ -363,7 +363,6 @@ public class LocalBluetoothDevice implements Comparable<LocalBluetoothDevice> {
// 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 @@ public class LocalBluetoothDevice implements Comparable<LocalBluetoothDevice> {
// 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 class LocalBluetoothDevice implements Comparable<LocalBluetoothDevice> {
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 @@ public class LocalBluetoothDevice implements Comparable<LocalBluetoothDevice> {
}
private void fillData() {
- BluetoothDevice manager = mLocalManager.getBluetoothManager();
-
fetchName();
fetchBtClass();
@@ -498,6 +494,17 @@ public class LocalBluetoothDevice implements Comparable<LocalBluetoothDevice> {
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();
@@ -611,6 +618,14 @@ public class LocalBluetoothDevice implements Comparable<LocalBluetoothDevice> {
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 +741,6 @@ public class LocalBluetoothDevice implements Comparable<LocalBluetoothDevice> {
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 @@ public class LocalBluetoothDeviceManager {
final LocalBluetoothManager mLocalManager;
final List<Callback> mCallbacks;
-
+
final List<LocalBluetoothDevice> mDevices = new ArrayList<LocalBluetoothDevice>();
public LocalBluetoothDeviceManager(LocalBluetoothManager localManager) {
@@ -47,7 +47,7 @@ public class LocalBluetoothDeviceManager {
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 @@ public class LocalBluetoothDeviceManager {
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 class LocalBluetoothDeviceManager {
}
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 @@ public class LocalBluetoothDeviceManager {
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 @@ public class LocalBluetoothDeviceManager {
/**
* 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 @@ public class LocalBluetoothDeviceManager {
}
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 @@ public class LocalBluetoothDeviceManager {
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 @@ public class LocalBluetoothDeviceManager {
*/
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 @@ public class LocalBluetoothDeviceManager {
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 @@ import android.widget.Toast;
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 @@ public class LocalBluetoothManager {
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 @@ public class LocalBluetoothManager {
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 @@ public class LocalBluetoothManager {
return true;
}
-
+
public BluetoothDevice getBluetoothManager() {
return mManager;
}
-
+
public Context getContext() {
return mContext;
}
@@ -116,7 +116,7 @@ public class LocalBluetoothManager {
public Activity getForegroundActivity() {
return mForegroundActivity;
}
-
+
public void setForegroundActivity(Activity activity) {
if (mErrorDialog != null) {
mErrorDialog.dismiss();
@@ -124,31 +124,31 @@ public class LocalBluetoothManager {
}
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 @@ public class LocalBluetoothManager {
* 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 @@ public class LocalBluetoothManager {
}
}
}
-
- 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 @@ public class LocalBluetoothManager {
mLocalDeviceManager.onBluetoothStateChanged(state == BluetoothDevice.BLUETOOTH_STATE_ON);
}
}
-
+
private void syncBluetoothState() {
int bluetoothState;
@@ -218,7 +218,7 @@ public class LocalBluetoothManager {
boolean wasSetStateSuccessful = enabled
? mManager.enable()
: mManager.disable();
-
+
if (wasSetStateSuccessful) {
setBluetoothStateInt(enabled
? BluetoothDevice.BLUETOOTH_STATE_TURNING_ON
@@ -229,11 +229,11 @@ public class LocalBluetoothManager {
"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 @@ public class LocalBluetoothManager {
mLocalDeviceManager.onScanningStateChanged(started);
dispatchScanningStateChanged(started);
}
-
+
private void dispatchScanningStateChanged(boolean started) {
synchronized (mCallbacks) {
for (Callback callback : mCallbacks) {
@@ -267,7 +267,7 @@ public class LocalBluetoothManager {
.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 @@ public class LocalBluetoothManager {
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 @@ public class Status extends PreferenceActivity {
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 @@ public class QuickLaunchSettings extends PreferenceActivity implements
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..80185c9 100644
--- a/src/com/android/settings/widget/SettingsAppWidgetProvider.java
+++ b/src/com/android/settings/widget/SettingsAppWidgetProvider.java
@@ -278,13 +278,7 @@ public class SettingsAppWidgetProvider extends AppWidgetProvider {
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);
}
/**
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 @@ public class AccessPointDialog extends AlertDialog implements DialogInterface.On
}
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 @@ public class AccessPointPreference extends Preference implements
// 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 @@ public class AdvancedSettings extends PreferenceActivity
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 751a5a3..6f43ebf 100644
--- a/src/com/android/settings/wifi/WifiLayer.java
+++ b/src/com/android/settings/wifi/WifiLayer.java
@@ -763,7 +763,9 @@ public class WifiLayer {
* 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;
}
@@ -1002,8 +1004,10 @@ public class WifiLayer {
* 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 @@ public class WifiSettings extends PreferenceActivity implements WifiLayer.Callba
}
mDialog = dialog;
- dialog.setOnDismissListener(this);
if (dialog != null) {
+ dialog.setOnDismissListener(this);
dialog.show();
}
}