Merge "Fix statusbar crash on devices with no Bluetooth" into ics-mr1

This commit is contained in:
Jesse Hall
2011-12-05 21:23:29 -08:00
committed by Android (Google) Code Review

View File

@ -36,7 +36,7 @@ public class BluetoothController extends BroadcastReceiver {
private int mIconId = R.drawable.stat_sys_data_bluetooth;
private int mContentDescriptionId = 0;
private boolean mEnabled;
private boolean mEnabled = false;
public BluetoothController(Context context) {
mContext = context;
@ -47,8 +47,10 @@ public class BluetoothController extends BroadcastReceiver {
context.registerReceiver(this, filter);
final BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter();
handleAdapterStateChange(adapter.getState());
handleConnectionStateChange(adapter.getConnectionState());
if (adapter != null) {
handleAdapterStateChange(adapter.getState());
handleConnectionStateChange(adapter.getConnectionState());
}
refreshViews();
}