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

Commit 4cebaa72 authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Throw exception when LE state is on, but bluetooth service is null."...

Merge "Throw exception when LE state is on, but bluetooth service is null." am: 4a680b91 am: 835b73ad am: 29b1dbad am: 84e3f271

Original change: https://android-review.googlesource.com/c/platform/packages/modules/Bluetooth/+/2003692

Change-Id: I4c8ddacf69f294d6adf024f061e16c6b00fb3d87
parents 55272e38 84e3f271
Loading
Loading
Loading
Loading
+12 −0
Original line number Original line Diff line number Diff line
@@ -2464,6 +2464,7 @@ public final class BluetoothAdapter {
     * supported, or an error code.
     * supported, or an error code.
     *
     *
     * @return whether the LE audio is supported
     * @return whether the LE audio is supported
     * @throws IllegalStateException if the bluetooth service is null
     */
     */
    @RequiresNoPermission
    @RequiresNoPermission
    public @LeFeatureReturnValues int isLeAudioSupported() {
    public @LeFeatureReturnValues int isLeAudioSupported() {
@@ -2477,6 +2478,9 @@ public final class BluetoothAdapter {
                mService.isLeAudioSupported(recv);
                mService.isLeAudioSupported(recv);
                return recv.awaitResultNoInterrupt(getSyncTimeout())
                return recv.awaitResultNoInterrupt(getSyncTimeout())
                    .getValue(BluetoothStatusCodes.ERROR_UNKNOWN);
                    .getValue(BluetoothStatusCodes.ERROR_UNKNOWN);
            } else {
                throw new IllegalStateException(
                        "LE state is on, but there is no bluetooth service.");
            }
            }
        } catch (TimeoutException e) {
        } catch (TimeoutException e) {
            Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable()));
            Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable()));
@@ -2494,6 +2498,7 @@ public final class BluetoothAdapter {
     * is not supported, or an error code.
     * is not supported, or an error code.
     *
     *
     * @return whether the LE audio broadcast source is supported
     * @return whether the LE audio broadcast source is supported
     * @throws IllegalStateException if the bluetooth service is null
     */
     */
    @RequiresNoPermission
    @RequiresNoPermission
    public @LeFeatureReturnValues int isLeAudioBroadcastSourceSupported() {
    public @LeFeatureReturnValues int isLeAudioBroadcastSourceSupported() {
@@ -2507,6 +2512,9 @@ public final class BluetoothAdapter {
                mService.isLeAudioBroadcastSourceSupported(recv);
                mService.isLeAudioBroadcastSourceSupported(recv);
                return recv.awaitResultNoInterrupt(getSyncTimeout())
                return recv.awaitResultNoInterrupt(getSyncTimeout())
                    .getValue(BluetoothStatusCodes.ERROR_UNKNOWN);
                    .getValue(BluetoothStatusCodes.ERROR_UNKNOWN);
            } else {
                throw new IllegalStateException(
                        "LE state is on, but there is no bluetooth service.");
            }
            }
        } catch (TimeoutException e) {
        } catch (TimeoutException e) {
            Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable()));
            Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable()));
@@ -2525,6 +2533,7 @@ public final class BluetoothAdapter {
     * not supported, or an error code.
     * not supported, or an error code.
     *
     *
     * @return whether the LE audio broadcast assistent is supported
     * @return whether the LE audio broadcast assistent is supported
     * @throws IllegalStateException if the bluetooth service is null
     */
     */
    @RequiresNoPermission
    @RequiresNoPermission
    public @LeFeatureReturnValues int isLeAudioBroadcastAssistantSupported() {
    public @LeFeatureReturnValues int isLeAudioBroadcastAssistantSupported() {
@@ -2538,6 +2547,9 @@ public final class BluetoothAdapter {
                mService.isLeAudioBroadcastAssistantSupported(recv);
                mService.isLeAudioBroadcastAssistantSupported(recv);
                return recv.awaitResultNoInterrupt(getSyncTimeout())
                return recv.awaitResultNoInterrupt(getSyncTimeout())
                    .getValue(BluetoothStatusCodes.ERROR_UNKNOWN);
                    .getValue(BluetoothStatusCodes.ERROR_UNKNOWN);
            } else {
                throw new IllegalStateException(
                        "LE state is on, but there is no bluetooth service.");
            }
            }
        } catch (TimeoutException e) {
        } catch (TimeoutException e) {
            Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable()));
            Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable()));