Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fc779ccf authored by Jorim Jaggi's avatar Jorim Jaggi Committed by Android Git Automerger
Browse files

am 01f1c5c8: Merge "Fix content description for bluetooth icon" into lmp-dev

* commit '01f1c5c8':
  Fix content description for bluetooth icon
parents 487e15b9 01f1c5c8
Loading
Loading
Loading
Loading
+10 −25
Original line number Original line Diff line number Diff line
@@ -85,7 +85,7 @@ public class PhoneStatusBarPolicy {
            }
            }
            else if (action.equals(BluetoothAdapter.ACTION_STATE_CHANGED) ||
            else if (action.equals(BluetoothAdapter.ACTION_STATE_CHANGED) ||
                    action.equals(BluetoothAdapter.ACTION_CONNECTION_STATE_CHANGED)) {
                    action.equals(BluetoothAdapter.ACTION_CONNECTION_STATE_CHANGED)) {
                updateBluetooth(intent);
                updateBluetooth();
            }
            }
            else if (action.equals(AudioManager.RINGER_MODE_CHANGED_ACTION)) {
            else if (action.equals(AudioManager.RINGER_MODE_CHANGED_ACTION)) {
                updateVolumeZen();
                updateVolumeZen();
@@ -128,16 +128,7 @@ public class PhoneStatusBarPolicy {
        mService.setIconVisibility(SLOT_CDMA_ERI, false);
        mService.setIconVisibility(SLOT_CDMA_ERI, false);


        // bluetooth status
        // bluetooth status
        BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter();
        updateBluetooth();
        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);


        // Alarm clock
        // Alarm clock
        mService.setIcon(SLOT_ALARM_CLOCK, R.drawable.stat_sys_alarm, 0, null);
        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;
        int iconId = R.drawable.stat_sys_data_bluetooth;
        String contentDescription = null;
        String contentDescription =
        String action = intent.getAction();
                mContext.getString(R.string.accessibility_bluetooth_disconnected);
        if (action.equals(BluetoothAdapter.ACTION_STATE_CHANGED)) {
        if (adapter != null) {
            int state = intent.getIntExtra(BluetoothAdapter.EXTRA_STATE, BluetoothAdapter.ERROR);
            mBluetoothEnabled = (adapter.getState() == BluetoothAdapter.STATE_ON);
            mBluetoothEnabled = state == BluetoothAdapter.STATE_ON;
            if (adapter.getConnectionState() == BluetoothAdapter.STATE_CONNECTED) {
        } 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) {
                iconId = R.drawable.stat_sys_data_bluetooth_connected;
                iconId = R.drawable.stat_sys_data_bluetooth_connected;
                contentDescription = mContext.getString(R.string.accessibility_bluetooth_connected);
                contentDescription = mContext.getString(R.string.accessibility_bluetooth_connected);
            } else {
                contentDescription = mContext.getString(
                        R.string.accessibility_bluetooth_disconnected);
            }
            }
        } else {
        } else {
            return;
            mBluetoothEnabled = false;
        }
        }


        mService.setIcon(SLOT_BLUETOOTH, iconId, 0, contentDescription);
        mService.setIcon(SLOT_BLUETOOTH, iconId, 0, contentDescription);