Fix invalidation issue for optimized/GL case.
The bug caused intermittent artifacts where some apps would not get
repainted until some overall screen invalidation occurred.
Change-Id: I82a3294429f15fe51cc8f4b47134e3b5540cb240
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java
index daf9ac4..e3a0715 100644
--- a/core/java/android/view/View.java
+++ b/core/java/android/view/View.java
@@ -6453,6 +6453,12 @@
mPrivateFlags &= ~DRAWING_CACHE_VALID;
final ViewParent p = mParent;
final AttachInfo ai = mAttachInfo;
+ if (p != null && ai != null && ai.mHardwareAccelerated) {
+ // fast-track for GL-enabled applications; just invalidate the whole hierarchy
+ // with a null dirty rect, which tells the ViewRoot to redraw everything
+ p.invalidateChild(this, null);
+ return;
+ }
if (p != null && ai != null && l < r && t < b) {
final int scrollX = mScrollX;
final int scrollY = mScrollY;
@@ -6496,6 +6502,12 @@
}
final AttachInfo ai = mAttachInfo;
final ViewParent p = mParent;
+ if (p != null && ai != null && ai.mHardwareAccelerated) {
+ // fast-track for GL-enabled applications; just invalidate the whole hierarchy
+ // with a null dirty rect, which tells the ViewRoot to redraw everything
+ p.invalidateChild(this, null);
+ return;
+ }
if (p != null && ai != null) {
final Rect r = ai.mTmpInvalRect;
diff --git a/core/java/android/view/ViewGroup.java b/core/java/android/view/ViewGroup.java
index ac63742..7b81b8f 100644
--- a/core/java/android/view/ViewGroup.java
+++ b/core/java/android/view/ViewGroup.java
@@ -2349,9 +2349,11 @@
child.draw(canvas);
}
} else {
+ child.mPrivateFlags &= ~DIRTY_MASK;
((HardwareCanvas) canvas).drawDisplayList(displayList);
}
} else if (cache != null) {
+ child.mPrivateFlags &= ~DIRTY_MASK;
final Paint cachePaint = mCachePaint;
if (alpha < 1.0f) {
cachePaint.setAlpha((int) (alpha * 255));
@@ -2583,6 +2585,7 @@
// addViewInner() will call child.requestLayout() when setting the new LayoutParams
// therefore, we call requestLayout() on ourselves before, so that the child's request
// will be blocked at our level
+ child.mPrivateFlags &= ~DIRTY_MASK;
requestLayout();
invalidate();
addViewInner(child, index, params, false);