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

Commit 5216d4d2 authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

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

parents f3891ced 33f7cab3
Loading
Loading
Loading
Loading
+17 −8
Original line number Diff line number Diff line
@@ -470,8 +470,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;
    }

    /*package*/ synchronized boolean isBluetoothScoRequestedInternally() {
@@ -1150,6 +1155,7 @@ public class BtHelper {
    }

    private void checkScoAudioState() {
        try {
            if (mBluetoothHeadset != null
                    && mBluetoothHeadsetDevice != null
                    && mScoAudioState == SCO_STATE_INACTIVE
@@ -1157,6 +1163,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() {