AI 143116: Added separate error messages for Bluetooth bonding rejections

and bonding failures due to down devices
  BUG=1308546

Automated import of CL 143116
This commit is contained in:
Michael Chan
2009-03-27 11:53:26 -07:00
committed by The Android Open Source Project
parent 60af953bda
commit a322045d92
2 changed files with 20 additions and 4 deletions

View File

@@ -491,6 +491,10 @@
<string name="bluetooth_pairing_error_message">There was a problem pairing with <xliff:g id="device_name">%1$s</xliff:g>.</string> <string name="bluetooth_pairing_error_message">There was a problem pairing with <xliff:g id="device_name">%1$s</xliff:g>.</string>
<!-- Message for the error dialog when BT pairing fails because the PIN entered is incorrect. --> <!-- Message for the error dialog when BT pairing fails because the PIN entered is incorrect. -->
<string name="bluetooth_pairing_pin_error_message">There was a problem pairing with <xliff:g id="device_name">%1$s</xliff:g> because the typed PIN is incorrect.</string> <string name="bluetooth_pairing_pin_error_message">There was a problem pairing with <xliff:g id="device_name">%1$s</xliff:g> because the typed PIN is incorrect.</string>
<!-- Message for the error dialog when BT pairing fails because the other device is down. -->
<string name="bluetooth_pairing_device_down_error_message">Cannot establish communication with <xliff:g id="device_name">%1$s</xliff:g>.</string>
<!-- Message for the error dialog when BT pairing fails because the other device rejected the pairing. -->
<string name="bluetooth_pairing_rejected_error_message">Pairing rejected by <xliff:g id="device_name">%1$s</xliff:g>.</string>
<!-- Message for the error dialog when BT connecting operation fails generically. --> <!-- Message for the error dialog when BT connecting operation fails generically. -->
<string name="bluetooth_connecting_error_message">There was a problem connecting to <xliff:g id="device_name">%1$s</xliff:g>.</string> <string name="bluetooth_connecting_error_message">There was a problem connecting to <xliff:g id="device_name">%1$s</xliff:g>.</string>

View File

@@ -181,10 +181,22 @@ public class LocalBluetoothDeviceManager {
* BluetoothDevice.UNBOND_REASON_* * BluetoothDevice.UNBOND_REASON_*
*/ */
public synchronized void onBondingError(String address, int reason) { public synchronized void onBondingError(String address, int reason) {
mLocalManager.showError(address, R.string.bluetooth_error_title, int errorMsg;
(reason == BluetoothDevice.UNBOND_REASON_AUTH_FAILED) ?
R.string.bluetooth_pairing_pin_error_message : switch(reason) {
R.string.bluetooth_pairing_error_message); case BluetoothDevice.UNBOND_REASON_AUTH_FAILED:
errorMsg = R.string.bluetooth_pairing_pin_error_message;
break;
case BluetoothDevice.UNBOND_REASON_AUTH_REJECTED:
errorMsg = R.string.bluetooth_pairing_rejected_error_message;
break;
case BluetoothDevice.UNBOND_REASON_REMOTE_DEVICE_DOWN:
errorMsg = R.string.bluetooth_pairing_device_down_error_message;
break;
default:
errorMsg = R.string.bluetooth_pairing_error_message;
}
mLocalManager.showError(address, R.string.bluetooth_error_title, errorMsg);
} }
public synchronized void onProfileStateChanged(String address, boolean transientState) { public synchronized void onProfileStateChanged(String address, boolean transientState) {