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

Commit c406397e authored by Christine Hallstrom's avatar Christine Hallstrom
Browse files

Unhide BluetoothDevice#getAddressType

This API is planned to become public API in Android V.

Bug: 321120941
Bug: 291280443
Test: m com.android.btservices
Change-Id: I78ecd04308315d6ef92310c58b21639b56257b8f
parent d4550494
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -534,6 +534,7 @@ package android.bluetooth {
    method public int describeContents();
    method @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public boolean fetchUuidsWithSdp();
    method public String getAddress();
    method @FlaggedApi("com.android.bluetooth.flags.get_address_type_api") public int getAddressType();
    method @Nullable @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public String getAlias();
    method @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public android.bluetooth.BluetoothClass getBluetoothClass();
    method @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public int getBondState();
@@ -554,6 +555,7 @@ package android.bluetooth {
    field @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public static final String ACTION_NAME_CHANGED = "android.bluetooth.device.action.NAME_CHANGED";
    field @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public static final String ACTION_PAIRING_REQUEST = "android.bluetooth.device.action.PAIRING_REQUEST";
    field @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public static final String ACTION_UUID = "android.bluetooth.device.action.UUID";
    field @FlaggedApi("com.android.bluetooth.flags.get_address_type_api") public static final int ADDRESS_TYPE_ANONYMOUS = 255; // 0xff
    field public static final int ADDRESS_TYPE_PUBLIC = 0; // 0x0
    field public static final int ADDRESS_TYPE_RANDOM = 1; // 0x1
    field public static final int ADDRESS_TYPE_UNKNOWN = 65535; // 0xffff
+6 −4
Original line number Diff line number Diff line
@@ -1342,7 +1342,8 @@ public final class BluetoothDevice implements Parcelable, Attributable {
    public static final int ADDRESS_TYPE_UNKNOWN = 0xFFFF;

    /** Address type used to indicate an anonymous advertisement. */
    private static final int ADDRESS_TYPE_ANONYMOUS = 0xFF;
    @FlaggedApi(Flags.FLAG_GET_ADDRESS_TYPE_API)
    public static final int ADDRESS_TYPE_ANONYMOUS = 0xFF;

    private static final String NULL_MAC_ADDRESS = "00:00:00:00:00:00";

@@ -1551,12 +1552,13 @@ public final class BluetoothDevice implements Parcelable, Attributable {
    }

    /**
     * Returns the address type of this BluetoothDevice.
     * Returns the address type of this BluetoothDevice, one of {@link ADDRESS_TYPE_PUBLIC}, {@link
     * ADDRESS_TYPE_RANDOM}, {@link ADDRESS_TYPE_ANONYMOUS}, or {@link ADDRESS_TYPE_UNKNOWN}.
     *
     * @return Bluetooth address type
     * @hide
     */
    public int getAddressType() {
    @FlaggedApi(Flags.FLAG_GET_ADDRESS_TYPE_API)
    public @AddressType int getAddressType() {
        if (DBG) Log.d(TAG, "mAddressType: " + mAddressType);
        return mAddressType;
    }