AudioService/WireAccessoryManager: change boot completion detection method

BOOT_COMPLETED intent is not a reliable way for system services
to detect boot completion. The intent broadcast can be significantly
delayed and there is no guaranty that system services
receive it before apps.

Use a systemReady() method called by SystemServer instead.

Bug: 14323903.
Change-Id: I781596a3545e7a1e719799982347cbcd9a4c9009
This commit is contained in:
Eric Laurent
2014-05-06 10:49:04 -07:00
parent ebb9e69513
commit 4a5eeb9c72
4 changed files with 77 additions and 47 deletions

View File

@ -333,6 +333,7 @@ public final class SystemServer {
InputManagerService inputManager = null;
TelephonyRegistry telephonyRegistry = null;
ConsumerIrService consumerIr = null;
AudioService audioService = null;
boolean onlyCore = false;
boolean firstBoot = false;
@ -759,7 +760,8 @@ public final class SystemServer {
if (!disableMedia && !"0".equals(SystemProperties.get("system_init.startaudioservice"))) {
try {
Slog.i(TAG, "Audio Service");
ServiceManager.addService(Context.AUDIO_SERVICE, new AudioService(context));
audioService = new AudioService(context);
ServiceManager.addService(Context.AUDIO_SERVICE, audioService);
} catch (Throwable e) {
reportWtf("starting Audio Service", e);
}
@ -1067,6 +1069,7 @@ public final class SystemServer {
final InputManagerService inputManagerF = inputManager;
final TelephonyRegistry telephonyRegistryF = telephonyRegistry;
final MediaRouterService mediaRouterF = mediaRouter;
final AudioService audioServiceF = audioService;
// We now tell the activity manager it is okay to run third party
// code. It will call back into us once it has gotten to the state
@ -1135,6 +1138,11 @@ public final class SystemServer {
} catch (Throwable e) {
reportWtf("making Recognition Service ready", e);
}
try {
if (audioServiceF != null) audioServiceF.systemReady();
} catch (Throwable e) {
reportWtf("Notifying AudioService running", e);
}
Watchdog.getInstance().start();
// It is now okay to let the various system services start their