6/ Fix some flakey issues with dragging to split

- Ensure that the task info activity type always matches the actual task
  activity type (can be different than the window configuration type)
- Ensure that the targets hit rects respect the insets, and that dragging
  out of all targets (but still within the window) will hide the last
  target
- Work around race with launching secondary task when splitting, wait
  until the split screen task org has moved existing tasks to secondary
  split root before starting the new task, and also update the home task
  position when going home (b/172686383)
- Add a timeout to clean up drag surfaces if SysUI crashes while
  mid-drag
- Clean up some other calls to get activity type/win mode

Bug: 169894807
Test: atest DragDropControllerTests
Test: atest DragAndDropPolicyTest
Test: atest SplitScreenTests
Change-Id: I7ae11cc38b1e927d955798ef1056e17c9e435758
This commit is contained in:
Winson Chung
2020-11-05 15:57:36 -08:00
parent e3d75ac262
commit 6dd73e98d7
13 changed files with 124 additions and 46 deletions

View File

@@ -35,6 +35,7 @@ import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyBoolean;
import static org.mockito.ArgumentMatchers.anyInt;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.doAnswer;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.reset;
@@ -68,10 +69,13 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import java.util.function.Consumer;
/**
* Tests for the drag and drop policy.
@@ -124,6 +128,12 @@ public class DragAndDropPolicyTest {
doReturn(new Rect(50, 0, 100, 100)).when(divider)
.getNonMinimizedSplitScreenSecondaryBounds();
doAnswer((Answer<Void>) invocation -> {
Consumer<Boolean> callback = invocation.getArgument(0);
callback.accept(true);
return null;
}).when(mSplitScreen).registerInSplitScreenListener(any());
mPolicy = new DragAndDropPolicy(mContext, mIActivityTaskManager, mSplitScreen, mStarter);
mActivityClipData = createClipData(MIMETYPE_APPLICATION_ACTIVITY);
mNonResizeableActivityClipData = createClipData(MIMETYPE_APPLICATION_ACTIVITY);