Give PBAP permission only after user confirms
Bug: 72872376 Test: manual Change-Id: I9617e3c10bf19e22f9a8f172332a83bbbebaf4a4
This commit is contained in:
@@ -57,6 +57,7 @@ public class BluetoothPairingController implements OnCheckedChangeListener,
|
|||||||
private int mPasskey;
|
private int mPasskey;
|
||||||
private String mDeviceName;
|
private String mDeviceName;
|
||||||
private LocalBluetoothProfile mPbapClientProfile;
|
private LocalBluetoothProfile mPbapClientProfile;
|
||||||
|
private boolean mPbapAllowed;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates an instance of a BluetoothPairingController.
|
* Creates an instance of a BluetoothPairingController.
|
||||||
@@ -87,15 +88,20 @@ public class BluetoothPairingController implements OnCheckedChangeListener,
|
|||||||
@Override
|
@Override
|
||||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||||
if (isChecked) {
|
if (isChecked) {
|
||||||
mDevice.setPhonebookAccessPermission(BluetoothDevice.ACCESS_ALLOWED);
|
mPbapAllowed = true;
|
||||||
} else {
|
} else {
|
||||||
mDevice.setPhonebookAccessPermission(BluetoothDevice.ACCESS_REJECTED);
|
mPbapAllowed = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDialogPositiveClick(BluetoothPairingDialogFragment dialog) {
|
public void onDialogPositiveClick(BluetoothPairingDialogFragment dialog) {
|
||||||
if (getDialogType() == USER_ENTRY_DIALOG) {
|
if (getDialogType() == USER_ENTRY_DIALOG) {
|
||||||
|
if (mPbapAllowed) {
|
||||||
|
mDevice.setPhonebookAccessPermission(BluetoothDevice.ACCESS_ALLOWED);
|
||||||
|
} else {
|
||||||
|
mDevice.setPhonebookAccessPermission(BluetoothDevice.ACCESS_REJECTED);
|
||||||
|
}
|
||||||
onPair(mUserInput);
|
onPair(mUserInput);
|
||||||
} else {
|
} else {
|
||||||
onPair(null);
|
onPair(null);
|
||||||
@@ -104,6 +110,7 @@ public class BluetoothPairingController implements OnCheckedChangeListener,
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDialogNegativeClick(BluetoothPairingDialogFragment dialog) {
|
public void onDialogNegativeClick(BluetoothPairingDialogFragment dialog) {
|
||||||
|
mDevice.setPhonebookAccessPermission(BluetoothDevice.ACCESS_REJECTED);
|
||||||
onCancel();
|
onCancel();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user