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

Commit 372da145 authored by Etienne Ruffieux's avatar Etienne Ruffieux Committed by Gerrit Code Review
Browse files

Merge "Updated documentation for new Bluetooth SystemApis"

parents fc501248 1abdad16
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -138,7 +138,7 @@ package android.bluetooth {
    method @RequiresPermission(allOf={android.Manifest.permission.BLUETOOTH_CONNECT, android.Manifest.permission.BLUETOOTH_PRIVILEGED}) public int disconnect();
    method @RequiresPermission(allOf={android.Manifest.permission.BLUETOOTH_CONNECT, android.Manifest.permission.BLUETOOTH_PRIVILEGED}) public boolean fetchUuidsWithSdp(int);
    method @NonNull @RequiresPermission(android.Manifest.permission.BLUETOOTH_PRIVILEGED) public String getAnonymizedAddress();
    method @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public int getBatteryLevel();
    method @IntRange(from=0xffffff9c, to=100) @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public int getBatteryLevel();
    method @Nullable @RequiresPermission(allOf={android.Manifest.permission.BLUETOOTH_CONNECT, android.Manifest.permission.BLUETOOTH_PRIVILEGED}) public String getIdentityAddress();
    method @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public int getMessageAccessPermission();
    method @Nullable @RequiresPermission(allOf={android.Manifest.permission.BLUETOOTH_CONNECT, android.Manifest.permission.BLUETOOTH_PRIVILEGED}) public byte[] getMetadata(int);
@@ -335,7 +335,7 @@ package android.bluetooth {
    method @RequiresPermission(allOf={android.Manifest.permission.BLUETOOTH_CONNECT, android.Manifest.permission.BLUETOOTH_PRIVILEGED}) public void registerCallback(@NonNull java.util.concurrent.Executor, @NonNull android.bluetooth.BluetoothLeAudio.Callback);
    method @RequiresPermission(allOf={android.Manifest.permission.BLUETOOTH_CONNECT, android.Manifest.permission.BLUETOOTH_PRIVILEGED}) public void setCodecConfigPreference(@NonNull android.bluetooth.BluetoothDevice, @NonNull android.bluetooth.BluetoothLeAudioCodecConfig);
    method @RequiresPermission(allOf={android.Manifest.permission.BLUETOOTH_CONNECT, android.Manifest.permission.BLUETOOTH_PRIVILEGED}) public boolean setConnectionPolicy(@NonNull android.bluetooth.BluetoothDevice, int);
    method @RequiresPermission(allOf={android.Manifest.permission.BLUETOOTH_CONNECT, android.Manifest.permission.BLUETOOTH_PRIVILEGED}) public void setVolume(int);
    method @RequiresPermission(allOf={android.Manifest.permission.BLUETOOTH_CONNECT, android.Manifest.permission.BLUETOOTH_PRIVILEGED}) public void setVolume(@IntRange(from=0, to=255) int);
    method @RequiresPermission(allOf={android.Manifest.permission.BLUETOOTH_CONNECT, android.Manifest.permission.BLUETOOTH_PRIVILEGED}) public void unregisterCallback(@NonNull android.bluetooth.BluetoothLeAudio.Callback);
    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";
+27 −3
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ package android.bluetooth;
import static android.bluetooth.BluetoothUtils.getSyncTimeout;

import android.annotation.IntDef;
import android.annotation.IntRange;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.RequiresPermission;
@@ -793,6 +794,15 @@ public final class BluetoothDevice implements Parcelable, Attributable {
    /**
     * Broadcast Action: This intent is used to broadcast CONNECTION ACCESS REQUEST
     *
     * This action will trigger a prompt for the user to accept or deny giving the
     * permission for this device. Permissions can be specified with
     * {@link #EXTRA_ACCESS_REQUEST_TYPE}.
     *
     * The reply will be an {@link #ACTION_CONNECTION_ACCESS_REPLY} sent to the specified
     * {@link #EXTRA_PACKAGE_NAME} and {@link #EXTRA_CLASS_NAME}.
     *
     * This action can be cancelled with {@link #ACTION_CONNECTION_ACCESS_CANCEL}.
     *
     * @hide
     */
    @SystemApi
@@ -806,6 +816,13 @@ public final class BluetoothDevice implements Parcelable, Attributable {
    /**
     * Broadcast Action: This intent is used to broadcast CONNECTION ACCESS REPLY
     *
     * This action is the reply from {@link #ACTION_CONNECTION_ACCESS_REQUEST}
     * that is sent to the specified {@link #EXTRA_PACKAGE_NAME}
     * and {@link #EXTRA_CLASS_NAME}.
     *
     * See the extra fields {@link #EXTRA_CONNECTION_ACCESS_RESULT} and
     * {@link #EXTRA_ALWAYS_ALLOWED} for possible results.
     *
     * @hide
     */
    @SystemApi
@@ -843,7 +860,11 @@ public final class BluetoothDevice implements Parcelable, Attributable {
            "android.bluetooth.device.action.SILENCE_MODE_CHANGED";

    /**
     * Used as an extra field in {@link #ACTION_CONNECTION_ACCESS_REQUEST} intent.
     * Used as an extra field in {@link #ACTION_CONNECTION_ACCESS_REQUEST}.
     *
     * Possible values are {@link #REQUEST_TYPE_PROFILE_CONNECTION},
     * {@link #REQUEST_TYPE_PHONEBOOK_ACCESS}, {@link #REQUEST_TYPE_MESSAGE_ACCESS}
     * and {@link #REQUEST_TYPE_SIM_ACCESS}
     *
     * @hide
     */
@@ -887,6 +908,8 @@ public final class BluetoothDevice implements Parcelable, Attributable {
    /**
     * Used as an extra field in {@link #ACTION_CONNECTION_ACCESS_REPLY} intent.
     *
     * Possible values are {@link #CONNECTION_ACCESS_YES} and {@link #CONNECTION_ACCESS_NO}.
     *
     * @hide
     */
    @SystemApi
@@ -1043,7 +1066,8 @@ public final class BluetoothDevice implements Parcelable, Attributable {
    public static final int PAIRING_VARIANT_DISPLAY_PIN = 5;

    /**
     * The user will be prompted to accept or deny the OOB pairing request
     * The user will be prompted to accept or deny the OOB pairing request.
     * This is used for Bluetooth 2.1 secure simple pairing.
     *
     * @hide
     */
@@ -1619,7 +1643,7 @@ public final class BluetoothDevice implements Parcelable, Attributable {
    @RequiresLegacyBluetoothPermission
    @RequiresBluetoothConnectPermission
    @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT)
    public int getBatteryLevel() {
    public @IntRange(from = -100, to = 100) int getBatteryLevel() {
        if (DBG) log("getBatteryLevel()");
        final IBluetooth service = sService;
        final int defaultValue = BATTERY_LEVEL_BLUETOOTH_OFF;
+22 −0
Original line number Diff line number Diff line
@@ -30,15 +30,37 @@ import android.bluetooth.annotations.RequiresBluetoothConnectPermission;
 */
@SystemApi
public interface BluetoothDevicePicker {

    /**
     * Extra for filter type used with {@link #ACTION_LAUNCH}.
     * The value must be a boolean indicating whether the device should need authentication or not.
     */
    @SuppressLint("ActionValue")
    public static final String EXTRA_NEED_AUTH =
            "android.bluetooth.devicepicker.extra.NEED_AUTH";

    /**
     * Extra for filter type used with {@link #ACTION_LAUNCH}.
     * This extra must contain the filter type that will be applied to the device list.
     * Possible values are {@link #FILTER_TYPE_ALL}, {@link #FILTER_TYPE_AUDIO},
     * {@link #FILTER_TYPE_TRANSFER}, {@link #FILTER_TYPE_PANU}, and {@link #FILTER_TYPE_NAP}.
     */
    @SuppressLint("ActionValue")
    public static final String EXTRA_FILTER_TYPE =
            "android.bluetooth.devicepicker.extra.FILTER_TYPE";

    /**
     * Extra for filter type used with {@link #ACTION_LAUNCH}.
     * This extra must contain the package name that called {@link #ACTION_LAUNCH}.
     */
    @SuppressLint("ActionValue")
    public static final String EXTRA_LAUNCH_PACKAGE =
            "android.bluetooth.devicepicker.extra.LAUNCH_PACKAGE";

    /**
     * Extra for filter type used with {@link #ACTION_LAUNCH}.
     * This extra must contain the class name that called {@link #ACTION_LAUNCH}.
     */
    @SuppressLint("ActionValue")
    public static final String EXTRA_LAUNCH_CLASS =
            "android.bluetooth.devicepicker.extra.DEVICE_PICKER_LAUNCH_CLASS";
+4 −3
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ import static android.bluetooth.BluetoothUtils.getSyncTimeout;
import android.Manifest;
import android.annotation.CallbackExecutor;
import android.annotation.IntDef;
import android.annotation.IntRange;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.RequiresPermission;
@@ -152,7 +153,7 @@ public final class BluetoothLeAudio implements BluetoothProfile, AutoCloseable {
    /**
     * Intent used to broadcast group node status information.
     *
     * <p>This intent will have 3 extra:
     * <p>This intent will have 3 extras:
     * <ul>
     * <li> {@link BluetoothDevice#EXTRA_DEVICE} - The remote device. It can
     * be null if no device is active. </li>
@@ -174,7 +175,7 @@ public final class BluetoothLeAudio implements BluetoothProfile, AutoCloseable {
    /**
     * Intent used to broadcast group status information.
     *
     * <p>This intent will have 4 extra:
     * <p>This intent will have 3 extras:
     * <ul>
     * <li> {@link BluetoothDevice#EXTRA_DEVICE} - The remote device. It can
     * be null if no device is active. </li>
@@ -1161,7 +1162,7 @@ public final class BluetoothLeAudio implements BluetoothProfile, AutoCloseable {
            android.Manifest.permission.BLUETOOTH_CONNECT,
            android.Manifest.permission.BLUETOOTH_PRIVILEGED
    })
    public void setVolume(int volume) {
    public void setVolume(@IntRange(from = 0, to = 255) int volume) {
        if (VDBG) log("setVolume(vol: " + volume + " )");
        final IBluetoothLeAudio service = getService();
        if (service == null) {