Merge changes from topic "aidl_trace"
* changes: Clean up binder txn tracking special case Enable binder txn tracing more broadly
This commit is contained in:
@@ -522,9 +522,6 @@ interface IActivityManager {
|
||||
@UnsupportedAppUsage(maxTargetSdk = 30, trackingBug = 170729553)
|
||||
boolean stopBinderTrackingAndDump(in ParcelFileDescriptor fd);
|
||||
|
||||
/** Enables server-side binder tracing for the calling uid. */
|
||||
void enableBinderTracing();
|
||||
|
||||
@UnsupportedAppUsage(maxTargetSdk = 30, trackingBug = 170729553)
|
||||
void suppressResizeConfigChanges(boolean suppress);
|
||||
@UnsupportedAppUsage(maxTargetSdk = 30, trackingBug = 170729553)
|
||||
|
||||
@@ -22,7 +22,6 @@ import android.annotation.SystemApi;
|
||||
import android.app.AppOpsManager;
|
||||
import android.compat.annotation.UnsupportedAppUsage;
|
||||
import android.util.ExceptionUtils;
|
||||
import android.util.IntArray;
|
||||
import android.util.Log;
|
||||
import android.util.Slog;
|
||||
|
||||
@@ -144,9 +143,6 @@ public class Binder implements IBinder {
|
||||
*/
|
||||
private static volatile boolean sStackTrackingEnabled = false;
|
||||
|
||||
private static final Object sTracingUidsWriteLock = new Object();
|
||||
private static volatile IntArray sTracingUidsImmutable = new IntArray();
|
||||
|
||||
/**
|
||||
* Enable Binder IPC stack tracking. If enabled, every binder transaction will be logged to
|
||||
* {@link TransactionTracker}.
|
||||
@@ -166,17 +162,6 @@ public class Binder implements IBinder {
|
||||
sStackTrackingEnabled = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @hide
|
||||
*/
|
||||
public static void enableTracingForUid(int uid) {
|
||||
synchronized (sTracingUidsWriteLock) {
|
||||
final IntArray copy = sTracingUidsImmutable.clone();
|
||||
copy.add(uid);
|
||||
sTracingUidsImmutable = copy;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if binder transaction stack tracking is enabled.
|
||||
*
|
||||
@@ -186,13 +171,6 @@ public class Binder implements IBinder {
|
||||
return sStackTrackingEnabled;
|
||||
}
|
||||
|
||||
/**
|
||||
* @hide
|
||||
*/
|
||||
public static boolean isTracingEnabled(int callingUid) {
|
||||
return sTracingUidsImmutable.indexOf(callingUid) != -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the binder transaction tracker for this process.
|
||||
*
|
||||
@@ -1262,8 +1240,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 +1256,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) {
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
|
||||
package com.android.systemui;
|
||||
|
||||
import android.app.ActivityManager;
|
||||
import android.app.ActivityThread;
|
||||
import android.app.Application;
|
||||
import android.app.Notification;
|
||||
@@ -29,7 +28,6 @@ import android.content.res.Configuration;
|
||||
import android.os.Bundle;
|
||||
import android.os.Looper;
|
||||
import android.os.Process;
|
||||
import android.os.RemoteException;
|
||||
import android.os.SystemProperties;
|
||||
import android.os.Trace;
|
||||
import android.os.UserHandle;
|
||||
@@ -130,13 +128,6 @@ public class SystemUIApplication extends Application implements
|
||||
ThreadedRenderer.EGL_CONTEXT_PRIORITY_HIGH_IMG);
|
||||
}
|
||||
|
||||
// Enable binder tracing on system server for calls originating from SysUI
|
||||
try {
|
||||
ActivityManager.getService().enableBinderTracing();
|
||||
} catch (RemoteException e) {
|
||||
Log.e(TAG, "Unable to enable binder tracing", e);
|
||||
}
|
||||
|
||||
registerReceiver(new BroadcastReceiver() {
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
|
||||
@@ -16342,11 +16342,6 @@ public class ActivityManagerService extends IActivityManager.Stub
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enableBinderTracing() {
|
||||
Binder.enableTracingForUid(Binder.getCallingUid());
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
public final class LocalService extends ActivityManagerInternal
|
||||
implements ActivityManagerLocal {
|
||||
|
||||
Reference in New Issue
Block a user