Merge "Import translations. DO NOT MERGE" into stage-aosp-master
diff --git a/src/com/android/settings/bluetooth/BluetoothPairingController.java b/src/com/android/settings/bluetooth/BluetoothPairingController.java
index ce82612..7d2d7b4 100644
--- a/src/com/android/settings/bluetooth/BluetoothPairingController.java
+++ b/src/com/android/settings/bluetooth/BluetoothPairingController.java
@@ -172,6 +172,22 @@
     }
 
     /**
+     * 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.
      *
      * @param s - The passkey/pin
diff --git a/src/com/android/settings/bluetooth/BluetoothPairingDialogFragment.java b/src/com/android/settings/bluetooth/BluetoothPairingDialogFragment.java
index 1aac0ff..18839dc 100644
--- a/src/com/android/settings/bluetooth/BluetoothPairingDialogFragment.java
+++ b/src/com/android/settings/bluetooth/BluetoothPairingDialogFragment.java
@@ -241,6 +241,7 @@
 
         contactSharing.setVisibility(mPairingController.isProfileReady()
                 ? View.GONE : View.VISIBLE);
+        mPairingController.setContactSharingState();
         contactSharing.setOnCheckedChangeListener(mPairingController);
         contactSharing.setChecked(mPairingController.getContactSharingState());
 
@@ -331,6 +332,7 @@
 
         contactSharing.setVisibility(
                 mPairingController.isProfileReady() ? View.GONE : View.VISIBLE);
+        mPairingController.setContactSharingState();
         contactSharing.setChecked(mPairingController.getContactSharingState());
         contactSharing.setOnCheckedChangeListener(mPairingController);