summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Jiakai Zhang <jiakaiz@google.com> 2024-01-05 14:45:41 +0000
committer Jiakai Zhang <jiakaiz@google.com> 2024-01-08 13:42:26 +0000
commit13694dad58c046d7e3a455f63dd0b9fba5d1fe43 (patch)
tree54406fa7625876ca047fdd4977d014ac58ee599f
parent3208e7e6c4f32470b86537212168a0b20967d358 (diff)
Expose APIs to get ART managed file stats.
Bug: 317081212 Test: m Change-Id: Ic1df81d6c0ddc8fad4f6ed5bfd63140b6ddda89b
-rw-r--r--libartservice/service/api/system-server-current.txt8
-rw-r--r--libartservice/service/java/com/android/server/art/ArtManagerLocal.java4
-rw-r--r--libartservice/service/java/com/android/server/art/model/ArtManagedFileStats.java10
-rw-r--r--tools/art_boot.cc5
4 files changed, 20 insertions, 7 deletions
diff --git a/libartservice/service/api/system-server-current.txt b/libartservice/service/api/system-server-current.txt
index ec1eab2306..9c1220edbc 100644
--- a/libartservice/service/api/system-server-current.txt
+++ b/libartservice/service/api/system-server-current.txt
@@ -14,6 +14,7 @@ package com.android.server.art {
method @NonNull public com.android.server.art.model.DexoptResult dexoptPackage(@NonNull com.android.server.pm.PackageManagerLocal.FilteredSnapshot, @NonNull String, @NonNull com.android.server.art.model.DexoptParams, @NonNull android.os.CancellationSignal);
method public void dump(@NonNull java.io.PrintWriter, @NonNull com.android.server.pm.PackageManagerLocal.FilteredSnapshot);
method public void dumpPackage(@NonNull java.io.PrintWriter, @NonNull com.android.server.pm.PackageManagerLocal.FilteredSnapshot, @NonNull String);
+ method @NonNull public com.android.server.art.model.ArtManagedFileStats getArtManagedFileStats(@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);
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[]);
@@ -93,6 +94,13 @@ package com.android.server.art.model {
field public static final int SCHEDULE_SUCCESS = 0; // 0x0
}
+ public abstract class ArtManagedFileStats {
+ method public long getTotalSizeBytesByType(int);
+ field public static final int TYPE_CUR_PROFILE = 2; // 0x2
+ field public static final int TYPE_DEXOPT_ARTIFACT = 0; // 0x0
+ field public static final int TYPE_REF_PROFILE = 1; // 0x1
+ }
+
public abstract class BatchDexoptParams {
method @NonNull public abstract com.android.server.art.model.DexoptParams getDexoptParams();
method @NonNull public abstract java.util.List<java.lang.String> getPackages();
diff --git a/libartservice/service/java/com/android/server/art/ArtManagerLocal.java b/libartservice/service/java/com/android/server/art/ArtManagerLocal.java
index c1969f400f..b8e05494f6 100644
--- a/libartservice/service/java/com/android/server/art/ArtManagerLocal.java
+++ b/libartservice/service/java/com/android/server/art/ArtManagerLocal.java
@@ -33,6 +33,7 @@ import static com.android.server.art.model.DexoptStatus.DexContainerFileDexoptSt
import android.annotation.CallbackExecutor;
import android.annotation.NonNull;
import android.annotation.Nullable;
+import android.annotation.SuppressLint;
import android.annotation.SystemApi;
import android.annotation.SystemService;
import android.app.job.JobInfo;
@@ -880,9 +881,8 @@ public final class ArtManagerLocal {
* @throws IllegalArgumentException if the package is not found
* @throws IllegalStateException if the operation encounters an error that should never happen
* (e.g., an internal logic error).
- *
- * @hide
*/
+ @SuppressLint("UnflaggedApi") // Flag support for mainline is not available.
@RequiresApi(Build.VERSION_CODES.UPSIDE_DOWN_CAKE)
@NonNull
public ArtManagedFileStats getArtManagedFileStats(
diff --git a/libartservice/service/java/com/android/server/art/model/ArtManagedFileStats.java b/libartservice/service/java/com/android/server/art/model/ArtManagedFileStats.java
index 7a60163eea..88d3a230ca 100644
--- a/libartservice/service/java/com/android/server/art/model/ArtManagedFileStats.java
+++ b/libartservice/service/java/com/android/server/art/model/ArtManagedFileStats.java
@@ -18,6 +18,7 @@ package com.android.server.art.model;
import android.annotation.IntDef;
import android.annotation.NonNull;
+import android.annotation.SuppressLint;
import android.annotation.SystemApi;
import com.android.internal.annotations.Immutable;
@@ -34,7 +35,8 @@ import java.util.Map;
*
* @hide
*/
-//@SystemApi(client = SystemApi.Client.SYSTEM_SERVER)
+@SuppressLint("UnflaggedApi") // Flag support for mainline is not available.
+@SystemApi(client = SystemApi.Client.SYSTEM_SERVER)
@Immutable
@AutoValue
@SuppressWarnings("AutoValueImmutableFields") // Can't use ImmutableMap because it's in Guava.
@@ -49,18 +51,21 @@ public abstract class ArtManagedFileStats {
* For a preload app, this type includes dexopt artifacts on readonly partitions if they are
* up-to-date.
*/
+ @SuppressLint("UnflaggedApi") // Flag support for mainline is not available.
public static final int TYPE_DEXOPT_ARTIFACT = 0;
/**
* Reference profiles.
*
* They are the ones used during the last profile-guided dexopt.
*/
+ @SuppressLint("UnflaggedApi") // Flag support for mainline is not available.
public static final int TYPE_REF_PROFILE = 1;
/**
* Current profiles.
*
* They may be used during the next profile-guided dexopt.
*/
+ @SuppressLint("UnflaggedApi") // Flag support for mainline is not available.
public static final int TYPE_CUR_PROFILE = 2;
/** @hide */
@@ -92,9 +97,8 @@ public abstract class ArtManagedFileStats {
*
* @throws IllegalArgumentException if {@code fileType} is not one of those defined in {@link
* FileTypes}.
- *
- * @hide
*/
+ @SuppressLint("UnflaggedApi") // Flag support for mainline is not available.
public long getTotalSizeBytesByType(@FileTypes int fileType) {
Long value = getTotalSizesBytes().get(fileType);
if (value == null) {
diff --git a/tools/art_boot.cc b/tools/art_boot.cc
index df6b30bbcc..dd242403a2 100644
--- a/tools/art_boot.cc
+++ b/tools/art_boot.cc
@@ -59,10 +59,11 @@ int main(int, char** argv) {
// The following system properties are temporarily used as feature flags to indicate whether the
// module has a particular change or not.
- // Note that they don't actually control the runtime behavior. Instead, they are only used for
- // guarding tests.
+ // Note that they don't actually control the runtime behavior within the module. Instead, they are
+ // only used for guarding tests and calls from the platform.
// TODO(b/305000383): Clean these up.
SetPropertyAndLog("dalvik.vm.features.embedded_profile", "true");
+ SetPropertyAndLog("dalvik.vm.features.art_managed_file_stats", "true");
return 0;
}