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

Commit 5ba55458 authored by Makoto Onuki's avatar Makoto Onuki
Browse files

Update the looper "slow message log"

Now you can set `setprop log.looper.1000.main.slow 0` to print all
handler messages. (previously 1 was the minimum allowed value.)

The above example will enable logging for the "main" thread on
UID 1000 (SYSTEM_UID).

Bug: n/a
Test: manual test with `setprop log.looper.1000.main.slow 0; adb shell stop; adb shell start`
and looking at logcat

Test: another manual test, make sure, without the setprop, no logs are printed.

Change-Id: I6172b211b6f01f2fb73a5c57cd93bdb219dca4f4
parent 8f733bee
Loading
Loading
Loading
Loading
+7 −4
Original line number Diff line number Diff line
@@ -177,12 +177,15 @@ public final class Looper {
        final long traceTag = me.mTraceTag;
        long slowDispatchThresholdMs = me.mSlowDispatchThresholdMs;
        long slowDeliveryThresholdMs = me.mSlowDeliveryThresholdMs;
        if (thresholdOverride > 0) {

        final boolean hasOverride = thresholdOverride >= 0;
        if (hasOverride) {
            slowDispatchThresholdMs = thresholdOverride;
            slowDeliveryThresholdMs = thresholdOverride;
        }
        final boolean logSlowDelivery = (slowDeliveryThresholdMs > 0) && (msg.when > 0);
        final boolean logSlowDispatch = (slowDispatchThresholdMs > 0);
        final boolean logSlowDelivery = (slowDeliveryThresholdMs > 0 || hasOverride)
                && (msg.when > 0);
        final boolean logSlowDispatch = (slowDispatchThresholdMs > 0 || hasOverride);

        final boolean needStartTime = logSlowDelivery || logSlowDispatch;
        final boolean needEndTime = logSlowDispatch;
@@ -283,7 +286,7 @@ public final class Looper {
                SystemProperties.getInt("log.looper."
                        + Process.myUid() + "."
                        + Thread.currentThread().getName()
                        + ".slow", 0);
                        + ".slow", -1);

        me.mSlowDeliveryDetected = false;