Merge "Bluetooth: Give PBAP permission only if device is AUDIO_VIDEO_HANDSFREE"

This commit is contained in:
Treehugger Robot
2017-11-30 17:38:01 +00:00
committed by Gerrit Code Review
2 changed files with 18 additions and 0 deletions

View File

@@ -171,6 +171,22 @@ public class BluetoothPairingController implements OnCheckedChangeListener,
}
}
/**
* Update Phone book permission
*
*/
public void setContactSharingState() {
if ((mDevice.getPhonebookAccessPermission() != BluetoothDevice.ACCESS_ALLOWED)
&& (mDevice.getPhonebookAccessPermission() != BluetoothDevice.ACCESS_REJECTED)) {
if (mDevice.getBluetoothClass().getDeviceClass()
== BluetoothClass.Device.AUDIO_VIDEO_HANDSFREE) {
onCheckedChanged(null, true);
} else {
onCheckedChanged(null, false);
}
}
}
/**
* A method for querying if the provided editable is a valid passkey/pin format for this device.
*

View File

@@ -224,6 +224,7 @@ public class BluetoothPairingDialogFragment extends InstrumentedDialogFragment i
contactSharing.setVisibility(mPairingController.isProfileReady()
? View.GONE : View.VISIBLE);
mPairingController.setContactSharingState();
contactSharing.setOnCheckedChangeListener(mPairingController);
contactSharing.setChecked(mPairingController.getContactSharingState());
@@ -314,6 +315,7 @@ public class BluetoothPairingDialogFragment extends InstrumentedDialogFragment i
contactSharing.setVisibility(
mPairingController.isProfileReady() ? View.GONE : View.VISIBLE);
mPairingController.setContactSharingState();
contactSharing.setChecked(mPairingController.getContactSharingState());
contactSharing.setOnCheckedChangeListener(mPairingController);