mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-19 18:58:19 +00:00
Adding tracing for non-detection of Pause
Bug: 156044202 Change-Id: I16f196db6266a0c3a84b59b7cdeb29863a37ff0f
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user