summaryrefslogtreecommitdiffstats
path: root/core/java/android
diff options
context:
space:
mode:
authorNitin Shivpure <nshivpur@codeaurora.org>2013-12-12 20:03:49 +0530
committerAndre Eisenbach <eisenbach@google.com>2015-06-02 01:23:11 -0700
commit1f8b844870eb9acb334b541b0b41de37e000d2f0 (patch)
tree6b764a7022454523321521046e7598e714b4d444 /core/java/android
parentac1f0a1a9169f8bbbddba68b0410d5530512da63 (diff)
downloadframeworks_base-1f8b844870eb9acb334b541b0b41de37e000d2f0.zip
frameworks_base-1f8b844870eb9acb334b541b0b41de37e000d2f0.tar.gz
frameworks_base-1f8b844870eb9acb334b541b0b41de37e000d2f0.tar.bz2
Bluetooth: Fix to avoid framework reboot during monkey testing
When running monkeyrunner, sometimes the framework is disconnected due to an unhandled Java exception while binding the PAN service (when it is unsuccessful). Handing the Java exception while binding PAN service solves this issue. Change-Id: Idea710593a3f9496305f636042605303e73e7749
Diffstat (limited to 'core/java/android')
-rw-r--r--core/java/android/bluetooth/BluetoothPan.java21
1 files changed, 15 insertions, 6 deletions
diff --git a/core/java/android/bluetooth/BluetoothPan.java b/core/java/android/bluetooth/BluetoothPan.java
index eb6166a..744f942 100644
--- a/core/java/android/bluetooth/BluetoothPan.java
+++ b/core/java/android/bluetooth/BluetoothPan.java
@@ -138,7 +138,6 @@ public final class BluetoothPan implements BluetoothProfile {
}
if (VDBG) Log.d(TAG, "BluetoothPan() call bindService");
doBind();
- if (VDBG) Log.d(TAG, "BluetoothPan(), bindService called");
}
boolean doBind() {
@@ -185,12 +184,22 @@ public final class BluetoothPan implements BluetoothProfile {
final private IBluetoothStateChangeCallback mStateChangeCallback = new IBluetoothStateChangeCallback.Stub() {
@Override
- public void onBluetoothStateChange(boolean on) throws RemoteException {
- //Handle enable request to bind again.
+ public void onBluetoothStateChange(boolean on) {
+ // Handle enable request to bind again.
+ Log.d(TAG, "onBluetoothStateChange on: " + on);
if (on) {
- Log.d(TAG, "onBluetoothStateChange(on) call bindService");
- doBind();
- if (VDBG) Log.d(TAG, "BluetoothPan(), bindService called");
+ try {
+ if (mPanService == null) {
+ if (VDBG) Log.d(TAG, "onBluetoothStateChange calling doBind()");
+ doBind();
+ }
+
+ } catch (IllegalStateException e) {
+ Log.e(TAG,"onBluetoothStateChange: could not bind to PAN service: ", e);
+
+ } catch (SecurityException e) {
+ Log.e(TAG,"onBluetoothStateChange: could not bind to PAN service: ", e);
+ }
} else {
if (VDBG) Log.d(TAG,"Unbinding service...");
synchronized (mConnection) {