am f2feb0fa: am 48a65d99: Merge change I8c5f2fc3 into eclair

Merge commit 'f2feb0faa266e5e0844c20a8adb9cdb5f360322f' into eclair-mr2-plus-aosp

* commit 'f2feb0faa266e5e0844c20a8adb9cdb5f360322f':
  Fix invalidate code path (#2273209).
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java
index 0b87536..1fc3678 100644
--- a/core/java/android/view/View.java
+++ b/core/java/android/view/View.java
@@ -4324,8 +4324,9 @@
             requestLayout();
             invalidate();
 
-            if (((mViewFlags & VISIBILITY_MASK) == GONE) && hasFocus()) {
-                clearFocus();
+            if (((mViewFlags & VISIBILITY_MASK) == GONE)) {
+                if (hasFocus()) clearFocus();
+                destroyDrawingCache();
             }
             if (mAttachInfo != null) {
                 mAttachInfo.mViewVisibilityChanged = true;
@@ -6283,6 +6284,7 @@
             canvas.translate(-mScrollX, -mScrollY);
 
             mPrivateFlags |= DRAWN;
+            mPrivateFlags |= DRAWING_CACHE_VALID;
 
             // Fast path for layouts with no backgrounds
             if ((mPrivateFlags & SKIP_DRAW) == SKIP_DRAW) {
@@ -6301,7 +6303,6 @@
                 // Restore the cached Canvas for our siblings
                 attachInfo.mCanvas = canvas;
             }
-            mPrivateFlags |= DRAWING_CACHE_VALID;
         }
     }