diff --git a/services/core/java/com/android/server/tracing/TracingServiceProxy.java b/services/core/java/com/android/server/tracing/TracingServiceProxy.java index c1d92cffe1a7454261a400fb4d9cdca3970e2dc4..68eb8eb1deafaeb0186c4f5052c837a2c49252f9 100644 --- a/services/core/java/com/android/server/tracing/TracingServiceProxy.java +++ b/services/core/java/com/android/server/tracing/TracingServiceProxy.java @@ -93,6 +93,7 @@ public class TracingServiceProxy extends SystemService { private final Context mContext; private final PackageManager mPackageManager; private final LruCache<ComponentName, ServiceConnector<IMessenger>> mCachedReporterServices; + private boolean mServicePublished = false; private final ITracingServiceProxy.Stub mTracingServiceProxy = new ITracingServiceProxy.Stub() { /** @@ -122,9 +123,12 @@ public class TracingServiceProxy extends SystemService { public void onStart() {} @Override - public void onBootPhase(int phase) { - if (phase == SystemService.PHASE_THIRD_PARTY_APPS_CAN_START) { + public void onUserUnlocking(@NonNull TargetUser user) { + // We need the device storage to be unlocked before we can accept and forward + // requests. + if (!mServicePublished) { publishBinderService(TRACING_SERVICE_PROXY_BINDER_NAME, mTracingServiceProxy); + mServicePublished = true; } }