diff --git a/src/com/android/settings/bluetooth/BluetoothPairingController.java b/src/com/android/settings/bluetooth/BluetoothPairingController.java index ce82612685b..7d2d7b48c30 100644 --- a/src/com/android/settings/bluetooth/BluetoothPairingController.java +++ b/src/com/android/settings/bluetooth/BluetoothPairingController.java @@ -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. * diff --git a/src/com/android/settings/bluetooth/BluetoothPairingDialogFragment.java b/src/com/android/settings/bluetooth/BluetoothPairingDialogFragment.java index 1aac0ff1c18..18839dc965d 100644 --- a/src/com/android/settings/bluetooth/BluetoothPairingDialogFragment.java +++ b/src/com/android/settings/bluetooth/BluetoothPairingDialogFragment.java @@ -241,6 +241,7 @@ public class BluetoothPairingDialogFragment extends InstrumentedDialogFragment i contactSharing.setVisibility(mPairingController.isProfileReady() ? View.GONE : View.VISIBLE); + mPairingController.setContactSharingState(); contactSharing.setOnCheckedChangeListener(mPairingController); contactSharing.setChecked(mPairingController.getContactSharingState()); @@ -331,6 +332,7 @@ public class BluetoothPairingDialogFragment extends InstrumentedDialogFragment i contactSharing.setVisibility( mPairingController.isProfileReady() ? View.GONE : View.VISIBLE); + mPairingController.setContactSharingState(); contactSharing.setChecked(mPairingController.getContactSharingState()); contactSharing.setOnCheckedChangeListener(mPairingController);