Fix ART Service initialization order problems.

- Move ArtManagerLocal initialization before the boot compilation step
  (UpdatePackagesIfNeeded).
- Delay scheduling the background dexopt job because the job scheduler
  hasn't been started at that point.

Test: Boot with dalvik.vm.useartservice=true and check logcat that ART
  Service starts up and a first-boot dexopt runs without errors.
Bug: 266028904
Change-Id: I108b877f2a99c69c20f7209339cd193c2d41e7ea
This commit is contained in:
Martin Stjernholm
2023-01-25 21:36:42 +00:00
parent b75a0dfe91
commit 48b9a472f6
2 changed files with 15 additions and 5 deletions

View File

@@ -1789,6 +1789,10 @@ public final class SystemServer implements Dumpable {
}
t.traceEnd();
t.traceBegin("ArtManagerLocal");
DexOptHelper.initializeArtManagerLocal(context, mPackageManagerService);
t.traceEnd();
t.traceBegin("UpdatePackagesIfNeeded");
try {
Watchdog.getInstance().pauseWatchingCurrentThread("dexopt");
@@ -2737,10 +2741,6 @@ public final class SystemServer implements Dumpable {
mSystemServiceManager.startService(PermissionPolicyService.class);
t.traceEnd();
t.traceBegin("ArtManagerLocal");
DexOptHelper.initializeArtManagerLocal(context, mPackageManagerService);
t.traceEnd();
t.traceBegin("MakePackageManagerServiceReady");
mPackageManagerService.systemReady();
t.traceEnd();