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

Commit d4fbc382 authored by Paul Wang's avatar Paul Wang Committed by Automerger Merge Worker
Browse files

Merge "Avoid disabling LE Audio when BT is off" am: dd3d813f am: d60b851b

parents 934beb41 d60b851b
Loading
Loading
Loading
Loading
+9 −7
Original line number Diff line number Diff line
@@ -77,17 +77,19 @@ public class BluetoothLeAudioPreferenceController
            return;
        }

        final boolean leAudioSwitchSupported =
                SystemProperties.getBoolean(LE_AUDIO_DYNAMIC_SWITCH_PROPERTY, false);

        final int isLeAudioSupportedStatus = mBluetoothAdapter.isLeAudioSupported();
        final boolean leAudioEnabled =
                (mBluetoothAdapter.isLeAudioSupported() == BluetoothStatusCodes.FEATURE_SUPPORTED);
                (isLeAudioSupportedStatus == BluetoothStatusCodes.FEATURE_SUPPORTED);

        ((SwitchPreference) mPreference).setChecked(leAudioEnabled);

        final boolean leAudioSwitchSupported =
                SystemProperties.getBoolean(LE_AUDIO_DYNAMIC_SWITCH_PROPERTY, false);
        if (!leAudioSwitchSupported) {
        // Disable option if Bluetooth is disabled or if switch is not supported
        if (isLeAudioSupportedStatus == BluetoothStatusCodes.ERROR_BLUETOOTH_NOT_ENABLED
                || !leAudioSwitchSupported) {
            mPreference.setEnabled(false);
        } else {
            SystemProperties.set(LE_AUDIO_DYNAMIC_ENABLED_PROPERTY,
                    Boolean.toString(leAudioEnabled));
        }
    }