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

Commit 9eb0706d authored by Rahul Sabnis's avatar Rahul Sabnis Committed by Automerger Merge Worker
Browse files

Merge "Skips the consent pairing dialog for recently associated CDM app and...

Merge "Skips the consent pairing dialog for recently associated CDM app and device combos because they have already been shown the CDM prompt which implicitly provides consent to bond." into sc-dev am: dc9a13ea

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/13534985

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I0c03faf50f356c9871cdf4d072f34cafb35da9ed
parents b585b40a dc9a13ea
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -1854,6 +1854,7 @@ package android.bluetooth {
  }
  }
  public final class BluetoothDevice implements android.os.Parcelable {
  public final class BluetoothDevice implements android.os.Parcelable {
    method @RequiresPermission(android.Manifest.permission.BLUETOOTH_PRIVILEGED) public boolean canBondWithoutDialog();
    method @RequiresPermission(android.Manifest.permission.BLUETOOTH_PRIVILEGED) public boolean cancelBondProcess();
    method @RequiresPermission(android.Manifest.permission.BLUETOOTH_PRIVILEGED) public boolean cancelBondProcess();
    method @Nullable @RequiresPermission(android.Manifest.permission.BLUETOOTH_PRIVILEGED) public byte[] getMetadata(int);
    method @Nullable @RequiresPermission(android.Manifest.permission.BLUETOOTH_PRIVILEGED) public byte[] getMetadata(int);
    method @RequiresPermission(android.Manifest.permission.BLUETOOTH) public int getSimAccessPermission();
    method @RequiresPermission(android.Manifest.permission.BLUETOOTH) public int getSimAccessPermission();
+1 −1
Original line number Original line Diff line number Diff line
@@ -1654,7 +1654,7 @@ public final class BluetoothAdapter {
        mContext = context;
        mContext = context;
    }
    }


    private String getOpPackageName() {
    String getOpPackageName() {
        // Workaround for legacy API for getting a BluetoothAdapter not
        // Workaround for legacy API for getting a BluetoothAdapter not
        // passing a context
        // passing a context
        if (mContext != null) {
        if (mContext != null) {
+27 −1
Original line number Original line Diff line number Diff line
@@ -1236,7 +1236,8 @@ public final class BluetoothDevice implements Parcelable {
            return false;
            return false;
        }
        }
        try {
        try {
            return service.createBond(this, transport, oobData);
            BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter();
            return service.createBond(this, transport, oobData, adapter.getOpPackageName());
        } catch (RemoteException e) {
        } catch (RemoteException e) {
            Log.e(TAG, "", e);
            Log.e(TAG, "", e);
        }
        }
@@ -1393,6 +1394,31 @@ public final class BluetoothDevice implements Parcelable {
        return BOND_NONE;
        return BOND_NONE;
    }
    }


    /**
     * Checks whether this bluetooth device is associated with CDM and meets the criteria to skip
     * the bluetooth pairing dialog because it has been already consented by the CDM prompt.
     *
     * @return true if we can bond without the dialog, false otherwise
     *
     * @hide
     */
    @SystemApi
    @RequiresPermission(Manifest.permission.BLUETOOTH_PRIVILEGED)
    public boolean canBondWithoutDialog() {
        final IBluetooth service = sService;
        if (service == null) {
            Log.e(TAG, "BT not enabled. Cannot check if we can skip pairing dialog");
            return false;
        }
        try {
            if (DBG) Log.d(TAG, "canBondWithoutDialog, device: " + this);
            return service.canBondWithoutDialog(this);
        } catch (RemoteException e) {
            Log.e(TAG, "", e);
        }
        return false;
    }

    /**
    /**
     * Returns whether there is an open connection to this device.
     * Returns whether there is an open connection to this device.
     *
     *