summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Jaikumar Ganesh <jaikumar@google.com> 2011-06-27 17:50:15 -0700
committer Jaikumar Ganesh <jaikumar@google.com> 2011-06-27 17:55:32 -0700
commitc73dd732c962238330cc2e5538a88bffbbb40fe8 (patch)
tree598a1034a8c61e0815d9e0dff9674dbe3fd60c01
parent7cec14235dcc5eaff5bcbcfe11f95dcf180b9a68 (diff)
Fix crash while device is pairing / unpairing.
When there are no paired devices, pairing a new device will cause a crash since the profile proxies will be null. Change-Id: Ie1a9fd198e46d7e9cc2ba1b2f3a806b3c709f568
-rw-r--r--core/java/android/server/BluetoothBondState.java8
-rwxr-xr-xcore/java/android/server/BluetoothService.java2
2 files changed, 7 insertions, 3 deletions
diff --git a/core/java/android/server/BluetoothBondState.java b/core/java/android/server/BluetoothBondState.java
index 5fa8836c1d9c..76e78858e029 100644
--- a/core/java/android/server/BluetoothBondState.java
+++ b/core/java/android/server/BluetoothBondState.java
@@ -89,7 +89,12 @@ class BluetoothBondState {
return mPendingOutgoingBonding;
}
- public synchronized void loadBondState() {
+ public synchronized void initBondState() {
+ getProfileProxy();
+ loadBondState();
+ }
+
+ private void loadBondState() {
if (mService.getBluetoothStateInternal() !=
BluetoothAdapter.STATE_TURNING_ON) {
return;
@@ -108,7 +113,6 @@ class BluetoothBondState {
mState.put(mService.getAddressFromObjectPath(device).toUpperCase(),
BluetoothDevice.BOND_BONDED);
}
- getProfileProxy();
}
public synchronized void setBondState(String address, int state) {
diff --git a/core/java/android/server/BluetoothService.java b/core/java/android/server/BluetoothService.java
index 7f47ebcbcc90..b5ae298f36e6 100755
--- a/core/java/android/server/BluetoothService.java
+++ b/core/java/android/server/BluetoothService.java
@@ -570,7 +570,7 @@ public class BluetoothService extends IBluetooth.Stub {
mIsDiscovering = false;
mBondState.readAutoPairingData();
- mBondState.loadBondState();
+ mBondState.initBondState();
initProfileState();
// This should be the last step of the the enable thread.