diff --git a/libartservice/service/api/system-server-current.txt b/libartservice/service/api/system-server-current.txt index f316065ed8..05163ebc70 100644 --- a/libartservice/service/api/system-server-current.txt +++ b/libartservice/service/api/system-server-current.txt @@ -19,6 +19,7 @@ package com.android.server.art { method @NonNull public com.android.server.art.model.DexoptStatus getDexoptStatus(@NonNull com.android.server.pm.PackageManagerLocal.FilteredSnapshot, @NonNull String); method @NonNull public com.android.server.art.model.DexoptStatus getDexoptStatus(@NonNull com.android.server.pm.PackageManagerLocal.FilteredSnapshot, @NonNull String, int); method public int handleShellCommand(@NonNull android.os.Binder, @NonNull android.os.ParcelFileDescriptor, @NonNull android.os.ParcelFileDescriptor, @NonNull android.os.ParcelFileDescriptor, @NonNull String[]); + method public void onApexStaged(@NonNull String[]); method public void onBoot(@NonNull String, @Nullable java.util.concurrent.Executor, @Nullable java.util.function.Consumer); method public void printShellCommandHelp(@NonNull java.io.PrintWriter); method public void removeDexoptDoneCallback(@NonNull com.android.server.art.ArtManagerLocal.DexoptDoneCallback); diff --git a/libartservice/service/java/com/android/server/art/ArtManagerLocal.java b/libartservice/service/java/com/android/server/art/ArtManagerLocal.java index d4e3c59f45..db82bfd982 100644 --- a/libartservice/service/java/com/android/server/art/ArtManagerLocal.java +++ b/libartservice/service/java/com/android/server/art/ArtManagerLocal.java @@ -852,6 +852,25 @@ public void onBoot(@NonNull @BootReason String bootReason, } } + /** + * Notifies ART Service that there are apexes staged for installation on next reboot (see + * the update sequence of + * an APEX). ART Service may use this to schedule a pre-reboot dexopt job. This might change + * in the future. + * + * This immediately returns after scheduling the job and doesn't wait for the job to run. + * + * @param stagedApexModuleNames The module names of the staged apexes, corresponding to + * the directory beneath /apex, e.g., {@code com.android.art} (not the package + * names, e.g., {@code com.google.android.art}). + */ + @SuppressLint("UnflaggedApi") // Flag support for mainline is not available. + @RequiresApi(Build.VERSION_CODES.UPSIDE_DOWN_CAKE) + public void onApexStaged(@NonNull String[] stagedApexModuleNames) { + // TODO(b/311377497): Check system requirements. + mInjector.getPreRebootDexoptJob().schedule(); + } + /** * Dumps the dexopt state of all packages in text format for debugging purposes. *