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:
@@ -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);
|
||||
}
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user