OSDN Git Service

Set the Adapter Service onCreate()
authorPavlin Radoslavov <pavlin@google.com>
Sat, 25 Jun 2016 00:31:52 +0000 (17:31 -0700)
committerPavlin Radoslavov <pavlin@google.com>
Thu, 25 Aug 2016 19:48:26 +0000 (12:48 -0700)
We should call setAdapterService(this) inside onCreate() instead of
inside BleOnProcessStart(). The former is more robust.

Change-Id: Ide1d98dfdde148645f3efe246e6fbf95659195a7
(cherry picked from commit 39d7556b76036e02b87a6c4288a9a090e2bd6686)

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

index f2a4326..016d796 100644 (file)
@@ -521,6 +521,8 @@ public class AdapterService extends Service {
         registerReceiver(mAlarmBroadcastReceiver, new IntentFilter(ACTION_ALARM_WAKEUP));
         mProfileObserver = new ProfileObserver(getApplicationContext(), this, new Handler());
         mProfileObserver.start();
+
+        setAdapterService(this);
     }
 
     @Override
@@ -576,9 +578,6 @@ public class AdapterService extends Service {
             // Ignore.
         }
 
-        //FIXME: Set static instance here???
-        setAdapterService(this);
-
         //Start Gatt service
         setGattProfileServiceState(supportedProfileServices,BluetoothAdapter.STATE_ON);
     }