Loading core/java/android/view/DragEvent.java +1 −1 Original line number Diff line number Diff line Loading @@ -195,7 +195,7 @@ public class DragEvent implements Parcelable { * {@link #ACTION_DRAG_ENTERED} while the drag shadow is still within the View object's bounding * box, but not within a descendant view that can accept the data. The {@link #getX()} and * {@link #getY()} methods supply * the X and Y position of of the drag point within the View object's bounding box. * the X and Y position of the drag point within the View object's bounding box. * <p> * A View receives an {@link #ACTION_DRAG_ENTERED} event before receiving any * ACTION_DRAG_LOCATION events. Loading core/java/android/view/View.java +11 −0 Original line number Diff line number Diff line Loading @@ -62,6 +62,7 @@ import android.content.Context; import android.content.ContextWrapper; import android.content.Intent; import android.content.res.ColorStateList; import android.content.res.CompatibilityInfo; import android.content.res.Configuration; import android.content.res.Resources; import android.content.res.TypedArray; Loading Loading @@ -27546,6 +27547,11 @@ public class View implements Drawable.Callback, KeyEvent.Callback, || (shadowTouchPoint.x < 0) || (shadowTouchPoint.y < 0)) { throw new IllegalStateException("Drag shadow dimensions must not be negative"); } final float overrideInvScale = CompatibilityInfo.getOverrideInvertedScale(); if (overrideInvScale != 1f) { shadowTouchPoint.x = (int) (shadowTouchPoint.x / overrideInvScale); shadowTouchPoint.y = (int) (shadowTouchPoint.y / overrideInvScale); } // Create 1x1 surface when zero surface size is specified because SurfaceControl.Builder // does not accept zero size surface. Loading @@ -27570,6 +27576,11 @@ public class View implements Drawable.Callback, KeyEvent.Callback, .setFormat(PixelFormat.TRANSLUCENT) .setCallsite("View.startDragAndDrop") .build(); if (overrideInvScale != 1f) { final SurfaceControl.Transaction transaction = new SurfaceControl.Transaction(); transaction.setMatrix(surfaceControl, 1 / overrideInvScale, 0, 0, 1 / overrideInvScale) .apply(); } final Surface surface = new Surface(); surface.copyFrom(surfaceControl); IBinder token = null; services/core/java/com/android/server/wm/DragDropController.java +3 −1 Original line number Diff line number Diff line Loading @@ -101,7 +101,8 @@ class DragDropController { float thumbCenterX, float thumbCenterY, ClipData data) { if (DEBUG_DRAG) { Slog.d(TAG_WM, "perform drag: win=" + window + " surface=" + surface + " flags=" + Integer.toHexString(flags) + " data=" + data); Integer.toHexString(flags) + " data=" + data + " touch(" + touchX + "," + touchY + ") thumb center(" + thumbCenterX + "," + thumbCenterY + ")"); } final IBinder dragToken = new Binder(); Loading Loading @@ -156,6 +157,7 @@ class DragDropController { mDragState.mPid = callerPid; mDragState.mUid = callerUid; mDragState.mOriginalAlpha = alpha; mDragState.mAnimatedScale = callingWin.mGlobalScale; mDragState.mToken = dragToken; mDragState.mDisplayContent = displayContent; mDragState.mData = data; Loading services/core/java/com/android/server/wm/DragState.java +4 −2 Original line number Diff line number Diff line Loading @@ -112,6 +112,7 @@ class DragState { int mTouchSource; boolean mDragResult; boolean mRelinquishDragSurfaceToDropTarget; float mAnimatedScale = 1.0f; float mOriginalAlpha; float mOriginalX, mOriginalY; float mCurrentX, mCurrentY; Loading Loading @@ -650,7 +651,8 @@ class DragState { PropertyValuesHolder.ofFloat( ANIMATED_PROPERTY_Y, mCurrentY - mThumbOffsetY, mOriginalY - mThumbOffsetY), PropertyValuesHolder.ofFloat(ANIMATED_PROPERTY_SCALE, 1, 1), PropertyValuesHolder.ofFloat(ANIMATED_PROPERTY_SCALE, mAnimatedScale, mAnimatedScale), PropertyValuesHolder.ofFloat( ANIMATED_PROPERTY_ALPHA, mOriginalAlpha, mOriginalAlpha / 2)); Loading Loading @@ -678,7 +680,7 @@ class DragState { ANIMATED_PROPERTY_X, mCurrentX - mThumbOffsetX, mCurrentX), PropertyValuesHolder.ofFloat( ANIMATED_PROPERTY_Y, mCurrentY - mThumbOffsetY, mCurrentY), PropertyValuesHolder.ofFloat(ANIMATED_PROPERTY_SCALE, 1, 0), PropertyValuesHolder.ofFloat(ANIMATED_PROPERTY_SCALE, mAnimatedScale, 0), PropertyValuesHolder.ofFloat(ANIMATED_PROPERTY_ALPHA, mOriginalAlpha, 0)); final AnimationListener listener = new AnimationListener(); animator.setDuration(MIN_ANIMATION_DURATION_MS); Loading Loading
core/java/android/view/DragEvent.java +1 −1 Original line number Diff line number Diff line Loading @@ -195,7 +195,7 @@ public class DragEvent implements Parcelable { * {@link #ACTION_DRAG_ENTERED} while the drag shadow is still within the View object's bounding * box, but not within a descendant view that can accept the data. The {@link #getX()} and * {@link #getY()} methods supply * the X and Y position of of the drag point within the View object's bounding box. * the X and Y position of the drag point within the View object's bounding box. * <p> * A View receives an {@link #ACTION_DRAG_ENTERED} event before receiving any * ACTION_DRAG_LOCATION events. Loading
core/java/android/view/View.java +11 −0 Original line number Diff line number Diff line Loading @@ -62,6 +62,7 @@ import android.content.Context; import android.content.ContextWrapper; import android.content.Intent; import android.content.res.ColorStateList; import android.content.res.CompatibilityInfo; import android.content.res.Configuration; import android.content.res.Resources; import android.content.res.TypedArray; Loading Loading @@ -27546,6 +27547,11 @@ public class View implements Drawable.Callback, KeyEvent.Callback, || (shadowTouchPoint.x < 0) || (shadowTouchPoint.y < 0)) { throw new IllegalStateException("Drag shadow dimensions must not be negative"); } final float overrideInvScale = CompatibilityInfo.getOverrideInvertedScale(); if (overrideInvScale != 1f) { shadowTouchPoint.x = (int) (shadowTouchPoint.x / overrideInvScale); shadowTouchPoint.y = (int) (shadowTouchPoint.y / overrideInvScale); } // Create 1x1 surface when zero surface size is specified because SurfaceControl.Builder // does not accept zero size surface. Loading @@ -27570,6 +27576,11 @@ public class View implements Drawable.Callback, KeyEvent.Callback, .setFormat(PixelFormat.TRANSLUCENT) .setCallsite("View.startDragAndDrop") .build(); if (overrideInvScale != 1f) { final SurfaceControl.Transaction transaction = new SurfaceControl.Transaction(); transaction.setMatrix(surfaceControl, 1 / overrideInvScale, 0, 0, 1 / overrideInvScale) .apply(); } final Surface surface = new Surface(); surface.copyFrom(surfaceControl); IBinder token = null;
services/core/java/com/android/server/wm/DragDropController.java +3 −1 Original line number Diff line number Diff line Loading @@ -101,7 +101,8 @@ class DragDropController { float thumbCenterX, float thumbCenterY, ClipData data) { if (DEBUG_DRAG) { Slog.d(TAG_WM, "perform drag: win=" + window + " surface=" + surface + " flags=" + Integer.toHexString(flags) + " data=" + data); Integer.toHexString(flags) + " data=" + data + " touch(" + touchX + "," + touchY + ") thumb center(" + thumbCenterX + "," + thumbCenterY + ")"); } final IBinder dragToken = new Binder(); Loading Loading @@ -156,6 +157,7 @@ class DragDropController { mDragState.mPid = callerPid; mDragState.mUid = callerUid; mDragState.mOriginalAlpha = alpha; mDragState.mAnimatedScale = callingWin.mGlobalScale; mDragState.mToken = dragToken; mDragState.mDisplayContent = displayContent; mDragState.mData = data; Loading
services/core/java/com/android/server/wm/DragState.java +4 −2 Original line number Diff line number Diff line Loading @@ -112,6 +112,7 @@ class DragState { int mTouchSource; boolean mDragResult; boolean mRelinquishDragSurfaceToDropTarget; float mAnimatedScale = 1.0f; float mOriginalAlpha; float mOriginalX, mOriginalY; float mCurrentX, mCurrentY; Loading Loading @@ -650,7 +651,8 @@ class DragState { PropertyValuesHolder.ofFloat( ANIMATED_PROPERTY_Y, mCurrentY - mThumbOffsetY, mOriginalY - mThumbOffsetY), PropertyValuesHolder.ofFloat(ANIMATED_PROPERTY_SCALE, 1, 1), PropertyValuesHolder.ofFloat(ANIMATED_PROPERTY_SCALE, mAnimatedScale, mAnimatedScale), PropertyValuesHolder.ofFloat( ANIMATED_PROPERTY_ALPHA, mOriginalAlpha, mOriginalAlpha / 2)); Loading Loading @@ -678,7 +680,7 @@ class DragState { ANIMATED_PROPERTY_X, mCurrentX - mThumbOffsetX, mCurrentX), PropertyValuesHolder.ofFloat( ANIMATED_PROPERTY_Y, mCurrentY - mThumbOffsetY, mCurrentY), PropertyValuesHolder.ofFloat(ANIMATED_PROPERTY_SCALE, 1, 0), PropertyValuesHolder.ofFloat(ANIMATED_PROPERTY_SCALE, mAnimatedScale, 0), PropertyValuesHolder.ofFloat(ANIMATED_PROPERTY_ALPHA, mOriginalAlpha, 0)); final AnimationListener listener = new AnimationListener(); animator.setDuration(MIN_ANIMATION_DURATION_MS); Loading