summaryrefslogtreecommitdiffstats
path: root/packages/SystemUI/src/com/android
diff options
context:
space:
mode:
authorDaniel Sandler <dsandler@android.com>2011-10-27 16:16:15 -0400
committerDaniel Sandler <dsandler@android.com>2011-10-27 16:16:15 -0400
commite3b7a2d13e46fe5e2faa4ec13bfff9e1f02b4145 (patch)
treec4f16bc1e142cd85acddde055e16054b004ab4a2 /packages/SystemUI/src/com/android
parent0f167d75667e1e4f731c2ab1166d345572a4ef46 (diff)
downloadframeworks_base-e3b7a2d13e46fe5e2faa4ec13bfff9e1f02b4145.zip
frameworks_base-e3b7a2d13e46fe5e2faa4ec13bfff9e1f02b4145.tar.gz
frameworks_base-e3b7a2d13e46fe5e2faa4ec13bfff9e1f02b4145.tar.bz2
Fix initial Bluetooth icon state.
Bug: 5206026 Change-Id: I17cd7ec00fefc0598673b885331c03ebbdf1bc39
Diffstat (limited to 'packages/SystemUI/src/com/android')
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicy.java37
1 files changed, 19 insertions, 18 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicy.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicy.java
index 9bee5df..5f18b5d 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicy.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicy.java
@@ -82,7 +82,7 @@ public class PhoneStatusBarPolicy {
private boolean mVolumeVisible;
// bluetooth device status
- private boolean mBluetoothEnabled;
+ private boolean mBluetoothEnabled = false;
// wifi
private static final int[][] sWifiSignalImages = {
@@ -139,6 +139,18 @@ public class PhoneStatusBarPolicy {
mContext = context;
mService = (StatusBarManager)context.getSystemService(Context.STATUS_BAR_SERVICE);
+ // listen for broadcasts
+ IntentFilter filter = new IntentFilter();
+ filter.addAction(Intent.ACTION_ALARM_CHANGED);
+ filter.addAction(Intent.ACTION_SYNC_STATE_CHANGED);
+ filter.addAction(AudioManager.RINGER_MODE_CHANGED_ACTION);
+ filter.addAction(AudioManager.VIBRATE_SETTING_CHANGED_ACTION);
+ filter.addAction(BluetoothAdapter.ACTION_STATE_CHANGED);
+ filter.addAction(BluetoothAdapter.ACTION_CONNECTION_STATE_CHANGED);
+ filter.addAction(TelephonyIntents.ACTION_SIM_STATE_CHANGED);
+ filter.addAction(TtyIntent.TTY_ENABLED_CHANGE_ACTION);
+ mContext.registerReceiver(mIntentReceiver, filter, null, mHandler);
+
// storage
mStorageManager = (StorageManager) context.getSystemService(Context.STORAGE_SERVICE);
mStorageManager.registerListener(
@@ -153,13 +165,15 @@ public class PhoneStatusBarPolicy {
mService.setIconVisibility("cdma_eri", false);
// bluetooth status
- mService.setIcon("bluetooth", R.drawable.stat_sys_data_bluetooth, 0, null);
BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter();
+ int bluetoothIcon = R.drawable.stat_sys_data_bluetooth;
if (adapter != null) {
- mBluetoothEnabled = adapter.isEnabled();
- } else {
- mBluetoothEnabled = false;
+ mBluetoothEnabled = (adapter.getState() == BluetoothAdapter.STATE_ON);
+ if (adapter.getConnectionState() == BluetoothAdapter.STATE_CONNECTED) {
+ bluetoothIcon = R.drawable.stat_sys_data_bluetooth_connected;
+ }
}
+ mService.setIcon("bluetooth", bluetoothIcon, 0, null);
mService.setIconVisibility("bluetooth", mBluetoothEnabled);
// Alarm clock
@@ -176,19 +190,6 @@ public class PhoneStatusBarPolicy {
mService.setIcon("volume", R.drawable.stat_sys_ringer_silent, 0, null);
mService.setIconVisibility("volume", false);
updateVolume();
-
- IntentFilter filter = new IntentFilter();
-
- // Register for Intent broadcasts for...
- filter.addAction(Intent.ACTION_ALARM_CHANGED);
- filter.addAction(Intent.ACTION_SYNC_STATE_CHANGED);
- filter.addAction(AudioManager.RINGER_MODE_CHANGED_ACTION);
- filter.addAction(AudioManager.VIBRATE_SETTING_CHANGED_ACTION);
- filter.addAction(BluetoothAdapter.ACTION_STATE_CHANGED);
- filter.addAction(BluetoothAdapter.ACTION_CONNECTION_STATE_CHANGED);
- filter.addAction(TelephonyIntents.ACTION_SIM_STATE_CHANGED);
- filter.addAction(TtyIntent.TTY_ENABLED_CHANGE_ACTION);
- mContext.registerReceiver(mIntentReceiver, filter, null, mHandler);
}
private final void updateAlarm(Intent intent) {