Prevent x-axis window movement during the initial swipe up to show transient taskbar

- If gesture starts and isLikelyToStartANewTask=true, we do not clamp
- If gesture starts and isLikelyToStartANewTask=false AND transient taskbar is not
  already showing, we clamp the scrolling

Bug: 258851206
Test: swipe up to show taskbar, no x-axis movement
      swipe left/right still works as expected

Change-Id: Iac194df63e03b4a28b49008983c88c165847aa31
This commit is contained in:
Jon Miranda
2022-11-18 10:02:16 -08:00
parent 193f8992f1
commit 08be3775f6
5 changed files with 55 additions and 0 deletions
@@ -750,6 +750,21 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>,
}
}
/**
* Sets whether or not we should clamp the scroll offset.
* This is used to avoid x-axis movement when swiping up transient taskbar.
* @param clampScrollOffset When true, we clamp the scroll to 0 before the clamp threshold is
* met.
*/
public void setClampScrollOffset(boolean clampScrollOffset) {
if (mRecentsView == null) {
mStateCallback.runOnceAtState(STATE_LAUNCHER_PRESENT,
() -> mRecentsView.setClampScrollOffset(clampScrollOffset));
return;
}
mRecentsView.setClampScrollOffset(clampScrollOffset);
}
public void setIsLikelyToStartNewTask(boolean isLikelyToStartNewTask) {
setIsLikelyToStartNewTask(
isLikelyToStartNewTask,