Add BluetoothService to reduce resuming time after reboot
As a subclass of SystemService, BluetoothService wraps around
BluetoothManagerService to unlock Auto-enabling Bluetooth earlier by overriding
onBootPhase() and removes the need to wait for BOOT_COMPLETED message.
Bug:21705209
Change-Id: I2acc41370a750d8416e11e662e06392326741d2c
diff --git a/services/java/com/android/server/SystemServer.java b/services/java/com/android/server/SystemServer.java
index 76226b4..014527b 100644
--- a/services/java/com/android/server/SystemServer.java
+++ b/services/java/com/android/server/SystemServer.java
@@ -21,7 +21,6 @@
import android.app.IAlarmManager;
import android.app.INotificationManager;
import android.app.usage.UsageStatsManagerInternal;
-import android.bluetooth.BluetoothAdapter;
import android.content.ComponentName;
import android.content.ContentResolver;
import android.content.Context;
@@ -401,7 +400,6 @@
NetworkScoreService networkScore = null;
NsdService serviceDiscovery= null;
WindowManagerService wm = null;
- BluetoothManagerService bluetooth = null;
UsbService usb = null;
SerialService serial = null;
NetworkTimeUpdateService networkTimeUpdater = null;
@@ -508,9 +506,8 @@
} else if (disableBluetooth) {
Slog.i(TAG, "Bluetooth Service disabled by config");
} else {
- Slog.i(TAG, "Bluetooth Manager Service");
- bluetooth = new BluetoothManagerService(context);
- ServiceManager.addService(BluetoothAdapter.BLUETOOTH_MANAGER_SERVICE, bluetooth);
+ Slog.i(TAG, "Bluetooth Service");
+ mSystemServiceManager.startService(BluetoothService.class);
}
} catch (RuntimeException e) {
Slog.e("System", "******************************************");