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

Commit 1338dd7e authored by Alex Chau's avatar Alex Chau
Browse files

Add logs to MotionPauseDetector

- Add logs to MotionPauseDetector to confirm if the current 700ms timeout is enough for tests

Bug: 194114179
Test: atest NexusLauncherOutOfProcTests:com.android.launcher3.memory.MemoryTests#testAppLaunchFromWorkspace
Change-Id: Ifc3e8a24c245b1877e3fae5d2cb96636c34e8e4b
parent 55861dc5
Loading
Loading
Loading
Loading
+16 −3
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@ package com.android.quickstep.util;

import android.content.Context;
import android.content.res.Resources;
import android.util.Log;
import android.view.MotionEvent;
import android.view.VelocityTracker;

@@ -85,7 +86,12 @@ public class MotionPauseDetector {
        mSpeedSomewhatFast = res.getDimension(R.dimen.motion_pause_detector_speed_somewhat_fast);
        mSpeedFast = res.getDimension(R.dimen.motion_pause_detector_speed_fast);
        mForcePauseTimeout = new Alarm();
        mForcePauseTimeout.setOnAlarmListener(alarm -> updatePaused(true /* isPaused */));
        mForcePauseTimeout.setOnAlarmListener(alarm -> {
            if (TestProtocol.sDebugTracing) {
                Log.d(TestProtocol.MOTION_PAUSE_TIMEOUT, "onAlarm");
            }
            updatePaused(true /* isPaused */);
        });
        mMakePauseHarderToTrigger = makePauseHarderToTrigger;
        mVelocityProvider = new SystemVelocityProvider(axis);
    }
@@ -119,9 +125,13 @@ public class MotionPauseDetector {
     * @param pointerIndex Index for the pointer being tracked in the motion event
     */
    public void addPosition(MotionEvent ev, int pointerIndex) {
        mForcePauseTimeout.setAlarm(TestProtocol.sForcePauseTimeout != null
        long timeoutMs = TestProtocol.sForcePauseTimeout != null
                ? TestProtocol.sForcePauseTimeout
                : mMakePauseHarderToTrigger ? HARDER_TRIGGER_TIMEOUT : FORCE_PAUSE_TIMEOUT);
                : mMakePauseHarderToTrigger ? HARDER_TRIGGER_TIMEOUT : FORCE_PAUSE_TIMEOUT;
        if (TestProtocol.sDebugTracing) {
            Log.d(TestProtocol.MOTION_PAUSE_TIMEOUT, "setAlarm: " + timeoutMs);
        }
        mForcePauseTimeout.setAlarm(timeoutMs);
        float newVelocity = mVelocityProvider.addMotionEvent(ev, ev.getPointerId(pointerIndex));
        if (mPreviousVelocity != null) {
            checkMotionPaused(newVelocity, mPreviousVelocity, ev.getEventTime());
@@ -162,6 +172,9 @@ public class MotionPauseDetector {
                }
            }
        }
        if (TestProtocol.sDebugTracing) {
            Log.d(TestProtocol.MOTION_PAUSE_TIMEOUT, "checkMotionPaused: " + isPaused);
        }
        updatePaused(isPaused);
    }

+1 −0
Original line number Diff line number Diff line
@@ -116,4 +116,5 @@ public final class TestProtocol {
    public static final String WORK_PROFILE_REMOVED = "b/159671700";
    public static final String FALLBACK_ACTIVITY_NO_SET = "b/181019015";
    public static final String THIRD_PARTY_LAUNCHER_NOT_SET = "b/187080582";
    public static final String MOTION_PAUSE_TIMEOUT = "b/194114179";
}