Merge "Sysprop for the count of active OOME tracing sessions"
diff --git a/private/app.te b/private/app.te
index 49b8cde..b6b4714 100644
--- a/private/app.te
+++ b/private/app.te
@@ -52,6 +52,9 @@
 get_prop(appdomain, device_config_runtime_native_prop)
 get_prop(appdomain, device_config_runtime_native_boot_prop)
 
+# Allow the heap dump ART plugin to the count of sessions waiting for OOME
+get_prop(appdomain, traced_oome_heap_session_count_prop)
+
 # Allow to read ro.vendor.camera.extensions.enabled
 get_prop(appdomain, camera2_extensions_prop)
 
diff --git a/private/compat/33.0/33.0.ignore.cil b/private/compat/33.0/33.0.ignore.cil
index 3418a29..ccee3cf 100644
--- a/private/compat/33.0/33.0.ignore.cil
+++ b/private/compat/33.0/33.0.ignore.cil
@@ -56,6 +56,7 @@
     stats_config_data_file
     system_net_netd_service
     timezone_metadata_prop
+    traced_oome_heap_session_count_prop
     tuner_config_prop
     tuner_server_ctl_prop
     ublk_block_device
diff --git a/private/property_contexts b/private/property_contexts
index c980696..3208377 100644
--- a/private/property_contexts
+++ b/private/property_contexts
@@ -221,6 +221,9 @@
 # heapprofd properties
 heapprofd.              u:object_r:heapprofd_prop:s0
 
+# traced properties
+traced.oome_heap_session.count u:object_r:traced_oome_heap_session_count_prop:s0 exact uint
+
 # servicemanager properties
 servicemanager.ready    u:object_r:servicemanager_prop:s0 exact bool
 
diff --git a/private/system_server.te b/private/system_server.te
index a39eaa2..4e3ef8d 100644
--- a/private/system_server.te
+++ b/private/system_server.te
@@ -839,6 +839,9 @@
 # Write tuner.server.enable
 set_prop(system_server, tuner_server_ctl_prop)
 
+# Allow the heap dump ART plugin to the count of sessions waiting for OOME
+get_prop(appdomain, traced_oome_heap_session_count_prop)
+
 # Create a socket for connections from debuggerd.
 allow system_server system_ndebug_socket:sock_file create_file_perms;
 
diff --git a/private/traced.te b/private/traced.te
index 3029094..171e092 100644
--- a/private/traced.te
+++ b/private/traced.te
@@ -60,6 +60,11 @@
 set_prop(traced, system_trace_prop)
 # Allow to lazily start producers.
 set_prop(traced, traced_lazy_prop)
+# Allow tracking the count of sessions intercepting Java OutOfMemoryError
+# If there are such tracing sessions and an OutOfMemoryError is thrown by ART,
+# the hprof plugin intercepts the error, lazily registers a data source to
+# traced and collects a heap dump.
+set_prop(traced, traced_oome_heap_session_count_prop)
 
 # Allow traced to talk to statsd for logging metrics.
 unix_socket_send(traced, statsdw, statsd)
diff --git a/public/property.te b/public/property.te
index e4470d6..74dd0f5 100644
--- a/public/property.te
+++ b/public/property.te
@@ -94,6 +94,7 @@
 system_restricted_prop(surfaceflinger_display_prop)
 system_restricted_prop(system_boot_reason_prop)
 system_restricted_prop(system_jvmti_agent_prop)
+system_restricted_prop(traced_oome_heap_session_count_prop)
 system_restricted_prop(ab_update_gki_prop)
 system_restricted_prop(usb_prop)
 system_restricted_prop(userspace_reboot_exported_prop)