Fixed the Bluetooth On/Off Checkbox in settings so it is enabled/disable properly.

In the BroadcastReceiver, pickup the new bluetooth status from the intent instead
of calling back to LocalBluetoothManager.  There could be race condition since
LocalBluetoothManager itself gets the same info via the BroadcastReceiver mechanism.
Also cleaned up logs.
This commit is contained in:
Michael Chan
2009-04-29 14:17:06 -07:00
parent d842cee7c2
commit f25063aee3
4 changed files with 33 additions and 30 deletions

View File

@@ -19,6 +19,7 @@ package com.android.settings.bluetooth;
import com.android.settings.R;
import android.bluetooth.BluetoothDevice;
import android.bluetooth.BluetoothError;
import android.bluetooth.BluetoothIntent;
import android.content.BroadcastReceiver;
import android.content.Context;
@@ -48,7 +49,9 @@ public class BluetoothEnabler implements Preference.OnPreferenceChangeListener {
private final BroadcastReceiver mReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
handleStateChanged(mLocalManager.getBluetoothState());
int state = intent.getIntExtra(BluetoothIntent.BLUETOOTH_STATE,
BluetoothError.ERROR);
handleStateChanged(state);
}
};