fw: delay TracingServiceProxy until PHASE_THIRD_PARTY_APPS_CAN_START
Because all methods in TracingServiceProxy want to bind/start services
in places outside system_server, it makes sense to wait until
PHASE_THIRD_PARTY_APPS_CAN_START to actually publish the service
This should solve some subtle race conditions around OOM heap dumps where they were being dropped on the floor by system_server because the GMSCore package had not yet been populated by PackageManager.
Bug: 333846370
Change-Id: I1addeafd9eac69e11c896fdda9a7a3924c09e22c
diff --git a/services/core/java/com/android/server/tracing/TracingServiceProxy.java b/services/core/java/com/android/server/tracing/TracingServiceProxy.java
index 10e868d..c1d92cf 100644
--- a/services/core/java/com/android/server/tracing/TracingServiceProxy.java
+++ b/services/core/java/com/android/server/tracing/TracingServiceProxy.java
@@ -119,8 +119,13 @@
}
@Override
- public void onStart() {
- publishBinderService(TRACING_SERVICE_PROXY_BINDER_NAME, mTracingServiceProxy);
+ public void onStart() {}
+
+ @Override
+ public void onBootPhase(int phase) {
+ if (phase == SystemService.PHASE_THIRD_PARTY_APPS_CAN_START) {
+ publishBinderService(TRACING_SERVICE_PROXY_BINDER_NAME, mTracingServiceProxy);
+ }
}
private void notifyTraceur(boolean sessionStolen) {