summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Romain Guy <romainguy@google.com> 2013-06-07 15:36:49 -0700
committer The Android Automerger <android-build@android.com> 2013-06-10 15:17:48 -0700
commit3ad5dfda321b3ccd3cde0a00c724d143d2ac6505 (patch)
tree10c441dd8fa1d2f7ff5d7d58a68d70ddbb52f69f
parent9e87efbb007bd289f666d166fb69b8c638ae5404 (diff)
Don't orphan footers with transient state
Bug #8725945 Selecting text in an EditText causes the View to have transient state. This would in turn cause the View to be removed from its ListView parent. When removed, the EditText would lose its AttachInfo, causing all sorts of problems. Headers and footers must not be removed, only detached. This is the part of the fix in AbsListView. Fixing AbsListView triggered a second bug: when a View is removed from the Window manager, it would keep its parent assigned, thus making it impossible to add it again to the window manager. When a ViewRootImpl goes through doDie(), it must set its content view's parent to null to properly cleanup. Change-Id: I0489daa74f8f7fcf85526f0928f8925ec30d4f42
-rw-r--r--core/java/android/view/ViewRootImpl.java1
-rw-r--r--core/java/android/widget/AbsListView.java4
2 files changed, 3 insertions, 2 deletions
diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java
index bbf5ae933153..6b2ed912d9d4 100644
--- a/core/java/android/view/ViewRootImpl.java
+++ b/core/java/android/view/ViewRootImpl.java
@@ -2829,6 +2829,7 @@ public final class ViewRootImpl implements ViewParent,
setAccessibilityFocus(null, null);
+ mView.assignParent(null);
mView = null;
mAttachInfo.mRootView = null;
mAttachInfo.mSurface = null;
diff --git a/core/java/android/widget/AbsListView.java b/core/java/android/widget/AbsListView.java
index bf662924b7f3..219891c4627b 100644
--- a/core/java/android/widget/AbsListView.java
+++ b/core/java/android/widget/AbsListView.java
@@ -6390,7 +6390,7 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
int viewType = lp.viewType;
final boolean scrapHasTransientState = scrap.hasTransientState();
if (!shouldRecycleViewType(viewType) || scrapHasTransientState) {
- if (viewType != ITEM_VIEW_TYPE_HEADER_OR_FOOTER || scrapHasTransientState) {
+ if (viewType != ITEM_VIEW_TYPE_HEADER_OR_FOOTER && scrapHasTransientState) {
if (mSkippedScrap == null) {
mSkippedScrap = new ArrayList<View>();
}
@@ -6464,7 +6464,7 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
final boolean scrapHasTransientState = victim.hasTransientState();
if (!shouldRecycleViewType(whichScrap) || scrapHasTransientState) {
// Do not move views that should be ignored
- if (whichScrap != ITEM_VIEW_TYPE_HEADER_OR_FOOTER ||
+ if (whichScrap != ITEM_VIEW_TYPE_HEADER_OR_FOOTER &&
scrapHasTransientState) {
removeDetachedView(victim, false);
}