diff options
author | Alan Viverette <alanv@google.com> | 2014-02-24 12:24:11 -0800 |
---|---|---|
committer | Alan Viverette <alanv@google.com> | 2014-02-24 12:24:47 -0800 |
commit | 462c2177f73754458821cfc0441a863c1fa527e4 (patch) | |
tree | 34d761eada5a59dea686798f9fb368edd22eb7cf | |
parent | 786e71ab11f2d89afffc9db7473f16206395c813 (diff) | |
download | frameworks_base-462c2177f73754458821cfc0441a863c1fa527e4.zip frameworks_base-462c2177f73754458821cfc0441a863c1fa527e4.tar.gz frameworks_base-462c2177f73754458821cfc0441a863c1fa527e4.tar.bz2 |
Check for ongoing detachment in AbsListView
BUG: 13167767
Change-Id: Ie1a828eadbb99daef46af77544f233fee09fd1bc
-rw-r--r-- | core/java/android/widget/AbsListView.java | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/core/java/android/widget/AbsListView.java b/core/java/android/widget/AbsListView.java index 3027be4..86fdae3 100644 --- a/core/java/android/widget/AbsListView.java +++ b/core/java/android/widget/AbsListView.java @@ -704,6 +704,11 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te private SavedState mPendingSync; /** + * Whether the view is in the process of detaching from its window. + */ + private boolean mIsDetaching; + + /** * Interface definition for a callback to be invoked when the list or grid * has been scrolled. */ @@ -2788,6 +2793,8 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te protected void onDetachedFromWindow() { super.onDetachedFromWindow(); + mIsDetaching = true; + // Dismiss the popup in case onSaveInstanceState() was not invoked dismissPopup(); @@ -2836,6 +2843,8 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te removeCallbacks(mTouchModeReset); mTouchModeReset.run(); } + + mIsDetaching = false; } @Override @@ -3462,7 +3471,7 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te mPositionScroller.stop(); } - if (!isAttachedToWindow()) { + if (mIsDetaching || !isAttachedToWindow()) { // Something isn't right. // Since we rely on being attached to get data set change notifications, // don't risk doing anything where we might try to resync and find things @@ -3701,7 +3710,7 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te mTouchMode = TOUCH_MODE_REST; child.setPressed(false); setPressed(false); - if (!mDataChanged && isAttachedToWindow()) { + if (!mDataChanged && !mIsDetaching && isAttachedToWindow()) { performClick.run(); } } @@ -3976,7 +3985,7 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te mPositionScroller.stop(); } - if (!isAttachedToWindow()) { + if (mIsDetaching || !isAttachedToWindow()) { // Something isn't right. // Since we rely on being attached to get data set change notifications, // don't risk doing anything where we might try to resync and find things |