From b9f7e269a92c0e84dc9ab01af1efa4d63539b4ce Mon Sep 17 00:00:00 2001 From: Lucas Dupin Date: Fri, 28 Jan 2022 14:58:02 -0800 Subject: [PATCH] Be forgiving with accidental horizontal scroll An accidental horizontal touch, due to vertical fling on the -1 screen could lead to imperceptible change in zoom, and send a frame to client composition. This CL adds extra padding to overlay scroll amount, to avoid these accidental gestures. Bug: 211245940 Test: https://ui.perfetto.dev/#!/viewer?trace_id=3260c116-c578-6dad-e047-0a327b7d346c Change-Id: Id05e482c79c1dcc2e1ba73baf8a4a4101797bbd2 --- .../com/android/launcher3/statehandlers/DepthController.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/quickstep/src/com/android/launcher3/statehandlers/DepthController.java b/quickstep/src/com/android/launcher3/statehandlers/DepthController.java index 3242d42f93..d54b9e774b 100644 --- a/quickstep/src/com/android/launcher3/statehandlers/DepthController.java +++ b/quickstep/src/com/android/launcher3/statehandlers/DepthController.java @@ -294,6 +294,11 @@ public class DepthController implements StateHandler, } public void onOverlayScrollChanged(float progress) { + // Add some padding to the progress, such we don't change the depth on the last frames of + // the animation. It's possible that a user flinging the feed quickly would scroll + // horizontally by accident, causing the device to enter client composition unnecessarily. + progress = Math.min(progress * 1.1f, 1f); + // Round out the progress to dedupe frequent, non-perceptable updates int progressI = (int) (progress * 256); float progressF = Utilities.boundToRange(progressI / 256f, 0f, 1f);