OSDN Git Service

am 2a576d9e: Merge "Invalidate old accessibility bounds on CONTENT_CHANGE" into mnc-dev
authorAlan Viverette <alanv@google.com>
Fri, 15 May 2015 20:23:55 +0000 (20:23 +0000)
committerAndroid Git Automerger <android-git-automerger@android.com>
Fri, 15 May 2015 20:23:55 +0000 (20:23 +0000)
* commit '2a576d9ec1ec353ee2278f2da01e685b6b7b24ee':
  Invalidate old accessibility bounds on CONTENT_CHANGE

core/java/android/view/ViewRootImpl.java
core/java/android/view/accessibility/AccessibilityNodeInfo.java

index 06dddfb..b7d902c 100644 (file)
@@ -966,6 +966,12 @@ public final class ViewRootImpl implements ViewParent,
             }
         }
 
+        invalidateRectOnScreen(dirty);
+
+        return null;
+    }
+
+    private void invalidateRectOnScreen(Rect dirty) {
         final Rect localDirty = mDirty;
         if (!localDirty.isEmpty() && !localDirty.contains(dirty)) {
             mAttachInfo.mSetIgnoreDirtyState = true;
@@ -985,8 +991,6 @@ public final class ViewRootImpl implements ViewParent,
         if (!mWillDrawSoon && (intersected || mIsAnimating)) {
             scheduleTraversals();
         }
-
-        return null;
     }
 
     void setWindowStopped(boolean stopped) {
@@ -6398,7 +6402,14 @@ public final class ViewRootImpl implements ViewParent,
         }
 
         // Refresh the node for the focused virtual view.
+        final Rect oldBounds = mTempRect;
+        mAccessibilityFocusedVirtualView.getBoundsInScreen(oldBounds);
         mAccessibilityFocusedVirtualView = provider.createAccessibilityNodeInfo(focusedChildId);
+        final Rect newBounds = mAccessibilityFocusedVirtualView.getBoundsInScreen();
+        if (!oldBounds.equals(newBounds)) {
+            oldBounds.union(newBounds);
+            invalidateRectOnScreen(oldBounds);
+        }
     }
 
     @Override
index 42e6766..901a32d 100644 (file)
@@ -1495,6 +1495,15 @@ public class AccessibilityNodeInfo implements Parcelable {
     }
 
     /**
+     * Returns the actual rect containing the node bounds in screen coordinates.
+     *
+     * @hide Not safe to expose outside the framework.
+     */
+    public Rect getBoundsInScreen() {
+        return mBoundsInScreen;
+    }
+
+    /**
      * Sets the node bounds in screen coordinates.
      * <p>
      *   <strong>Note:</strong> Cannot be called from an