Update app compilation APIs.
- Add performance characteristics to `optimizePackage`.
- Add a link to the compiler filter spec. (Note that the doc is currently
a bit outdated, but the doc updates are submitted and staging, so the
doc will eventually be up-to-date.)
- Make constants in ReasonMapping public.
This CL doesn't include changes to PriorityClassApi because the
suggested changes are still under discussion.
Bug: 246854668
Test: m com.google.android.art
Ignore-AOSP-First: ART Services.
Change-Id: I0676b4ce18e8deee98b0047465965be85782804f
diff --git a/libartservice/service/api/system-server-current.txt b/libartservice/service/api/system-server-current.txt
index 1a71901..cef4365 100644
--- a/libartservice/service/api/system-server-current.txt
+++ b/libartservice/service/api/system-server-current.txt
@@ -13,6 +13,20 @@
method @NonNull public com.android.server.art.model.OptimizeResult optimizePackage(@NonNull com.android.server.pm.snapshot.PackageDataSnapshot, @NonNull String, @NonNull com.android.server.art.model.OptimizeParams, @NonNull android.os.CancellationSignal);
}
+ public class ReasonMapping {
+ field public static final String REASON_BG_DEXOPT = "bg-dexopt";
+ field public static final String REASON_BOOT_AFTER_OTA = "boot-after-ota";
+ field public static final String REASON_CMDLINE = "cmdline";
+ field public static final String REASON_FIRST_BOOT = "first-boot";
+ field public static final String REASON_INACTIVE = "inactive";
+ field public static final String REASON_INSTALL = "install";
+ field public static final String REASON_INSTALL_BULK = "install-bulk";
+ field public static final String REASON_INSTALL_BULK_DOWNGRADED = "install-bulk-downgraded";
+ field public static final String REASON_INSTALL_BULK_SECONDARY = "install-bulk-secondary";
+ field public static final String REASON_INSTALL_BULK_SECONDARY_DOWNGRADED = "install-bulk-secondary-downgraded";
+ field public static final String REASON_INSTALL_FAST = "install-fast";
+ }
+
}
package com.android.server.art.model {
diff --git a/libartservice/service/java/com/android/server/art/ArtManagerLocal.java b/libartservice/service/java/com/android/server/art/ArtManagerLocal.java
index 177da6b..d4659ff 100644
--- a/libartservice/service/java/com/android/server/art/ArtManagerLocal.java
+++ b/libartservice/service/java/com/android/server/art/ArtManagerLocal.java
@@ -230,7 +230,8 @@
}
/**
- * Optimizes a package.
+ * Optimizes a package. The time this operation takes ranges from a few milliseconds to several
+ * minutes, depending on the params and the code size of the package.
*
* @throws IllegalArgumentException if the package is not found or the params are illegal
* @throws IllegalStateException if an internal error occurs
diff --git a/libartservice/service/java/com/android/server/art/ReasonMapping.java b/libartservice/service/java/com/android/server/art/ReasonMapping.java
index 107f7dc..88a330c 100644
--- a/libartservice/service/java/com/android/server/art/ReasonMapping.java
+++ b/libartservice/service/java/com/android/server/art/ReasonMapping.java
@@ -19,6 +19,7 @@
import static com.android.server.art.model.ArtFlags.PriorityClassApi;
import android.annotation.NonNull;
+import android.annotation.SystemApi;
import android.os.SystemProperties;
import android.text.TextUtils;
@@ -31,6 +32,7 @@
*
* @hide
*/
+@SystemApi(client = SystemApi.Client.SYSTEM_SERVER)
public class ReasonMapping {
private ReasonMapping() {}
diff --git a/libartservice/service/java/com/android/server/art/model/OptimizeParams.java b/libartservice/service/java/com/android/server/art/model/OptimizeParams.java
index 672aebb..fdfb6b8 100644
--- a/libartservice/service/java/com/android/server/art/model/OptimizeParams.java
+++ b/libartservice/service/java/com/android/server/art/model/OptimizeParams.java
@@ -67,10 +67,13 @@
}
/**
- * The target compiler filter. Note that the compiler filter might be adjusted before the
- * execution based on factors like whether the profile is available or whether the app is
- * used by other apps. If not set, the default compiler filter for the given reason will be
- * used.
+ * The target compiler filter, passed as the {@code --compiler-filer} option to dex2oat.
+ * Supported values are listed in
+ * https://source.android.com/docs/core/dalvik/configure#compilation_options.
+ *
+ * Note that the compiler filter might be adjusted before the execution based on factors
+ * like whether the profile is available or whether the app is used by other apps. If not
+ * set, the default compiler filter for the given reason will be used.
*/
@NonNull
public Builder setCompilerFilter(@NonNull String value) {