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

Commit 89175d8a authored by Automerger Merge Worker's avatar Automerger Merge Worker
Browse files

Merge "Make the BluetoothHidHost class @SystemApi" am: 5e7e617e am: 41ccb1e0

Change-Id: I67034df8454b879dac49acb65b005273bd07be01
parents 97be24f4 41ccb1e0
Loading
Loading
Loading
Loading
+8 −0
Original line number Original line Diff line number Diff line
@@ -1412,6 +1412,14 @@ package android.bluetooth {
    method @RequiresPermission(android.Manifest.permission.BLUETOOTH_ADMIN) public boolean setConnectionPolicy(@NonNull android.bluetooth.BluetoothDevice, int);
    method @RequiresPermission(android.Manifest.permission.BLUETOOTH_ADMIN) public boolean setConnectionPolicy(@NonNull android.bluetooth.BluetoothDevice, int);
  }
  }
  public final class BluetoothHidHost implements android.bluetooth.BluetoothProfile {
    method @NonNull public java.util.List<android.bluetooth.BluetoothDevice> getConnectedDevices();
    method @RequiresPermission(android.Manifest.permission.BLUETOOTH) public int getConnectionPolicy(@Nullable android.bluetooth.BluetoothDevice);
    method public int getConnectionState(@Nullable android.bluetooth.BluetoothDevice);
    method @RequiresPermission(android.Manifest.permission.BLUETOOTH_ADMIN) public boolean setConnectionPolicy(@Nullable android.bluetooth.BluetoothDevice, int);
    field public static final String ACTION_CONNECTION_STATE_CHANGED = "android.bluetooth.input.profile.action.CONNECTION_STATE_CHANGED";
  }
  public final class BluetoothPan implements android.bluetooth.BluetoothProfile {
  public final class BluetoothPan implements android.bluetooth.BluetoothProfile {
    method protected void finalize();
    method protected void finalize();
    method @NonNull public java.util.List<android.bluetooth.BluetoothDevice> getConnectedDevices();
    method @NonNull public java.util.List<android.bluetooth.BluetoothDevice> getConnectedDevices();
+11 −4
Original line number Original line Diff line number Diff line
@@ -17,9 +17,12 @@
package android.bluetooth;
package android.bluetooth;


import android.Manifest;
import android.Manifest;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.RequiresPermission;
import android.annotation.RequiresPermission;
import android.annotation.SdkConstant;
import android.annotation.SdkConstant;
import android.annotation.SdkConstant.SdkConstantType;
import android.annotation.SdkConstant.SdkConstantType;
import android.annotation.SuppressLint;
import android.annotation.SystemApi;
import android.annotation.SystemApi;
import android.content.Context;
import android.content.Context;
import android.os.Binder;
import android.os.Binder;
@@ -43,6 +46,7 @@ import java.util.List;
 *
 *
 * @hide
 * @hide
 */
 */
@SystemApi
public final class BluetoothHidHost implements BluetoothProfile {
public final class BluetoothHidHost implements BluetoothProfile {
    private static final String TAG = "BluetoothHidHost";
    private static final String TAG = "BluetoothHidHost";
    private static final boolean DBG = true;
    private static final boolean DBG = true;
@@ -66,6 +70,7 @@ public final class BluetoothHidHost implements BluetoothProfile {
     * <p>Requires {@link android.Manifest.permission#BLUETOOTH} permission to
     * <p>Requires {@link android.Manifest.permission#BLUETOOTH} permission to
     * receive.
     * receive.
     */
     */
    @SuppressLint("ActionValue")
    @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
    @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
    public static final String ACTION_CONNECTION_STATE_CHANGED =
    public static final String ACTION_CONNECTION_STATE_CHANGED =
            "android.bluetooth.input.profile.action.CONNECTION_STATE_CHANGED";
            "android.bluetooth.input.profile.action.CONNECTION_STATE_CHANGED";
@@ -325,7 +330,7 @@ public final class BluetoothHidHost implements BluetoothProfile {
     * {@inheritDoc}
     * {@inheritDoc}
     */
     */
    @Override
    @Override
    public List<BluetoothDevice> getConnectedDevices() {
    public @NonNull List<BluetoothDevice> getConnectedDevices() {
        if (VDBG) log("getConnectedDevices()");
        if (VDBG) log("getConnectedDevices()");
        final IBluetoothHidHost service = getService();
        final IBluetoothHidHost service = getService();
        if (service != null && isEnabled()) {
        if (service != null && isEnabled()) {
@@ -342,6 +347,8 @@ public final class BluetoothHidHost implements BluetoothProfile {


    /**
    /**
     * {@inheritDoc}
     * {@inheritDoc}
     *
     * @hide
     */
     */
    @Override
    @Override
    public List<BluetoothDevice> getDevicesMatchingConnectionStates(int[] states) {
    public List<BluetoothDevice> getDevicesMatchingConnectionStates(int[] states) {
@@ -363,7 +370,7 @@ public final class BluetoothHidHost implements BluetoothProfile {
     * {@inheritDoc}
     * {@inheritDoc}
     */
     */
    @Override
    @Override
    public int getConnectionState(BluetoothDevice device) {
    public int getConnectionState(@Nullable BluetoothDevice device) {
        if (VDBG) log("getState(" + device + ")");
        if (VDBG) log("getState(" + device + ")");
        final IBluetoothHidHost service = getService();
        final IBluetoothHidHost service = getService();
        if (service != null && isEnabled() && isValidDevice(device)) {
        if (service != null && isEnabled() && isValidDevice(device)) {
@@ -409,7 +416,7 @@ public final class BluetoothHidHost implements BluetoothProfile {
     */
     */
    @SystemApi
    @SystemApi
    @RequiresPermission(Manifest.permission.BLUETOOTH_ADMIN)
    @RequiresPermission(Manifest.permission.BLUETOOTH_ADMIN)
    public boolean setConnectionPolicy(BluetoothDevice device, int connectionPolicy) {
    public boolean setConnectionPolicy(@Nullable BluetoothDevice device, int connectionPolicy) {
        if (DBG) log("setConnectionPolicy(" + device + ", " + connectionPolicy + ")");
        if (DBG) log("setConnectionPolicy(" + device + ", " + connectionPolicy + ")");
        final IBluetoothHidHost service = getService();
        final IBluetoothHidHost service = getService();
        if (service != null && isEnabled() && isValidDevice(device)) {
        if (service != null && isEnabled() && isValidDevice(device)) {
@@ -457,7 +464,7 @@ public final class BluetoothHidHost implements BluetoothProfile {
     */
     */
    @SystemApi
    @SystemApi
    @RequiresPermission(Manifest.permission.BLUETOOTH)
    @RequiresPermission(Manifest.permission.BLUETOOTH)
    public int getConnectionPolicy(BluetoothDevice device) {
    public int getConnectionPolicy(@Nullable BluetoothDevice device) {
        if (VDBG) log("getConnectionPolicy(" + device + ")");
        if (VDBG) log("getConnectionPolicy(" + device + ")");
        final IBluetoothHidHost service = getService();
        final IBluetoothHidHost service = getService();
        if (service != null && isEnabled() && isValidDevice(device)) {
        if (service != null && isEnabled() && isValidDevice(device)) {