Loading core/java/android/window/DesktopModeFlags.java +2 −1 Original line number Diff line number Diff line Loading @@ -75,7 +75,8 @@ public enum DesktopModeFlags { Flags::enableDesktopAppLaunchAlttabTransitions, false), ENABLE_DESKTOP_APP_LAUNCH_TRANSITIONS( Flags::enableDesktopAppLaunchTransitions, false), ENABLE_DESKTOP_WINDOWING_PERSISTENCE(Flags::enableDesktopWindowingPersistence, false); ENABLE_DESKTOP_WINDOWING_PERSISTENCE(Flags::enableDesktopWindowingPersistence, false), ENABLE_HANDLE_INPUT_FIX(Flags::enableHandleInputFix, true); private static final String TAG = "DesktopModeFlagsUtil"; // Function called to obtain aconfig flag value. Loading libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/DesktopModeWindowDecorViewModel.java +6 −6 Original line number Diff line number Diff line Loading @@ -465,7 +465,7 @@ public class DesktopModeWindowDecorViewModel implements WindowDecorViewModel, final RunningTaskInfo oldTaskInfo = decoration.mTaskInfo; if (taskInfo.displayId != oldTaskInfo.displayId && !Flags.enableHandleInputFix()) { && !DesktopModeFlags.ENABLE_HANDLE_INPUT_FIX.isTrue()) { removeTaskFromEventReceiver(oldTaskInfo.displayId); incrementEventReceiverTasks(taskInfo.displayId); } Loading Loading @@ -539,7 +539,7 @@ public class DesktopModeWindowDecorViewModel implements WindowDecorViewModel, decoration.close(); final int displayId = taskInfo.displayId; if (mEventReceiversByDisplay.contains(displayId) && !Flags.enableHandleInputFix()) { && !DesktopModeFlags.ENABLE_HANDLE_INPUT_FIX.isTrue()) { removeTaskFromEventReceiver(displayId); } // Remove the decoration from the cache last because WindowDecoration#close could still Loading Loading @@ -1234,7 +1234,7 @@ public class DesktopModeWindowDecorViewModel implements WindowDecorViewModel, relevantDecor.updateHoverAndPressStatus(ev); final int action = ev.getActionMasked(); if (action == MotionEvent.ACTION_UP || action == MotionEvent.ACTION_CANCEL) { if (!mTransitionDragActive && !Flags.enableHandleInputFix()) { if (!mTransitionDragActive && !DesktopModeFlags.ENABLE_HANDLE_INPUT_FIX.isTrue()) { relevantDecor.closeHandleMenuIfNeeded(ev); } } Loading Loading @@ -1277,7 +1277,7 @@ public class DesktopModeWindowDecorViewModel implements WindowDecorViewModel, } final boolean shouldStartTransitionDrag = relevantDecor.checkTouchEventInFocusedCaptionHandle(ev) || Flags.enableHandleInputFix(); || DesktopModeFlags.ENABLE_HANDLE_INPUT_FIX.isTrue(); if (dragFromStatusBarAllowed && shouldStartTransitionDrag) { mTransitionDragActive = true; } Loading Loading @@ -1593,7 +1593,7 @@ public class DesktopModeWindowDecorViewModel implements WindowDecorViewModel, windowDecoration.relayout(taskInfo, startT, finishT, false /* applyStartTransactionOnDraw */, false /* shouldSetTaskPositionAndCrop */, mFocusTransitionObserver.hasGlobalFocus(taskInfo)); if (!Flags.enableHandleInputFix()) { if (!DesktopModeFlags.ENABLE_HANDLE_INPUT_FIX.isTrue()) { incrementEventReceiverTasks(taskInfo.displayId); } } Loading Loading @@ -1754,7 +1754,7 @@ public class DesktopModeWindowDecorViewModel implements WindowDecorViewModel, && Flags.enableDesktopWindowingImmersiveHandleHiding()) { decor.onInsetsStateChanged(insetsState); } if (!Flags.enableHandleInputFix()) { if (!DesktopModeFlags.ENABLE_HANDLE_INPUT_FIX.isTrue()) { // If status bar inset is visible, top task is not in immersive mode. // This value is only needed when the App Handle input is being handled // through the global input monitor (hence the flag check) to ignore gestures Loading libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/DesktopModeWindowDecoration.java +7 −7 Original line number Diff line number Diff line Loading @@ -807,7 +807,7 @@ public class DesktopModeWindowDecoration extends WindowDecoration<WindowDecorLin */ void disposeStatusBarInputLayer() { if (!isAppHandle(mWindowDecorViewHolder) || !Flags.enableHandleInputFix()) { || !DesktopModeFlags.ENABLE_HANDLE_INPUT_FIX.isTrue()) { return; } asAppHandle(mWindowDecorViewHolder).disposeStatusBarInputLayer(); Loading Loading @@ -951,7 +951,7 @@ public class DesktopModeWindowDecoration extends WindowDecoration<WindowDecorLin } controlsElement.mAlignment = RelayoutParams.OccludingCaptionElement.Alignment.END; relayoutParams.mOccludingCaptionElements.add(controlsElement); } else if (isAppHandle && !Flags.enableHandleInputFix()) { } else if (isAppHandle && !DesktopModeFlags.ENABLE_HANDLE_INPUT_FIX.isTrue()) { // The focused decor (fullscreen/split) does not need to handle input because input in // the App Handle is handled by the InputMonitor in DesktopModeWindowDecorViewModel. // Note: This does not apply with the above flag enabled as the status bar input layer Loading Loading @@ -1560,13 +1560,13 @@ public class DesktopModeWindowDecoration extends WindowDecoration<WindowDecorLin */ boolean checkTouchEventInFocusedCaptionHandle(MotionEvent ev) { if (isHandleMenuActive() || !isAppHandle(mWindowDecorViewHolder) || Flags.enableHandleInputFix()) { || DesktopModeFlags.ENABLE_HANDLE_INPUT_FIX.isTrue()) { return false; } // The status bar input layer can only receive input in handle coordinates to begin with, // so checking coordinates is unnecessary as input is always within handle bounds. if (isAppHandle(mWindowDecorViewHolder) && Flags.enableHandleInputFix() && DesktopModeFlags.ENABLE_HANDLE_INPUT_FIX.isTrue() && isCaptionVisible()) { return true; } Loading Loading @@ -1603,7 +1603,7 @@ public class DesktopModeWindowDecoration extends WindowDecoration<WindowDecorLin * @param ev the MotionEvent to compare */ void checkTouchEvent(MotionEvent ev) { if (mResult.mRootView == null || Flags.enableHandleInputFix()) return; if (mResult.mRootView == null || DesktopModeFlags.ENABLE_HANDLE_INPUT_FIX.isTrue()) return; final View caption = mResult.mRootView.findViewById(R.id.desktop_mode_caption); final View handle = caption.findViewById(R.id.caption_handle); final boolean inHandle = !isHandleMenuActive() Loading @@ -1616,7 +1616,7 @@ public class DesktopModeWindowDecoration extends WindowDecoration<WindowDecorLin // If the whole handle menu can be touched directly, rely on FLAG_WATCH_OUTSIDE_TOUCH. // This is for the case that some of the handle menu is underneath the status bar. if (isAppHandle(mWindowDecorViewHolder) && !Flags.enableHandleInputFix()) { && !DesktopModeFlags.ENABLE_HANDLE_INPUT_FIX.isTrue()) { mHandleMenu.checkMotionEvent(ev); closeHandleMenuIfNeeded(ev); } Loading @@ -1630,7 +1630,7 @@ public class DesktopModeWindowDecoration extends WindowDecoration<WindowDecorLin * @param ev the MotionEvent to compare against. */ void updateHoverAndPressStatus(MotionEvent ev) { if (mResult.mRootView == null || Flags.enableHandleInputFix()) return; if (mResult.mRootView == null || DesktopModeFlags.ENABLE_HANDLE_INPUT_FIX.isTrue()) return; final View handle = mResult.mRootView.findViewById(R.id.caption_handle); final boolean inHandle = !isHandleMenuActive() && checkTouchEventInFocusedCaptionHandle(ev); Loading libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/HandleMenu.kt +5 −4 Original line number Diff line number Diff line Loading @@ -39,11 +39,11 @@ import android.widget.Button import android.widget.ImageButton import android.widget.ImageView import android.widget.TextView import android.window.DesktopModeFlags import android.window.SurfaceSyncGroup import androidx.annotation.VisibleForTesting import androidx.compose.ui.graphics.toArgb import androidx.core.view.isGone import com.android.window.flags.Flags import com.android.wm.shell.R import com.android.wm.shell.shared.split.SplitScreenConstants import com.android.wm.shell.splitscreen.SplitScreenController Loading Loading @@ -83,7 +83,7 @@ class HandleMenu( private val taskInfo: RunningTaskInfo = parentDecor.mTaskInfo private val isViewAboveStatusBar: Boolean get() = (Flags.enableHandleInputFix() && !taskInfo.isFreeform) get() = (DesktopModeFlags.ENABLE_HANDLE_INPUT_FIX.isTrue() && !taskInfo.isFreeform) private val pillElevation: Int = loadDimensionPixelSize( R.dimen.desktop_mode_handle_menu_pill_elevation) Loading Loading @@ -201,7 +201,8 @@ class HandleMenu( val x = handleMenuPosition.x.toInt() val y = handleMenuPosition.y.toInt() handleMenuViewContainer = if ((!taskInfo.isFreeform && Flags.enableHandleInputFix()) || forceShowSystemBars) { if ((!taskInfo.isFreeform && DesktopModeFlags.ENABLE_HANDLE_INPUT_FIX.isTrue()) || forceShowSystemBars) { AdditionalSystemViewContainer( windowManagerWrapper = windowManagerWrapper, taskId = taskInfo.taskId, Loading Loading @@ -237,7 +238,7 @@ class HandleMenu( menuX = marginMenuStart menuY = captionY + marginMenuTop } else { if (Flags.enableHandleInputFix()) { if (DesktopModeFlags.ENABLE_HANDLE_INPUT_FIX.isTrue()) { // In a focused decor, we use global coordinates for handle menu. Therefore we // need to account for other factors like split stage and menu/handle width to // center the menu. Loading libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/HandleMenuImageButton.kt +3 −4 Original line number Diff line number Diff line Loading @@ -16,13 +16,12 @@ package com.android.wm.shell.windowdecor import android.app.ActivityManager.RunningTaskInfo import com.android.window.flags.Flags import com.android.wm.shell.windowdecor.additionalviewcontainer.AdditionalSystemViewContainer import android.content.Context import android.util.AttributeSet import android.view.MotionEvent import android.widget.ImageButton import android.window.DesktopModeFlags import com.android.wm.shell.windowdecor.additionalviewcontainer.AdditionalSystemViewContainer /** * A custom [ImageButton] for buttons inside handle menu that intentionally doesn't handle hovers. Loading @@ -39,7 +38,7 @@ class HandleMenuImageButton( lateinit var taskInfo: RunningTaskInfo override fun onHoverEvent(motionEvent: MotionEvent): Boolean { if (Flags.enableHandleInputFix() || taskInfo.isFreeform) { if (DesktopModeFlags.ENABLE_HANDLE_INPUT_FIX.isTrue() || taskInfo.isFreeform) { return super.onHoverEvent(motionEvent) } else { return false Loading Loading
core/java/android/window/DesktopModeFlags.java +2 −1 Original line number Diff line number Diff line Loading @@ -75,7 +75,8 @@ public enum DesktopModeFlags { Flags::enableDesktopAppLaunchAlttabTransitions, false), ENABLE_DESKTOP_APP_LAUNCH_TRANSITIONS( Flags::enableDesktopAppLaunchTransitions, false), ENABLE_DESKTOP_WINDOWING_PERSISTENCE(Flags::enableDesktopWindowingPersistence, false); ENABLE_DESKTOP_WINDOWING_PERSISTENCE(Flags::enableDesktopWindowingPersistence, false), ENABLE_HANDLE_INPUT_FIX(Flags::enableHandleInputFix, true); private static final String TAG = "DesktopModeFlagsUtil"; // Function called to obtain aconfig flag value. Loading
libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/DesktopModeWindowDecorViewModel.java +6 −6 Original line number Diff line number Diff line Loading @@ -465,7 +465,7 @@ public class DesktopModeWindowDecorViewModel implements WindowDecorViewModel, final RunningTaskInfo oldTaskInfo = decoration.mTaskInfo; if (taskInfo.displayId != oldTaskInfo.displayId && !Flags.enableHandleInputFix()) { && !DesktopModeFlags.ENABLE_HANDLE_INPUT_FIX.isTrue()) { removeTaskFromEventReceiver(oldTaskInfo.displayId); incrementEventReceiverTasks(taskInfo.displayId); } Loading Loading @@ -539,7 +539,7 @@ public class DesktopModeWindowDecorViewModel implements WindowDecorViewModel, decoration.close(); final int displayId = taskInfo.displayId; if (mEventReceiversByDisplay.contains(displayId) && !Flags.enableHandleInputFix()) { && !DesktopModeFlags.ENABLE_HANDLE_INPUT_FIX.isTrue()) { removeTaskFromEventReceiver(displayId); } // Remove the decoration from the cache last because WindowDecoration#close could still Loading Loading @@ -1234,7 +1234,7 @@ public class DesktopModeWindowDecorViewModel implements WindowDecorViewModel, relevantDecor.updateHoverAndPressStatus(ev); final int action = ev.getActionMasked(); if (action == MotionEvent.ACTION_UP || action == MotionEvent.ACTION_CANCEL) { if (!mTransitionDragActive && !Flags.enableHandleInputFix()) { if (!mTransitionDragActive && !DesktopModeFlags.ENABLE_HANDLE_INPUT_FIX.isTrue()) { relevantDecor.closeHandleMenuIfNeeded(ev); } } Loading Loading @@ -1277,7 +1277,7 @@ public class DesktopModeWindowDecorViewModel implements WindowDecorViewModel, } final boolean shouldStartTransitionDrag = relevantDecor.checkTouchEventInFocusedCaptionHandle(ev) || Flags.enableHandleInputFix(); || DesktopModeFlags.ENABLE_HANDLE_INPUT_FIX.isTrue(); if (dragFromStatusBarAllowed && shouldStartTransitionDrag) { mTransitionDragActive = true; } Loading Loading @@ -1593,7 +1593,7 @@ public class DesktopModeWindowDecorViewModel implements WindowDecorViewModel, windowDecoration.relayout(taskInfo, startT, finishT, false /* applyStartTransactionOnDraw */, false /* shouldSetTaskPositionAndCrop */, mFocusTransitionObserver.hasGlobalFocus(taskInfo)); if (!Flags.enableHandleInputFix()) { if (!DesktopModeFlags.ENABLE_HANDLE_INPUT_FIX.isTrue()) { incrementEventReceiverTasks(taskInfo.displayId); } } Loading Loading @@ -1754,7 +1754,7 @@ public class DesktopModeWindowDecorViewModel implements WindowDecorViewModel, && Flags.enableDesktopWindowingImmersiveHandleHiding()) { decor.onInsetsStateChanged(insetsState); } if (!Flags.enableHandleInputFix()) { if (!DesktopModeFlags.ENABLE_HANDLE_INPUT_FIX.isTrue()) { // If status bar inset is visible, top task is not in immersive mode. // This value is only needed when the App Handle input is being handled // through the global input monitor (hence the flag check) to ignore gestures Loading
libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/DesktopModeWindowDecoration.java +7 −7 Original line number Diff line number Diff line Loading @@ -807,7 +807,7 @@ public class DesktopModeWindowDecoration extends WindowDecoration<WindowDecorLin */ void disposeStatusBarInputLayer() { if (!isAppHandle(mWindowDecorViewHolder) || !Flags.enableHandleInputFix()) { || !DesktopModeFlags.ENABLE_HANDLE_INPUT_FIX.isTrue()) { return; } asAppHandle(mWindowDecorViewHolder).disposeStatusBarInputLayer(); Loading Loading @@ -951,7 +951,7 @@ public class DesktopModeWindowDecoration extends WindowDecoration<WindowDecorLin } controlsElement.mAlignment = RelayoutParams.OccludingCaptionElement.Alignment.END; relayoutParams.mOccludingCaptionElements.add(controlsElement); } else if (isAppHandle && !Flags.enableHandleInputFix()) { } else if (isAppHandle && !DesktopModeFlags.ENABLE_HANDLE_INPUT_FIX.isTrue()) { // The focused decor (fullscreen/split) does not need to handle input because input in // the App Handle is handled by the InputMonitor in DesktopModeWindowDecorViewModel. // Note: This does not apply with the above flag enabled as the status bar input layer Loading Loading @@ -1560,13 +1560,13 @@ public class DesktopModeWindowDecoration extends WindowDecoration<WindowDecorLin */ boolean checkTouchEventInFocusedCaptionHandle(MotionEvent ev) { if (isHandleMenuActive() || !isAppHandle(mWindowDecorViewHolder) || Flags.enableHandleInputFix()) { || DesktopModeFlags.ENABLE_HANDLE_INPUT_FIX.isTrue()) { return false; } // The status bar input layer can only receive input in handle coordinates to begin with, // so checking coordinates is unnecessary as input is always within handle bounds. if (isAppHandle(mWindowDecorViewHolder) && Flags.enableHandleInputFix() && DesktopModeFlags.ENABLE_HANDLE_INPUT_FIX.isTrue() && isCaptionVisible()) { return true; } Loading Loading @@ -1603,7 +1603,7 @@ public class DesktopModeWindowDecoration extends WindowDecoration<WindowDecorLin * @param ev the MotionEvent to compare */ void checkTouchEvent(MotionEvent ev) { if (mResult.mRootView == null || Flags.enableHandleInputFix()) return; if (mResult.mRootView == null || DesktopModeFlags.ENABLE_HANDLE_INPUT_FIX.isTrue()) return; final View caption = mResult.mRootView.findViewById(R.id.desktop_mode_caption); final View handle = caption.findViewById(R.id.caption_handle); final boolean inHandle = !isHandleMenuActive() Loading @@ -1616,7 +1616,7 @@ public class DesktopModeWindowDecoration extends WindowDecoration<WindowDecorLin // If the whole handle menu can be touched directly, rely on FLAG_WATCH_OUTSIDE_TOUCH. // This is for the case that some of the handle menu is underneath the status bar. if (isAppHandle(mWindowDecorViewHolder) && !Flags.enableHandleInputFix()) { && !DesktopModeFlags.ENABLE_HANDLE_INPUT_FIX.isTrue()) { mHandleMenu.checkMotionEvent(ev); closeHandleMenuIfNeeded(ev); } Loading @@ -1630,7 +1630,7 @@ public class DesktopModeWindowDecoration extends WindowDecoration<WindowDecorLin * @param ev the MotionEvent to compare against. */ void updateHoverAndPressStatus(MotionEvent ev) { if (mResult.mRootView == null || Flags.enableHandleInputFix()) return; if (mResult.mRootView == null || DesktopModeFlags.ENABLE_HANDLE_INPUT_FIX.isTrue()) return; final View handle = mResult.mRootView.findViewById(R.id.caption_handle); final boolean inHandle = !isHandleMenuActive() && checkTouchEventInFocusedCaptionHandle(ev); Loading
libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/HandleMenu.kt +5 −4 Original line number Diff line number Diff line Loading @@ -39,11 +39,11 @@ import android.widget.Button import android.widget.ImageButton import android.widget.ImageView import android.widget.TextView import android.window.DesktopModeFlags import android.window.SurfaceSyncGroup import androidx.annotation.VisibleForTesting import androidx.compose.ui.graphics.toArgb import androidx.core.view.isGone import com.android.window.flags.Flags import com.android.wm.shell.R import com.android.wm.shell.shared.split.SplitScreenConstants import com.android.wm.shell.splitscreen.SplitScreenController Loading Loading @@ -83,7 +83,7 @@ class HandleMenu( private val taskInfo: RunningTaskInfo = parentDecor.mTaskInfo private val isViewAboveStatusBar: Boolean get() = (Flags.enableHandleInputFix() && !taskInfo.isFreeform) get() = (DesktopModeFlags.ENABLE_HANDLE_INPUT_FIX.isTrue() && !taskInfo.isFreeform) private val pillElevation: Int = loadDimensionPixelSize( R.dimen.desktop_mode_handle_menu_pill_elevation) Loading Loading @@ -201,7 +201,8 @@ class HandleMenu( val x = handleMenuPosition.x.toInt() val y = handleMenuPosition.y.toInt() handleMenuViewContainer = if ((!taskInfo.isFreeform && Flags.enableHandleInputFix()) || forceShowSystemBars) { if ((!taskInfo.isFreeform && DesktopModeFlags.ENABLE_HANDLE_INPUT_FIX.isTrue()) || forceShowSystemBars) { AdditionalSystemViewContainer( windowManagerWrapper = windowManagerWrapper, taskId = taskInfo.taskId, Loading Loading @@ -237,7 +238,7 @@ class HandleMenu( menuX = marginMenuStart menuY = captionY + marginMenuTop } else { if (Flags.enableHandleInputFix()) { if (DesktopModeFlags.ENABLE_HANDLE_INPUT_FIX.isTrue()) { // In a focused decor, we use global coordinates for handle menu. Therefore we // need to account for other factors like split stage and menu/handle width to // center the menu. Loading
libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/HandleMenuImageButton.kt +3 −4 Original line number Diff line number Diff line Loading @@ -16,13 +16,12 @@ package com.android.wm.shell.windowdecor import android.app.ActivityManager.RunningTaskInfo import com.android.window.flags.Flags import com.android.wm.shell.windowdecor.additionalviewcontainer.AdditionalSystemViewContainer import android.content.Context import android.util.AttributeSet import android.view.MotionEvent import android.widget.ImageButton import android.window.DesktopModeFlags import com.android.wm.shell.windowdecor.additionalviewcontainer.AdditionalSystemViewContainer /** * A custom [ImageButton] for buttons inside handle menu that intentionally doesn't handle hovers. Loading @@ -39,7 +38,7 @@ class HandleMenuImageButton( lateinit var taskInfo: RunningTaskInfo override fun onHoverEvent(motionEvent: MotionEvent): Boolean { if (Flags.enableHandleInputFix() || taskInfo.isFreeform) { if (DesktopModeFlags.ENABLE_HANDLE_INPUT_FIX.isTrue() || taskInfo.isFreeform) { return super.onHoverEvent(motionEvent) } else { return false Loading