Refinements to drag/drop

Thumbnail measurement & drawing has been moved out into a delegate
class called View.DragThumbnailBuilder.  This consolidates the
thumbnail-related code as well as ensuring that the drag initiator
does not have to know a priori where to place the thumbnail relative
to the touch point *before* the thumbnail measurement step, as was
previously the case.

startDrag() no longer needs to be told where the current touch point
is at the time the drag is launched.

Drag events are now dispatched only to VISIBLE views.

Dispatch shouldn't double-recycle events any more when the target
window is local to the system process.

Change-Id: I49419103765a0cad2e18ddfcdd6dacb94daf1ff1
diff --git a/core/java/android/view/ViewRoot.java b/core/java/android/view/ViewRoot.java
index c63f7d6..155122f 100644
--- a/core/java/android/view/ViewRoot.java
+++ b/core/java/android/view/ViewRoot.java
@@ -24,6 +24,7 @@
 import android.graphics.Canvas;
 import android.graphics.PixelFormat;
 import android.graphics.PorterDuff;
+import android.graphics.Point;
 import android.graphics.PointF;
 import android.graphics.Rect;
 import android.graphics.Region;
@@ -205,6 +206,7 @@
     ClipDescription mDragDescription;
     View mCurrentDragView;
     final PointF mDragPoint = new PointF();
+    final PointF mLastTouchPoint = new PointF();
 
     /**
      * see {@link #playSoundEffect(int)}
@@ -2024,6 +2026,9 @@
             if (MEASURE_LATENCY) {
                 lt.sample("A Dispatching TouchEvents", System.nanoTime() - event.getEventTimeNano());
             }
+            // cache for possible drag-initiation
+            mLastTouchPoint.x = event.getRawX();
+            mLastTouchPoint.y = event.getRawY();
             handled = mView.dispatchTouchEvent(event);
             if (MEASURE_LATENCY) {
                 lt.sample("B Dispatched TouchEvents ", System.nanoTime() - event.getEventTimeNano());
@@ -2509,6 +2514,11 @@
         event.recycle();
     }
 
+    public void getLastTouchPoint(Point outLocation) {
+        outLocation.x = (int) mLastTouchPoint.x;
+        outLocation.y = (int) mLastTouchPoint.y;
+    }
+
     public void setDragFocus(DragEvent event, View newDragTarget) {
         final int action = event.mAction;
         // If we've dragged off of a view, send it the EXITED message