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

Commit 705aeb2d authored by Ze Li's avatar Ze Li
Browse files

[Audiosharing] Update BluetoothUtils#isAudioSharingEnabled to handle the case...

[Audiosharing] Update BluetoothUtils#isAudioSharingEnabled to handle the case where LE is on but no bluetooth service

Bug: 331152872
Test: manual
Change-Id: I2ee870e722c8f1c89b6b4b628981c20da6cc3569
parent 804f0c04
Loading
Loading
Loading
Loading
+10 −5
Original line number Diff line number Diff line
@@ -534,11 +534,16 @@ public class BluetoothUtils {
    /** Returns if the le audio sharing is enabled. */
    public static boolean isAudioSharingEnabled() {
        BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter();
        try {
            return Flags.enableLeAudioSharing()
                    && adapter.isLeAudioBroadcastSourceSupported()
                            == BluetoothStatusCodes.FEATURE_SUPPORTED
                    && adapter.isLeAudioBroadcastAssistantSupported()
                            == BluetoothStatusCodes.FEATURE_SUPPORTED;
        } catch (IllegalStateException e) {
            Log.d(TAG, "LE state is on, but there is no bluetooth service.", e);
            return false;
        }
    }

    /** Returns if the broadcast is on-going. */