Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 02d2b3ba authored by Christopher Tate's avatar Christopher Tate
Browse files

API CHANGE: startDrag() now takes "int flags" instead of "boolean localOnly"

There will be, in the future, a flag (View.DRAG_FLAG_GLOBAL) that means
for the drag to be cross-application.  For now that flag constant is @hide
and furthermore the server-side implementation strips it, enforcing
local-only drags.

Change-Id: I8db840480ab90e18a5b8ecf29d62b4e6eafd405e
parent 5220834c
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -216462,10 +216462,10 @@
</parameter>
<parameter name="shadowBuilder" type="android.view.View.DragShadowBuilder">
</parameter>
<parameter name="myWindowOnly" type="boolean">
</parameter>
<parameter name="myLocalState" type="java.lang.Object">
</parameter>
<parameter name="flags" type="int">
</parameter>
</method>
<method name="unscheduleDrawable"
 return="void"
@@ -257994,7 +257994,7 @@
 deprecated="not deprecated"
 visibility="public"
>
<parameter name="t" type="T">
<parameter name="arg0" type="T">
</parameter>
</method>
</interface>
+1 −1
Original line number Diff line number Diff line
@@ -121,7 +121,7 @@ interface IWindowSession {
     * the drag to the OS and passes that as the return value.  A return value of
     * null indicates failure.
     */
    IBinder prepareDrag(IWindow window, boolean localOnly,
    IBinder prepareDrag(IWindow window, int flags,
            int thumbnailWidth, int thumbnailHeight, out Surface outSurface);

    /**
+11 −6
Original line number Diff line number Diff line
@@ -2137,6 +2137,12 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility
     */
    boolean mCanAcceptDrop;

    /**
     * Flag indicating that a drag can cross window boundaries
     * @hide
     */
    public static final int DRAG_FLAG_GLOBAL = 1;

    /**
     * Position of the vertical scroll bar.
     */
@@ -10633,22 +10639,21 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility
     *
     * @param data !!! TODO
     * @param shadowBuilder !!! TODO
     * @param myWindowOnly When {@code true}, indicates that the drag operation should be
     *     restricted to the calling application. In this case only the calling application
     *     will see any DragEvents related to this drag operation.
     * @param myLocalState An arbitrary object that will be passed as part of every DragEvent
     *     delivered to the calling application during the course of the current drag operation.
     *     This object is private to the application that called startDrag(), and is not
     *     visible to other applications. It provides a lightweight way for the application to
     *     propagate information from the initiator to the recipient of a drag within its own
     *     application; for example, to help disambiguate between 'copy' and 'move' semantics.
     * @param flags Flags affecting the drag operation.  At present no flags are defined;
     *     pass 0 for this parameter.
     * @return {@code true} if the drag operation was initiated successfully; {@code false} if
     *     an error prevented the drag from taking place.
     */
    public final boolean startDrag(ClipData data, DragShadowBuilder shadowBuilder,
            boolean myWindowOnly, Object myLocalState) {
            Object myLocalState, int flags) {
        if (ViewDebug.DEBUG_DRAG) {
            Log.d(VIEW_LOG_TAG, "startDrag: data=" + data + " local=" + myWindowOnly);
            Log.d(VIEW_LOG_TAG, "startDrag: data=" + data + " flags=" + flags);
        }
        boolean okay = false;

@@ -10668,7 +10673,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility
        Surface surface = new Surface();
        try {
            IBinder token = mAttachInfo.mSession.prepareDrag(mAttachInfo.mWindow,
                    myWindowOnly, shadowSize.x, shadowSize.y, surface);
                    flags, shadowSize.x, shadowSize.y, surface);
            if (ViewDebug.DEBUG_DRAG) Log.d(VIEW_LOG_TAG, "prepareDrag returned token=" + token
                    + " surface=" + surface);
            if (token != null) {
+1 −1
Original line number Diff line number Diff line
@@ -8104,7 +8104,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
                CharSequence selectedText = mTransformed.subSequence(start, end);
                ClipData data = ClipData.newPlainText(null, null, selectedText);
                DragLocalState localState = new DragLocalState(this, start, end);
                startDrag(data, getTextThumbnailBuilder(selectedText), false, localState);
                startDrag(data, getTextThumbnailBuilder(selectedText), localState, 0);
                stopSelectionActionMode();
            } else {
                updateSelectedRegion();
+1 −1
Original line number Diff line number Diff line
@@ -163,7 +163,7 @@ public class ShirtPocket extends ImageView {
                        shadow = new DragShadowBuilder(mWindow.findViewById(R.id.preview));
                    }

                    v.startDrag(clip, shadow, false, null);
                    v.startDrag(clip, shadow, null, 0);

                    // TODO: only discard the clipping if it was accepted
                    stash(null);
Loading