Merge "Adding debugging code for bug where recycled views still had parent" into jb-dev
diff --git a/packages/SystemUI/src/com/android/systemui/recent/RecentsHorizontalScrollView.java b/packages/SystemUI/src/com/android/systemui/recent/RecentsHorizontalScrollView.java
index 9f801b0..1302c1f 100644
--- a/packages/SystemUI/src/com/android/systemui/recent/RecentsHorizontalScrollView.java
+++ b/packages/SystemUI/src/com/android/systemui/recent/RecentsHorizontalScrollView.java
@@ -83,6 +83,12 @@
setLayoutTransition(null);
mLinearLayout.removeAllViews();
+ for (int i = 0; i < mRecycledViews.size(); i++) {
+ View child = mRecycledViews.get(i);
+ if (child.getParent() != null) {
+ throw new RuntimeException("Recycled child has a parent");
+ }
+ }
for (int i = 0; i < mAdapter.getCount(); i++) {
View old = null;
if (mRecycledViews.size() != 0) {
@@ -183,6 +189,9 @@
public void onChildDismissed(View v) {
mRecycledViews.add(v);
mLinearLayout.removeView(v);
+ if (v.getParent() != null) {
+ throw new RuntimeException("Recycled child has parent");
+ }
mCallback.handleSwipe(v);
// Restore the alpha/translation parameters to what they were before swiping
// (for when these items are recycled)
@@ -354,9 +363,15 @@
mNumItemsInOneScreenful =
(int) FloatMath.ceil(dm.widthPixels / (float) child.getMeasuredWidth());
mRecycledViews.add(child);
+ if (child.getParent() != null) {
+ throw new RuntimeException("First recycled child has parent");
+ }
for (int i = 0; i < mNumItemsInOneScreenful - 1; i++) {
mRecycledViews.add(mAdapter.createView(mLinearLayout));
+ if (mRecycledViews.get(mRecycledViews.size() - 1).getParent() != null) {
+ throw new RuntimeException("Recycled child has parent");
+ }
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/recent/RecentsVerticalScrollView.java b/packages/SystemUI/src/com/android/systemui/recent/RecentsVerticalScrollView.java
index c1597e0..3c71784 100644
--- a/packages/SystemUI/src/com/android/systemui/recent/RecentsVerticalScrollView.java
+++ b/packages/SystemUI/src/com/android/systemui/recent/RecentsVerticalScrollView.java
@@ -84,6 +84,12 @@
setLayoutTransition(null);
mLinearLayout.removeAllViews();
+ for (int i = 0; i < mRecycledViews.size(); i++) {
+ View child = mRecycledViews.get(i);
+ if (child.getParent() != null) {
+ throw new RuntimeException("Recycled child has parent");
+ }
+ }
// Once we can clear the data associated with individual item views,
// we can get rid of the removeAllViews() and the code below will
// recycle them.
@@ -190,6 +196,9 @@
public void onChildDismissed(View v) {
mRecycledViews.add(v);
mLinearLayout.removeView(v);
+ if (v.getParent() != null) {
+ throw new RuntimeException("Recycled child has parent");
+ }
mCallback.handleSwipe(v);
// Restore the alpha/translation parameters to what they were before swiping
// (for when these items are recycled)
@@ -363,9 +372,15 @@
mNumItemsInOneScreenful =
(int) FloatMath.ceil(dm.heightPixels / (float) child.getMeasuredHeight());
mRecycledViews.add(child);
+ if (child.getParent() != null) {
+ throw new RuntimeException("First recycled child has parent");
+ }
for (int i = 0; i < mNumItemsInOneScreenful - 1; i++) {
mRecycledViews.add(mAdapter.createView(mLinearLayout));
+ if (mRecycledViews.get(mRecycledViews.size() - 1).getParent() != null) {
+ throw new RuntimeException("Recycled child has parent");
+ }
}
}