summaryrefslogtreecommitdiffstats
path: root/src/com/android
diff options
context:
space:
mode:
authorjhtop.kim <jhtop.kim@samsung.com>2011-07-28 19:50:58 +0900
committerJake Hamby <jhamby@google.com>2011-08-24 15:31:40 -0700
commitd66b61908d8532af4cfecbf0185b452c2833a3b0 (patch)
tree00afd0b254dad2751d73fa303cd4bf012b55f1aa /src/com/android
parenta796598ff9d4ef28a4d448ac2ffa142aa736a4cb (diff)
downloadpackages_apps_settings-d66b61908d8532af4cfecbf0185b452c2833a3b0.zip
packages_apps_settings-d66b61908d8532af4cfecbf0185b452c2833a3b0.tar.gz
packages_apps_settings-d66b61908d8532af4cfecbf0185b452c2833a3b0.tar.bz2
Bluetooth : fix for unnecessary device-scan starting
- When trying to pair with any device, if bond state changes device scan will be started automatically. - add some flag to check proper scan time and to prevent unnecessary device scanning. Signed-off-by: jhtop.kim <jhtop.kim@samsung.com> Change-Id: I4977ec122105f33cdd25a4f5c9fed59dda916379
Diffstat (limited to 'src/com/android')
-rw-r--r--src/com/android/settings/bluetooth/BluetoothSettings.java19
1 files changed, 14 insertions, 5 deletions
diff --git a/src/com/android/settings/bluetooth/BluetoothSettings.java b/src/com/android/settings/bluetooth/BluetoothSettings.java
index 4b86a74..9f56f32 100644
--- a/src/com/android/settings/bluetooth/BluetoothSettings.java
+++ b/src/com/android/settings/bluetooth/BluetoothSettings.java
@@ -68,6 +68,7 @@ public final class BluetoothSettings extends DeviceListPreferenceFragment {
private PreferenceGroup mAvailableDevicesCategory;
private boolean mAvailableDevicesCategoryIsPresent;
+ private boolean mActivityStarted;
private TextView mEmptyView;
@@ -98,6 +99,7 @@ public final class BluetoothSettings extends DeviceListPreferenceFragment {
@Override
public void onActivityCreated(Bundle savedInstanceState) {
+ mActivityStarted = true;
super.onActivityCreated(savedInstanceState);
mEmptyView = (TextView) getView().findViewById(android.R.id.empty);
@@ -144,7 +146,7 @@ public final class BluetoothSettings extends DeviceListPreferenceFragment {
}
getActivity().registerReceiver(mReceiver, mIntentFilter);
- updateContent(mLocalAdapter.getBluetoothState());
+ updateContent(mLocalAdapter.getBluetoothState(), mActivityStarted);
}
@Override
@@ -226,7 +228,7 @@ public final class BluetoothSettings extends DeviceListPreferenceFragment {
preferenceGroup.setEnabled(true);
}
- private void updateContent(int bluetoothState) {
+ private void updateContent(int bluetoothState, boolean scanState) {
final PreferenceScreen preferenceScreen = getPreferenceScreen();
int messageId = 0;
@@ -289,7 +291,14 @@ public final class BluetoothSettings extends DeviceListPreferenceFragment {
if (numberOfPairedDevices == 0) {
preferenceScreen.removePreference(mPairedDevicesCategory);
- startScanning();
+ if (scanState == true) {
+ mActivityStarted = false;
+ startScanning();
+ } else {
+ if (!mAvailableDevicesCategoryIsPresent) {
+ getPreferenceScreen().addPreference(mAvailableDevicesCategory);
+ }
+ }
}
getActivity().invalidateOptionsMenu();
return; // not break
@@ -316,7 +325,7 @@ public final class BluetoothSettings extends DeviceListPreferenceFragment {
@Override
public void onBluetoothStateChanged(int bluetoothState) {
super.onBluetoothStateChanged(bluetoothState);
- updateContent(bluetoothState);
+ updateContent(bluetoothState, true);
}
@Override
@@ -329,7 +338,7 @@ public final class BluetoothSettings extends DeviceListPreferenceFragment {
public void onDeviceBondStateChanged(CachedBluetoothDevice cachedDevice, int bondState) {
setDeviceListGroup(getPreferenceScreen());
removeAllDevices();
- updateContent(mLocalAdapter.getBluetoothState());
+ updateContent(mLocalAdapter.getBluetoothState(), false);
}
private final View.OnClickListener mDeviceProfilesListener = new View.OnClickListener() {