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

Commit 27436858 authored by Ben Lin's avatar Ben Lin
Browse files

DO NOT MERGE Invalidate D&D operations when destination DocInfo is null.

Test: Updated unit tests.
Bug: 37641417
Change-Id: I01aa0d6c3a2a1d62668761a6a97581c6d9b5a14d
parent 85622acc
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -40,10 +40,16 @@ public final class DragAndDropHelper {
     * localState isn't carried over from one process to another.
     */
    public static boolean canCopyTo(Object dragLocalState, DocumentInfo dst) {
        if (dst == null) {
            if (DEBUG) Log.d(TAG, "Invalid destination. Ignoring.");
            return false;
        }

        if (dragLocalState == null || !(dragLocalState instanceof List<?>)) {
            if (DEBUG) Log.d(TAG, "Invalid local state object. Will allow copy.");
            return true;
        }

        List<?> src = (List<?>) dragLocalState;
        if (src.contains(dst)) {
            if (DEBUG) Log.d(TAG, "Drop target same as source. Ignoring.");
+1 −0
Original line number Diff line number Diff line
@@ -407,6 +407,7 @@ public class ActionHandlerTest {
        // DragEvent gets recycled in Android, so it is possible that by the time the callback is
        // called, event.getLocalState() and event.getClipData() returns null. This tests to ensure
        // our Clipper is getting the original CipData passed in.
        mEnv.docs.nextRootDocument = TestEnv.FOLDER_0;
        mHandler = new ActionHandler<>(
                mActivity,
                mEnv.state,