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

Commit 5f249b17 authored by Łukasz Rymanowski's avatar Łukasz Rymanowski Committed by Automerger Merge Worker
Browse files

Merge "leaudio: Add callback to notify about streaming state" into main am: 5f0bbd7c

parents d052d5ee 5f0bbd7c
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -81,6 +81,9 @@ oneway interface IBluetoothLeAudio {
    const int GROUP_NODE_ADDED = 1;
    const int GROUP_NODE_REMOVED = 2;

    const int GROUP_STREAM_STATUS_IDLE = 0;
    const int GROUP_STREAM_STATUS_STREAMING = 1;

    /**
     * Get device group id. Devices with same group id belong to same group (i.e left and right
     * earbud)
+1 −0
Original line number Diff line number Diff line
@@ -494,6 +494,7 @@ package android.bluetooth {
    method public void onGroupNodeAdded(@NonNull android.bluetooth.BluetoothDevice, int);
    method public void onGroupNodeRemoved(@NonNull android.bluetooth.BluetoothDevice, int);
    method public void onGroupStatusChanged(int, int);
    method @FlaggedApi("com.android.bluetooth.flags.leaudio_callback_on_group_stream_status") public default void onGroupStreamStatusChanged(int, int);
  }

  public final class BluetoothLeAudioCodecConfigMetadata implements android.os.Parcelable {
+45 −1
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ package android.bluetooth;
import static android.bluetooth.BluetoothUtils.getSyncTimeout;

import android.annotation.CallbackExecutor;
import android.annotation.FlaggedApi;
import android.annotation.IntDef;
import android.annotation.IntRange;
import android.annotation.NonNull;
@@ -38,6 +39,7 @@ import android.os.RemoteException;
import android.util.CloseGuard;
import android.util.Log;

import com.android.bluetooth.flags.Flags;
import com.android.modules.utils.SynchronousResultReceiver;

import java.lang.annotation.Retention;
@@ -61,7 +63,7 @@ import java.util.concurrent.TimeoutException;
 */
public final class BluetoothLeAudio implements BluetoothProfile, AutoCloseable {
    private static final String TAG = "BluetoothLeAudio";
    private static final boolean DBG = false;
    private static final boolean DBG = Log.isLoggable(TAG, Log.DEBUG);
    private static final boolean VDBG = false;

    private final Map<Callback, Executor> mCallbackExecutorMap = new HashMap<>();
@@ -85,6 +87,15 @@ public final class BluetoothLeAudio implements BluetoothProfile, AutoCloseable {
                })
        @interface GroupStatus {}

        /** @hide */
        @Retention(RetentionPolicy.SOURCE)
        @IntDef(
                value = {
                    GROUP_STREAM_STATUS_IDLE,
                    GROUP_STREAM_STATUS_STREAMING,
                })
        @interface GroupStreamStatus {}

        /**
         * Callback invoked when callback is registered and when codec config changes on the remote
         * device.
@@ -127,6 +138,22 @@ public final class BluetoothLeAudio implements BluetoothProfile, AutoCloseable {
         */
        @SystemApi
        void onGroupStatusChanged(int groupId, @GroupStatus int groupStatus);

        /**
         * Callback invoked when the group's stream status changes.
         *
         * @param groupId the group id
         * @param groupStreamStatus streaming or idle state.
         * @hide
         */
        @FlaggedApi(Flags.FLAG_LEAUDIO_CALLBACK_ON_GROUP_STREAM_STATUS)
        @SystemApi
        default void onGroupStreamStatusChanged(
                int groupId, @GroupStreamStatus int groupStreamStatus) {
            if (DBG) {
                Log.d(TAG, " onGroupStreamStatusChanged is not implemented.");
            }
        }
    }

    @SuppressLint("AndroidFrameworkBluetoothPermission")
@@ -620,6 +647,23 @@ public final class BluetoothLeAudio implements BluetoothProfile, AutoCloseable {
     */
    public static final int GROUP_STATUS_INACTIVE = IBluetoothLeAudio.GROUP_STATUS_INACTIVE;

    /**
     * Indicating that group stream is in IDLE (not streaming)
     *
     * @hide
     */
    @FlaggedApi(Flags.FLAG_LEAUDIO_CALLBACK_ON_GROUP_STREAM_STATUS)
    public static final int GROUP_STREAM_STATUS_IDLE = IBluetoothLeAudio.GROUP_STREAM_STATUS_IDLE;

    /**
     * Indicating that group is STREAMING
     *
     * @hide
     */
    @FlaggedApi(Flags.FLAG_LEAUDIO_CALLBACK_ON_GROUP_STREAM_STATUS)
    public static final int GROUP_STREAM_STATUS_STREAMING =
            IBluetoothLeAudio.GROUP_STREAM_STATUS_STREAMING;

    private IBluetoothLeAudio mService;

    /**