Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7171d686 authored by Sanket Padawe's avatar Sanket Padawe Committed by Android (Google) Code Review
Browse files

Merge "Add PBAP checkbox for BT pairing consent dialog." into mnc-dev

parents 6e613472 2ef44c5e
Loading
Loading
Loading
Loading
+4 −5
Original line number Diff line number Diff line
@@ -86,16 +86,15 @@
            android:textColor="@*android:color/secondary_text_material_light"
            android:visibility="gone" />

        <TextView
            android:id="@+id/phonebook_sharing_message"
        <CheckBox
            android:id="@+id/phonebook_sharing_message_confirm_pin"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginStart="@dimen/bluetooth_dialog_padding"
            android:layout_marginEnd="@dimen/bluetooth_dialog_padding"
            android:layout_marginBottom="@dimen/bluetooth_dialog_padding"
            android:gravity="center_vertical"
            android:text="@string/bluetooth_pairing_will_share_phonebook"
            android:textSize="12sp" />
            android:text="@string/bluetooth_pairing_shares_phonebook"
            android:textAppearance="?android:attr/textAppearanceSmall" />

    </LinearLayout>

+4 −5
Original line number Diff line number Diff line
@@ -87,16 +87,15 @@
            android:textAppearance="@android:style/TextAppearance.Material.Subhead"
            android:textColor="@*android:color/secondary_text_material_light"/>

        <TextView
            android:id="@+id/phonebook_sharing_message"
        <CheckBox
            android:id="@+id/phonebook_sharing_message_entry_pin"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginStart="@dimen/bluetooth_dialog_padding"
            android:layout_marginEnd="@dimen/bluetooth_dialog_padding"
            android:layout_marginBottom="@dimen/bluetooth_dialog_padding"
            android:gravity="center_vertical"
            android:text="@string/bluetooth_pairing_will_share_phonebook"
            android:textSize="12sp" />
            android:text="@string/bluetooth_pairing_shares_phonebook"
            android:textAppearance="?android:attr/textAppearanceSmall" />

    </LinearLayout>

+0 −2
Original line number Diff line number Diff line
@@ -1155,8 +1155,6 @@
    <!-- Message when bluetooth dialog when passkey or pin needs to be displayed. -->
    <string name="bluetooth_display_passkey_pin_msg">To pair with:<xliff:g id="bold1">&lt;br>&lt;b></xliff:g><xliff:g id="device_name">%1$s</xliff:g><xliff:g id="end_bold1">&lt;/b>&lt;br>&lt;br></xliff:g>Type on it:<xliff:g id="bold2">&lt;br>&lt;b></xliff:g><xliff:g id="passkey">%2$s</xliff:g><xliff:g id="end_bold2">&lt;/b></xliff:g>, then press Return or Enter.</string>
    <!-- Message in pairing dialogs.  [CHAR LIMIT=NONE] -->
    <string name="bluetooth_pairing_will_share_phonebook">Pairing grants access to your contacts and call history when connected.</string>
    <!-- Checkbox message in pairing dialogs.  [CHAR LIMIT=NONE] -->
    <string name="bluetooth_pairing_shares_phonebook">Grant access to your contacts and call history when connected.</string>
+37 −0
Original line number Diff line number Diff line
@@ -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;