Loading res/layout/bluetooth_pin_confirm.xml +3 −24 Original line number Original line Diff line number Diff line Loading @@ -29,31 +29,11 @@ android:layout_width="match_parent" android:layout_width="match_parent" android:orientation="vertical"> android:orientation="vertical"> <TextView android:id="@+id/message_caption" 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_marginTop="@dimen/bluetooth_dialog_padding" android:gravity="center_vertical" android:textAppearance="@android:style/TextAppearance.Material.Body1" android:textColor="@*android:color/secondary_text_material_light" /> <TextView android:id="@+id/message_subhead" 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:textAppearance="@android:style/TextAppearance.Material.Subhead" /> <TextView <TextView android:id="@+id/pairing_caption" android:id="@+id/pairing_caption" android:layout_width="wrap_content" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="@dimen/bluetooth_dialog_padding" android:layout_marginStart="@dimen/bluetooth_dialog_padding" android:layout_marginStart="@dimen/bluetooth_dialog_padding" android:layout_marginEnd="@dimen/bluetooth_dialog_padding" android:layout_marginEnd="@dimen/bluetooth_dialog_padding" android:gravity="center_vertical" android:gravity="center_vertical" Loading Loading @@ -92,9 +72,8 @@ android:layout_height="wrap_content" android:layout_height="wrap_content" android:layout_marginStart="@dimen/bluetooth_dialog_padding" android:layout_marginStart="@dimen/bluetooth_dialog_padding" android:layout_marginEnd="@dimen/bluetooth_dialog_padding" android:layout_marginEnd="@dimen/bluetooth_dialog_padding" android:gravity="center_vertical" android:textAppearance="@android:style/TextAppearance.Material.Body1" android:text="@string/bluetooth_pairing_shares_phonebook" android:textColor="@*android:color/secondary_text_material_light" /> android:textAppearance="?android:attr/textAppearanceSmall" /> </LinearLayout> </LinearLayout> Loading res/values/strings.xml +3 −5 Original line number Original line Diff line number Diff line Loading @@ -1154,12 +1154,10 @@ <!-- ======================================================================================= --> <!-- ======================================================================================= --> <!-- Title for the dialog to enter PIN. [CHAR LIMIT=40] --> <!-- Title for the dialog to enter PIN. [CHAR LIMIT=40] --> <string name="bluetooth_pairing_request">Bluetooth pairing request</string> <string name="bluetooth_pairing_request">Pair with <xliff:g id="device_name">%1$s</xliff:g>?</string> <!-- Message when bluetooth dialog for pin entry is showing. [CHAR LIMIT=NONE] --> <string name="bluetooth_enter_pin_msg">Device</string> <!-- Message when bluetooth is informing the user of the pairing key. [CHAR LIMIT=NONE] --> <!-- Message when bluetooth is informing the user of the pairing key. [CHAR LIMIT=NONE] --> <string name="bluetooth_pairing_key_msg">Pairing code</string> <string name="bluetooth_pairing_key_msg">Bluetooth pairing code</string> <!-- Message when bluetooth dialog for passkey entry is showing. [CHAR LIMIT=NONE] --> <!-- Message when bluetooth dialog for passkey entry is showing. [CHAR LIMIT=NONE] --> <string name="bluetooth_enter_passkey_msg">Type the pairing code then press Return or Enter</string> <string name="bluetooth_enter_passkey_msg">Type the pairing code then press Return or Enter</string> Loading Loading @@ -1188,7 +1186,7 @@ <string name="bluetooth_display_passkey_pin_msg">To pair with:<xliff:g id="bold1"><br><b></xliff:g><xliff:g id="device_name">%1$s</xliff:g><xliff:g id="end_bold1"></b><br><br></xliff:g>Type on it:<xliff:g id="bold2"><br><b></xliff:g><xliff:g id="passkey">%2$s</xliff:g><xliff:g id="end_bold2"></b></xliff:g>, then press Return or Enter.</string> <string name="bluetooth_display_passkey_pin_msg">To pair with:<xliff:g id="bold1"><br><b></xliff:g><xliff:g id="device_name">%1$s</xliff:g><xliff:g id="end_bold1"></b><br><br></xliff:g>Type on it:<xliff:g id="bold2"><br><b></xliff:g><xliff:g id="passkey">%2$s</xliff:g><xliff:g id="end_bold2"></b></xliff:g>, then press Return or Enter.</string> <!-- Checkbox message in pairing dialogs. [CHAR LIMIT=NONE] --> <!-- 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> <string name="bluetooth_pairing_shares_phonebook">Allow <xliff:g id="device_name">%1$s</xliff:g> to access your contacts and call history</string> <!-- Title for BT error dialogs. --> <!-- Title for BT error dialogs. --> <string name="bluetooth_error_title"></string> <string name="bluetooth_error_title"></string> Loading src/com/android/settings/bluetooth/BluetoothPairingDialog.java +34 −26 Original line number Original line Diff line number Diff line Loading @@ -168,7 +168,8 @@ public final class BluetoothPairingDialog extends AlertActivity implements private void createUserEntryDialog() { private void createUserEntryDialog() { final AlertController.AlertParams p = mAlertParams; final AlertController.AlertParams p = mAlertParams; p.mTitle = getString(R.string.bluetooth_pairing_request); p.mTitle = getString(R.string.bluetooth_pairing_request, mCachedDeviceManager.getName(mDevice)); p.mView = createPinEntryView(); p.mView = createPinEntryView(); p.mPositiveButtonText = getString(android.R.string.ok); p.mPositiveButtonText = getString(android.R.string.ok); p.mPositiveButtonListener = this; p.mPositiveButtonListener = this; Loading @@ -182,13 +183,22 @@ public final class BluetoothPairingDialog extends AlertActivity implements private View createPinEntryView() { private View createPinEntryView() { View view = getLayoutInflater().inflate(R.layout.bluetooth_pin_entry, null); View view = getLayoutInflater().inflate(R.layout.bluetooth_pin_entry, null); TextView messageViewCaption = (TextView) view.findViewById(R.id.message_caption); TextView messageViewCaptionHint = (TextView) view.findViewById(R.id.pin_values_hint); TextView messageViewCaptionHint = (TextView) view.findViewById(R.id.pin_values_hint); TextView messageViewContent = (TextView) view.findViewById(R.id.message_subhead); TextView messageView2 = (TextView) view.findViewById(R.id.message_below_pin); TextView messageView2 = (TextView) view.findViewById(R.id.message_below_pin); CheckBox alphanumericPin = (CheckBox) view.findViewById(R.id.alphanumeric_pin); CheckBox alphanumericPin = (CheckBox) view.findViewById(R.id.alphanumeric_pin); CheckBox contactSharing = (CheckBox) view.findViewById( CheckBox contactSharing = (CheckBox) view.findViewById( R.id.phonebook_sharing_message_entry_pin); R.id.phonebook_sharing_message_entry_pin); contactSharing.setText(getString(R.string.bluetooth_pairing_shares_phonebook, mCachedDeviceManager.getName(mDevice))); if (mDevice.getPhonebookAccessPermission() == BluetoothDevice.ACCESS_ALLOWED) { contactSharing.setChecked(true); } else if (mDevice.getPhonebookAccessPermission() == BluetoothDevice.ACCESS_REJECTED){ contactSharing.setChecked(false); } else { contactSharing.setChecked(true); mDevice.setPhonebookAccessPermission(BluetoothDevice.ACCESS_ALLOWED); } contactSharing.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { contactSharing.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override @Override public void onCheckedChanged(CompoundButton compoundButton, boolean isChecked) { public void onCheckedChanged(CompoundButton compoundButton, boolean isChecked) { Loading @@ -209,8 +219,7 @@ public final class BluetoothPairingDialog extends AlertActivity implements mPairingView.addTextChangedListener(this); mPairingView.addTextChangedListener(this); alphanumericPin.setOnCheckedChangeListener(this); alphanumericPin.setOnCheckedChangeListener(this); int messageId1; int messageId; int messageId2; int messageIdHint = R.string.bluetooth_pin_values_hint; int messageIdHint = R.string.bluetooth_pin_values_hint; int maxLength; int maxLength; switch (mType) { switch (mType) { Loading @@ -218,15 +227,13 @@ public final class BluetoothPairingDialog extends AlertActivity implements messageIdHint = R.string.bluetooth_pin_values_hint_16_digits; messageIdHint = R.string.bluetooth_pin_values_hint_16_digits; // FALLTHROUGH // FALLTHROUGH case BluetoothDevice.PAIRING_VARIANT_PIN: case BluetoothDevice.PAIRING_VARIANT_PIN: messageId1 = R.string.bluetooth_enter_pin_msg; messageId = R.string.bluetooth_enter_pin_other_device; messageId2 = R.string.bluetooth_enter_pin_other_device; // Maximum of 16 characters in a PIN // Maximum of 16 characters in a PIN maxLength = BLUETOOTH_PIN_MAX_LENGTH; maxLength = BLUETOOTH_PIN_MAX_LENGTH; break; break; case BluetoothDevice.PAIRING_VARIANT_PASSKEY: case BluetoothDevice.PAIRING_VARIANT_PASSKEY: messageId1 = R.string.bluetooth_enter_pin_msg; messageId = R.string.bluetooth_enter_passkey_other_device; messageId2 = R.string.bluetooth_enter_passkey_other_device; // Maximum of 6 digits for passkey // Maximum of 6 digits for passkey maxLength = BLUETOOTH_PASSKEY_MAX_LENGTH; maxLength = BLUETOOTH_PASSKEY_MAX_LENGTH; alphanumericPin.setVisibility(View.GONE); alphanumericPin.setVisibility(View.GONE); Loading @@ -237,10 +244,8 @@ public final class BluetoothPairingDialog extends AlertActivity implements return null; return null; } } messageViewCaption.setText(messageId1); messageViewCaptionHint.setText(messageIdHint); messageViewCaptionHint.setText(messageIdHint); messageViewContent.setText(mCachedDeviceManager.getName(mDevice)); messageView2.setText(messageId); messageView2.setText(messageId2); mPairingView.setInputType(InputType.TYPE_CLASS_NUMBER); mPairingView.setInputType(InputType.TYPE_CLASS_NUMBER); mPairingView.setFilters(new InputFilter[] { mPairingView.setFilters(new InputFilter[] { new LengthFilter(maxLength) }); new LengthFilter(maxLength) }); Loading @@ -250,15 +255,22 @@ public final class BluetoothPairingDialog extends AlertActivity implements private View createView() { private View createView() { View view = getLayoutInflater().inflate(R.layout.bluetooth_pin_confirm, null); View view = getLayoutInflater().inflate(R.layout.bluetooth_pin_confirm, null); // Escape device name to avoid HTML injection. String name = Html.escapeHtml(mCachedDeviceManager.getName(mDevice)); TextView messageViewCaption = (TextView) view.findViewById(R.id.message_caption); TextView messageViewContent = (TextView) view.findViewById(R.id.message_subhead); TextView pairingViewCaption = (TextView) view.findViewById(R.id.pairing_caption); TextView pairingViewCaption = (TextView) view.findViewById(R.id.pairing_caption); TextView pairingViewContent = (TextView) view.findViewById(R.id.pairing_subhead); TextView pairingViewContent = (TextView) view.findViewById(R.id.pairing_subhead); TextView messagePairing = (TextView) view.findViewById(R.id.pairing_code_message); TextView messagePairing = (TextView) view.findViewById(R.id.pairing_code_message); CheckBox contactSharing = (CheckBox) view.findViewById( CheckBox contactSharing = (CheckBox) view.findViewById( R.id.phonebook_sharing_message_confirm_pin); R.id.phonebook_sharing_message_confirm_pin); contactSharing.setText(getString(R.string.bluetooth_pairing_shares_phonebook, mCachedDeviceManager.getName(mDevice))); if (mDevice.getPhonebookAccessPermission() == BluetoothDevice.ACCESS_ALLOWED) { contactSharing.setChecked(true); } else if (mDevice.getPhonebookAccessPermission() == BluetoothDevice.ACCESS_REJECTED){ contactSharing.setChecked(false); } else { contactSharing.setChecked(true); mDevice.setPhonebookAccessPermission(BluetoothDevice.ACCESS_ALLOWED); } contactSharing.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { contactSharing.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override @Override public void onCheckedChanged(CompoundButton compoundButton, boolean isChecked) { public void onCheckedChanged(CompoundButton compoundButton, boolean isChecked) { Loading @@ -283,14 +295,12 @@ public final class BluetoothPairingDialog extends AlertActivity implements case BluetoothDevice.PAIRING_VARIANT_DISPLAY_PIN: case BluetoothDevice.PAIRING_VARIANT_DISPLAY_PIN: messagePairing.setVisibility(View.VISIBLE); messagePairing.setVisibility(View.VISIBLE); case BluetoothDevice.PAIRING_VARIANT_PASSKEY_CONFIRMATION: case BluetoothDevice.PAIRING_VARIANT_PASSKEY_CONFIRMATION: messageCaption = getString(R.string.bluetooth_enter_pin_msg); pairingContent = mPairingKey; pairingContent = mPairingKey; break; break; case BluetoothDevice.PAIRING_VARIANT_CONSENT: case BluetoothDevice.PAIRING_VARIANT_CONSENT: case BluetoothDevice.PAIRING_VARIANT_OOB_CONSENT: case BluetoothDevice.PAIRING_VARIANT_OOB_CONSENT: messagePairing.setVisibility(View.VISIBLE); messagePairing.setVisibility(View.VISIBLE); messageCaption = getString(R.string.bluetooth_enter_pin_msg); break; break; default: default: Loading @@ -298,11 +308,6 @@ public final class BluetoothPairingDialog extends AlertActivity implements return null; return null; } } if (messageViewCaption != null) { messageViewCaption.setText(messageCaption); messageViewContent.setText(name); } if (pairingContent != null) { if (pairingContent != null) { pairingViewCaption.setVisibility(View.VISIBLE); pairingViewCaption.setVisibility(View.VISIBLE); pairingViewContent.setVisibility(View.VISIBLE); pairingViewContent.setVisibility(View.VISIBLE); Loading @@ -314,7 +319,8 @@ public final class BluetoothPairingDialog extends AlertActivity implements private void createConfirmationDialog() { private void createConfirmationDialog() { final AlertController.AlertParams p = mAlertParams; final AlertController.AlertParams p = mAlertParams; p.mTitle = getString(R.string.bluetooth_pairing_request); p.mTitle = getString(R.string.bluetooth_pairing_request, mCachedDeviceManager.getName(mDevice)); p.mView = createView(); p.mView = createView(); p.mPositiveButtonText = getString(R.string.bluetooth_pairing_accept); p.mPositiveButtonText = getString(R.string.bluetooth_pairing_accept); p.mPositiveButtonListener = this; p.mPositiveButtonListener = this; Loading @@ -325,7 +331,8 @@ public final class BluetoothPairingDialog extends AlertActivity implements private void createConsentDialog() { private void createConsentDialog() { final AlertController.AlertParams p = mAlertParams; final AlertController.AlertParams p = mAlertParams; p.mTitle = getString(R.string.bluetooth_pairing_request); p.mTitle = getString(R.string.bluetooth_pairing_request, mCachedDeviceManager.getName(mDevice)); p.mView = createView(); p.mView = createView(); p.mPositiveButtonText = getString(R.string.bluetooth_pairing_accept); p.mPositiveButtonText = getString(R.string.bluetooth_pairing_accept); p.mPositiveButtonListener = this; p.mPositiveButtonListener = this; Loading @@ -336,7 +343,8 @@ public final class BluetoothPairingDialog extends AlertActivity implements private void createDisplayPasskeyOrPinDialog() { private void createDisplayPasskeyOrPinDialog() { final AlertController.AlertParams p = mAlertParams; final AlertController.AlertParams p = mAlertParams; p.mTitle = getString(R.string.bluetooth_pairing_request); p.mTitle = getString(R.string.bluetooth_pairing_request, mCachedDeviceManager.getName(mDevice)); p.mView = createView(); p.mView = createView(); p.mNegativeButtonText = getString(android.R.string.cancel); p.mNegativeButtonText = getString(android.R.string.cancel); p.mNegativeButtonListener = this; p.mNegativeButtonListener = this; Loading Loading
res/layout/bluetooth_pin_confirm.xml +3 −24 Original line number Original line Diff line number Diff line Loading @@ -29,31 +29,11 @@ android:layout_width="match_parent" android:layout_width="match_parent" android:orientation="vertical"> android:orientation="vertical"> <TextView android:id="@+id/message_caption" 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_marginTop="@dimen/bluetooth_dialog_padding" android:gravity="center_vertical" android:textAppearance="@android:style/TextAppearance.Material.Body1" android:textColor="@*android:color/secondary_text_material_light" /> <TextView android:id="@+id/message_subhead" 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:textAppearance="@android:style/TextAppearance.Material.Subhead" /> <TextView <TextView android:id="@+id/pairing_caption" android:id="@+id/pairing_caption" android:layout_width="wrap_content" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="@dimen/bluetooth_dialog_padding" android:layout_marginStart="@dimen/bluetooth_dialog_padding" android:layout_marginStart="@dimen/bluetooth_dialog_padding" android:layout_marginEnd="@dimen/bluetooth_dialog_padding" android:layout_marginEnd="@dimen/bluetooth_dialog_padding" android:gravity="center_vertical" android:gravity="center_vertical" Loading Loading @@ -92,9 +72,8 @@ android:layout_height="wrap_content" android:layout_height="wrap_content" android:layout_marginStart="@dimen/bluetooth_dialog_padding" android:layout_marginStart="@dimen/bluetooth_dialog_padding" android:layout_marginEnd="@dimen/bluetooth_dialog_padding" android:layout_marginEnd="@dimen/bluetooth_dialog_padding" android:gravity="center_vertical" android:textAppearance="@android:style/TextAppearance.Material.Body1" android:text="@string/bluetooth_pairing_shares_phonebook" android:textColor="@*android:color/secondary_text_material_light" /> android:textAppearance="?android:attr/textAppearanceSmall" /> </LinearLayout> </LinearLayout> Loading
res/values/strings.xml +3 −5 Original line number Original line Diff line number Diff line Loading @@ -1154,12 +1154,10 @@ <!-- ======================================================================================= --> <!-- ======================================================================================= --> <!-- Title for the dialog to enter PIN. [CHAR LIMIT=40] --> <!-- Title for the dialog to enter PIN. [CHAR LIMIT=40] --> <string name="bluetooth_pairing_request">Bluetooth pairing request</string> <string name="bluetooth_pairing_request">Pair with <xliff:g id="device_name">%1$s</xliff:g>?</string> <!-- Message when bluetooth dialog for pin entry is showing. [CHAR LIMIT=NONE] --> <string name="bluetooth_enter_pin_msg">Device</string> <!-- Message when bluetooth is informing the user of the pairing key. [CHAR LIMIT=NONE] --> <!-- Message when bluetooth is informing the user of the pairing key. [CHAR LIMIT=NONE] --> <string name="bluetooth_pairing_key_msg">Pairing code</string> <string name="bluetooth_pairing_key_msg">Bluetooth pairing code</string> <!-- Message when bluetooth dialog for passkey entry is showing. [CHAR LIMIT=NONE] --> <!-- Message when bluetooth dialog for passkey entry is showing. [CHAR LIMIT=NONE] --> <string name="bluetooth_enter_passkey_msg">Type the pairing code then press Return or Enter</string> <string name="bluetooth_enter_passkey_msg">Type the pairing code then press Return or Enter</string> Loading Loading @@ -1188,7 +1186,7 @@ <string name="bluetooth_display_passkey_pin_msg">To pair with:<xliff:g id="bold1"><br><b></xliff:g><xliff:g id="device_name">%1$s</xliff:g><xliff:g id="end_bold1"></b><br><br></xliff:g>Type on it:<xliff:g id="bold2"><br><b></xliff:g><xliff:g id="passkey">%2$s</xliff:g><xliff:g id="end_bold2"></b></xliff:g>, then press Return or Enter.</string> <string name="bluetooth_display_passkey_pin_msg">To pair with:<xliff:g id="bold1"><br><b></xliff:g><xliff:g id="device_name">%1$s</xliff:g><xliff:g id="end_bold1"></b><br><br></xliff:g>Type on it:<xliff:g id="bold2"><br><b></xliff:g><xliff:g id="passkey">%2$s</xliff:g><xliff:g id="end_bold2"></b></xliff:g>, then press Return or Enter.</string> <!-- Checkbox message in pairing dialogs. [CHAR LIMIT=NONE] --> <!-- 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> <string name="bluetooth_pairing_shares_phonebook">Allow <xliff:g id="device_name">%1$s</xliff:g> to access your contacts and call history</string> <!-- Title for BT error dialogs. --> <!-- Title for BT error dialogs. --> <string name="bluetooth_error_title"></string> <string name="bluetooth_error_title"></string> Loading
src/com/android/settings/bluetooth/BluetoothPairingDialog.java +34 −26 Original line number Original line Diff line number Diff line Loading @@ -168,7 +168,8 @@ public final class BluetoothPairingDialog extends AlertActivity implements private void createUserEntryDialog() { private void createUserEntryDialog() { final AlertController.AlertParams p = mAlertParams; final AlertController.AlertParams p = mAlertParams; p.mTitle = getString(R.string.bluetooth_pairing_request); p.mTitle = getString(R.string.bluetooth_pairing_request, mCachedDeviceManager.getName(mDevice)); p.mView = createPinEntryView(); p.mView = createPinEntryView(); p.mPositiveButtonText = getString(android.R.string.ok); p.mPositiveButtonText = getString(android.R.string.ok); p.mPositiveButtonListener = this; p.mPositiveButtonListener = this; Loading @@ -182,13 +183,22 @@ public final class BluetoothPairingDialog extends AlertActivity implements private View createPinEntryView() { private View createPinEntryView() { View view = getLayoutInflater().inflate(R.layout.bluetooth_pin_entry, null); View view = getLayoutInflater().inflate(R.layout.bluetooth_pin_entry, null); TextView messageViewCaption = (TextView) view.findViewById(R.id.message_caption); TextView messageViewCaptionHint = (TextView) view.findViewById(R.id.pin_values_hint); TextView messageViewCaptionHint = (TextView) view.findViewById(R.id.pin_values_hint); TextView messageViewContent = (TextView) view.findViewById(R.id.message_subhead); TextView messageView2 = (TextView) view.findViewById(R.id.message_below_pin); TextView messageView2 = (TextView) view.findViewById(R.id.message_below_pin); CheckBox alphanumericPin = (CheckBox) view.findViewById(R.id.alphanumeric_pin); CheckBox alphanumericPin = (CheckBox) view.findViewById(R.id.alphanumeric_pin); CheckBox contactSharing = (CheckBox) view.findViewById( CheckBox contactSharing = (CheckBox) view.findViewById( R.id.phonebook_sharing_message_entry_pin); R.id.phonebook_sharing_message_entry_pin); contactSharing.setText(getString(R.string.bluetooth_pairing_shares_phonebook, mCachedDeviceManager.getName(mDevice))); if (mDevice.getPhonebookAccessPermission() == BluetoothDevice.ACCESS_ALLOWED) { contactSharing.setChecked(true); } else if (mDevice.getPhonebookAccessPermission() == BluetoothDevice.ACCESS_REJECTED){ contactSharing.setChecked(false); } else { contactSharing.setChecked(true); mDevice.setPhonebookAccessPermission(BluetoothDevice.ACCESS_ALLOWED); } contactSharing.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { contactSharing.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override @Override public void onCheckedChanged(CompoundButton compoundButton, boolean isChecked) { public void onCheckedChanged(CompoundButton compoundButton, boolean isChecked) { Loading @@ -209,8 +219,7 @@ public final class BluetoothPairingDialog extends AlertActivity implements mPairingView.addTextChangedListener(this); mPairingView.addTextChangedListener(this); alphanumericPin.setOnCheckedChangeListener(this); alphanumericPin.setOnCheckedChangeListener(this); int messageId1; int messageId; int messageId2; int messageIdHint = R.string.bluetooth_pin_values_hint; int messageIdHint = R.string.bluetooth_pin_values_hint; int maxLength; int maxLength; switch (mType) { switch (mType) { Loading @@ -218,15 +227,13 @@ public final class BluetoothPairingDialog extends AlertActivity implements messageIdHint = R.string.bluetooth_pin_values_hint_16_digits; messageIdHint = R.string.bluetooth_pin_values_hint_16_digits; // FALLTHROUGH // FALLTHROUGH case BluetoothDevice.PAIRING_VARIANT_PIN: case BluetoothDevice.PAIRING_VARIANT_PIN: messageId1 = R.string.bluetooth_enter_pin_msg; messageId = R.string.bluetooth_enter_pin_other_device; messageId2 = R.string.bluetooth_enter_pin_other_device; // Maximum of 16 characters in a PIN // Maximum of 16 characters in a PIN maxLength = BLUETOOTH_PIN_MAX_LENGTH; maxLength = BLUETOOTH_PIN_MAX_LENGTH; break; break; case BluetoothDevice.PAIRING_VARIANT_PASSKEY: case BluetoothDevice.PAIRING_VARIANT_PASSKEY: messageId1 = R.string.bluetooth_enter_pin_msg; messageId = R.string.bluetooth_enter_passkey_other_device; messageId2 = R.string.bluetooth_enter_passkey_other_device; // Maximum of 6 digits for passkey // Maximum of 6 digits for passkey maxLength = BLUETOOTH_PASSKEY_MAX_LENGTH; maxLength = BLUETOOTH_PASSKEY_MAX_LENGTH; alphanumericPin.setVisibility(View.GONE); alphanumericPin.setVisibility(View.GONE); Loading @@ -237,10 +244,8 @@ public final class BluetoothPairingDialog extends AlertActivity implements return null; return null; } } messageViewCaption.setText(messageId1); messageViewCaptionHint.setText(messageIdHint); messageViewCaptionHint.setText(messageIdHint); messageViewContent.setText(mCachedDeviceManager.getName(mDevice)); messageView2.setText(messageId); messageView2.setText(messageId2); mPairingView.setInputType(InputType.TYPE_CLASS_NUMBER); mPairingView.setInputType(InputType.TYPE_CLASS_NUMBER); mPairingView.setFilters(new InputFilter[] { mPairingView.setFilters(new InputFilter[] { new LengthFilter(maxLength) }); new LengthFilter(maxLength) }); Loading @@ -250,15 +255,22 @@ public final class BluetoothPairingDialog extends AlertActivity implements private View createView() { private View createView() { View view = getLayoutInflater().inflate(R.layout.bluetooth_pin_confirm, null); View view = getLayoutInflater().inflate(R.layout.bluetooth_pin_confirm, null); // Escape device name to avoid HTML injection. String name = Html.escapeHtml(mCachedDeviceManager.getName(mDevice)); TextView messageViewCaption = (TextView) view.findViewById(R.id.message_caption); TextView messageViewContent = (TextView) view.findViewById(R.id.message_subhead); TextView pairingViewCaption = (TextView) view.findViewById(R.id.pairing_caption); TextView pairingViewCaption = (TextView) view.findViewById(R.id.pairing_caption); TextView pairingViewContent = (TextView) view.findViewById(R.id.pairing_subhead); TextView pairingViewContent = (TextView) view.findViewById(R.id.pairing_subhead); TextView messagePairing = (TextView) view.findViewById(R.id.pairing_code_message); TextView messagePairing = (TextView) view.findViewById(R.id.pairing_code_message); CheckBox contactSharing = (CheckBox) view.findViewById( CheckBox contactSharing = (CheckBox) view.findViewById( R.id.phonebook_sharing_message_confirm_pin); R.id.phonebook_sharing_message_confirm_pin); contactSharing.setText(getString(R.string.bluetooth_pairing_shares_phonebook, mCachedDeviceManager.getName(mDevice))); if (mDevice.getPhonebookAccessPermission() == BluetoothDevice.ACCESS_ALLOWED) { contactSharing.setChecked(true); } else if (mDevice.getPhonebookAccessPermission() == BluetoothDevice.ACCESS_REJECTED){ contactSharing.setChecked(false); } else { contactSharing.setChecked(true); mDevice.setPhonebookAccessPermission(BluetoothDevice.ACCESS_ALLOWED); } contactSharing.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { contactSharing.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override @Override public void onCheckedChanged(CompoundButton compoundButton, boolean isChecked) { public void onCheckedChanged(CompoundButton compoundButton, boolean isChecked) { Loading @@ -283,14 +295,12 @@ public final class BluetoothPairingDialog extends AlertActivity implements case BluetoothDevice.PAIRING_VARIANT_DISPLAY_PIN: case BluetoothDevice.PAIRING_VARIANT_DISPLAY_PIN: messagePairing.setVisibility(View.VISIBLE); messagePairing.setVisibility(View.VISIBLE); case BluetoothDevice.PAIRING_VARIANT_PASSKEY_CONFIRMATION: case BluetoothDevice.PAIRING_VARIANT_PASSKEY_CONFIRMATION: messageCaption = getString(R.string.bluetooth_enter_pin_msg); pairingContent = mPairingKey; pairingContent = mPairingKey; break; break; case BluetoothDevice.PAIRING_VARIANT_CONSENT: case BluetoothDevice.PAIRING_VARIANT_CONSENT: case BluetoothDevice.PAIRING_VARIANT_OOB_CONSENT: case BluetoothDevice.PAIRING_VARIANT_OOB_CONSENT: messagePairing.setVisibility(View.VISIBLE); messagePairing.setVisibility(View.VISIBLE); messageCaption = getString(R.string.bluetooth_enter_pin_msg); break; break; default: default: Loading @@ -298,11 +308,6 @@ public final class BluetoothPairingDialog extends AlertActivity implements return null; return null; } } if (messageViewCaption != null) { messageViewCaption.setText(messageCaption); messageViewContent.setText(name); } if (pairingContent != null) { if (pairingContent != null) { pairingViewCaption.setVisibility(View.VISIBLE); pairingViewCaption.setVisibility(View.VISIBLE); pairingViewContent.setVisibility(View.VISIBLE); pairingViewContent.setVisibility(View.VISIBLE); Loading @@ -314,7 +319,8 @@ public final class BluetoothPairingDialog extends AlertActivity implements private void createConfirmationDialog() { private void createConfirmationDialog() { final AlertController.AlertParams p = mAlertParams; final AlertController.AlertParams p = mAlertParams; p.mTitle = getString(R.string.bluetooth_pairing_request); p.mTitle = getString(R.string.bluetooth_pairing_request, mCachedDeviceManager.getName(mDevice)); p.mView = createView(); p.mView = createView(); p.mPositiveButtonText = getString(R.string.bluetooth_pairing_accept); p.mPositiveButtonText = getString(R.string.bluetooth_pairing_accept); p.mPositiveButtonListener = this; p.mPositiveButtonListener = this; Loading @@ -325,7 +331,8 @@ public final class BluetoothPairingDialog extends AlertActivity implements private void createConsentDialog() { private void createConsentDialog() { final AlertController.AlertParams p = mAlertParams; final AlertController.AlertParams p = mAlertParams; p.mTitle = getString(R.string.bluetooth_pairing_request); p.mTitle = getString(R.string.bluetooth_pairing_request, mCachedDeviceManager.getName(mDevice)); p.mView = createView(); p.mView = createView(); p.mPositiveButtonText = getString(R.string.bluetooth_pairing_accept); p.mPositiveButtonText = getString(R.string.bluetooth_pairing_accept); p.mPositiveButtonListener = this; p.mPositiveButtonListener = this; Loading @@ -336,7 +343,8 @@ public final class BluetoothPairingDialog extends AlertActivity implements private void createDisplayPasskeyOrPinDialog() { private void createDisplayPasskeyOrPinDialog() { final AlertController.AlertParams p = mAlertParams; final AlertController.AlertParams p = mAlertParams; p.mTitle = getString(R.string.bluetooth_pairing_request); p.mTitle = getString(R.string.bluetooth_pairing_request, mCachedDeviceManager.getName(mDevice)); p.mView = createView(); p.mView = createView(); p.mNegativeButtonText = getString(android.R.string.cancel); p.mNegativeButtonText = getString(android.R.string.cancel); p.mNegativeButtonListener = this; p.mNegativeButtonListener = this; Loading