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>
Sat, 25 Jun 2016 00:31:52 +0000 (17:31 -0700)
We should call setAdapterService(this) inside onCreate() instead of
inside BleOnProcessStart(). The former is more robust.

Change-Id: Ide1d98dfdde148645f3efe246e6fbf95659195a7

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

index 30c35f9..72f4ffa 100644 (file)
@@ -524,6 +524,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
@@ -579,9 +581,6 @@ public class AdapterService extends Service {
             // Ignore.
         }
 
-        //FIXME: Set static instance here???
-        setAdapterService(this);
-
         //Start Gatt service
         setGattProfileServiceState(supportedProfileServices,BluetoothAdapter.STATE_ON);
     }