Merge "Enable binder txn tracing more broadly"

This commit is contained in:
Zimuzo Ezeozue
2022-09-13 21:49:44 +00:00
committed by Android (Google) Code Review

View File

@@ -1262,8 +1262,15 @@ public class Binder implements IBinder {
// Log any exceptions as warnings, don't silently suppress them.
// If the call was {@link IBinder#FLAG_ONEWAY} then these exceptions
// disappear into the ether.
final boolean tracingEnabled = Trace.isTagEnabled(Trace.TRACE_TAG_AIDL) &&
(Binder.isStackTrackingEnabled() || Binder.isTracingEnabled(callingUid));
final boolean tagEnabled = Trace.isTagEnabled(Trace.TRACE_TAG_AIDL);
final String transactionTraceName;
if (tagEnabled) {
transactionTraceName = getTransactionTraceName(code);
} else {
transactionTraceName = null;
}
final boolean tracingEnabled = tagEnabled && transactionTraceName != null;
try {
final BinderCallHeavyHitterWatcher heavyHitterWatcher = sHeavyHitterWatcher;
if (heavyHitterWatcher != null) {
@@ -1271,7 +1278,7 @@ public class Binder implements IBinder {
heavyHitterWatcher.onTransaction(callingUid, getClass(), code);
}
if (tracingEnabled) {
Trace.traceBegin(Trace.TRACE_TAG_AIDL, getTransactionTraceName(code));
Trace.traceBegin(Trace.TRACE_TAG_AIDL, transactionTraceName);
}
if ((flags & FLAG_COLLECT_NOTED_APP_OPS) != 0) {