Merge "Rename WindowDecor classes for Desktop Mode." into tm-qpr-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
eeaee6e734
@@ -93,7 +93,7 @@ import com.android.wm.shell.unfold.animation.SplitTaskUnfoldAnimator;
|
|||||||
import com.android.wm.shell.unfold.animation.UnfoldTaskAnimator;
|
import com.android.wm.shell.unfold.animation.UnfoldTaskAnimator;
|
||||||
import com.android.wm.shell.unfold.qualifier.UnfoldShellTransition;
|
import com.android.wm.shell.unfold.qualifier.UnfoldShellTransition;
|
||||||
import com.android.wm.shell.unfold.qualifier.UnfoldTransition;
|
import com.android.wm.shell.unfold.qualifier.UnfoldTransition;
|
||||||
import com.android.wm.shell.windowdecor.CaptionWindowDecorViewModel;
|
import com.android.wm.shell.windowdecor.DesktopModeWindowDecorViewModel;
|
||||||
import com.android.wm.shell.windowdecor.WindowDecorViewModel;
|
import com.android.wm.shell.windowdecor.WindowDecorViewModel;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@@ -192,7 +192,7 @@ public abstract class WMShellModule {
|
|||||||
SyncTransactionQueue syncQueue,
|
SyncTransactionQueue syncQueue,
|
||||||
Optional<DesktopModeController> desktopModeController,
|
Optional<DesktopModeController> desktopModeController,
|
||||||
Optional<DesktopTasksController> desktopTasksController) {
|
Optional<DesktopTasksController> desktopTasksController) {
|
||||||
return new CaptionWindowDecorViewModel(
|
return new DesktopModeWindowDecorViewModel(
|
||||||
context,
|
context,
|
||||||
mainHandler,
|
mainHandler,
|
||||||
mainChoreographer,
|
mainChoreographer,
|
||||||
|
|||||||
@@ -61,12 +61,12 @@ import java.util.Optional;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* View model for the window decoration with a caption and shadows. Works with
|
* View model for the window decoration with a caption and shadows. Works with
|
||||||
* {@link CaptionWindowDecoration}.
|
* {@link DesktopModeWindowDecoration}.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class CaptionWindowDecorViewModel implements WindowDecorViewModel {
|
public class DesktopModeWindowDecorViewModel implements WindowDecorViewModel {
|
||||||
private static final String TAG = "CaptionViewModel";
|
private static final String TAG = "DesktopModeWindowDecorViewModel";
|
||||||
private final CaptionWindowDecoration.Factory mCaptionWindowDecorFactory;
|
private final DesktopModeWindowDecoration.Factory mDesktopModeWindowDecorFactory;
|
||||||
private final ActivityTaskManager mActivityTaskManager;
|
private final ActivityTaskManager mActivityTaskManager;
|
||||||
private final ShellTaskOrganizer mTaskOrganizer;
|
private final ShellTaskOrganizer mTaskOrganizer;
|
||||||
private final Context mContext;
|
private final Context mContext;
|
||||||
@@ -81,11 +81,12 @@ public class CaptionWindowDecorViewModel implements WindowDecorViewModel {
|
|||||||
|
|
||||||
private SparseArray<EventReceiver> mEventReceiversByDisplay = new SparseArray<>();
|
private SparseArray<EventReceiver> mEventReceiversByDisplay = new SparseArray<>();
|
||||||
|
|
||||||
private final SparseArray<CaptionWindowDecoration> mWindowDecorByTaskId = new SparseArray<>();
|
private final SparseArray<DesktopModeWindowDecoration> mWindowDecorByTaskId =
|
||||||
|
new SparseArray<>();
|
||||||
private final DragStartListenerImpl mDragStartListener = new DragStartListenerImpl();
|
private final DragStartListenerImpl mDragStartListener = new DragStartListenerImpl();
|
||||||
private InputMonitorFactory mInputMonitorFactory;
|
private InputMonitorFactory mInputMonitorFactory;
|
||||||
|
|
||||||
public CaptionWindowDecorViewModel(
|
public DesktopModeWindowDecorViewModel(
|
||||||
Context context,
|
Context context,
|
||||||
Handler mainHandler,
|
Handler mainHandler,
|
||||||
Choreographer mainChoreographer,
|
Choreographer mainChoreographer,
|
||||||
@@ -103,12 +104,12 @@ public class CaptionWindowDecorViewModel implements WindowDecorViewModel {
|
|||||||
syncQueue,
|
syncQueue,
|
||||||
desktopModeController,
|
desktopModeController,
|
||||||
desktopTasksController,
|
desktopTasksController,
|
||||||
new CaptionWindowDecoration.Factory(),
|
new DesktopModeWindowDecoration.Factory(),
|
||||||
new InputMonitorFactory());
|
new InputMonitorFactory());
|
||||||
}
|
}
|
||||||
|
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
CaptionWindowDecorViewModel(
|
DesktopModeWindowDecorViewModel(
|
||||||
Context context,
|
Context context,
|
||||||
Handler mainHandler,
|
Handler mainHandler,
|
||||||
Choreographer mainChoreographer,
|
Choreographer mainChoreographer,
|
||||||
@@ -117,7 +118,7 @@ public class CaptionWindowDecorViewModel implements WindowDecorViewModel {
|
|||||||
SyncTransactionQueue syncQueue,
|
SyncTransactionQueue syncQueue,
|
||||||
Optional<DesktopModeController> desktopModeController,
|
Optional<DesktopModeController> desktopModeController,
|
||||||
Optional<DesktopTasksController> desktopTasksController,
|
Optional<DesktopTasksController> desktopTasksController,
|
||||||
CaptionWindowDecoration.Factory captionWindowDecorFactory,
|
DesktopModeWindowDecoration.Factory desktopModeWindowDecorFactory,
|
||||||
InputMonitorFactory inputMonitorFactory) {
|
InputMonitorFactory inputMonitorFactory) {
|
||||||
mContext = context;
|
mContext = context;
|
||||||
mMainHandler = mainHandler;
|
mMainHandler = mainHandler;
|
||||||
@@ -129,7 +130,7 @@ public class CaptionWindowDecorViewModel implements WindowDecorViewModel {
|
|||||||
mDesktopModeController = desktopModeController;
|
mDesktopModeController = desktopModeController;
|
||||||
mDesktopTasksController = desktopTasksController;
|
mDesktopTasksController = desktopTasksController;
|
||||||
|
|
||||||
mCaptionWindowDecorFactory = captionWindowDecorFactory;
|
mDesktopModeWindowDecorFactory = desktopModeWindowDecorFactory;
|
||||||
mInputMonitorFactory = inputMonitorFactory;
|
mInputMonitorFactory = inputMonitorFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -151,7 +152,7 @@ public class CaptionWindowDecorViewModel implements WindowDecorViewModel {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onTaskInfoChanged(RunningTaskInfo taskInfo) {
|
public void onTaskInfoChanged(RunningTaskInfo taskInfo) {
|
||||||
final CaptionWindowDecoration decoration = mWindowDecorByTaskId.get(taskInfo.taskId);
|
final DesktopModeWindowDecoration decoration = mWindowDecorByTaskId.get(taskInfo.taskId);
|
||||||
|
|
||||||
if (decoration == null) return;
|
if (decoration == null) return;
|
||||||
|
|
||||||
@@ -170,7 +171,7 @@ public class CaptionWindowDecorViewModel implements WindowDecorViewModel {
|
|||||||
SurfaceControl taskSurface,
|
SurfaceControl taskSurface,
|
||||||
SurfaceControl.Transaction startT,
|
SurfaceControl.Transaction startT,
|
||||||
SurfaceControl.Transaction finishT) {
|
SurfaceControl.Transaction finishT) {
|
||||||
final CaptionWindowDecoration decoration = mWindowDecorByTaskId.get(taskInfo.taskId);
|
final DesktopModeWindowDecoration decoration = mWindowDecorByTaskId.get(taskInfo.taskId);
|
||||||
|
|
||||||
if (!shouldShowWindowDecor(taskInfo)) {
|
if (!shouldShowWindowDecor(taskInfo)) {
|
||||||
if (decoration != null) {
|
if (decoration != null) {
|
||||||
@@ -191,7 +192,7 @@ public class CaptionWindowDecorViewModel implements WindowDecorViewModel {
|
|||||||
RunningTaskInfo taskInfo,
|
RunningTaskInfo taskInfo,
|
||||||
SurfaceControl.Transaction startT,
|
SurfaceControl.Transaction startT,
|
||||||
SurfaceControl.Transaction finishT) {
|
SurfaceControl.Transaction finishT) {
|
||||||
final CaptionWindowDecoration decoration = mWindowDecorByTaskId.get(taskInfo.taskId);
|
final DesktopModeWindowDecoration decoration = mWindowDecorByTaskId.get(taskInfo.taskId);
|
||||||
if (decoration == null) return;
|
if (decoration == null) return;
|
||||||
|
|
||||||
decoration.relayout(taskInfo, startT, finishT);
|
decoration.relayout(taskInfo, startT, finishT);
|
||||||
@@ -199,7 +200,7 @@ public class CaptionWindowDecorViewModel implements WindowDecorViewModel {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void destroyWindowDecoration(RunningTaskInfo taskInfo) {
|
public void destroyWindowDecoration(RunningTaskInfo taskInfo) {
|
||||||
final CaptionWindowDecoration decoration =
|
final DesktopModeWindowDecoration decoration =
|
||||||
mWindowDecorByTaskId.removeReturnOld(taskInfo.taskId);
|
mWindowDecorByTaskId.removeReturnOld(taskInfo.taskId);
|
||||||
if (decoration == null) return;
|
if (decoration == null) return;
|
||||||
|
|
||||||
@@ -232,7 +233,7 @@ public class CaptionWindowDecorViewModel implements WindowDecorViewModel {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
CaptionWindowDecoration decoration = mWindowDecorByTaskId.get(mTaskId);
|
DesktopModeWindowDecoration decoration = mWindowDecorByTaskId.get(mTaskId);
|
||||||
final int id = v.getId();
|
final int id = v.getId();
|
||||||
if (id == R.id.close_window) {
|
if (id == R.id.close_window) {
|
||||||
WindowContainerTransaction wct = new WindowContainerTransaction();
|
WindowContainerTransaction wct = new WindowContainerTransaction();
|
||||||
@@ -373,7 +374,7 @@ public class CaptionWindowDecorViewModel implements WindowDecorViewModel {
|
|||||||
boolean handled = false;
|
boolean handled = false;
|
||||||
if (event instanceof MotionEvent) {
|
if (event instanceof MotionEvent) {
|
||||||
handled = true;
|
handled = true;
|
||||||
CaptionWindowDecorViewModel.this
|
DesktopModeWindowDecorViewModel.this
|
||||||
.handleReceivedMotionEvent((MotionEvent) event, mInputMonitor);
|
.handleReceivedMotionEvent((MotionEvent) event, mInputMonitor);
|
||||||
}
|
}
|
||||||
finishInputEvent(event, handled);
|
finishInputEvent(event, handled);
|
||||||
@@ -433,7 +434,7 @@ public class CaptionWindowDecorViewModel implements WindowDecorViewModel {
|
|||||||
*/
|
*/
|
||||||
private void handleReceivedMotionEvent(MotionEvent ev, InputMonitor inputMonitor) {
|
private void handleReceivedMotionEvent(MotionEvent ev, InputMonitor inputMonitor) {
|
||||||
if (DesktopModeStatus.isProto2Enabled()) {
|
if (DesktopModeStatus.isProto2Enabled()) {
|
||||||
CaptionWindowDecoration focusedDecor = getFocusedDecor();
|
DesktopModeWindowDecoration focusedDecor = getFocusedDecor();
|
||||||
if (focusedDecor == null
|
if (focusedDecor == null
|
||||||
|| focusedDecor.mTaskInfo.getWindowingMode() != WINDOWING_MODE_FREEFORM) {
|
|| focusedDecor.mTaskInfo.getWindowingMode() != WINDOWING_MODE_FREEFORM) {
|
||||||
handleCaptionThroughStatusBar(ev);
|
handleCaptionThroughStatusBar(ev);
|
||||||
@@ -460,7 +461,7 @@ public class CaptionWindowDecorViewModel implements WindowDecorViewModel {
|
|||||||
private void handleEventOutsideFocusedCaption(MotionEvent ev) {
|
private void handleEventOutsideFocusedCaption(MotionEvent ev) {
|
||||||
int action = ev.getActionMasked();
|
int action = ev.getActionMasked();
|
||||||
if (action == MotionEvent.ACTION_UP || action == MotionEvent.ACTION_CANCEL) {
|
if (action == MotionEvent.ACTION_UP || action == MotionEvent.ACTION_CANCEL) {
|
||||||
CaptionWindowDecoration focusedDecor = getFocusedDecor();
|
DesktopModeWindowDecoration focusedDecor = getFocusedDecor();
|
||||||
if (focusedDecor == null) {
|
if (focusedDecor == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -480,7 +481,7 @@ public class CaptionWindowDecorViewModel implements WindowDecorViewModel {
|
|||||||
switch (ev.getActionMasked()) {
|
switch (ev.getActionMasked()) {
|
||||||
case MotionEvent.ACTION_DOWN: {
|
case MotionEvent.ACTION_DOWN: {
|
||||||
// Begin drag through status bar if applicable.
|
// Begin drag through status bar if applicable.
|
||||||
CaptionWindowDecoration focusedDecor = getFocusedDecor();
|
DesktopModeWindowDecoration focusedDecor = getFocusedDecor();
|
||||||
if (focusedDecor != null) {
|
if (focusedDecor != null) {
|
||||||
boolean dragFromStatusBarAllowed = false;
|
boolean dragFromStatusBarAllowed = false;
|
||||||
if (DesktopModeStatus.isProto2Enabled()) {
|
if (DesktopModeStatus.isProto2Enabled()) {
|
||||||
@@ -499,7 +500,7 @@ public class CaptionWindowDecorViewModel implements WindowDecorViewModel {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case MotionEvent.ACTION_UP: {
|
case MotionEvent.ACTION_UP: {
|
||||||
CaptionWindowDecoration focusedDecor = getFocusedDecor();
|
DesktopModeWindowDecoration focusedDecor = getFocusedDecor();
|
||||||
if (focusedDecor == null) {
|
if (focusedDecor == null) {
|
||||||
mTransitionDragActive = false;
|
mTransitionDragActive = false;
|
||||||
return;
|
return;
|
||||||
@@ -529,11 +530,11 @@ public class CaptionWindowDecorViewModel implements WindowDecorViewModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
private CaptionWindowDecoration getFocusedDecor() {
|
private DesktopModeWindowDecoration getFocusedDecor() {
|
||||||
int size = mWindowDecorByTaskId.size();
|
int size = mWindowDecorByTaskId.size();
|
||||||
CaptionWindowDecoration focusedDecor = null;
|
DesktopModeWindowDecoration focusedDecor = null;
|
||||||
for (int i = 0; i < size; i++) {
|
for (int i = 0; i < size; i++) {
|
||||||
CaptionWindowDecoration decor = mWindowDecorByTaskId.valueAt(i);
|
DesktopModeWindowDecoration decor = mWindowDecorByTaskId.valueAt(i);
|
||||||
if (decor != null && decor.isFocused()) {
|
if (decor != null && decor.isFocused()) {
|
||||||
focusedDecor = decor;
|
focusedDecor = decor;
|
||||||
break;
|
break;
|
||||||
@@ -571,13 +572,13 @@ public class CaptionWindowDecorViewModel implements WindowDecorViewModel {
|
|||||||
SurfaceControl taskSurface,
|
SurfaceControl taskSurface,
|
||||||
SurfaceControl.Transaction startT,
|
SurfaceControl.Transaction startT,
|
||||||
SurfaceControl.Transaction finishT) {
|
SurfaceControl.Transaction finishT) {
|
||||||
CaptionWindowDecoration oldDecoration = mWindowDecorByTaskId.get(taskInfo.taskId);
|
DesktopModeWindowDecoration oldDecoration = mWindowDecorByTaskId.get(taskInfo.taskId);
|
||||||
if (oldDecoration != null) {
|
if (oldDecoration != null) {
|
||||||
// close the old decoration if it exists to avoid two window decorations being added
|
// close the old decoration if it exists to avoid two window decorations being added
|
||||||
oldDecoration.close();
|
oldDecoration.close();
|
||||||
}
|
}
|
||||||
final CaptionWindowDecoration windowDecoration =
|
final DesktopModeWindowDecoration windowDecoration =
|
||||||
mCaptionWindowDecorFactory.create(
|
mDesktopModeWindowDecorFactory.create(
|
||||||
mContext,
|
mContext,
|
||||||
mDisplayController,
|
mDisplayController,
|
||||||
mTaskOrganizer,
|
mTaskOrganizer,
|
||||||
@@ -43,12 +43,12 @@ import com.android.wm.shell.desktopmode.DesktopModeStatus;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Defines visuals and behaviors of a window decoration of a caption bar and shadows. It works with
|
* Defines visuals and behaviors of a window decoration of a caption bar and shadows. It works with
|
||||||
* {@link CaptionWindowDecorViewModel}. The caption bar contains a handle, back button, and close
|
* {@link DesktopModeWindowDecorViewModel}. The caption bar contains a handle, back button, and
|
||||||
* button.
|
* close button.
|
||||||
*
|
*
|
||||||
* The shadow's thickness is 20dp when the window is in focus and 5dp when the window isn't.
|
* The shadow's thickness is 20dp when the window is in focus and 5dp when the window isn't.
|
||||||
*/
|
*/
|
||||||
public class CaptionWindowDecoration extends WindowDecoration<WindowDecorLinearLayout> {
|
public class DesktopModeWindowDecoration extends WindowDecoration<WindowDecorLinearLayout> {
|
||||||
private final Handler mHandler;
|
private final Handler mHandler;
|
||||||
private final Choreographer mChoreographer;
|
private final Choreographer mChoreographer;
|
||||||
private final SyncTransactionQueue mSyncQueue;
|
private final SyncTransactionQueue mSyncQueue;
|
||||||
@@ -69,7 +69,7 @@ public class CaptionWindowDecoration extends WindowDecoration<WindowDecorLinearL
|
|||||||
|
|
||||||
private AdditionalWindow mHandleMenu;
|
private AdditionalWindow mHandleMenu;
|
||||||
|
|
||||||
CaptionWindowDecoration(
|
DesktopModeWindowDecoration(
|
||||||
Context context,
|
Context context,
|
||||||
DisplayController displayController,
|
DisplayController displayController,
|
||||||
ShellTaskOrganizer taskOrganizer,
|
ShellTaskOrganizer taskOrganizer,
|
||||||
@@ -424,7 +424,7 @@ public class CaptionWindowDecoration extends WindowDecoration<WindowDecorLinearL
|
|||||||
|
|
||||||
static class Factory {
|
static class Factory {
|
||||||
|
|
||||||
CaptionWindowDecoration create(
|
DesktopModeWindowDecoration create(
|
||||||
Context context,
|
Context context,
|
||||||
DisplayController displayController,
|
DisplayController displayController,
|
||||||
ShellTaskOrganizer taskOrganizer,
|
ShellTaskOrganizer taskOrganizer,
|
||||||
@@ -433,7 +433,7 @@ public class CaptionWindowDecoration extends WindowDecoration<WindowDecorLinearL
|
|||||||
Handler handler,
|
Handler handler,
|
||||||
Choreographer choreographer,
|
Choreographer choreographer,
|
||||||
SyncTransactionQueue syncQueue) {
|
SyncTransactionQueue syncQueue) {
|
||||||
return new CaptionWindowDecoration(
|
return new DesktopModeWindowDecoration(
|
||||||
context,
|
context,
|
||||||
displayController,
|
displayController,
|
||||||
taskOrganizer,
|
taskOrganizer,
|
||||||
@@ -60,14 +60,14 @@ import java.util.Optional;
|
|||||||
import java.util.concurrent.CountDownLatch;
|
import java.util.concurrent.CountDownLatch;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
/** Tests of {@link CaptionWindowDecorViewModel} */
|
/** Tests of {@link DesktopModeWindowDecorViewModel} */
|
||||||
@SmallTest
|
@SmallTest
|
||||||
public class CaptionWindowDecorViewModelTests extends ShellTestCase {
|
public class DesktopModeWindowDecorViewModelTests extends ShellTestCase {
|
||||||
|
|
||||||
private static final String TAG = "CaptionWindowDecorViewModelTests";
|
private static final String TAG = "DesktopModeWindowDecorViewModelTests";
|
||||||
|
|
||||||
@Mock private CaptionWindowDecoration mCaptionWindowDecoration;
|
@Mock private DesktopModeWindowDecoration mDesktopModeWindowDecoration;
|
||||||
@Mock private CaptionWindowDecoration.Factory mCaptionWindowDecorFactory;
|
@Mock private DesktopModeWindowDecoration.Factory mDesktopModeWindowDecorFactory;
|
||||||
|
|
||||||
@Mock private Handler mMainHandler;
|
@Mock private Handler mMainHandler;
|
||||||
@Mock private Choreographer mMainChoreographer;
|
@Mock private Choreographer mMainChoreographer;
|
||||||
@@ -79,17 +79,17 @@ public class CaptionWindowDecorViewModelTests extends ShellTestCase {
|
|||||||
@Mock private InputMonitor mInputMonitor;
|
@Mock private InputMonitor mInputMonitor;
|
||||||
@Mock private InputManager mInputManager;
|
@Mock private InputManager mInputManager;
|
||||||
|
|
||||||
@Mock private CaptionWindowDecorViewModel.InputMonitorFactory mMockInputMonitorFactory;
|
@Mock private DesktopModeWindowDecorViewModel.InputMonitorFactory mMockInputMonitorFactory;
|
||||||
private final List<InputManager> mMockInputManagers = new ArrayList<>();
|
private final List<InputManager> mMockInputManagers = new ArrayList<>();
|
||||||
|
|
||||||
private CaptionWindowDecorViewModel mCaptionWindowDecorViewModel;
|
private DesktopModeWindowDecorViewModel mDesktopModeWindowDecorViewModel;
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setUp() {
|
public void setUp() {
|
||||||
mMockInputManagers.add(mInputManager);
|
mMockInputManagers.add(mInputManager);
|
||||||
|
|
||||||
mCaptionWindowDecorViewModel =
|
mDesktopModeWindowDecorViewModel =
|
||||||
new CaptionWindowDecorViewModel(
|
new DesktopModeWindowDecorViewModel(
|
||||||
mContext,
|
mContext,
|
||||||
mMainHandler,
|
mMainHandler,
|
||||||
mMainChoreographer,
|
mMainChoreographer,
|
||||||
@@ -98,12 +98,12 @@ public class CaptionWindowDecorViewModelTests extends ShellTestCase {
|
|||||||
mSyncQueue,
|
mSyncQueue,
|
||||||
Optional.of(mDesktopModeController),
|
Optional.of(mDesktopModeController),
|
||||||
Optional.of(mDesktopTasksController),
|
Optional.of(mDesktopTasksController),
|
||||||
mCaptionWindowDecorFactory,
|
mDesktopModeWindowDecorFactory,
|
||||||
mMockInputMonitorFactory
|
mMockInputMonitorFactory
|
||||||
);
|
);
|
||||||
|
|
||||||
doReturn(mCaptionWindowDecoration)
|
doReturn(mDesktopModeWindowDecoration)
|
||||||
.when(mCaptionWindowDecorFactory)
|
.when(mDesktopModeWindowDecorFactory)
|
||||||
.create(any(), any(), any(), any(), any(), any(), any(), any());
|
.create(any(), any(), any(), any(), any(), any(), any(), any());
|
||||||
|
|
||||||
when(mMockInputMonitorFactory.create(any(), any())).thenReturn(mInputMonitor);
|
when(mMockInputMonitorFactory.create(any(), any())).thenReturn(mInputMonitor);
|
||||||
@@ -123,13 +123,15 @@ public class CaptionWindowDecorViewModelTests extends ShellTestCase {
|
|||||||
final SurfaceControl.Transaction startT = mock(SurfaceControl.Transaction.class);
|
final SurfaceControl.Transaction startT = mock(SurfaceControl.Transaction.class);
|
||||||
final SurfaceControl.Transaction finishT = mock(SurfaceControl.Transaction.class);
|
final SurfaceControl.Transaction finishT = mock(SurfaceControl.Transaction.class);
|
||||||
|
|
||||||
mCaptionWindowDecorViewModel.onTaskOpening(taskInfo, surfaceControl, startT, finishT);
|
mDesktopModeWindowDecorViewModel.onTaskOpening(
|
||||||
|
taskInfo, surfaceControl, startT, finishT);
|
||||||
|
|
||||||
taskInfo.configuration.windowConfiguration.setWindowingMode(WINDOWING_MODE_UNDEFINED);
|
taskInfo.configuration.windowConfiguration.setWindowingMode(WINDOWING_MODE_UNDEFINED);
|
||||||
taskInfo.configuration.windowConfiguration.setActivityType(ACTIVITY_TYPE_UNDEFINED);
|
taskInfo.configuration.windowConfiguration.setActivityType(ACTIVITY_TYPE_UNDEFINED);
|
||||||
mCaptionWindowDecorViewModel.onTaskChanging(taskInfo, surfaceControl, startT, finishT);
|
mDesktopModeWindowDecorViewModel.onTaskChanging(
|
||||||
|
taskInfo, surfaceControl, startT, finishT);
|
||||||
});
|
});
|
||||||
verify(mCaptionWindowDecorFactory)
|
verify(mDesktopModeWindowDecorFactory)
|
||||||
.create(
|
.create(
|
||||||
mContext,
|
mContext,
|
||||||
mDisplayController,
|
mDisplayController,
|
||||||
@@ -139,7 +141,7 @@ public class CaptionWindowDecorViewModelTests extends ShellTestCase {
|
|||||||
mMainHandler,
|
mMainHandler,
|
||||||
mMainChoreographer,
|
mMainChoreographer,
|
||||||
mSyncQueue);
|
mSyncQueue);
|
||||||
verify(mCaptionWindowDecoration).close();
|
verify(mDesktopModeWindowDecoration).close();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -153,14 +155,16 @@ public class CaptionWindowDecorViewModelTests extends ShellTestCase {
|
|||||||
final SurfaceControl.Transaction finishT = mock(SurfaceControl.Transaction.class);
|
final SurfaceControl.Transaction finishT = mock(SurfaceControl.Transaction.class);
|
||||||
taskInfo.configuration.windowConfiguration.setActivityType(ACTIVITY_TYPE_UNDEFINED);
|
taskInfo.configuration.windowConfiguration.setActivityType(ACTIVITY_TYPE_UNDEFINED);
|
||||||
|
|
||||||
mCaptionWindowDecorViewModel.onTaskChanging(taskInfo, surfaceControl, startT, finishT);
|
mDesktopModeWindowDecorViewModel.onTaskChanging(
|
||||||
|
taskInfo, surfaceControl, startT, finishT);
|
||||||
|
|
||||||
taskInfo.configuration.windowConfiguration.setWindowingMode(WINDOWING_MODE_FREEFORM);
|
taskInfo.configuration.windowConfiguration.setWindowingMode(WINDOWING_MODE_FREEFORM);
|
||||||
taskInfo.configuration.windowConfiguration.setActivityType(ACTIVITY_TYPE_STANDARD);
|
taskInfo.configuration.windowConfiguration.setActivityType(ACTIVITY_TYPE_STANDARD);
|
||||||
|
|
||||||
mCaptionWindowDecorViewModel.onTaskChanging(taskInfo, surfaceControl, startT, finishT);
|
mDesktopModeWindowDecorViewModel.onTaskChanging(
|
||||||
|
taskInfo, surfaceControl, startT, finishT);
|
||||||
});
|
});
|
||||||
verify(mCaptionWindowDecorFactory, times(1))
|
verify(mDesktopModeWindowDecorFactory, times(1))
|
||||||
.create(
|
.create(
|
||||||
mContext,
|
mContext,
|
||||||
mDisplayController,
|
mDisplayController,
|
||||||
@@ -183,9 +187,10 @@ public class CaptionWindowDecorViewModelTests extends ShellTestCase {
|
|||||||
final SurfaceControl.Transaction startT = mock(SurfaceControl.Transaction.class);
|
final SurfaceControl.Transaction startT = mock(SurfaceControl.Transaction.class);
|
||||||
final SurfaceControl.Transaction finishT = mock(SurfaceControl.Transaction.class);
|
final SurfaceControl.Transaction finishT = mock(SurfaceControl.Transaction.class);
|
||||||
|
|
||||||
mCaptionWindowDecorViewModel.onTaskOpening(taskInfo, surfaceControl, startT, finishT);
|
mDesktopModeWindowDecorViewModel.onTaskOpening(
|
||||||
|
taskInfo, surfaceControl, startT, finishT);
|
||||||
|
|
||||||
mCaptionWindowDecorViewModel.destroyWindowDecoration(taskInfo);
|
mDesktopModeWindowDecorViewModel.destroyWindowDecoration(taskInfo);
|
||||||
});
|
});
|
||||||
verify(mMockInputMonitorFactory).create(any(), any());
|
verify(mMockInputMonitorFactory).create(any(), any());
|
||||||
verify(mInputMonitor).dispose();
|
verify(mInputMonitor).dispose();
|
||||||
@@ -214,13 +219,14 @@ public class CaptionWindowDecorViewModelTests extends ShellTestCase {
|
|||||||
final SurfaceControl.Transaction startT = mock(SurfaceControl.Transaction.class);
|
final SurfaceControl.Transaction startT = mock(SurfaceControl.Transaction.class);
|
||||||
final SurfaceControl.Transaction finishT = mock(SurfaceControl.Transaction.class);
|
final SurfaceControl.Transaction finishT = mock(SurfaceControl.Transaction.class);
|
||||||
|
|
||||||
mCaptionWindowDecorViewModel.onTaskOpening(taskInfo, surfaceControl, startT, finishT);
|
mDesktopModeWindowDecorViewModel.onTaskOpening(taskInfo, surfaceControl, startT,
|
||||||
mCaptionWindowDecorViewModel.onTaskOpening(secondTaskInfo, surfaceControl,
|
finishT);
|
||||||
|
mDesktopModeWindowDecorViewModel.onTaskOpening(secondTaskInfo, surfaceControl,
|
||||||
startT, finishT);
|
startT, finishT);
|
||||||
mCaptionWindowDecorViewModel.onTaskOpening(thirdTaskInfo, surfaceControl,
|
mDesktopModeWindowDecorViewModel.onTaskOpening(thirdTaskInfo, surfaceControl,
|
||||||
startT, finishT);
|
startT, finishT);
|
||||||
mCaptionWindowDecorViewModel.destroyWindowDecoration(thirdTaskInfo);
|
mDesktopModeWindowDecorViewModel.destroyWindowDecoration(thirdTaskInfo);
|
||||||
mCaptionWindowDecorViewModel.destroyWindowDecoration(taskInfo);
|
mDesktopModeWindowDecorViewModel.destroyWindowDecoration(taskInfo);
|
||||||
});
|
});
|
||||||
verify(mMockInputMonitorFactory, times(2)).create(any(), any());
|
verify(mMockInputMonitorFactory, times(2)).create(any(), any());
|
||||||
verify(mInputMonitor, times(1)).dispose();
|
verify(mInputMonitor, times(1)).dispose();
|
||||||
Reference in New Issue
Block a user