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

Commit 9340fc07 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "API Review: add `UNBOND` in `EXTRA_REASON` name" into tm-dev am: c47e6b5b

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/modules/Bluetooth/+/17189144

Change-Id: Ic46fb8176b72f87ba826eee9a308ecd93fa6a912
parents f3ff040b c47e6b5b
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -426,7 +426,7 @@ final class BondStateMachine extends StateMachine {
        intent.putExtra(BluetoothDevice.EXTRA_BOND_STATE, newState);
        intent.putExtra(BluetoothDevice.EXTRA_PREVIOUS_BOND_STATE, oldState);
        if (newState == BluetoothDevice.BOND_NONE) {
            intent.putExtra(BluetoothDevice.EXTRA_REASON, reason);
            intent.putExtra(BluetoothDevice.EXTRA_UNBOND_REASON, reason);
        }
        mAdapterService.sendBroadcastAsUser(intent, UserHandle.ALL, BLUETOOTH_CONNECT,
                Utils.getTempAllowlistBroadcastOptions());
+3 −3
Original line number Diff line number Diff line
@@ -361,10 +361,10 @@ public class BondStateMachineTest {
        Assert.assertEquals(oldState, intent.getIntExtra(BluetoothDevice.EXTRA_PREVIOUS_BOND_STATE,
                                                          -1));
        if (newState == BOND_NONE) {
            Assert.assertEquals(TEST_BOND_REASON, intent.getIntExtra(BluetoothDevice.EXTRA_REASON,
                                                              -1));
            Assert.assertEquals(TEST_BOND_REASON,
                    intent.getIntExtra(BluetoothDevice.EXTRA_UNBOND_REASON, -1));
        } else {
            Assert.assertEquals(-1, intent.getIntExtra(BluetoothDevice.EXTRA_REASON, -1));
            Assert.assertEquals(-1, intent.getIntExtra(BluetoothDevice.EXTRA_UNBOND_REASON, -1));
        }
    }
}
+1 −1
Original line number Diff line number Diff line
@@ -187,7 +187,7 @@ package android.bluetooth {
    field public static final String EXTRA_PAIRING_INITIATOR = "android.bluetooth.device.extra.PAIRING_INITIATOR";
    field public static final int EXTRA_PAIRING_INITIATOR_BACKGROUND = 2; // 0x2
    field public static final int EXTRA_PAIRING_INITIATOR_FOREGROUND = 1; // 0x1
    field public static final String EXTRA_REASON = "android.bluetooth.device.extra.REASON";
    field public static final String EXTRA_UNBOND_REASON = "android.bluetooth.device.extra.REASON";
    field public static final int METADATA_COMPANION_APP = 4; // 0x4
    field public static final int METADATA_DEVICE_TYPE = 17; // 0x11
    field public static final int METADATA_ENHANCED_SETTINGS_UI_URI = 16; // 0x10
+15 −5
Original line number Diff line number Diff line
@@ -217,7 +217,7 @@ public final class BluetoothDevice implements Parcelable, Attributable {
     * #EXTRA_BOND_STATE} and {@link #EXTRA_PREVIOUS_BOND_STATE}.
     */
    // Note: When EXTRA_BOND_STATE is BOND_NONE then this will also
    // contain a hidden extra field EXTRA_REASON with the result code.
    // contain a hidden extra field EXTRA_UNBOND_REASON with the result code.
    @RequiresLegacyBluetoothPermission
    @RequiresBluetoothConnectPermission
    @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT)
@@ -380,8 +380,7 @@ public final class BluetoothDevice implements Parcelable, Attributable {
    public static final int BOND_BONDED = 12;

    /**
     * Used as an int extra field in {@link #ACTION_PAIRING_REQUEST}
     * intents for unbond reason.
     * Used as an int extra field in {@link #ACTION_PAIRING_REQUEST} intents for unbond reason.
     * Possible value are :
     *  - {@link #UNBOND_REASON_AUTH_FAILED}
     *  - {@link #UNBOND_REASON_AUTH_REJECTED}
@@ -393,11 +392,22 @@ public final class BluetoothDevice implements Parcelable, Attributable {
     *  - {@link #UNBOND_REASON_REMOTE_AUTH_CANCELED}
     *  - {@link #UNBOND_REASON_REMOVED}
     *
     * {@hide}
     * Note: Can be added as a hidden extra field for {@link #ACTION_BOND_STATE_CHANGED} when the
     * {@link #EXTRA_BOND_STATE} is {@link #BOND_NONE}
     *
     * @hide
     */
    @SystemApi
    @SuppressLint("ActionValue")
    public static final String EXTRA_REASON = "android.bluetooth.device.extra.REASON";
    public static final String EXTRA_UNBOND_REASON = "android.bluetooth.device.extra.REASON";

    /**
     * Use {@link EXTRA_UNBOND_REASON} instead
     * @hide
     */
    @UnsupportedAppUsage
    public static final String EXTRA_REASON = EXTRA_UNBOND_REASON;


    /**
     * Used as an int extra field in {@link #ACTION_PAIRING_REQUEST}