Call through to ART Service in notifyDexLoad if it is enabled.

Move the ArtManagerLocal initialization to a place where it can access
PackageManagerLocal but still is early enough to precede binder calls
to notifyDexLoad.

Test: Build with dalvik.vm.useartservice=true, boot, launch an app, and
      check with temporary logging that
      ArtManagerLocal.notifyDexContainersLoaded gets called.
Bug: 254043366
Change-Id: I97d59f9c15402648627006dde874a068b0706157
This commit is contained in:
Martin Stjernholm
2022-10-28 01:48:42 +01:00
parent 78dfbc18f5
commit f138c7b6b6
3 changed files with 89 additions and 13 deletions

View File

@@ -109,6 +109,7 @@ import com.android.server.ambientcontext.AmbientContextManagerService;
import com.android.server.appbinding.AppBindingService;
import com.android.server.art.ArtManagerLocal;
import com.android.server.art.ArtModuleServiceInitializer;
import com.android.server.art.DexUseManagerLocal;
import com.android.server.attention.AttentionManagerService;
import com.android.server.audio.AudioService;
import com.android.server.biometrics.AuthService;
@@ -1220,6 +1221,13 @@ public final class SystemServer implements Dumpable {
Watchdog.getInstance().resumeWatchingCurrentThread("packagemanagermain");
}
// DexUseManagerLocal needs to be loaded after PackageManagerLocal has been registered, but
// before PackageManagerService starts processing binder calls to notifyDexLoad.
// DexUseManagerLocal may also call artd, so ensure ArtModuleServiceManager is instantiated.
ArtModuleServiceInitializer.setArtModuleServiceManager(new ArtModuleServiceManager());
LocalManagerRegistry.addManager(
DexUseManagerLocal.class, DexUseManagerLocal.createInstance());
mFirstBoot = mPackageManagerService.isFirstBoot();
mPackageManager = mSystemContext.getPackageManager();
t.traceEnd();
@@ -2723,7 +2731,6 @@ public final class SystemServer implements Dumpable {
t.traceEnd();
t.traceBegin("ArtManagerLocal");
ArtModuleServiceInitializer.setArtModuleServiceManager(new ArtModuleServiceManager());
LocalManagerRegistry.addManager(ArtManagerLocal.class, new ArtManagerLocal(context));
t.traceEnd();