diff options
| author | Matthew Xie <mattx@google.com> | 2011-09-07 23:32:51 -0700 |
|---|---|---|
| committer | Matthew Xie <mattx@google.com> | 2011-09-08 15:05:19 -0700 |
| commit | 694c0b833b4235b396ec1b798610d617d0ec7b5c (patch) | |
| tree | 2733e36f4abb333f5c4eddc08d732d5ab240a406 /core/java/android/server/BluetoothEventLoop.java | |
| parent | 1d124d5037644ed66a78c181c4eff13a7da04443 (diff) | |
| download | frameworks_base-694c0b833b4235b396ec1b798610d617d0ec7b5c.zip frameworks_base-694c0b833b4235b396ec1b798610d617d0ec7b5c.tar.gz frameworks_base-694c0b833b4235b396ec1b798610d617d0ec7b5c.tar.bz2 | |
Apply timeout for powerdown event and reset state machine when bluez crashes
The powerdown event was missed some time for unknown reasons and bluez could
crash for unknown reasons. We will debug on the issue. But for the time
being, we add a powerdown timer and process power up event to recover from
bluez crash
bug 5239719
Change-Id: Ie7315fb01e029747951e1a97a2d2f1dce53a997b
Diffstat (limited to 'core/java/android/server/BluetoothEventLoop.java')
| -rw-r--r-- | core/java/android/server/BluetoothEventLoop.java | 19 |
1 files changed, 2 insertions, 17 deletions
diff --git a/core/java/android/server/BluetoothEventLoop.java b/core/java/android/server/BluetoothEventLoop.java index 6eff796..e4f2d32 100644 --- a/core/java/android/server/BluetoothEventLoop.java +++ b/core/java/android/server/BluetoothEventLoop.java @@ -59,9 +59,8 @@ class BluetoothEventLoop { // from remote device when Android is in Suspend state. private PowerManager.WakeLock mWakeLock; - private static final int EVENT_RESTART_BLUETOOTH = 1; - private static final int EVENT_PAIRING_CONSENT_DELAYED_ACCEPT = 2; - private static final int EVENT_AGENT_CANCEL = 3; + private static final int EVENT_PAIRING_CONSENT_DELAYED_ACCEPT = 1; + private static final int EVENT_AGENT_CANCEL = 2; private static final int CREATE_DEVICE_ALREADY_EXISTS = 1; private static final int CREATE_DEVICE_SUCCESS = 0; @@ -75,9 +74,6 @@ class BluetoothEventLoop { public void handleMessage(Message msg) { String address = null; switch (msg.what) { - case EVENT_RESTART_BLUETOOTH: - mBluetoothService.restart(); - break; case EVENT_PAIRING_CONSENT_DELAYED_ACCEPT: address = (String)msg.obj; if (address != null) { @@ -375,9 +371,6 @@ class BluetoothEventLoop { } else if (name.equals("Powered")) { mBluetoothState.sendMessage(BluetoothAdapterStateMachine.POWER_STATE_CHANGED, propValues[1].equals("true") ? new Boolean(true) : new Boolean(false)); - // bluetoothd has restarted, re-read all our properties. - // Note: bluez only sends this property change when it restarts. - onRestartRequired(); } else if (name.equals("DiscoverableTimeout")) { adapterProperties.setProperty(name, propValues[1]); } @@ -1033,14 +1026,6 @@ class BluetoothEventLoop { mBluetoothService.onHealthDeviceChannelChanged(devicePath, channelPath, exists); } - private void onRestartRequired() { - if (mBluetoothService.isEnabled()) { - Log.e(TAG, "*** A serious error occurred (did bluetoothd crash?) - " + - "restarting Bluetooth ***"); - mHandler.sendEmptyMessage(EVENT_RESTART_BLUETOOTH); - } - } - private static void log(String msg) { Log.d(TAG, msg); } |
