Merge changes from topic "am-882196d9-9fac-4e85-b0bf-2018fa4b68ae" into oc-dev

* changes:
  [automerger skipped] Merge translations of Bluetooth confirmation text skipped: 3f8d33ff71 skipped: 4a82795313 skipped: ba2ea1e53e skipped: 2d1bae1bd8 skipped: 8bc91c3b8b skipped: 3e48235bf6
  [automerger skipped] Merge translations of Bluetooth confirmation text skipped: 3f8d33ff71 skipped: 4a82795313 skipped: ba2ea1e53e skipped: 2d1bae1bd8 skipped: 8bc91c3b8b
  [automerger skipped] Merge translations of Bluetooth confirmation text skipped: 3f8d33ff71 skipped: 4a82795313 skipped: ba2ea1e53e skipped: 2d1bae1bd8
  [automerger skipped] Merge translations of Bluetooth confirmation text skipped: 3f8d33ff71 skipped: 4a82795313 skipped: ba2ea1e53e
  [automerger skipped] Merge translations of Bluetooth confirmation text skipped: 3f8d33ff71 skipped: 4a82795313
  [automerger skipped] Merge translations of Bluetooth confirmation text skipped: 3f8d33ff71
  Merge translations of Bluetooth confirmation text
diff --git a/src/com/android/settings/bluetooth/BluetoothPairingController.java b/src/com/android/settings/bluetooth/BluetoothPairingController.java
index ce82612..d06cb7e 100644
--- a/src/com/android/settings/bluetooth/BluetoothPairingController.java
+++ b/src/com/android/settings/bluetooth/BluetoothPairingController.java
@@ -57,6 +57,7 @@
     private int mPasskey;
     private String mDeviceName;
     private LocalBluetoothProfile mPbapClientProfile;
+    private boolean mPbapAllowed;
 
     /**
      * Creates an instance of a BluetoothPairingController.
@@ -87,15 +88,20 @@
     @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 @@
 
     @Override
     public void onDialogNegativeClick(BluetoothPairingDialogFragment dialog) {
+        mDevice.setPhonebookAccessPermission(BluetoothDevice.ACCESS_REJECTED);
         onCancel();
     }