From 4f5cd591f4aff8dff1038cef228ab22a559c6ab0 Mon Sep 17 00:00:00 2001
From: Michael Chan <>
Date: Fri, 27 Mar 2009 17:04:53 -0700
Subject: [PATCH] AI 143288: am: CL 143116 Added separate error messages for
Bluetooth bonding rejections and bonding failures due to down devices
Original author: chanm Merged from: //branches/donutburger/...
Automated import of CL 143288
---
res/values/strings.xml | 4 ++++
.../LocalBluetoothDeviceManager.java | 20 +++++++++++++++----
2 files changed, 20 insertions(+), 4 deletions(-)
diff --git a/res/values/strings.xml b/res/values/strings.xml
index b126ec13e8a..7df151c602f 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -491,6 +491,10 @@
There was a problem pairing with %1$s.
There was a problem pairing with %1$s because the typed PIN is incorrect.
+
+ Cannot establish communication with %1$s.
+
+ Pairing rejected by %1$s.
There was a problem connecting to %1$s.
diff --git a/src/com/android/settings/bluetooth/LocalBluetoothDeviceManager.java b/src/com/android/settings/bluetooth/LocalBluetoothDeviceManager.java
index 9527980b5a5..9e46b4d3094 100644
--- a/src/com/android/settings/bluetooth/LocalBluetoothDeviceManager.java
+++ b/src/com/android/settings/bluetooth/LocalBluetoothDeviceManager.java
@@ -181,10 +181,22 @@ public class LocalBluetoothDeviceManager {
* BluetoothDevice.UNBOND_REASON_*
*/
public synchronized void onBondingError(String address, int reason) {
- mLocalManager.showError(address, R.string.bluetooth_error_title,
- (reason == BluetoothDevice.UNBOND_REASON_AUTH_FAILED) ?
- R.string.bluetooth_pairing_pin_error_message :
- R.string.bluetooth_pairing_error_message);
+ int errorMsg;
+
+ switch(reason) {
+ 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) {