OSDN Git Service

fixed bt on off stress test issue
authorzzy <zhenye@broadcom.com>
Tue, 11 Sep 2012 00:38:06 +0000 (17:38 -0700)
committerMatthew Xie <mattx@google.com>
Tue, 11 Sep 2012 23:55:25 +0000 (16:55 -0700)
root cause: cleanup stack process overlapped with bt turning
on process sometime. The cleanup() call in adapterservice.java
need to be call from onUnbind() to synchronize the
BluetoothSererviceManager unbindandFinish() call.
bug 7083069

Change-Id: Ib4c64d7e5fc996277278471969f187bb5e915a76

src/com/android/bluetooth/btservice/AdapterService.java

index 7f2d378..8ff2022 100755 (executable)
@@ -256,14 +256,13 @@ public class AdapterService extends Service {
         return mBinder;
     }
     public boolean onUnbind(Intent intent) {
-        if (DBG) debugLog("onUnbind");
+        if (DBG) debugLog("onUnbind, calling cleanup");
+        cleanup();
         return super.onUnbind(intent);
     }
 
     public void onDestroy() {
         debugLog("****onDestroy()********");
-        mHandler.removeMessages(MESSAGE_SHUTDOWN);
-        cleanup();
     }
 
     void processStart() {
@@ -384,8 +383,6 @@ public class AdapterService extends Service {
     private static final int MESSAGE_PROFILE_SERVICE_STATE_CHANGED =1;
     private static final int MESSAGE_PROFILE_CONNECTION_STATE_CHANGED=20;
     private static final int MESSAGE_CONNECT_OTHER_PROFILES = 30;
-    private static final int MESSAGE_SHUTDOWN= 100;
-    private static final int SHUTDOWN_TIMEOUT=2000;
     private static final int CONNECT_OTHER_PROFILES_TIMEOUT= 6000;
 
     private final Handler mHandler = new Handler() {
@@ -394,11 +391,6 @@ public class AdapterService extends Service {
             if (DBG) debugLog("Message: " + msg.what);
 
             switch (msg.what) {
-                case MESSAGE_SHUTDOWN: {
-                    if (DBG) Log.d(TAG,"***SHUTDOWN: TIMEOUT!!! Forcing shutdown...");
-                    stopSelf();
-                }
-                    break;
                 case MESSAGE_PROFILE_SERVICE_STATE_CHANGED: {
                     if(DBG) debugLog("MESSAGE_PROFILE_SERVICE_STATE_CHANGED");
                     processProfileServiceStateChanged((String) msg.obj, msg.arg1);