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

Commit c837ccb5 authored by Jaikumar Ganesh's avatar Jaikumar Ganesh Committed by Android (Google) Code Review
Browse files

Merge "Check if BT is disabled or not when sending audio state."

parents ebabd09a 6f7a9736
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -603,7 +603,7 @@ public final class BluetoothHeadset implements BluetoothProfile {
     */
    public boolean setAudioState(BluetoothDevice device, int state) {
        if (DBG) log("setAudioState");
        if (mService != null && isEnabled()) {
        if (mService != null && !isDisabled()) {
            try {
                return mService.setAudioState(device, state);
            } catch (RemoteException e) {Log.e(TAG, e.toString());}
@@ -622,7 +622,7 @@ public final class BluetoothHeadset implements BluetoothProfile {
     */
    public int getAudioState(BluetoothDevice device) {
        if (DBG) log("getAudioState");
        if (mService != null && isEnabled()) {
        if (mService != null && !isDisabled()) {
            try {
                return mService.getAudioState(device);
            } catch (RemoteException e) {Log.e(TAG, e.toString());}
@@ -705,6 +705,11 @@ public final class BluetoothHeadset implements BluetoothProfile {
       return false;
    }

    private boolean isDisabled() {
       if (mAdapter.getState() == BluetoothAdapter.STATE_OFF) return true;
       return false;
    }

    private boolean isValidDevice(BluetoothDevice device) {
       if (device == null) return false;