From a9d976f39af3af17ac86ee82335a488d20b0c3d8 Mon Sep 17 00:00:00 2001 From: Phil Weaver Date: Tue, 1 Nov 2016 09:55:24 -0700 Subject: [PATCH] Don't invalidate list data during layout. When a FastScroller is enabled, we were invalidating the list data during layout, which left the UI in a bad state. Long-presses didn't work properly, and TalkBack touches were impossible to perform. Bug: 31160338 Test: Manually tested long pressing, and verified that TalkBack now works with the TestActivity in ag/1567328. Change-Id: Iecd2d597259748a3ecbf5573950e565a0e9faa42 (cherry picked from commit 2112742be6a6e0a6a2a13c8a1cf16f1cb69f7980) --- core/java/android/widget/AbsListView.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/core/java/android/widget/AbsListView.java b/core/java/android/widget/AbsListView.java index f1bfadee5f36f..c01348d69f3cc 100644 --- a/core/java/android/widget/AbsListView.java +++ b/core/java/android/widget/AbsListView.java @@ -2168,7 +2168,6 @@ public abstract class AbsListView extends AdapterView implements Te } layoutChildren(); - mInLayout = false; mOverscrollMax = (b - t) / OVERSCROLL_LIMIT_DIVISOR; @@ -2176,6 +2175,7 @@ public abstract class AbsListView extends AdapterView implements Te if (mFastScroll != null) { mFastScroll.onItemCountChanged(getChildCount(), mItemCount); } + mInLayout = false; } /** @@ -2705,6 +2705,9 @@ public abstract class AbsListView extends AdapterView implements Te * fail to relayout them properly to accommodate for new bounds. */ void handleBoundsChange() { + if (mInLayout) { + return; + } final int childCount = getChildCount(); if (childCount > 0) { mDataChanged = true;