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

Commit f5570d6a authored by Zach Johnson's avatar Zach Johnson Committed by Android (Google) Code Review
Browse files

Merge "Remove duplicate method exposure"

parents 777975d7 dd30037e
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -152,7 +152,6 @@ package android.bluetooth {
  public final class BluetoothDevice implements android.os.Parcelable {
    method @RequiresPermission(allOf={android.Manifest.permission.BLUETOOTH_CONNECT, android.Manifest.permission.BLUETOOTH_PRIVILEGED}) public boolean canBondWithoutDialog();
    method @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public boolean cancelBondProcess();
    method @RequiresPermission(allOf={android.Manifest.permission.BLUETOOTH_CONNECT, android.Manifest.permission.BLUETOOTH_PRIVILEGED}) public boolean cancelPairing();
    method @RequiresPermission(allOf={android.Manifest.permission.BLUETOOTH_CONNECT, android.Manifest.permission.BLUETOOTH_PRIVILEGED, android.Manifest.permission.MODIFY_PHONE_STATE}) public int connect();
    method @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public boolean createBond(int);
    method @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public boolean createBondOutOfBand(int, @Nullable android.bluetooth.OobData, @Nullable android.bluetooth.OobData);
+0 −33
Original line number Diff line number Diff line
@@ -2321,39 +2321,6 @@ public final class BluetoothDevice implements Parcelable, Attributable {
        return defaultValue;
    }

    /**
     * Cancels pairing to this device
     *
     * @return true if pairing cancelled successfully, false otherwise
     *
     * @hide
     */
    @SystemApi
    @RequiresLegacyBluetoothAdminPermission
    @RequiresBluetoothConnectPermission
    @RequiresPermission(allOf = {
            android.Manifest.permission.BLUETOOTH_CONNECT,
            android.Manifest.permission.BLUETOOTH_PRIVILEGED,
    })
    public boolean cancelPairing() {
        if (DBG) log("cancelPairing()");
        final IBluetooth service = sService;
        final boolean defaultValue = false;
        if (service == null) {
            Log.e(TAG, "BT not enabled. Cannot cancel pairing");
            if (DBG) log(Log.getStackTraceString(new Throwable()));
        } else {
            try {
                final SynchronousResultReceiver<Boolean> recv = new SynchronousResultReceiver();
                service.cancelBondProcess(this, mAttributionSource, recv);
                return recv.awaitResultNoInterrupt(getSyncTimeout()).getValue(defaultValue);
            } catch (RemoteException | TimeoutException e) {
                Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable()));
            }
        }
        return defaultValue;
    }

    boolean isBluetoothEnabled() {
        boolean ret = false;
        BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter();