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

Commit aaf637ff authored by Hansong Zhang's avatar Hansong Zhang Committed by android-build-merger
Browse files

Merge "Give PBAP permission only after user confirms" into pi-dev am: fcac34d7

am: cd09ff50

Change-Id: I404d323a39dc7a42f20c3411aebb2237c1fb13f3
parents 09df7d70 cd09ff50
Loading
Loading
Loading
Loading
+9 −2
Original line number Diff line number Diff line
@@ -57,6 +57,7 @@ public class BluetoothPairingController implements OnCheckedChangeListener,
    private int mPasskey;
    private String mDeviceName;
    private LocalBluetoothProfile mPbapClientProfile;
    private boolean mPbapAllowed;

    /**
     * Creates an instance of a BluetoothPairingController.
@@ -87,15 +88,20 @@ public class BluetoothPairingController implements OnCheckedChangeListener,
    @Override
    public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
        if (isChecked) {
            mDevice.setPhonebookAccessPermission(BluetoothDevice.ACCESS_ALLOWED);
            mPbapAllowed = true;
        } else {
            mDevice.setPhonebookAccessPermission(BluetoothDevice.ACCESS_REJECTED);
            mPbapAllowed = false;
        }
    }

    @Override
    public void onDialogPositiveClick(BluetoothPairingDialogFragment dialog) {
        if (getDialogType() == USER_ENTRY_DIALOG) {
            if (mPbapAllowed) {
                mDevice.setPhonebookAccessPermission(BluetoothDevice.ACCESS_ALLOWED);
            } else {
                mDevice.setPhonebookAccessPermission(BluetoothDevice.ACCESS_REJECTED);
            }
            onPair(mUserInput);
        } else {
            onPair(null);
@@ -104,6 +110,7 @@ public class BluetoothPairingController implements OnCheckedChangeListener,

    @Override
    public void onDialogNegativeClick(BluetoothPairingDialogFragment dialog) {
        mDevice.setPhonebookAccessPermission(BluetoothDevice.ACCESS_REJECTED);
        onCancel();
    }