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

Commit 33f7cab3 authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "BtHelper: handle BT crash" into main am: e05cc57c

parents 4435cac2 e05cc57c
Loading
Loading
Loading
Loading
+17 −8
Original line number Diff line number Diff line
@@ -484,8 +484,13 @@ public class BtHelper {
        if (mBluetoothHeadset == null || mBluetoothHeadsetDevice == null) {
            return false;
        }
        try {
            return mBluetoothHeadset.getAudioState(mBluetoothHeadsetDevice)
                    == BluetoothHeadset.STATE_AUDIO_CONNECTED;
        } catch (Exception e) {
            Log.e(TAG, "Exception while getting audio state of " + mBluetoothHeadsetDevice, e);
        }
        return false;
    }

    // @GuardedBy("mDeviceBroker.mSetModeLock")
@@ -1163,6 +1168,7 @@ public class BtHelper {
    }

    private void checkScoAudioState() {
        try {
            if (mBluetoothHeadset != null
                    && mBluetoothHeadsetDevice != null
                    && mScoAudioState == SCO_STATE_INACTIVE
@@ -1170,6 +1176,9 @@ public class BtHelper {
                    != BluetoothHeadset.STATE_AUDIO_DISCONNECTED) {
                mScoAudioState = SCO_STATE_ACTIVE_EXTERNAL;
            }
        } catch (Exception e) {
            Log.e(TAG, "Exception while getting audio state of " + mBluetoothHeadsetDevice, e);
        }
    }

    private boolean getBluetoothHeadset() {