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

Commit 82865bfc authored by Olivier Gaillard's avatar Olivier Gaillard
Browse files

Track excessive binder calls in the critical event logs.

It will help to understand if any ANRs are due to high binder calls.

Change-Id: I3aad499f73ff00c52689c69e85ac87ca8b91e5ac
parent 7b5f3f42
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -61,6 +61,12 @@ message CriticalEventProto {
    NativeCrash native_crash = 6;
    SystemServerStarted system_server_started = 7;
    InstallPackages install_packages = 8;
    ExcessiveBinderCalls excessive_binder_calls = 9;
  }

  message ExcessiveBinderCalls {
    // The uid sending many calls.
    optional int32 uid = 1;
  }

  message InstallPackages {}
+1 −0
Original line number Diff line number Diff line
@@ -9028,6 +9028,7 @@ public class ActivityManagerService extends IActivityManager.Stub
                        Slog.wtf(TAG, "Uid " + uid + " sent too many Binders to uid "
                                + Process.myUid());
                        BinderProxy.dumpProxyDebugInfo();
                        CriticalEventLog.getInstance().logExcessiveBinderCalls(uid);
                        if (uid == Process.SYSTEM_UID) {
                            Slog.i(TAG, "Skipping kill (uid is SYSTEM)");
                        } else {
+10 −0
Original line number Diff line number Diff line
@@ -30,6 +30,7 @@ import com.android.server.criticalevents.nano.CriticalEventProto;
import com.android.server.criticalevents.nano.CriticalEventProto.AppNotResponding;
import com.android.server.criticalevents.nano.CriticalEventProto.HalfWatchdog;
import com.android.server.criticalevents.nano.CriticalEventProto.InstallPackages;
import com.android.server.criticalevents.nano.CriticalEventProto.ExcessiveBinderCalls;
import com.android.server.criticalevents.nano.CriticalEventProto.JavaCrash;
import com.android.server.criticalevents.nano.CriticalEventProto.NativeCrash;
import com.android.server.criticalevents.nano.CriticalEventProto.SystemServerStarted;
@@ -143,6 +144,15 @@ public class CriticalEventLog {
        return System.currentTimeMillis();
    }

   /** Logs when a uid sends an excessive number of binder calls. */
    public void logExcessiveBinderCalls(int uid) {
        CriticalEventProto event = new CriticalEventProto();
        ExcessiveBinderCalls calls = new ExcessiveBinderCalls();
        calls.uid = uid;
        event.setExcessiveBinderCalls(calls);
        log(event);
    }

    /** Logs when one or more packages are installed. */
    public void logInstallPackagesStarted() {
        CriticalEventProto event = new CriticalEventProto();