summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJorim Jaggi <jjaggi@google.com>2014-10-09 19:15:24 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2014-10-09 19:15:24 +0000
commit3601aeb6d46d5d8702a12776e39b096092ecf45b (patch)
treec79b01c019ee1dea3b01fe30d616409d68d815d8
parentf7941dee46a6e0b0277ec11330a639fcb96d61e9 (diff)
parent01f1c5c85476b7eee3155ac1a1f6b570582ecd6c (diff)
downloadframeworks_base-3601aeb6d46d5d8702a12776e39b096092ecf45b.zip
frameworks_base-3601aeb6d46d5d8702a12776e39b096092ecf45b.tar.gz
frameworks_base-3601aeb6d46d5d8702a12776e39b096092ecf45b.tar.bz2
am 01f1c5c8: Merge "Fix content description for bluetooth icon" into lmp-dev
* commit '01f1c5c85476b7eee3155ac1a1f6b570582ecd6c': Fix content description for bluetooth icon
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicy.java35
1 files changed, 10 insertions, 25 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 6006217..47e1ab5 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicy.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicy.java
@@ -85,7 +85,7 @@ public class PhoneStatusBarPolicy {
}
else if (action.equals(BluetoothAdapter.ACTION_STATE_CHANGED) ||
action.equals(BluetoothAdapter.ACTION_CONNECTION_STATE_CHANGED)) {
- updateBluetooth(intent);
+ updateBluetooth();
}
else if (action.equals(AudioManager.RINGER_MODE_CHANGED_ACTION)) {
updateVolumeZen();
@@ -128,16 +128,7 @@ public class PhoneStatusBarPolicy {
mService.setIconVisibility(SLOT_CDMA_ERI, false);
// bluetooth status
- BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter();
- int bluetoothIcon = R.drawable.stat_sys_data_bluetooth;
- if (adapter != null) {
- mBluetoothEnabled = (adapter.getState() == BluetoothAdapter.STATE_ON);
- if (adapter.getConnectionState() == BluetoothAdapter.STATE_CONNECTED) {
- bluetoothIcon = R.drawable.stat_sys_data_bluetooth_connected;
- }
- }
- mService.setIcon(SLOT_BLUETOOTH, bluetoothIcon, 0, null);
- mService.setIconVisibility(SLOT_BLUETOOTH, mBluetoothEnabled);
+ updateBluetooth();
// Alarm clock
mService.setIcon(SLOT_ALARM_CLOCK, R.drawable.stat_sys_alarm, 0, null);
@@ -253,25 +244,19 @@ public class PhoneStatusBarPolicy {
}
}
- private final void updateBluetooth(Intent intent) {
+ private final void updateBluetooth() {
+ BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter();
int iconId = R.drawable.stat_sys_data_bluetooth;
- String contentDescription = null;
- String action = intent.getAction();
- if (action.equals(BluetoothAdapter.ACTION_STATE_CHANGED)) {
- int state = intent.getIntExtra(BluetoothAdapter.EXTRA_STATE, BluetoothAdapter.ERROR);
- mBluetoothEnabled = state == BluetoothAdapter.STATE_ON;
- } else if (action.equals(BluetoothAdapter.ACTION_CONNECTION_STATE_CHANGED)) {
- int state = intent.getIntExtra(BluetoothAdapter.EXTRA_CONNECTION_STATE,
- BluetoothAdapter.STATE_DISCONNECTED);
- if (state == BluetoothAdapter.STATE_CONNECTED) {
+ String contentDescription =
+ mContext.getString(R.string.accessibility_bluetooth_disconnected);
+ if (adapter != null) {
+ mBluetoothEnabled = (adapter.getState() == BluetoothAdapter.STATE_ON);
+ if (adapter.getConnectionState() == BluetoothAdapter.STATE_CONNECTED) {
iconId = R.drawable.stat_sys_data_bluetooth_connected;
contentDescription = mContext.getString(R.string.accessibility_bluetooth_connected);
- } else {
- contentDescription = mContext.getString(
- R.string.accessibility_bluetooth_disconnected);
}
} else {
- return;
+ mBluetoothEnabled = false;
}
mService.setIcon(SLOT_BLUETOOTH, iconId, 0, contentDescription);