summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorYK Jeffrey Chao <jechao@broadcom.com>2013-04-24 11:55:23 -0700
committerMatthew Xie <mattx@google.com>2013-05-10 00:29:11 -0700
commitad9fff218081d2f49471487d37387c764d69ed29 (patch)
tree29dee09eb7136238ac7dddcb87b25c3b8b6167ce /src
parentbad4995703f97fab3c7c84b297a8ca6df65191fa (diff)
downloadandroid_packages_apps_Bluetooth-ad9fff218081d2f49471487d37387c764d69ed29.tar.gz
android_packages_apps_Bluetooth-ad9fff218081d2f49471487d37387c764d69ed29.tar.bz2
android_packages_apps_Bluetooth-ad9fff218081d2f49471487d37387c764d69ed29.zip
Preload timeout and retry mechanism (2/3)
If the Preload process was stuck due to unknown hardware init failure, a 8-second ENABLE_TIMEOUT timeout would be eventually expired in Java layer at AdapterState and attempted to set BT state back to STATE_OFF. However BluetoothManagerService did not handle this case accordingly and led to state mis-matching between Java layer and BTIF at the end. Add the processing logic in AdapterState to handle the case when an explicit STATE_OFF notification from BTIF was received in the TurningOn Pending state. bug 7566317 Change-Id: I29c379cd453d05297ed382a5e8f862fa7d0f8881
Diffstat (limited to 'src')
-rwxr-xr-xsrc/com/android/bluetooth/btservice/AdapterState.java11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/com/android/bluetooth/btservice/AdapterState.java b/src/com/android/bluetooth/btservice/AdapterState.java
index fbc32a52d..108c05579 100755
--- a/src/com/android/bluetooth/btservice/AdapterState.java
+++ b/src/com/android/bluetooth/btservice/AdapterState.java
@@ -258,7 +258,7 @@ final class AdapterState extends StateMachine {
Log.w(TAG,"Timeout will setting scan mode..Continuing with disable...");
//Fall through
case BEGIN_DISABLE: {
- if (DBG) Log.d(TAG,"CURRENT_STATE=PENDING, MESSAGE = BEGIN_DISABLE" + isTurningOn + ", isTurningOff=" + isTurningOff);
+ if (DBG) Log.d(TAG,"CURRENT_STATE=PENDING, MESSAGE = BEGIN_DISABLE, isTurningOn=" + isTurningOn + ", isTurningOff=" + isTurningOff);
removeMessages(SET_SCAN_MODE_TIMEOUT);
sendMessageDelayed(DISABLE_TIMEOUT, DISABLE_TIMEOUT_DELAY);
boolean ret = mAdapterService.disableNative();
@@ -273,6 +273,15 @@ final class AdapterState extends StateMachine {
break;
case DISABLED:
if (DBG) Log.d(TAG,"CURRENT_STATE=PENDING, MESSAGE = DISABLED, isTurningOn=" + isTurningOn + ", isTurningOff=" + isTurningOff);
+ if (isTurningOn) {
+ removeMessages(ENABLE_TIMEOUT);
+ errorLog("Error enabling Bluetooth - hardware init failed");
+ mPendingCommandState.setTurningOn(false);
+ transitionTo(mOffState);
+ mAdapterService.stopProfileServices();
+ notifyAdapterStateChange(BluetoothAdapter.STATE_OFF);
+ break;
+ }
removeMessages(DISABLE_TIMEOUT);
sendMessageDelayed(STOP_TIMEOUT, STOP_TIMEOUT_DELAY);
if (mAdapterService.stopProfileServices()) {