From bd94f7c2b821f9a4ec9fb74260ac68539dffb571 Mon Sep 17 00:00:00 2001 From: Jorim Jaggi Date: Thu, 18 Nov 2021 19:09:39 +0100 Subject: [PATCH] Add cheap aidl tracing suitable for always-on-tracing (3/3) Instead of having only one switch to enable all binder tracing, we seperate between stack tracking and tracing. Stack tracking still works as before. However, the more lightweight option, tracing using android.os.Trace, is toggleable separately and will work on the receiver side without dumping the entire stack trace. We also make the tracing more efficient by caching getTransactionName and concatting the class name. Also, enable this selectively for SysUI+Launcher, which is currently the focus of always-on-tracing effort to figure out what kind of binder calls these processes are calling which seems to contribute a huge amount of jank (long binder calls are in >= 50% of janky traces). Test: external/perfetto/tools/record_android_trace gfx view freq sched wm am aidl Test: atest aidl_unittest Bug: 202278427 Change-Id: Ia555740400808e0a467d00e305b6743931d3af0a --- .../android/quickstep/QuickstepProcessInitializer.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/quickstep/src/com/android/quickstep/QuickstepProcessInitializer.java b/quickstep/src/com/android/quickstep/QuickstepProcessInitializer.java index a551f55de5..678372cf24 100644 --- a/quickstep/src/com/android/quickstep/QuickstepProcessInitializer.java +++ b/quickstep/src/com/android/quickstep/QuickstepProcessInitializer.java @@ -16,9 +16,11 @@ package com.android.quickstep; import android.annotation.TargetApi; +import android.app.ActivityManager; import android.content.Context; import android.content.pm.PackageManager; import android.os.Build; +import android.os.RemoteException; import android.os.UserManager; import android.util.Log; @@ -60,5 +62,12 @@ public class QuickstepProcessInitializer extends MainProcessInitializer { // Elevate GPU priority for Quickstep and Remote animations. ThreadedRendererCompat.setContextPriority( ThreadedRendererCompat.EGL_CONTEXT_PRIORITY_HIGH_IMG); + + // Enable binder tracing on system server for calls originating from Launcher + try { + ActivityManager.getService().enableBinderTracing(); + } catch (RemoteException e) { + Log.e(TAG, "Unable to enable binder tracing", e); + } } }