Source:
private void assertDragAndDropResults(ComponentName sourceComponentName, String sourceMode, ComponentName targetComponentName, String targetMode, String expectedStartDragResult, String expectedDropResult, String expectedListenerResults) throws Exception { Log.e(TAG, "session: " + mSessionId + ", source: " + sourceMode + ", target: " + targetMode); if (supportsFreeform()) { Point displaySize = getDisplaySize(); launchFreeformActivity(sourceComponentName, sourceMode, mSourceLogTag, displaySize, true ); launchFreeformActivity(targetComponentName, targetMode, mTargetLogTag, displaySize, false ); } else { launchActivitiesInSplitScreen(getLaunchActivityBuilder() .setTargetActivity(sourceComponentName) .setIntentExtra(bundle -> { bundle.putString(EXTRA_MODE, sourceMode); bundle.putString(EXTRA_LOGTAG, mSourceLogTag); }), getLaunchActivityBuilder().setTargetActivity(targetComponentName) .setIntentExtra(bundle -> { bundle.putString(EXTRA_MODE, targetMode); bundle.putString(EXTRA_LOGTAG, mTargetLogTag); })); } mAmWmState.computeState(false); Point p1 = getWindowCenter(sourceComponentName); assertNotNull(p1); Point p2 = getWindowCenter(targetComponentName); assertNotNull(p2); TestLogService.registerClient(mSourceLogTag, RESULT_KEY_START_DRAG); TestLogService.registerClient(mTargetLogTag, RESULT_KEY_DRAG_ENDED); injectInput(p1, p2, SWIPE_STEPS); mSourceResults = TestLogService.getResultsForClient(mSourceLogTag, 1000); assertSourceResult(RESULT_KEY_START_DRAG, expectedStartDragResult); mTargetResults = TestLogService.getResultsForClient(mTargetLogTag, 1000); assertTargetResult(RESULT_KEY_DROP_RESULT, expectedDropResult); if (!RESULT_MISSING.equals(expectedDropResult)) { assertTargetResult(RESULT_KEY_ACCESS_BEFORE, RESULT_EXCEPTION); assertTargetResult(RESULT_KEY_ACCESS_AFTER, RESULT_EXCEPTION); } assertListenerResults(expectedListenerResults); }

Target:
private void assertDragAndDropResults(ComponentName sourceComponentName, String sourceMode, ComponentName targetComponentName, String targetMode, String expectedStartDragResult, String expectedDropResult, String expectedListenerResults) throws Exception { Log.e(TAG, "session: " + mSessionId + ", source: " + sourceMode + ", target: " + targetMode); if (supportsFreeform()) { Point displaySize = getDisplaySize(); launchFreeformActivity(sourceComponentName, sourceMode, mSourceLogTag, displaySize, true ); launchFreeformActivity(targetComponentName, targetMode, mTargetLogTag, displaySize, false ); } else { launchActivitiesInSplitScreen(getLaunchActivityBuilder() .setTargetActivity(sourceComponentName) .setIntentExtra(bundle -> { bundle.putString(EXTRA_MODE, sourceMode); bundle.putString(EXTRA_LOGTAG, mSourceLogTag); }), getLaunchActivityBuilder().setTargetActivity(targetComponentName) .setIntentExtra(bundle -> { bundle.putString(EXTRA_MODE, targetMode); bundle.putString(EXTRA_LOGTAG, mTargetLogTag); })); } Point p1 = getWindowCenter(sourceComponentName); assertNotNull(p1); Point p2 = getWindowCenter(targetComponentName); assertNotNull(p2); TestLogService.registerClient(mSourceLogTag, RESULT_KEY_START_DRAG); TestLogService.registerClient(mTargetLogTag, RESULT_KEY_DRAG_ENDED); injectInput(p1, p2, SWIPE_STEPS); mSourceResults = TestLogService.getResultsForClient(mSourceLogTag, 1000); assertSourceResult(RESULT_KEY_START_DRAG, expectedStartDragResult); mTargetResults = TestLogService.getResultsForClient(mTargetLogTag, 1000); assertTargetResult(RESULT_KEY_DROP_RESULT, expectedDropResult); if (!RESULT_MISSING.equals(expectedDropResult)) { assertTargetResult(RESULT_KEY_ACCESS_BEFORE, RESULT_EXCEPTION); assertTargetResult(RESULT_KEY_ACCESS_AFTER, RESULT_EXCEPTION); } assertListenerResults(expectedListenerResults); }