summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/java/android/view/ViewGroup.java28
-rw-r--r--core/java/android/view/ViewOverlay.java24
2 files changed, 12 insertions, 40 deletions
diff --git a/core/java/android/view/ViewGroup.java b/core/java/android/view/ViewGroup.java
index 1977ef5ae989..b78348237864 100644
--- a/core/java/android/view/ViewGroup.java
+++ b/core/java/android/view/ViewGroup.java
@@ -5823,34 +5823,6 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
}
/**
- * Quick invalidation method that simply transforms the dirty rect into the parent's
- * coordinate system, pruning the invalidation if the parent has already been invalidated.
- *
- * @hide
- */
- protected ViewParent damageChildInParent(int left, int top, final Rect dirty) {
- if ((mPrivateFlags & PFLAG_DRAWN) != 0
- || (mPrivateFlags & PFLAG_DRAWING_CACHE_VALID) != 0) {
- dirty.offset(left - mScrollX, top - mScrollY);
- if ((mGroupFlags & FLAG_CLIP_CHILDREN) == 0) {
- dirty.union(0, 0, mRight - mLeft, mBottom - mTop);
- }
-
- if ((mGroupFlags & FLAG_CLIP_CHILDREN) == 0 ||
- dirty.intersect(0, 0, mRight - mLeft, mBottom - mTop)) {
-
- if (!getMatrix().isIdentity()) {
- transformRect(dirty);
- }
-
- return mParent;
- }
- }
-
- return null;
- }
-
- /**
* Offset a rectangle that is in a descendant's coordinate
* space into our coordinate space.
* @param descendant A descendant of this view
diff --git a/core/java/android/view/ViewOverlay.java b/core/java/android/view/ViewOverlay.java
index f061370cc581..21123c167792 100644
--- a/core/java/android/view/ViewOverlay.java
+++ b/core/java/android/view/ViewOverlay.java
@@ -330,20 +330,20 @@ public class ViewOverlay {
@Override
public void onDescendantInvalidated(@NonNull View child, @NonNull View target) {
- if (mHostView != null && mHostView.getParent() != null) {
- mHostView.getParent().onDescendantInvalidated(mHostView, target);
- }
- }
+ if (mHostView != null) {
+ if (mHostView instanceof ViewGroup) {
+ // Propagate invalidate through the host...
+ ((ViewGroup) mHostView).onDescendantInvalidated(mHostView, target);
- /**
- * @hide
- */
- @Override
- protected ViewParent damageChildInParent(int left, int top, Rect dirty) {
- if (mHostView instanceof ViewGroup) {
- return ((ViewGroup) mHostView).damageChildInParent(left, top, dirty);
+ // ...and also this view, since it will hold the descendant, and must later
+ // propagate the calls to update display lists if dirty
+ super.onDescendantInvalidated(child, target);
+ } else {
+ // Can't use onDescendantInvalidated because host isn't a ViewGroup - fall back
+ // to invalidating.
+ invalidate();
+ }
}
- return null;
}
@Override