Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fe43ff27 authored by Zim's avatar Zim
Browse files

Clean up binder txn tracking special case

Previously, binder txns were only traced for txns from sysui/launcher
to system_server.

ag/Iffc4bb534d239c07d2e4d43ab43a9ed76abe7496 enabled binder txn tracking
more broadly

Removed the special case for sysui/launcher and cleaned up the code

Test: Manual
Bug: 161393989
Change-Id: I9d46d2362ca0ca33bc2477d68092f7ba5fe9c8ac
parent dd3be999
Loading
Loading
Loading
Loading
+0 −3
Original line number Diff line number Diff line
@@ -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)
+0 −22
Original line number Diff line number Diff line
@@ -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.
     *
+0 −9
Original line number Diff line number Diff line
@@ -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) {
+0 −5
Original line number Diff line number Diff line
@@ -16397,11 +16397,6 @@ public class ActivityManagerService extends IActivityManager.Stub
        }
    }
    @Override
    public void enableBinderTracing() {
        Binder.enableTracingForUid(Binder.getCallingUid());
    }
    @VisibleForTesting
    public final class LocalService extends ActivityManagerInternal
            implements ActivityManagerLocal {