From 74e613cb91301c1dff4e817ec66ac3624f059465 Mon Sep 17 00:00:00 2001 From: pramod kotreshappa Date: Mon, 3 Mar 2014 13:04:11 -0800 Subject: Bluetooth: Fix for BT fails to turn on in PDT test Fix for BT fails to turn on after several hours of PDT test Issue is due to disable timeout, host fails to get the wack ACK from the SoC during BT turn of. Adding ssr cleanup routine in disable timout routine CRs-Fixed: 614585 Change-Id: Ia32da9426f976ddc71f0ad740312222b4b646c94 --- jni/com_android_bluetooth_btservice_AdapterService.cpp | 14 ++++++++++++++ src/com/android/bluetooth/btservice/AdapterService.java | 1 + src/com/android/bluetooth/btservice/AdapterState.java | 1 + 3 files changed, 16 insertions(+) diff --git a/jni/com_android_bluetooth_btservice_AdapterService.cpp b/jni/com_android_bluetooth_btservice_AdapterService.cpp index 6e5e1aa6f..dc6964f9e 100644 --- a/jni/com_android_bluetooth_btservice_AdapterService.cpp +++ b/jni/com_android_bluetooth_btservice_AdapterService.cpp @@ -662,6 +662,19 @@ static bool cleanupNative(JNIEnv *env, jobject obj) { return JNI_TRUE; } +static bool ssrcleanupNative(JNIEnv *env, jobject obj) { + ALOGV("%s:",__FUNCTION__); + + jboolean result = JNI_FALSE; + if (!sBluetoothInterface) return result; + + sBluetoothInterface->ssrcleanup(); + ALOGI("%s: return from cleanup",__FUNCTION__); + + env->DeleteGlobalRef(sJniCallbacksObj); + return JNI_TRUE; +} + static jboolean enableNative(JNIEnv* env, jobject obj) { ALOGV("%s:",__FUNCTION__); @@ -1124,6 +1137,7 @@ static JNINativeMethod sMethods[] = { {"classInitNative", "()V", (void *) classInitNative}, {"initNative", "()Z", (void *) initNative}, {"cleanupNative", "()V", (void*) cleanupNative}, + {"ssrcleanupNative", "()V", (void*) ssrcleanupNative}, {"enableNative", "()Z", (void*) enableNative}, {"disableNative", "()Z", (void*) disableNative}, {"setAdapterPropertyNative", "(I[B)Z", (void*) setAdapterPropertyNative}, diff --git a/src/com/android/bluetooth/btservice/AdapterService.java b/src/com/android/bluetooth/btservice/AdapterService.java index 181998df4..f45a8c081 100644 --- a/src/com/android/bluetooth/btservice/AdapterService.java +++ b/src/com/android/bluetooth/btservice/AdapterService.java @@ -1584,6 +1584,7 @@ public class AdapterService extends Service { private native static void classInitNative(); private native boolean initNative(); private native void cleanupNative(); + /*package*/ native void ssrcleanupNative(); /*package*/ native boolean enableNative(); /*package*/ native boolean disableNative(); /*package*/ native boolean setAdapterPropertyNative(int type, byte[] val); diff --git a/src/com/android/bluetooth/btservice/AdapterState.java b/src/com/android/bluetooth/btservice/AdapterState.java index b239278ba..a0ec83865 100644 --- a/src/com/android/bluetooth/btservice/AdapterState.java +++ b/src/com/android/bluetooth/btservice/AdapterState.java @@ -349,6 +349,7 @@ final class AdapterState extends StateMachine { if (DBG) Log.d(TAG,"CURRENT_STATE=PENDING, MESSAGE = DISABLE_TIMEOUT, isTurningOn=" + isTurningOn + ", isTurningOff=" + isTurningOff); errorLog("Error disabling Bluetooth"); mPendingCommandState.setTurningOff(false); + adapterService.ssrcleanupNative(); transitionTo(mOffState); notifyAdapterStateChange(BluetoothAdapter.STATE_OFF); errorLog("Killing the process to force a restart as part cleanup"); -- cgit v1.2.3