summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Eric Miao <ericymiao@google.com> 2024-10-23 15:26:54 -0700
committer Eric Miao <ericymiao@google.com> 2024-10-24 16:52:11 +0000
commit7ef7a82315fe8918d6b51f54d3b57aa3d03455ff (patch)
tree453b36f94ac25ac5a4de5481c83d7b306145141c
parent9126dc19a7766fc65be83556f93ab9ee3f5c3e00 (diff)
Use readonly version of 'report_postgc_memory_metrics'
Isolated Process will crash if it involves reading a flag value that is READ_WRITE. Gantry doesn't allow updating an existing flag from READ_WRITE to READ_ONLY, we will thus introduce a readonly version of the flag and use that in the code. Once the new aconfig storage API is landed, which is supposedly to help Isolated Process with accessing of the flag values, we could then switch back to the READ_WRITE version of this flag, which allows us to enable/disable the feature at runtime. Bug: 363965015 Flag: report_postgc_memory_metrics_readonly Change-Id: Ia2fc232a2ca56cf40572b5edb5eac24e3fb8f227
-rw-r--r--core/java/android/app/ActivityThread.java2
-rw-r--r--core/java/android/app/metrics.aconfig9
2 files changed, 10 insertions, 1 deletions
diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java
index b0a8b1b2dbf3..52251745f758 100644
--- a/core/java/android/app/ActivityThread.java
+++ b/core/java/android/app/ActivityThread.java
@@ -7681,7 +7681,7 @@ public final class ActivityThread extends ClientTransactionHandler
});
// Register callback to report native memory metrics post GC cleanup
- if (Flags.reportPostgcMemoryMetrics() &&
+ if (Flags.reportPostgcMemoryMetricsReadonly() &&
com.android.libcore.readonly.Flags.postCleanupApis()) {
VMRuntime.addPostCleanupCallback(new Runnable() {
@Override public void run() {
diff --git a/core/java/android/app/metrics.aconfig b/core/java/android/app/metrics.aconfig
index 488f1c71990b..55d9c2d6b347 100644
--- a/core/java/android/app/metrics.aconfig
+++ b/core/java/android/app/metrics.aconfig
@@ -8,3 +8,12 @@ flag {
description: "Controls whether to report memory metrics post GC cleanup"
bug: "331243037"
}
+
+flag {
+ namespace: "system_performance"
+ name: "report_postgc_memory_metrics_readonly"
+ is_exported: false
+ description: "Controls whether to report memory metrics post GC cleanup (readonly)"
+ bug: "331243037"
+ is_fixed_read_only: true
+}