Properly prevent All Apps relayouts by avoiding scrollToPosition

Calling scrollToPosition on RecyclerView internally calls
requestLayout() (to cacluate where to scroll and then go there).
Therefore, we should avoid calling that whenever possible, especially
during transitions. In particular, we can optimize scrollToTop() to not
scrollToPosition() if we are already at the top.

This makes some other workarounds unnecessary, namely setting All Apps
to GONE during system gestures.

Test: Open an app, swipe up, ensure AllAppsRecyclerView doesn't get
onLayout().  If we had scrolled to an app first, we get one layout
in prepareRecentsUi(), but not during the transition.

Bug: 140308849
Change-Id: I62ee341bf5893c121cfc013cc6542559f79d2a42
This commit is contained in:
Tony Wickham
2019-09-03 16:16:54 -07:00
parent c40872b913
commit bfdeda96e6
4 changed files with 9 additions and 16 deletions
@@ -43,7 +43,6 @@ public class AnimatorSetBuilder {
public static final int ANIM_ALL_APPS_HEADER_FADE = 12; // e.g. predictions
public static final int FLAG_DONT_ANIMATE_OVERVIEW = 1 << 0;
public static final int FLAG_DONT_UPDATE_ALL_APPS_VISIBILITY = 1 << 1;
protected final ArrayList<Animator> mAnims = new ArrayList<>();