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
This commit is contained in:
Miao Chou
2015-06-26 17:14:35 -07:00
committed by Andre Eisenbach
parent d3ecb3e6f0
commit 658bf2fa6d
3 changed files with 80 additions and 27 deletions

View File

@@ -21,7 +21,6 @@ import android.app.ActivityThread;
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 @@ public final class SystemServer {
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 @@ public final class SystemServer {
} 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", "******************************************");