From 091794671d8a7c3f85b2f1c192112d5d7654e480 Mon Sep 17 00:00:00 2001 From: vadimt Date: Thu, 7 May 2020 20:06:58 -0700 Subject: [PATCH] Adding tracing for non-detection of Pause Bug: 156044202 Change-Id: I16f196db6266a0c3a84b59b7cdeb29863a37ff0f --- .../quickstep/util/MotionPauseDetector.java | 14 ++++++++++++++ .../android/launcher3/testing/TestProtocol.java | 1 + 2 files changed, 15 insertions(+) diff --git a/quickstep/src/com/android/quickstep/util/MotionPauseDetector.java b/quickstep/src/com/android/quickstep/util/MotionPauseDetector.java index 7d52571900..a5d456878a 100644 --- a/quickstep/src/com/android/quickstep/util/MotionPauseDetector.java +++ b/quickstep/src/com/android/quickstep/util/MotionPauseDetector.java @@ -19,11 +19,13 @@ import static com.android.launcher3.config.FeatureFlags.ENABLE_LSQ_VELOCITY_PROV import android.content.Context; import android.content.res.Resources; +import android.util.Log; import android.view.MotionEvent; import com.android.launcher3.Alarm; import com.android.launcher3.R; import com.android.launcher3.compat.AccessibilityManagerCompat; +import com.android.launcher3.testing.TestProtocol; /** * Given positions along x- or y-axis, tracks velocity and acceleration and determines when there is @@ -84,6 +86,9 @@ public class MotionPauseDetector { mSpeedSlow = res.getDimension(R.dimen.motion_pause_detector_speed_slow); mSpeedSomewhatFast = res.getDimension(R.dimen.motion_pause_detector_speed_somewhat_fast); mSpeedFast = res.getDimension(R.dimen.motion_pause_detector_speed_fast); + if (TestProtocol.sDebugTracing) { + Log.d(TestProtocol.PAUSE_NOT_DETECTED, "creating alarm"); + } mForcePauseTimeout = new Alarm(); mForcePauseTimeout.setOnAlarmListener(alarm -> updatePaused(true /* isPaused */)); mMakePauseHarderToTrigger = makePauseHarderToTrigger; @@ -120,6 +125,9 @@ public class MotionPauseDetector { * @param pointerIndex Index for the pointer being tracked in the motion event */ public void addPosition(MotionEvent ev, int pointerIndex) { + if (TestProtocol.sDebugTracing) { + Log.d(TestProtocol.PAUSE_NOT_DETECTED, "setting alarm"); + } mForcePauseTimeout.setAlarm(mMakePauseHarderToTrigger ? HARDER_TRIGGER_TIMEOUT : FORCE_PAUSE_TIMEOUT); @@ -167,6 +175,9 @@ public class MotionPauseDetector { } private void updatePaused(boolean isPaused) { + if (TestProtocol.sDebugTracing) { + Log.d(TestProtocol.PAUSE_NOT_DETECTED, "updatePaused: " + isPaused); + } if (mDisallowPause) { isPaused = false; } @@ -188,6 +199,9 @@ public class MotionPauseDetector { setOnMotionPauseListener(null); mIsPaused = mHasEverBeenPaused = false; mSlowStartTime = 0; + if (TestProtocol.sDebugTracing) { + Log.d(TestProtocol.PAUSE_NOT_DETECTED, "canceling alarm"); + } mForcePauseTimeout.cancelAlarm(); } diff --git a/src/com/android/launcher3/testing/TestProtocol.java b/src/com/android/launcher3/testing/TestProtocol.java index fba6269097..32c6a1d70c 100644 --- a/src/com/android/launcher3/testing/TestProtocol.java +++ b/src/com/android/launcher3/testing/TestProtocol.java @@ -99,4 +99,5 @@ public final class TestProtocol { public static final String REQUEST_MOCK_SENSOR_ROTATION = "mock-sensor-rotation"; public static final String PERMANENT_DIAG_TAG = "TaplTarget"; + public static final String PAUSE_NOT_DETECTED = "b/139891609"; }