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

Commit e05cc57c authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "BtHelper: handle BT crash" into main

parents 295e98dd 168ad524
Loading
Loading
Loading
Loading
+17 −8
Original line number Diff line number Diff line
@@ -436,8 +436,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")
@@ -1051,6 +1056,7 @@ public class BtHelper {
    }

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