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

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

Merge "Add Audio Location bit mask IntDef"

parents 23634acb 98dc18a9
Loading
Loading
Loading
Loading
+29 −1
Original line number Original line Diff line number Diff line
@@ -340,7 +340,35 @@ package android.bluetooth {
    field @RequiresPermission(allOf={android.Manifest.permission.BLUETOOTH_CONNECT, android.Manifest.permission.BLUETOOTH_PRIVILEGED}) public static final String ACTION_LE_AUDIO_ACTIVE_DEVICE_CHANGED = "android.bluetooth.action.LE_AUDIO_ACTIVE_DEVICE_CHANGED";
    field @RequiresPermission(allOf={android.Manifest.permission.BLUETOOTH_CONNECT, android.Manifest.permission.BLUETOOTH_PRIVILEGED}) public static final String ACTION_LE_AUDIO_ACTIVE_DEVICE_CHANGED = "android.bluetooth.action.LE_AUDIO_ACTIVE_DEVICE_CHANGED";
    field @RequiresPermission(allOf={android.Manifest.permission.BLUETOOTH_CONNECT, android.Manifest.permission.BLUETOOTH_PRIVILEGED}) public static final String ACTION_LE_AUDIO_GROUP_NODE_STATUS_CHANGED = "android.bluetooth.action.LE_AUDIO_GROUP_NODE_STATUS_CHANGED";
    field @RequiresPermission(allOf={android.Manifest.permission.BLUETOOTH_CONNECT, android.Manifest.permission.BLUETOOTH_PRIVILEGED}) public static final String ACTION_LE_AUDIO_GROUP_NODE_STATUS_CHANGED = "android.bluetooth.action.LE_AUDIO_GROUP_NODE_STATUS_CHANGED";
    field @RequiresPermission(android.Manifest.permission.BLUETOOTH_PRIVILEGED) public static final String ACTION_LE_AUDIO_GROUP_STATUS_CHANGED = "android.bluetooth.action.LE_AUDIO_GROUP_STATUS_CHANGED";
    field @RequiresPermission(android.Manifest.permission.BLUETOOTH_PRIVILEGED) public static final String ACTION_LE_AUDIO_GROUP_STATUS_CHANGED = "android.bluetooth.action.LE_AUDIO_GROUP_STATUS_CHANGED";
    field public static final int AUDIO_LOCATION_INVALID = -1; // 0xffffffff
    field public static final int AUDIO_LOCATION_BACK_CENTER = 256; // 0x100
    field public static final int AUDIO_LOCATION_BACK_LEFT = 16; // 0x10
    field public static final int AUDIO_LOCATION_BACK_RIGHT = 32; // 0x20
    field public static final int AUDIO_LOCATION_BOTTOM_FRONT_CENTER = 2097152; // 0x200000
    field public static final int AUDIO_LOCATION_BOTTOM_FRONT_LEFT = 4194304; // 0x400000
    field public static final int AUDIO_LOCATION_BOTTOM_FRONT_RIGHT = 8388608; // 0x800000
    field public static final int AUDIO_LOCATION_FRONT_CENTER = 4; // 0x4
    field public static final int AUDIO_LOCATION_FRONT_LEFT = 1; // 0x1
    field public static final int AUDIO_LOCATION_FRONT_LEFT_OF_CENTER = 64; // 0x40
    field public static final int AUDIO_LOCATION_FRONT_LEFT_WIDE = 16777216; // 0x1000000
    field public static final int AUDIO_LOCATION_FRONT_RIGHT = 2; // 0x2
    field public static final int AUDIO_LOCATION_FRONT_RIGHT_OF_CENTER = 128; // 0x80
    field public static final int AUDIO_LOCATION_FRONT_RIGHT_WIDE = 33554432; // 0x2000000
    field public static final int AUDIO_LOCATION_INVALID = 0; // 0x0
    field public static final int AUDIO_LOCATION_LEFT_SURROUND = 67108864; // 0x4000000
    field public static final int AUDIO_LOCATION_LOW_FREQ_EFFECTS_ONE = 8; // 0x8
    field public static final int AUDIO_LOCATION_LOW_FREQ_EFFECTS_TWO = 512; // 0x200
    field public static final int AUDIO_LOCATION_RIGHT_SURROUND = 134217728; // 0x8000000
    field public static final int AUDIO_LOCATION_SIDE_LEFT = 1024; // 0x400
    field public static final int AUDIO_LOCATION_SIDE_RIGHT = 2048; // 0x800
    field public static final int AUDIO_LOCATION_TOP_BACK_CENTER = 1048576; // 0x100000
    field public static final int AUDIO_LOCATION_TOP_BACK_LEFT = 65536; // 0x10000
    field public static final int AUDIO_LOCATION_TOP_BACK_RIGHT = 131072; // 0x20000
    field public static final int AUDIO_LOCATION_TOP_CENTER = 32768; // 0x8000
    field public static final int AUDIO_LOCATION_TOP_FRONT_CENTER = 16384; // 0x4000
    field public static final int AUDIO_LOCATION_TOP_FRONT_LEFT = 4096; // 0x1000
    field public static final int AUDIO_LOCATION_TOP_FRONT_RIGHT = 8192; // 0x2000
    field public static final int AUDIO_LOCATION_TOP_SIDE_LEFT = 262144; // 0x40000
    field public static final int AUDIO_LOCATION_TOP_SIDE_RIGHT = 524288; // 0x80000
    field public static final String EXTRA_LE_AUDIO_GROUP_ID = "android.bluetooth.extra.LE_AUDIO_GROUP_ID";
    field public static final String EXTRA_LE_AUDIO_GROUP_ID = "android.bluetooth.extra.LE_AUDIO_GROUP_ID";
    field public static final String EXTRA_LE_AUDIO_GROUP_NODE_STATUS = "android.bluetooth.extra.LE_AUDIO_GROUP_NODE_STATUS";
    field public static final String EXTRA_LE_AUDIO_GROUP_NODE_STATUS = "android.bluetooth.extra.LE_AUDIO_GROUP_NODE_STATUS";
    field public static final String EXTRA_LE_AUDIO_GROUP_STATUS = "android.bluetooth.extra.LE_AUDIO_GROUP_STATUS";
    field public static final String EXTRA_LE_AUDIO_GROUP_STATUS = "android.bluetooth.extra.LE_AUDIO_GROUP_STATUS";
+265 −2
Original line number Original line Diff line number Diff line
@@ -21,6 +21,7 @@ import static android.bluetooth.BluetoothUtils.getSyncTimeout;


import android.Manifest;
import android.Manifest;
import android.annotation.CallbackExecutor;
import android.annotation.CallbackExecutor;
import android.annotation.IntDef;
import android.annotation.NonNull;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.Nullable;
import android.annotation.RequiresPermission;
import android.annotation.RequiresPermission;
@@ -39,6 +40,8 @@ import android.util.Log;


import com.android.modules.utils.SynchronousResultReceiver;
import com.android.modules.utils.SynchronousResultReceiver;


import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.util.ArrayList;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashMap;
import java.util.List;
import java.util.List;
@@ -299,7 +302,267 @@ public final class BluetoothLeAudio implements BluetoothProfile, AutoCloseable {
     * @hide
     * @hide
     */
     */
    @SystemApi
    @SystemApi
    public static final int AUDIO_LOCATION_INVALID = -1;
    public static final int AUDIO_LOCATION_INVALID = 0;

    /**
     * This represents an audio location front left.
     *
     * @hide
     */
    @SystemApi
    public static final int AUDIO_LOCATION_FRONT_LEFT = 0x01 << 0;

    /**
     * This represents an audio location front right.
     *
     * @hide
     */
    @SystemApi
    public static final int AUDIO_LOCATION_FRONT_RIGHT = 0x01 << 1;

    /**
     * This represents an audio location front center.
     *
     * @hide
     */
    @SystemApi
    public static final int AUDIO_LOCATION_FRONT_CENTER = 0x01 << 2;

    /**
     * This represents an audio location low frequency effects 1.
     *
     * @hide
     */
    @SystemApi
    public static final int AUDIO_LOCATION_LOW_FREQ_EFFECTS_ONE = 0x01 << 3;

    /**
     * This represents an audio location back left.
     *
     * @hide
     */
    @SystemApi
    public static final int AUDIO_LOCATION_BACK_LEFT = 0x01 << 4;

    /**
     * This represents an audio location back right.
     *
     * @hide
     */
    @SystemApi
    public static final int AUDIO_LOCATION_BACK_RIGHT = 0x01 << 5;

    /**
     * This represents an audio location front left of center.
     *
     * @hide
     */
    @SystemApi
    public static final int AUDIO_LOCATION_FRONT_LEFT_OF_CENTER = 0x01 << 6;

    /**
     * This represents an audio location front right of center.
     *
     * @hide
     */
    @SystemApi
    public static final int AUDIO_LOCATION_FRONT_RIGHT_OF_CENTER = 0x01 << 7;

    /**
     * This represents an audio location back center.
     *
     * @hide
     */
    @SystemApi
    public static final int AUDIO_LOCATION_BACK_CENTER = 0x01 << 8;

    /**
     * This represents an audio location low frequency effects 2.
     *
     * @hide
     */
    @SystemApi
    public static final int AUDIO_LOCATION_LOW_FREQ_EFFECTS_TWO = 0x01 << 9;

    /**
     * This represents an audio location side left.
     *
     * @hide
     */
    @SystemApi
    public static final int AUDIO_LOCATION_SIDE_LEFT = 0x01 << 10;

    /**
     * This represents an audio location side right.
     *
     * @hide
     */
    @SystemApi
    public static final int AUDIO_LOCATION_SIDE_RIGHT = 0x01 << 11;

    /**
     * This represents an audio location top front left.
     *
     * @hide
     */
    @SystemApi
    public static final int AUDIO_LOCATION_TOP_FRONT_LEFT = 0x01 << 12;

    /**
     * This represents an audio location top front right.
     *
     * @hide
     */
    @SystemApi
    public static final int AUDIO_LOCATION_TOP_FRONT_RIGHT = 0x01 << 13;

    /**
     * This represents an audio location top front center.
     *
     * @hide
     */
    @SystemApi
    public static final int AUDIO_LOCATION_TOP_FRONT_CENTER = 0x01 << 14;

    /**
     * This represents an audio location top center.
     *
     * @hide
     */
    @SystemApi
    public static final int AUDIO_LOCATION_TOP_CENTER = 0x01 << 15;

    /**
     * This represents an audio location top back left.
     *
     * @hide
     */
    @SystemApi
    public static final int AUDIO_LOCATION_TOP_BACK_LEFT = 0x01 << 16;

    /**
     * This represents an audio location top back right.
     *
     * @hide
     */
    @SystemApi
    public static final int AUDIO_LOCATION_TOP_BACK_RIGHT = 0x01 << 17;

    /**
     * This represents an audio location top side left.
     *
     * @hide
     */
    @SystemApi
    public static final int AUDIO_LOCATION_TOP_SIDE_LEFT = 0x01 << 18;

    /**
     * This represents an audio location top side right.
     *
     * @hide
     */
    @SystemApi
    public static final int AUDIO_LOCATION_TOP_SIDE_RIGHT = 0x01 << 19;

    /**
     * This represents an audio location top back center.
     *
     * @hide
     */
    @SystemApi
    public static final int AUDIO_LOCATION_TOP_BACK_CENTER = 0x01 << 20;

    /**
     * This represents an audio location bottom front center.
     *
     * @hide
     */
    @SystemApi
    public static final int AUDIO_LOCATION_BOTTOM_FRONT_CENTER = 0x01 << 21;

    /**
     * This represents an audio location bottom front left.
     *
     * @hide
     */
    @SystemApi
    public static final int AUDIO_LOCATION_BOTTOM_FRONT_LEFT = 0x01 << 22;

    /**
     * This represents an audio location bottom front right.
     *
     * @hide
     */
    @SystemApi
    public static final int AUDIO_LOCATION_BOTTOM_FRONT_RIGHT = 0x01 << 23;

    /**
     * This represents an audio location front left wide.
     *
     * @hide
     */
    @SystemApi
    public static final int AUDIO_LOCATION_FRONT_LEFT_WIDE = 0x01 << 24;

    /**
     * This represents an audio location front right wide.
     *
     * @hide
     */
    @SystemApi
    public static final int AUDIO_LOCATION_FRONT_RIGHT_WIDE = 0x01 << 25;

    /**
     * This represents an audio location left surround.
     *
     * @hide
     */
    @SystemApi
    public static final int AUDIO_LOCATION_LEFT_SURROUND = 0x01 << 26;

    /**
     * This represents an audio location right surround.
     *
     * @hide
     */
    @SystemApi
    public static final int AUDIO_LOCATION_RIGHT_SURROUND = 0x01 << 27;

    /** @hide */
    @IntDef(flag = true, prefix = "AUDIO_LOCATION_",
            value = {
            AUDIO_LOCATION_INVALID,
            AUDIO_LOCATION_FRONT_LEFT,
            AUDIO_LOCATION_FRONT_RIGHT,
            AUDIO_LOCATION_FRONT_CENTER,
            AUDIO_LOCATION_LOW_FREQ_EFFECTS_ONE,
            AUDIO_LOCATION_BACK_LEFT,
            AUDIO_LOCATION_BACK_RIGHT,
            AUDIO_LOCATION_FRONT_LEFT_OF_CENTER,
            AUDIO_LOCATION_FRONT_RIGHT_OF_CENTER,
            AUDIO_LOCATION_BACK_CENTER,
            AUDIO_LOCATION_LOW_FREQ_EFFECTS_TWO,
            AUDIO_LOCATION_SIDE_LEFT,
            AUDIO_LOCATION_SIDE_RIGHT,
            AUDIO_LOCATION_TOP_FRONT_LEFT,
            AUDIO_LOCATION_TOP_FRONT_RIGHT,
            AUDIO_LOCATION_TOP_FRONT_CENTER,
            AUDIO_LOCATION_TOP_CENTER,
            AUDIO_LOCATION_TOP_BACK_LEFT,
            AUDIO_LOCATION_TOP_BACK_RIGHT,
            AUDIO_LOCATION_TOP_SIDE_LEFT,
            AUDIO_LOCATION_TOP_SIDE_RIGHT,
            AUDIO_LOCATION_TOP_BACK_CENTER,
            AUDIO_LOCATION_BOTTOM_FRONT_CENTER,
            AUDIO_LOCATION_BOTTOM_FRONT_LEFT,
            AUDIO_LOCATION_BOTTOM_FRONT_RIGHT,
            AUDIO_LOCATION_FRONT_LEFT_WIDE,
            AUDIO_LOCATION_FRONT_RIGHT_WIDE,
            AUDIO_LOCATION_LEFT_SURROUND,
            AUDIO_LOCATION_RIGHT_SURROUND,
    })
    @Retention(RetentionPolicy.SOURCE)
    public @interface AudioLocation {}


    /**
    /**
     * Contains group id.
     * Contains group id.
@@ -998,7 +1261,7 @@ public final class BluetoothLeAudio implements BluetoothProfile, AutoCloseable {
            android.Manifest.permission.BLUETOOTH_PRIVILEGED
            android.Manifest.permission.BLUETOOTH_PRIVILEGED
    })
    })
    @SystemApi
    @SystemApi
    public int getAudioLocation(@NonNull BluetoothDevice device) {
    public @AudioLocation int getAudioLocation(@NonNull BluetoothDevice device) {
        if (VDBG) log("getAudioLocation()");
        if (VDBG) log("getAudioLocation()");
        final IBluetoothLeAudio service = getService();
        final IBluetoothLeAudio service = getService();
        final int defaultLocation = AUDIO_LOCATION_INVALID;
        final int defaultLocation = AUDIO_LOCATION_INVALID;