Loading src/com/android/documentsui/DragAndDropHelper.java +6 −0 Original line number Diff line number Diff line Loading @@ -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."); Loading tests/unit/com/android/documentsui/files/ActionHandlerTest.java +1 −0 Original line number Diff line number Diff line Loading @@ -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, Loading Loading
src/com/android/documentsui/DragAndDropHelper.java +6 −0 Original line number Diff line number Diff line Loading @@ -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."); Loading
tests/unit/com/android/documentsui/files/ActionHandlerTest.java +1 −0 Original line number Diff line number Diff line Loading @@ -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, Loading