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

Commit 30897aaa authored by Sunny Goyal's avatar Sunny Goyal
Browse files

Temporarily enabling various tracing for debug devices

Change-Id: Iebee7d0a4c408f50ab911b31edbec12499a42844
parent 732c7f30
Loading
Loading
Loading
Loading
+21 −0
Original line number Diff line number Diff line
@@ -37,6 +37,7 @@ import android.os.HandlerThread;
import android.os.IBinder;
import android.os.RemoteException;
import android.util.Log;
import android.util.SparseArray;
import android.view.Choreographer;
import android.view.MotionEvent;
import android.view.View;
@@ -47,6 +48,7 @@ import com.android.launcher3.LauncherAppState;
import com.android.launcher3.MainThreadExecutor;
import com.android.launcher3.R;
import com.android.launcher3.uioverrides.UiFactory;
import com.android.launcher3.util.TraceHelper;
import com.android.systemui.shared.recents.IOverviewProxy;
import com.android.systemui.shared.recents.ISystemUiProxy;
import com.android.systemui.shared.system.ActivityManagerWrapper;
@@ -58,6 +60,15 @@ import com.android.systemui.shared.system.NavigationBarCompat.HitTarget;
@TargetApi(Build.VERSION_CODES.O)
public class TouchInteractionService extends Service {

    private static final SparseArray<String> sMotionEventNames;

    static {
        sMotionEventNames = new SparseArray<>(3);
        sMotionEventNames.put(ACTION_DOWN, "ACTION_DOWN");
        sMotionEventNames.put(ACTION_UP, "ACTION_UP");
        sMotionEventNames.put(ACTION_CANCEL, "ACTION_CANCEL");
    }

    public static final int EDGE_NAV_BAR = 1 << 8;

    private static final String TAG = "TouchInteractionService";
@@ -71,12 +82,19 @@ public class TouchInteractionService extends Service {

        @Override
        public void onPreMotionEvent(@HitTarget int downHitTarget) throws RemoteException {
            TraceHelper.beginSection("SysUiBinder");
            onBinderPreMotionEvent(downHitTarget);
            TraceHelper.partitionSection("SysUiBinder", "Down target " + downHitTarget);
        }

        @Override
        public void onMotionEvent(MotionEvent ev) {
            mEventQueue.queue(ev);

            String name = sMotionEventNames.get(ev.getActionMasked());
            if (name != null){
                TraceHelper.partitionSection("SysUiBinder", name);
            }
        }

        @Override
@@ -93,12 +111,14 @@ public class TouchInteractionService extends Service {
        @Override
        public void onQuickSwitch() {
            mEventQueue.onQuickSwitch();
            TraceHelper.endSection("SysUiBinder", "onQuickSwitch");
        }

        @Override
        public void onQuickScrubStart() {
            mEventQueue.onQuickScrubStart();
            sQuickScrubEnabled = true;
            TraceHelper.partitionSection("SysUiBinder", "onQuickScrubStart");
        }

        @Override
@@ -109,6 +129,7 @@ public class TouchInteractionService extends Service {
        @Override
        public void onQuickScrubEnd() {
            mEventQueue.onQuickScrubEnd();
            TraceHelper.endSection("SysUiBinder", "onQuickScrubEnd");
            sQuickScrubEnabled = false;
        }
    };
+1 −7
Original line number Diff line number Diff line
@@ -73,13 +73,7 @@ public class FirstFrameAnimatorHelper extends AnimatorListenerAdapter
            view.getViewTreeObserver().removeOnDrawListener(sGlobalDrawListener);
        }

        TraceHelper.beginSection("TICK");
        sGlobalDrawListener = new ViewTreeObserver.OnDrawListener() {
                public void onDraw() {
                    sGlobalFrameCounter++;
                    TraceHelper.partitionSection("TICK", "Frame drawn");
                }
            };
        sGlobalDrawListener = () -> sGlobalFrameCounter++;
        view.getViewTreeObserver().addOnDrawListener(sGlobalDrawListener);
        sVisible = true;
    }
+7 −2
Original line number Diff line number Diff line
@@ -15,12 +15,16 @@
 */
package com.android.launcher3.util;

import static android.util.Log.VERBOSE;
import static android.util.Log.isLoggable;

import android.os.SystemClock;
import android.os.Trace;
import android.util.ArrayMap;
import android.util.Log;
import android.util.MutableLong;

import com.android.launcher3.Utilities;
import com.android.launcher3.config.FeatureFlags;

/**
@@ -31,7 +35,8 @@ import com.android.launcher3.config.FeatureFlags;
 */
public class TraceHelper {

    private static final boolean ENABLED = FeatureFlags.IS_DOGFOOD_BUILD;
    private static final boolean FORCE_LOG = Utilities.IS_DEBUG_DEVICE;
    private static final boolean ENABLED = FORCE_LOG || FeatureFlags.IS_DOGFOOD_BUILD;

    private static final boolean SYSTEM_TRACE = false;
    private static final ArrayMap<String, MutableLong> sUpTimes = ENABLED ? new ArrayMap<>() : null;
@@ -40,7 +45,7 @@ public class TraceHelper {
        if (ENABLED) {
            MutableLong time = sUpTimes.get(sectionName);
            if (time == null) {
                time = new MutableLong(Log.isLoggable(sectionName, Log.VERBOSE) ? 0 : -1);
                time = new MutableLong((FORCE_LOG || isLoggable(sectionName, VERBOSE)) ? 0 : -1);
                sUpTimes.put(sectionName, time);
            }
            if (time.value >= 0) {