Loading libs/WindowManager/Shell/src/com/android/wm/shell/dagger/WMShellModule.java +4 −2 Original line number Diff line number Diff line Loading @@ -188,14 +188,16 @@ public abstract class WMShellModule { @ShellMainThread Choreographer mainChoreographer, ShellTaskOrganizer taskOrganizer, DisplayController displayController, SyncTransactionQueue syncQueue) { SyncTransactionQueue syncQueue, @DynamicOverride DesktopModeController desktopModeController) { return new CaptionWindowDecorViewModel( context, mainHandler, mainChoreographer, taskOrganizer, displayController, syncQueue); syncQueue, desktopModeController); } // Loading libs/WindowManager/Shell/src/com/android/wm/shell/desktopmode/DesktopModeController.java +19 −0 Original line number Diff line number Diff line Loading @@ -176,6 +176,25 @@ public class DesktopModeController implements RemoteCallable<DesktopModeControll mShellTaskOrganizer.applyTransaction(wct); } /** * Turn desktop mode on or off * @param active the desired state for desktop mode setting */ public void setDesktopModeActive(boolean active) { int value = active ? 1 : 0; Settings.System.putInt(mContext.getContentResolver(), Settings.System.DESKTOP_MODE, value); } /** * Returns the windowing mode of the display area with the specified displayId. * @param displayId * @return */ public int getDisplayAreaWindowingMode(int displayId) { return mRootTaskDisplayAreaOrganizer.getDisplayAreaInfo(displayId) .configuration.windowConfiguration.getWindowingMode(); } /** * A {@link ContentObserver} for listening to changes to {@link Settings.System#DESKTOP_MODE} */ Loading libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/CaptionWindowDecorViewModel.java +15 −3 Original line number Diff line number Diff line Loading @@ -37,6 +37,7 @@ import com.android.wm.shell.R; import com.android.wm.shell.ShellTaskOrganizer; import com.android.wm.shell.common.DisplayController; import com.android.wm.shell.common.SyncTransactionQueue; import com.android.wm.shell.desktopmode.DesktopModeController; import com.android.wm.shell.desktopmode.DesktopModeStatus; import com.android.wm.shell.freeform.FreeformTaskTransitionStarter; import com.android.wm.shell.transition.Transitions; Loading @@ -54,6 +55,7 @@ public class CaptionWindowDecorViewModel implements WindowDecorViewModel<Caption private final DisplayController mDisplayController; private final SyncTransactionQueue mSyncQueue; private FreeformTaskTransitionStarter mTransitionStarter; private DesktopModeController mDesktopModeController; public CaptionWindowDecorViewModel( Context context, Loading @@ -61,7 +63,8 @@ public class CaptionWindowDecorViewModel implements WindowDecorViewModel<Caption Choreographer mainChoreographer, ShellTaskOrganizer taskOrganizer, DisplayController displayController, SyncTransactionQueue syncQueue) { SyncTransactionQueue syncQueue, DesktopModeController desktopModeController) { mContext = context; mMainHandler = mainHandler; mMainChoreographer = mainChoreographer; Loading @@ -69,6 +72,7 @@ public class CaptionWindowDecorViewModel implements WindowDecorViewModel<Caption mTaskOrganizer = taskOrganizer; mDisplayController = displayController; mSyncQueue = syncQueue; mDesktopModeController = desktopModeController; } @Override Loading Loading @@ -211,8 +215,10 @@ public class CaptionWindowDecorViewModel implements WindowDecorViewModel<Caption } private void handleEventForMove(MotionEvent e) { if (mTaskOrganizer.getRunningTaskInfo(mTaskId).getWindowingMode() == WINDOWING_MODE_FULLSCREEN) { RunningTaskInfo taskInfo = mTaskOrganizer.getRunningTaskInfo(mTaskId); int windowingMode = mDesktopModeController .getDisplayAreaWindowingMode(taskInfo.displayId); if (windowingMode == WINDOWING_MODE_FULLSCREEN) { return; } switch (e.getActionMasked()) { Loading @@ -230,8 +236,14 @@ public class CaptionWindowDecorViewModel implements WindowDecorViewModel<Caption case MotionEvent.ACTION_UP: case MotionEvent.ACTION_CANCEL: { int dragPointerIdx = e.findPointerIndex(mDragPointerId); int statusBarHeight = mDisplayController.getDisplayLayout(taskInfo.displayId) .stableInsets().top; mDragResizeCallback.onDragResizeEnd( e.getRawX(dragPointerIdx), e.getRawY(dragPointerIdx)); if (e.getRawY(dragPointerIdx) <= statusBarHeight && windowingMode == WINDOWING_MODE_FREEFORM) { mDesktopModeController.setDesktopModeActive(false); } break; } } Loading Loading
libs/WindowManager/Shell/src/com/android/wm/shell/dagger/WMShellModule.java +4 −2 Original line number Diff line number Diff line Loading @@ -188,14 +188,16 @@ public abstract class WMShellModule { @ShellMainThread Choreographer mainChoreographer, ShellTaskOrganizer taskOrganizer, DisplayController displayController, SyncTransactionQueue syncQueue) { SyncTransactionQueue syncQueue, @DynamicOverride DesktopModeController desktopModeController) { return new CaptionWindowDecorViewModel( context, mainHandler, mainChoreographer, taskOrganizer, displayController, syncQueue); syncQueue, desktopModeController); } // Loading
libs/WindowManager/Shell/src/com/android/wm/shell/desktopmode/DesktopModeController.java +19 −0 Original line number Diff line number Diff line Loading @@ -176,6 +176,25 @@ public class DesktopModeController implements RemoteCallable<DesktopModeControll mShellTaskOrganizer.applyTransaction(wct); } /** * Turn desktop mode on or off * @param active the desired state for desktop mode setting */ public void setDesktopModeActive(boolean active) { int value = active ? 1 : 0; Settings.System.putInt(mContext.getContentResolver(), Settings.System.DESKTOP_MODE, value); } /** * Returns the windowing mode of the display area with the specified displayId. * @param displayId * @return */ public int getDisplayAreaWindowingMode(int displayId) { return mRootTaskDisplayAreaOrganizer.getDisplayAreaInfo(displayId) .configuration.windowConfiguration.getWindowingMode(); } /** * A {@link ContentObserver} for listening to changes to {@link Settings.System#DESKTOP_MODE} */ Loading
libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/CaptionWindowDecorViewModel.java +15 −3 Original line number Diff line number Diff line Loading @@ -37,6 +37,7 @@ import com.android.wm.shell.R; import com.android.wm.shell.ShellTaskOrganizer; import com.android.wm.shell.common.DisplayController; import com.android.wm.shell.common.SyncTransactionQueue; import com.android.wm.shell.desktopmode.DesktopModeController; import com.android.wm.shell.desktopmode.DesktopModeStatus; import com.android.wm.shell.freeform.FreeformTaskTransitionStarter; import com.android.wm.shell.transition.Transitions; Loading @@ -54,6 +55,7 @@ public class CaptionWindowDecorViewModel implements WindowDecorViewModel<Caption private final DisplayController mDisplayController; private final SyncTransactionQueue mSyncQueue; private FreeformTaskTransitionStarter mTransitionStarter; private DesktopModeController mDesktopModeController; public CaptionWindowDecorViewModel( Context context, Loading @@ -61,7 +63,8 @@ public class CaptionWindowDecorViewModel implements WindowDecorViewModel<Caption Choreographer mainChoreographer, ShellTaskOrganizer taskOrganizer, DisplayController displayController, SyncTransactionQueue syncQueue) { SyncTransactionQueue syncQueue, DesktopModeController desktopModeController) { mContext = context; mMainHandler = mainHandler; mMainChoreographer = mainChoreographer; Loading @@ -69,6 +72,7 @@ public class CaptionWindowDecorViewModel implements WindowDecorViewModel<Caption mTaskOrganizer = taskOrganizer; mDisplayController = displayController; mSyncQueue = syncQueue; mDesktopModeController = desktopModeController; } @Override Loading Loading @@ -211,8 +215,10 @@ public class CaptionWindowDecorViewModel implements WindowDecorViewModel<Caption } private void handleEventForMove(MotionEvent e) { if (mTaskOrganizer.getRunningTaskInfo(mTaskId).getWindowingMode() == WINDOWING_MODE_FULLSCREEN) { RunningTaskInfo taskInfo = mTaskOrganizer.getRunningTaskInfo(mTaskId); int windowingMode = mDesktopModeController .getDisplayAreaWindowingMode(taskInfo.displayId); if (windowingMode == WINDOWING_MODE_FULLSCREEN) { return; } switch (e.getActionMasked()) { Loading @@ -230,8 +236,14 @@ public class CaptionWindowDecorViewModel implements WindowDecorViewModel<Caption case MotionEvent.ACTION_UP: case MotionEvent.ACTION_CANCEL: { int dragPointerIdx = e.findPointerIndex(mDragPointerId); int statusBarHeight = mDisplayController.getDisplayLayout(taskInfo.displayId) .stableInsets().top; mDragResizeCallback.onDragResizeEnd( e.getRawX(dragPointerIdx), e.getRawY(dragPointerIdx)); if (e.getRawY(dragPointerIdx) <= statusBarHeight && windowingMode == WINDOWING_MODE_FREEFORM) { mDesktopModeController.setDesktopModeActive(false); } break; } } Loading