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

Commit 695c1c2e authored by William Escande's avatar William Escande Committed by Automerger Merge Worker
Browse files

Merge "Reformat the file" into main am: af52ff73

parents 5674407d af52ff73
Loading
Loading
Loading
Loading
+224 −192
Original line number Original line Diff line number Diff line
@@ -342,43 +342,49 @@ public final class BluetoothHapClient implements BluetoothProfile, AutoCloseable
     * the left and right side and each device will have their own connection state changes.
     * the left and right side and each device will have their own connection state changes.
     *
     *
     * <p>This intent will have 3 extras:
     * <p>This intent will have 3 extras:
     *
     * <ul>
     * <ul>
     * <li> {@link #EXTRA_STATE} - The current state of the profile. </li>
     *   <li>{@link #EXTRA_STATE} - The current state of the profile.
     * <li> {@link #EXTRA_PREVIOUS_STATE}- The previous state of the profile.</li>
     *   <li>{@link #EXTRA_PREVIOUS_STATE}- The previous state of the profile.
     * <li> {@link BluetoothDevice#EXTRA_DEVICE} - The remote device. </li>
     *   <li>{@link BluetoothDevice#EXTRA_DEVICE} - The remote device.
     * </ul>
     * </ul>
     *
     *
     * <p>{@link #EXTRA_STATE} or {@link #EXTRA_PREVIOUS_STATE} can be any of
     * <p>{@link #EXTRA_STATE} or {@link #EXTRA_PREVIOUS_STATE} can be any of {@link
     * {@link #STATE_DISCONNECTED}, {@link #STATE_CONNECTING},
     * #STATE_DISCONNECTED}, {@link #STATE_CONNECTING}, {@link #STATE_CONNECTED}, {@link
     * {@link #STATE_CONNECTED}, {@link #STATE_DISCONNECTING}.
     * #STATE_DISCONNECTING}.
     *
     * @hide
     * @hide
     */
     */
    @SystemApi
    @SystemApi
    @RequiresBluetoothConnectPermission
    @RequiresBluetoothConnectPermission
    @RequiresPermission(allOf = {
    @RequiresPermission(
            allOf = {
                android.Manifest.permission.BLUETOOTH_CONNECT,
                android.Manifest.permission.BLUETOOTH_CONNECT,
            android.Manifest.permission.BLUETOOTH_PRIVILEGED,
                android.Manifest.permission.BLUETOOTH_PRIVILEGED
            })
            })
    @SdkConstant(SdkConstant.SdkConstantType.BROADCAST_INTENT_ACTION)
    @SdkConstant(SdkConstant.SdkConstantType.BROADCAST_INTENT_ACTION)
    public static final String ACTION_HAP_CONNECTION_STATE_CHANGED =
    public static final String ACTION_HAP_CONNECTION_STATE_CHANGED =
            "android.bluetooth.action.HAP_CONNECTION_STATE_CHANGED";
            "android.bluetooth.action.HAP_CONNECTION_STATE_CHANGED";


    /**
    /**
     * Intent used to broadcast the device availability change and the availability of its
     * Intent used to broadcast the device availability change and the availability of its presets.
     * presets. Please note that in the binaural case, there will be two different LE devices for
     * Please note that in the binaural case, there will be two different LE devices for the left
     * the left and right side and each device will have their own availability event.
     * and right side and each device will have their own availability event.
     *
     *
     * <p>This intent will have 2 extras:
     * <p>This intent will have 2 extras:
     *
     * <ul>
     * <ul>
     * <li> {@link BluetoothDevice#EXTRA_DEVICE} - The remote device. </li>
     *   <li>{@link BluetoothDevice#EXTRA_DEVICE} - The remote device.
     * <li> {@link #EXTRA_HAP_FEATURES} - Supported features map. </li>
     *   <li>{@link #EXTRA_HAP_FEATURES} - Supported features map.
     * </ul>
     * </ul>
     *
     * @hide
     * @hide
     */
     */
    @RequiresBluetoothConnectPermission
    @RequiresBluetoothConnectPermission
    @RequiresPermission(allOf = {
    @RequiresPermission(
            allOf = {
                android.Manifest.permission.BLUETOOTH_CONNECT,
                android.Manifest.permission.BLUETOOTH_CONNECT,
            android.Manifest.permission.BLUETOOTH_PRIVILEGED,
                android.Manifest.permission.BLUETOOTH_PRIVILEGED
            })
            })
    @SdkConstant(SdkConstant.SdkConstantType.BROADCAST_INTENT_ACTION)
    @SdkConstant(SdkConstant.SdkConstantType.BROADCAST_INTENT_ACTION)
    public static final String ACTION_HAP_DEVICE_AVAILABLE =
    public static final String ACTION_HAP_DEVICE_AVAILABLE =
@@ -391,9 +397,10 @@ public final class BluetoothHapClient implements BluetoothProfile, AutoCloseable
    public static final String EXTRA_HAP_FEATURES = "android.bluetooth.extra.HAP_FEATURES";
    public static final String EXTRA_HAP_FEATURES = "android.bluetooth.extra.HAP_FEATURES";


    /**
    /**
     * Represents an invalid index value. This is usually value returned in a currently
     * Represents an invalid index value. This is usually value returned in a currently active
     * active preset request for a device which is not connected. This value shouldn't be used
     * preset request for a device which is not connected. This value shouldn't be used in the API
     * in the API calls.
     * calls.
     *
     * @hide
     * @hide
     */
     */
    public static final int PRESET_INDEX_UNAVAILABLE = IBluetoothHapClient.PRESET_INDEX_UNAVAILABLE;
    public static final int PRESET_INDEX_UNAVAILABLE = IBluetoothHapClient.PRESET_INDEX_UNAVAILABLE;
@@ -542,29 +549,28 @@ public final class BluetoothHapClient implements BluetoothProfile, AutoCloseable
    }
    }


    /**
    /**
     * Register a {@link Callback} that will be invoked during the
     * Register a {@link Callback} that will be invoked during the operation of this profile.
     * operation of this profile.
     *
     *
     * Repeated registration of the same <var>callback</var> object after the first call to this
     * <p>Repeated registration of the same <var>callback</var> object after the first call to this
     * method will result with IllegalArgumentException being thrown, even when the
     * method will result with IllegalArgumentException being thrown, even when the
     * <var>executor</var> is different. API caller would have to call
     * <var>executor</var> is different. API caller would have to call {@link
     * {@link #unregisterCallback(Callback)} with the same callback object before registering it
     * #unregisterCallback(Callback)} with the same callback object before registering it again.
     * again.
     *
     *
     * @param executor an {@link Executor} to execute given callback
     * @param executor an {@link Executor} to execute given callback
     * @param callback user implementation of the {@link Callback}
     * @param callback user implementation of the {@link Callback}
     * @throws NullPointerException if a null executor, or callback is given, or
     * @throws NullPointerException if a null executor, or callback is given, or
     *  IllegalArgumentException if the same <var>callback<var> is already registered.
     *     IllegalArgumentException if the same <var>callback</var> is already registered.
     * @hide
     * @hide
     */
     */
    @SystemApi
    @SystemApi
    @RequiresBluetoothConnectPermission
    @RequiresBluetoothConnectPermission
    @RequiresPermission(allOf = {
    @RequiresPermission(
            allOf = {
                android.Manifest.permission.BLUETOOTH_CONNECT,
                android.Manifest.permission.BLUETOOTH_CONNECT,
            android.Manifest.permission.BLUETOOTH_PRIVILEGED,
                android.Manifest.permission.BLUETOOTH_PRIVILEGED
            })
            })
    public void registerCallback(@NonNull @CallbackExecutor Executor executor,
    public void registerCallback(
            @NonNull Callback callback) {
            @NonNull @CallbackExecutor Executor executor, @NonNull Callback callback) {
        Objects.requireNonNull(executor, "executor cannot be null");
        Objects.requireNonNull(executor, "executor cannot be null");
        Objects.requireNonNull(callback, "callback cannot be null");
        Objects.requireNonNull(callback, "callback cannot be null");


@@ -605,8 +611,9 @@ public final class BluetoothHapClient implements BluetoothProfile, AutoCloseable


    /**
    /**
     * Unregister the specified {@link Callback}.
     * Unregister the specified {@link Callback}.
     * <p>The same {@link Callback} object used when calling
     *
     * {@link #registerCallback(Executor, Callback)} must be used.
     * <p>The same {@link Callback} object used when calling {@link #registerCallback(Executor,
     * Callback)} must be used.
     *
     *
     * <p>Callbacks are automatically unregistered when application process goes away
     * <p>Callbacks are automatically unregistered when application process goes away
     *
     *
@@ -617,9 +624,10 @@ public final class BluetoothHapClient implements BluetoothProfile, AutoCloseable
     */
     */
    @SystemApi
    @SystemApi
    @RequiresBluetoothConnectPermission
    @RequiresBluetoothConnectPermission
    @RequiresPermission(allOf = {
    @RequiresPermission(
            allOf = {
                android.Manifest.permission.BLUETOOTH_CONNECT,
                android.Manifest.permission.BLUETOOTH_CONNECT,
            android.Manifest.permission.BLUETOOTH_PRIVILEGED,
                android.Manifest.permission.BLUETOOTH_PRIVILEGED
            })
            })
    public void unregisterCallback(@NonNull Callback callback) {
    public void unregisterCallback(@NonNull Callback callback) {
        Objects.requireNonNull(callback, "callback cannot be null");
        Objects.requireNonNull(callback, "callback cannot be null");
@@ -652,9 +660,9 @@ public final class BluetoothHapClient implements BluetoothProfile, AutoCloseable
    /**
    /**
     * Set connection policy of the profile
     * Set connection policy of the profile
     *
     *
     * <p> The device should already be paired.
     * <p>The device should already be paired. Connection policy can be one of {@link
     * Connection policy can be one of {@link #CONNECTION_POLICY_ALLOWED},
     * #CONNECTION_POLICY_ALLOWED}, {@link #CONNECTION_POLICY_FORBIDDEN}, {@link
     * {@link #CONNECTION_POLICY_FORBIDDEN}, {@link #CONNECTION_POLICY_UNKNOWN}
     * #CONNECTION_POLICY_UNKNOWN}
     *
     *
     * @param device Paired bluetooth device
     * @param device Paired bluetooth device
     * @param connectionPolicy is the connection policy to set to for this profile
     * @param connectionPolicy is the connection policy to set to for this profile
@@ -663,12 +671,13 @@ public final class BluetoothHapClient implements BluetoothProfile, AutoCloseable
     */
     */
    @SystemApi
    @SystemApi
    @RequiresBluetoothConnectPermission
    @RequiresBluetoothConnectPermission
    @RequiresPermission(allOf = {
    @RequiresPermission(
            allOf = {
                android.Manifest.permission.BLUETOOTH_CONNECT,
                android.Manifest.permission.BLUETOOTH_CONNECT,
            android.Manifest.permission.BLUETOOTH_PRIVILEGED,
                android.Manifest.permission.BLUETOOTH_PRIVILEGED
            })
            })
    public boolean setConnectionPolicy(@NonNull BluetoothDevice device,
    public boolean setConnectionPolicy(
            @ConnectionPolicy int connectionPolicy) {
            @NonNull BluetoothDevice device, @ConnectionPolicy int connectionPolicy) {
        if (DBG) log("setConnectionPolicy(" + device + ", " + connectionPolicy + ")");
        if (DBG) log("setConnectionPolicy(" + device + ", " + connectionPolicy + ")");
        Objects.requireNonNull(device, "BluetoothDevice cannot be null");
        Objects.requireNonNull(device, "BluetoothDevice cannot be null");
        final IBluetoothHapClient service = getService();
        final IBluetoothHapClient service = getService();
@@ -695,9 +704,8 @@ public final class BluetoothHapClient implements BluetoothProfile, AutoCloseable
    /**
    /**
     * Get the connection policy of the profile.
     * Get the connection policy of the profile.
     *
     *
     * <p> The connection policy can be any of:
     * <p>The connection policy can be any of: {@link #CONNECTION_POLICY_ALLOWED}, {@link
     * {@link #CONNECTION_POLICY_ALLOWED}, {@link #CONNECTION_POLICY_FORBIDDEN},
     * #CONNECTION_POLICY_FORBIDDEN}, {@link #CONNECTION_POLICY_UNKNOWN}
     * {@link #CONNECTION_POLICY_UNKNOWN}
     *
     *
     * @param device Bluetooth device
     * @param device Bluetooth device
     * @return connection policy of the device or {@link #CONNECTION_POLICY_FORBIDDEN} if device is
     * @return connection policy of the device or {@link #CONNECTION_POLICY_FORBIDDEN} if device is
@@ -706,9 +714,10 @@ public final class BluetoothHapClient implements BluetoothProfile, AutoCloseable
     */
     */
    @SystemApi
    @SystemApi
    @RequiresBluetoothConnectPermission
    @RequiresBluetoothConnectPermission
    @RequiresPermission(allOf = {
    @RequiresPermission(
            allOf = {
                android.Manifest.permission.BLUETOOTH_CONNECT,
                android.Manifest.permission.BLUETOOTH_CONNECT,
            android.Manifest.permission.BLUETOOTH_PRIVILEGED,
                android.Manifest.permission.BLUETOOTH_PRIVILEGED
            })
            })
    public @ConnectionPolicy int getConnectionPolicy(@Nullable BluetoothDevice device) {
    public @ConnectionPolicy int getConnectionPolicy(@Nullable BluetoothDevice device) {
        if (VDBG) log("getConnectionPolicy(" + device + ")");
        if (VDBG) log("getConnectionPolicy(" + device + ")");
@@ -733,13 +742,15 @@ public final class BluetoothHapClient implements BluetoothProfile, AutoCloseable


    /**
    /**
     * {@inheritDoc}
     * {@inheritDoc}
     *
     * @hide
     * @hide
     */
     */
    @SystemApi
    @SystemApi
    @RequiresBluetoothConnectPermission
    @RequiresBluetoothConnectPermission
    @RequiresPermission(allOf = {
    @RequiresPermission(
            allOf = {
                android.Manifest.permission.BLUETOOTH_CONNECT,
                android.Manifest.permission.BLUETOOTH_CONNECT,
            android.Manifest.permission.BLUETOOTH_PRIVILEGED,
                android.Manifest.permission.BLUETOOTH_PRIVILEGED
            })
            })
    @Override
    @Override
    public @NonNull List<BluetoothDevice> getConnectedDevices() {
    public @NonNull List<BluetoothDevice> getConnectedDevices() {
@@ -767,13 +778,15 @@ public final class BluetoothHapClient implements BluetoothProfile, AutoCloseable


    /**
    /**
     * {@inheritDoc}
     * {@inheritDoc}
     *
     * @hide
     * @hide
     */
     */
    @SystemApi
    @SystemApi
    @RequiresBluetoothConnectPermission
    @RequiresBluetoothConnectPermission
    @RequiresPermission(allOf = {
    @RequiresPermission(
            allOf = {
                android.Manifest.permission.BLUETOOTH_CONNECT,
                android.Manifest.permission.BLUETOOTH_CONNECT,
            android.Manifest.permission.BLUETOOTH_PRIVILEGED,
                android.Manifest.permission.BLUETOOTH_PRIVILEGED
            })
            })
    @Override
    @Override
    @NonNull
    @NonNull
@@ -802,13 +815,15 @@ public final class BluetoothHapClient implements BluetoothProfile, AutoCloseable


    /**
    /**
     * {@inheritDoc}
     * {@inheritDoc}
     *
     * @hide
     * @hide
     */
     */
    @SystemApi
    @SystemApi
    @RequiresBluetoothConnectPermission
    @RequiresBluetoothConnectPermission
    @RequiresPermission(allOf = {
    @RequiresPermission(
            allOf = {
                android.Manifest.permission.BLUETOOTH_CONNECT,
                android.Manifest.permission.BLUETOOTH_CONNECT,
            android.Manifest.permission.BLUETOOTH_PRIVILEGED,
                android.Manifest.permission.BLUETOOTH_PRIVILEGED
            })
            })
    @Override
    @Override
    @BluetoothProfile.BtProfileState
    @BluetoothProfile.BtProfileState
@@ -834,24 +849,23 @@ public final class BluetoothHapClient implements BluetoothProfile, AutoCloseable
    }
    }


    /**
    /**
     * Gets the group identifier, which can be used in the group related part of
     * Gets the group identifier, which can be used in the group related part of the API.
     * the API.
     *
     *
     * <p>Users are expected to get group identifier for each of the connected
     * <p>Users are expected to get group identifier for each of the connected device to discover
     * device to discover the device grouping. This allows them to make an informed
     * the device grouping. This allows them to make an informed decision which devices can be
     * decision which devices can be controlled by single group API call and which
     * controlled by single group API call and which require individual device calls.
     * require individual device calls.
     *
     *
     * <p>Note that some binaural HA devices may not support group operations,
     * <p>Note that some binaural HA devices may not support group operations, therefore are not
     * therefore are not considered a valid HAP group. In such case -1 is returned
     * considered a valid HAP group. In such case -1 is returned even if such device is a valid Le
     * even if such device is a valid Le Audio Coordinated Set member.
     * Audio Coordinated Set member.
     *
     *
     * @param device
     * @param device
     * @return valid group identifier or -1
     * @return valid group identifier or -1
     * @hide
     * @hide
     */
     */
    @RequiresBluetoothConnectPermission
    @RequiresBluetoothConnectPermission
    @RequiresPermission(allOf = {
    @RequiresPermission(
            allOf = {
                android.Manifest.permission.BLUETOOTH_CONNECT,
                android.Manifest.permission.BLUETOOTH_CONNECT,
                android.Manifest.permission.BLUETOOTH_PRIVILEGED,
                android.Manifest.permission.BLUETOOTH_PRIVILEGED,
            })
            })
@@ -883,9 +897,10 @@ public final class BluetoothHapClient implements BluetoothProfile, AutoCloseable
     * @hide
     * @hide
     */
     */
    @RequiresBluetoothConnectPermission
    @RequiresBluetoothConnectPermission
    @RequiresPermission(allOf = {
    @RequiresPermission(
            allOf = {
                android.Manifest.permission.BLUETOOTH_CONNECT,
                android.Manifest.permission.BLUETOOTH_CONNECT,
            android.Manifest.permission.BLUETOOTH_PRIVILEGED,
                android.Manifest.permission.BLUETOOTH_PRIVILEGED
            })
            })
    public int getActivePresetIndex(@NonNull BluetoothDevice device) {
    public int getActivePresetIndex(@NonNull BluetoothDevice device) {
        final IBluetoothHapClient service = getService();
        final IBluetoothHapClient service = getService();
@@ -911,13 +926,14 @@ public final class BluetoothHapClient implements BluetoothProfile, AutoCloseable
     * Get the currently active preset info for a remote device.
     * Get the currently active preset info for a remote device.
     *
     *
     * @param device is the device for which we want to get the preset name
     * @param device is the device for which we want to get the preset name
     * @return currently active preset info if selected, null if preset info is not available
     * @return currently active preset info if selected, null if preset info is not available for
     *         for the remote device
     *     the remote device
     * @hide
     * @hide
     */
     */
    @SystemApi
    @SystemApi
    @RequiresBluetoothConnectPermission
    @RequiresBluetoothConnectPermission
    @RequiresPermission(allOf = {
    @RequiresPermission(
            allOf = {
                android.Manifest.permission.BLUETOOTH_CONNECT,
                android.Manifest.permission.BLUETOOTH_CONNECT,
                android.Manifest.permission.BLUETOOTH_PRIVILEGED
                android.Manifest.permission.BLUETOOTH_PRIVILEGED
            })
            })
@@ -946,9 +962,9 @@ public final class BluetoothHapClient implements BluetoothProfile, AutoCloseable
    /**
    /**
     * Selects the currently active preset for a HA device
     * Selects the currently active preset for a HA device
     *
     *
     * On success, {@link Callback#onPresetSelected(BluetoothDevice, int, int)} will be called with
     * <p>On success, {@link Callback#onPresetSelected(BluetoothDevice, int, int)} will be called
     * reason code {@link BluetoothStatusCodes#REASON_LOCAL_APP_REQUEST}
     * with reason code {@link BluetoothStatusCodes#REASON_LOCAL_APP_REQUEST} On failure, {@link
     * On failure, {@link Callback#onPresetSelectionFailed(BluetoothDevice, int)} will be called.
     * Callback#onPresetSelectionFailed(BluetoothDevice, int)} will be called.
     *
     *
     * @param device is the device for which we want to set the active preset
     * @param device is the device for which we want to set the active preset
     * @param presetIndex is an index of one of the available presets
     * @param presetIndex is an index of one of the available presets
@@ -956,7 +972,8 @@ public final class BluetoothHapClient implements BluetoothProfile, AutoCloseable
     */
     */
    @SystemApi
    @SystemApi
    @RequiresBluetoothConnectPermission
    @RequiresBluetoothConnectPermission
    @RequiresPermission(allOf = {
    @RequiresPermission(
            allOf = {
                android.Manifest.permission.BLUETOOTH_CONNECT,
                android.Manifest.permission.BLUETOOTH_CONNECT,
                android.Manifest.permission.BLUETOOTH_PRIVILEGED
                android.Manifest.permission.BLUETOOTH_PRIVILEGED
            })
            })
@@ -977,14 +994,13 @@ public final class BluetoothHapClient implements BluetoothProfile, AutoCloseable
    /**
    /**
     * Selects the currently active preset for a Hearing Aid device group.
     * Selects the currently active preset for a Hearing Aid device group.
     *
     *
     * <p> This group call may replace multiple device calls if those are part of the
     * <p>This group call may replace multiple device calls if those are part of the valid HAS
     * valid HAS group. Note that binaural HA devices may or may not support group.
     * group. Note that binaural HA devices may or may not support group.
     *
     *
     * On success, {@link Callback#onPresetSelected(BluetoothDevice, int, int)} will be called
     * <p>On success, {@link Callback#onPresetSelected(BluetoothDevice, int, int)} will be called
     * for each device within the group with reason code
     * for each device within the group with reason code {@link
     * {@link BluetoothStatusCodes#REASON_LOCAL_APP_REQUEST}
     * BluetoothStatusCodes#REASON_LOCAL_APP_REQUEST} On failure, {@link
     * On failure, {@link Callback#onPresetSelectionForGroupFailed(int, int)} will be
     * Callback#onPresetSelectionForGroupFailed(int, int)} will be called for the group.
     * called for the group.
     *
     *
     * @param groupId is the device group identifier for which want to set the active preset
     * @param groupId is the device group identifier for which want to set the active preset
     * @param presetIndex is an index of one of the available presets
     * @param presetIndex is an index of one of the available presets
@@ -992,7 +1008,8 @@ public final class BluetoothHapClient implements BluetoothProfile, AutoCloseable
     */
     */
    @SystemApi
    @SystemApi
    @RequiresBluetoothConnectPermission
    @RequiresBluetoothConnectPermission
    @RequiresPermission(allOf = {
    @RequiresPermission(
            allOf = {
                android.Manifest.permission.BLUETOOTH_CONNECT,
                android.Manifest.permission.BLUETOOTH_CONNECT,
                android.Manifest.permission.BLUETOOTH_PRIVILEGED
                android.Manifest.permission.BLUETOOTH_PRIVILEGED
            })
            })
@@ -1013,14 +1030,15 @@ public final class BluetoothHapClient implements BluetoothProfile, AutoCloseable
    /**
    /**
     * Sets the next preset as a currently active preset for a HA device
     * Sets the next preset as a currently active preset for a HA device
     *
     *
     * <p> Note that the meaning of 'next' is HA device implementation specific and
     * <p>Note that the meaning of 'next' is HA device implementation specific and does not
     * does not necessarily mean a higher preset index.
     * necessarily mean a higher preset index.
     *
     *
     * @param device is the device for which we want to set the active preset
     * @param device is the device for which we want to set the active preset
     * @hide
     * @hide
     */
     */
    @RequiresBluetoothConnectPermission
    @RequiresBluetoothConnectPermission
    @RequiresPermission(allOf = {
    @RequiresPermission(
            allOf = {
                android.Manifest.permission.BLUETOOTH_CONNECT,
                android.Manifest.permission.BLUETOOTH_CONNECT,
                android.Manifest.permission.BLUETOOTH_PRIVILEGED
                android.Manifest.permission.BLUETOOTH_PRIVILEGED
            })
            })
@@ -1041,16 +1059,18 @@ public final class BluetoothHapClient implements BluetoothProfile, AutoCloseable
    /**
    /**
     * Sets the next preset as a currently active preset for a HA device group
     * Sets the next preset as a currently active preset for a HA device group
     *
     *
     * <p> Note that the meaning of 'next' is HA device implementation specific and
     * <p>Note that the meaning of 'next' is HA device implementation specific and does not
     * does not necessarily mean a higher preset index.
     * necessarily mean a higher preset index.
     * <p> This group call may replace multiple device calls if those are part of the
     *
     * valid HAS group. Note that binaural HA devices may or may not support group.
     * <p>This group call may replace multiple device calls if those are part of the valid HAS
     * group. Note that binaural HA devices may or may not support group.
     *
     *
     * @param groupId is the device group identifier for which want to set the active preset
     * @param groupId is the device group identifier for which want to set the active preset
     * @hide
     * @hide
     */
     */
    @RequiresBluetoothConnectPermission
    @RequiresBluetoothConnectPermission
    @RequiresPermission(allOf = {
    @RequiresPermission(
            allOf = {
                android.Manifest.permission.BLUETOOTH_CONNECT,
                android.Manifest.permission.BLUETOOTH_CONNECT,
                android.Manifest.permission.BLUETOOTH_PRIVILEGED
                android.Manifest.permission.BLUETOOTH_PRIVILEGED
            })
            })
@@ -1071,14 +1091,15 @@ public final class BluetoothHapClient implements BluetoothProfile, AutoCloseable
    /**
    /**
     * Sets the previous preset as a currently active preset for a HA device.
     * Sets the previous preset as a currently active preset for a HA device.
     *
     *
     * <p> Note that the meaning of 'previous' is HA device implementation specific and
     * <p>Note that the meaning of 'previous' is HA device implementation specific and does not
     * does not necessarily mean a lower preset index.
     * necessarily mean a lower preset index.
     *
     *
     * @param device is the device for which we want to set the active preset
     * @param device is the device for which we want to set the active preset
     * @hide
     * @hide
     */
     */
    @RequiresBluetoothConnectPermission
    @RequiresBluetoothConnectPermission
    @RequiresPermission(allOf = {
    @RequiresPermission(
            allOf = {
                android.Manifest.permission.BLUETOOTH_CONNECT,
                android.Manifest.permission.BLUETOOTH_CONNECT,
                android.Manifest.permission.BLUETOOTH_PRIVILEGED
                android.Manifest.permission.BLUETOOTH_PRIVILEGED
            })
            })
@@ -1099,16 +1120,18 @@ public final class BluetoothHapClient implements BluetoothProfile, AutoCloseable
    /**
    /**
     * Sets the previous preset as a currently active preset for a HA device group
     * Sets the previous preset as a currently active preset for a HA device group
     *
     *
     * <p> Note the meaning of 'previous' is HA device implementation specific and
     * <p>Note the meaning of 'previous' is HA device implementation specific and does not
     * does not necessarily mean a lower preset index.
     * necessarily mean a lower preset index.
     * <p> This group call may replace multiple device calls if those are part of the
     *
     * valid HAS group. Note that binaural HA devices may or may not support group.
     * <p>This group call may replace multiple device calls if those are part of the valid HAS
     * group. Note that binaural HA devices may or may not support group.
     *
     *
     * @param groupId is the device group identifier for which want to set the active preset
     * @param groupId is the device group identifier for which want to set the active preset
     * @hide
     * @hide
     */
     */
    @RequiresBluetoothConnectPermission
    @RequiresBluetoothConnectPermission
    @RequiresPermission(allOf = {
    @RequiresPermission(
            allOf = {
                android.Manifest.permission.BLUETOOTH_CONNECT,
                android.Manifest.permission.BLUETOOTH_CONNECT,
                android.Manifest.permission.BLUETOOTH_PRIVILEGED
                android.Manifest.permission.BLUETOOTH_PRIVILEGED
            })
            })
@@ -1135,7 +1158,8 @@ public final class BluetoothHapClient implements BluetoothProfile, AutoCloseable
     * @hide
     * @hide
     */
     */
    @RequiresBluetoothConnectPermission
    @RequiresBluetoothConnectPermission
    @RequiresPermission(allOf = {
    @RequiresPermission(
            allOf = {
                android.Manifest.permission.BLUETOOTH_CONNECT,
                android.Manifest.permission.BLUETOOTH_CONNECT,
                android.Manifest.permission.BLUETOOTH_PRIVILEGED
                android.Manifest.permission.BLUETOOTH_PRIVILEGED
            })
            })
@@ -1170,7 +1194,8 @@ public final class BluetoothHapClient implements BluetoothProfile, AutoCloseable
     */
     */
    @SystemApi
    @SystemApi
    @RequiresBluetoothConnectPermission
    @RequiresBluetoothConnectPermission
    @RequiresPermission(allOf = {
    @RequiresPermission(
            allOf = {
                android.Manifest.permission.BLUETOOTH_CONNECT,
                android.Manifest.permission.BLUETOOTH_CONNECT,
                android.Manifest.permission.BLUETOOTH_PRIVILEGED
                android.Manifest.permission.BLUETOOTH_PRIVILEGED
            })
            })
@@ -1203,7 +1228,8 @@ public final class BluetoothHapClient implements BluetoothProfile, AutoCloseable
     * @hide
     * @hide
     */
     */
    @RequiresBluetoothConnectPermission
    @RequiresBluetoothConnectPermission
    @RequiresPermission(allOf = {
    @RequiresPermission(
            allOf = {
                android.Manifest.permission.BLUETOOTH_CONNECT,
                android.Manifest.permission.BLUETOOTH_CONNECT,
                android.Manifest.permission.BLUETOOTH_PRIVILEGED
                android.Manifest.permission.BLUETOOTH_PRIVILEGED
            })
            })
@@ -1236,7 +1262,8 @@ public final class BluetoothHapClient implements BluetoothProfile, AutoCloseable
     */
     */
    @SystemApi
    @SystemApi
    @RequiresBluetoothConnectPermission
    @RequiresBluetoothConnectPermission
    @RequiresPermission(allOf = {
    @RequiresPermission(
            allOf = {
                android.Manifest.permission.BLUETOOTH_CONNECT,
                android.Manifest.permission.BLUETOOTH_CONNECT,
                android.Manifest.permission.BLUETOOTH_PRIVILEGED
                android.Manifest.permission.BLUETOOTH_PRIVILEGED
            })
            })
@@ -1254,7 +1281,8 @@ public final class BluetoothHapClient implements BluetoothProfile, AutoCloseable
     */
     */
    @SystemApi
    @SystemApi
    @RequiresBluetoothConnectPermission
    @RequiresBluetoothConnectPermission
    @RequiresPermission(allOf = {
    @RequiresPermission(
            allOf = {
                android.Manifest.permission.BLUETOOTH_CONNECT,
                android.Manifest.permission.BLUETOOTH_CONNECT,
                android.Manifest.permission.BLUETOOTH_PRIVILEGED
                android.Manifest.permission.BLUETOOTH_PRIVILEGED
            })
            })
@@ -1272,7 +1300,8 @@ public final class BluetoothHapClient implements BluetoothProfile, AutoCloseable
     */
     */
    @SystemApi
    @SystemApi
    @RequiresBluetoothConnectPermission
    @RequiresBluetoothConnectPermission
    @RequiresPermission(allOf = {
    @RequiresPermission(
            allOf = {
                android.Manifest.permission.BLUETOOTH_CONNECT,
                android.Manifest.permission.BLUETOOTH_CONNECT,
                android.Manifest.permission.BLUETOOTH_PRIVILEGED
                android.Manifest.permission.BLUETOOTH_PRIVILEGED
            })
            })
@@ -1290,7 +1319,8 @@ public final class BluetoothHapClient implements BluetoothProfile, AutoCloseable
     */
     */
    @SystemApi
    @SystemApi
    @RequiresBluetoothConnectPermission
    @RequiresBluetoothConnectPermission
    @RequiresPermission(allOf = {
    @RequiresPermission(
            allOf = {
                android.Manifest.permission.BLUETOOTH_CONNECT,
                android.Manifest.permission.BLUETOOTH_CONNECT,
                android.Manifest.permission.BLUETOOTH_PRIVILEGED
                android.Manifest.permission.BLUETOOTH_PRIVILEGED
            })
            })
@@ -1308,7 +1338,8 @@ public final class BluetoothHapClient implements BluetoothProfile, AutoCloseable
     */
     */
    @SystemApi
    @SystemApi
    @RequiresBluetoothConnectPermission
    @RequiresBluetoothConnectPermission
    @RequiresPermission(allOf = {
    @RequiresPermission(
            allOf = {
                android.Manifest.permission.BLUETOOTH_CONNECT,
                android.Manifest.permission.BLUETOOTH_CONNECT,
                android.Manifest.permission.BLUETOOTH_PRIVILEGED
                android.Manifest.permission.BLUETOOTH_PRIVILEGED
            })
            })
@@ -1322,10 +1353,9 @@ public final class BluetoothHapClient implements BluetoothProfile, AutoCloseable
     *
     *
     * <p>Note that the name length is restricted to 40 characters.
     * <p>Note that the name length is restricted to 40 characters.
     *
     *
     * On success, {@link Callback#onPresetInfoChanged(BluetoothDevice, List, int)}
     * <p>On success, {@link Callback#onPresetInfoChanged(BluetoothDevice, List, int)} with a new
     * with a new name will be called and reason code
     * name will be called and reason code {@link BluetoothStatusCodes#REASON_LOCAL_APP_REQUEST} On
     * {@link BluetoothStatusCodes#REASON_LOCAL_APP_REQUEST}
     * failure, {@link Callback#onSetPresetNameFailed(BluetoothDevice, int)} will be called.
     * On failure, {@link Callback#onSetPresetNameFailed(BluetoothDevice, int)} will be called.
     *
     *
     * @param device is the device for which we want to get the preset name
     * @param device is the device for which we want to get the preset name
     * @param presetIndex is an index of one of the available presets
     * @param presetIndex is an index of one of the available presets
@@ -1334,12 +1364,13 @@ public final class BluetoothHapClient implements BluetoothProfile, AutoCloseable
     */
     */
    @SystemApi
    @SystemApi
    @RequiresBluetoothConnectPermission
    @RequiresBluetoothConnectPermission
    @RequiresPermission(allOf = {
    @RequiresPermission(
            allOf = {
                android.Manifest.permission.BLUETOOTH_CONNECT,
                android.Manifest.permission.BLUETOOTH_CONNECT,
                android.Manifest.permission.BLUETOOTH_PRIVILEGED
                android.Manifest.permission.BLUETOOTH_PRIVILEGED
            })
            })
    public void setPresetName(@NonNull BluetoothDevice device, int presetIndex,
    public void setPresetName(
            @NonNull String name) {
            @NonNull BluetoothDevice device, int presetIndex, @NonNull String name) {
        final IBluetoothHapClient service = getService();
        final IBluetoothHapClient service = getService();
        if (service == null) {
        if (service == null) {
            Log.w(TAG, "Proxy not attached to service");
            Log.w(TAG, "Proxy not attached to service");
@@ -1358,10 +1389,10 @@ public final class BluetoothHapClient implements BluetoothProfile, AutoCloseable
     *
     *
     * <p>Note that the name length is restricted to 40 characters.
     * <p>Note that the name length is restricted to 40 characters.
     *
     *
     * On success, {@link Callback#onPresetInfoChanged(BluetoothDevice, List, int)}
     * <p>On success, {@link Callback#onPresetInfoChanged(BluetoothDevice, List, int)} with a new
     * with a new name will be called for each device within the group with reason code
     * name will be called for each device within the group with reason code {@link
     * {@link BluetoothStatusCodes#REASON_LOCAL_APP_REQUEST}
     * BluetoothStatusCodes#REASON_LOCAL_APP_REQUEST} On failure, {@link
     * On failure, {@link Callback#onSetPresetNameForGroupFailed(int, int)} will be invoked
     * Callback#onSetPresetNameForGroupFailed(int, int)} will be invoked
     *
     *
     * @param groupId is the device group identifier
     * @param groupId is the device group identifier
     * @param presetIndex is an index of one of the available presets
     * @param presetIndex is an index of one of the available presets
@@ -1370,7 +1401,8 @@ public final class BluetoothHapClient implements BluetoothProfile, AutoCloseable
     */
     */
    @SystemApi
    @SystemApi
    @RequiresBluetoothConnectPermission
    @RequiresBluetoothConnectPermission
    @RequiresPermission(allOf = {
    @RequiresPermission(
            allOf = {
                android.Manifest.permission.BLUETOOTH_CONNECT,
                android.Manifest.permission.BLUETOOTH_CONNECT,
                android.Manifest.permission.BLUETOOTH_PRIVILEGED
                android.Manifest.permission.BLUETOOTH_PRIVILEGED
            })
            })