diff --git a/res/layout/bluetooth_pin_confirm.xml b/res/layout/bluetooth_pin_confirm.xml index 08f5d9fc56e..2968b38828a 100644 --- a/res/layout/bluetooth_pin_confirm.xml +++ b/res/layout/bluetooth_pin_confirm.xml @@ -86,16 +86,15 @@ android:textColor="@*android:color/secondary_text_material_light" android:visibility="gone" /> - + android:text="@string/bluetooth_pairing_shares_phonebook" + android:textAppearance="?android:attr/textAppearanceSmall" /> diff --git a/res/layout/bluetooth_pin_entry.xml b/res/layout/bluetooth_pin_entry.xml index 6f50cd42241..aa9f1877437 100644 --- a/res/layout/bluetooth_pin_entry.xml +++ b/res/layout/bluetooth_pin_entry.xml @@ -87,16 +87,15 @@ android:textAppearance="@android:style/TextAppearance.Material.Subhead" android:textColor="@*android:color/secondary_text_material_light"/> - + android:text="@string/bluetooth_pairing_shares_phonebook" + android:textAppearance="?android:attr/textAppearanceSmall" /> diff --git a/res/values/strings.xml b/res/values/strings.xml index 789224c027b..3d74e5d51f3 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -1155,8 +1155,6 @@ To pair with:<br><b>%1$s</b><br><br>Type on it:<br><b>%2$s</b>, then press Return or Enter. - - Pairing grants access to your contacts and call history when connected. Grant access to your contacts and call history when connected. diff --git a/src/com/android/settings/bluetooth/BluetoothPairingDialog.java b/src/com/android/settings/bluetooth/BluetoothPairingDialog.java index ffe49450f52..29cac62eadd 100755 --- a/src/com/android/settings/bluetooth/BluetoothPairingDialog.java +++ b/src/com/android/settings/bluetooth/BluetoothPairingDialog.java @@ -16,6 +16,7 @@ package com.android.settings.bluetooth; +import android.bluetooth.BluetoothClass; import android.bluetooth.BluetoothDevice; import android.content.BroadcastReceiver; import android.content.Context; @@ -186,6 +187,24 @@ public final class BluetoothPairingDialog extends AlertActivity implements TextView messageViewContent = (TextView) view.findViewById(R.id.message_subhead); TextView messageView2 = (TextView) view.findViewById(R.id.message_below_pin); CheckBox alphanumericPin = (CheckBox) view.findViewById(R.id.alphanumeric_pin); + CheckBox contactSharing = (CheckBox) view.findViewById( + R.id.phonebook_sharing_message_entry_pin); + contactSharing.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { + @Override + public void onCheckedChanged(CompoundButton compoundButton, boolean isChecked) { + if (isChecked) { + mDevice.setPhonebookAccessPermission(BluetoothDevice.ACCESS_ALLOWED); + } else { + mDevice.setPhonebookAccessPermission(BluetoothDevice.ACCESS_REJECTED); + } + } + }); + if (mDevice.getBluetoothClass().getDeviceClass() + == BluetoothClass.Device.AUDIO_VIDEO_HANDSFREE) { + contactSharing.setVisibility(View.VISIBLE); + } else { + contactSharing.setVisibility(View.GONE); + } mPairingView = (EditText) view.findViewById(R.id.text); mPairingView.addTextChangedListener(this); alphanumericPin.setOnCheckedChangeListener(this); @@ -238,6 +257,24 @@ public final class BluetoothPairingDialog extends AlertActivity implements TextView pairingViewCaption = (TextView) view.findViewById(R.id.pairing_caption); TextView pairingViewContent = (TextView) view.findViewById(R.id.pairing_subhead); TextView messagePairing = (TextView) view.findViewById(R.id.pairing_code_message); + CheckBox contactSharing = (CheckBox) view.findViewById( + R.id.phonebook_sharing_message_confirm_pin); + contactSharing.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { + @Override + public void onCheckedChanged(CompoundButton compoundButton, boolean isChecked) { + if (isChecked) { + mDevice.setPhonebookAccessPermission(BluetoothDevice.ACCESS_ALLOWED); + } else { + mDevice.setPhonebookAccessPermission(BluetoothDevice.ACCESS_REJECTED); + } + } + }); + if (mDevice.getBluetoothClass().getDeviceClass() + == BluetoothClass.Device.AUDIO_VIDEO_HANDSFREE) { + contactSharing.setVisibility(View.VISIBLE); + } else { + contactSharing.setVisibility(View.GONE); + } String messageCaption = null; String pairingContent = null;