Added overlay support for drawing/responding to text anchors.

Overlays let views draw and respond to touch events outside of their
bounds. This allows selection anchors to be friendlier and easier to
grab. This is currently private API, pending further evaluation.

Added themes/styles for text selection anchors.

Added assets for text selection anchors as provided by UX. The
left/right anchors are currently not suitable for use. They are here
for bookkeeping and replacement later. The theme currently uses the
'middle' anchor asset for all three. This will be changed once assets
are ready.

Change-Id: I01b21e5ae90cab201f86f38f2f5eeaf2bd7f6bcd
diff --git a/core/java/android/view/ViewRoot.java b/core/java/android/view/ViewRoot.java
index 57c9055..acec476 100644
--- a/core/java/android/view/ViewRoot.java
+++ b/core/java/android/view/ViewRoot.java
@@ -222,6 +222,8 @@
 
     private final int mDensity;
     
+    private boolean mHasOverlay;
+
     public static IWindowSession getWindowSession(Looper mainLooper) {
         synchronized (mStaticInit) {
             if (!mInitialized) {
@@ -1518,6 +1520,9 @@
                         canvas.setScreenDensity(scalingRequired
                                 ? DisplayMetrics.DENSITY_DEVICE : 0);
                         mView.draw(canvas);
+                        if (mHasOverlay) {
+                            mView.onDrawOverlay(canvas);
+                        }
                     } finally {
                         mAttachInfo.mIgnoreDirtyState = false;
                         canvas.restoreToCount(saveCount);
@@ -2914,6 +2919,19 @@
         return scrollToRectOrFocus(rectangle, immediate);
     }
 
+    /**
+     * @hide
+     */
+    public void childOverlayStateChanged(View child) {
+        final boolean oldState = mHasOverlay;
+        mHasOverlay = child.isOverlayEnabled();
+        // Invalidate the whole thing when we change overlay states just in case
+        // something left chunks of data drawn someplace it shouldn't have.
+        if (mHasOverlay != oldState) {
+            child.invalidate();
+        }
+    }
+
     class TakenSurfaceHolder extends BaseSurfaceHolder {
         @Override
         public boolean onAllowLockCanvas() {