Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ba537f04 authored by Ben Lin's avatar Ben Lin
Browse files

Caption/DesktopWindowDecor: don't show window decor for private display.

Shell/SystemUI has no access to private displays, so if a task is
starting on it, even if we get a transition signal to Shell, we should
not do anything such as adding window decoration to it since Shell has
no access to its attributes, such as its context.

This was not a problem since we used to always use the default
DEFAULT_DISPLAY Context.

Bug: 389901828
Test: atest
com.android.test.input.UinputRecordingIntegrationTests#testEvemuRecording
Test: atest
android.server.wm.multidisplay.MultiDisplayKeyguardTests#testDismissKeyguardActivity_secondaryDisplay
Flag: EXEMPT bugfix

Change-Id: I9194d6c89547f18416b4a50e7f3b659c16bef6f8
parent 17c69415
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -284,6 +284,10 @@ public class CaptionWindowDecorViewModel implements WindowDecorViewModel, FocusT
    }

    private boolean shouldShowWindowDecor(RunningTaskInfo taskInfo) {
        if (mDisplayController.getDisplay(taskInfo.displayId) == null) {
            // If DisplayController doesn't have it tracked, it could be a private/managed display.
            return false;
        }
        if (taskInfo.getWindowingMode() == WINDOWING_MODE_FREEFORM) {
            return true;
        }
+4 −0
Original line number Diff line number Diff line
@@ -1641,6 +1641,10 @@ public class DesktopModeWindowDecorViewModel implements WindowDecorViewModel,
    }

    private boolean shouldShowWindowDecor(RunningTaskInfo taskInfo) {
        if (mDisplayController.getDisplay(taskInfo.displayId) == null) {
            // If DisplayController doesn't have it tracked, it could be a private/managed display.
            return false;
        }
        if (taskInfo.getWindowingMode() == WINDOWING_MODE_FREEFORM) return true;
        if (mSplitScreenController != null
                && mSplitScreenController.isTaskRootOrStageRoot(taskInfo.taskId)) {
+3 −0
Original line number Diff line number Diff line
@@ -31,6 +31,7 @@ import android.platform.test.flag.junit.SetFlagsRule
import android.testing.TestableContext
import android.util.SparseArray
import android.view.Choreographer
import android.view.Display
import android.view.Display.DEFAULT_DISPLAY
import android.view.IWindowManager
import android.view.InputChannel
@@ -157,6 +158,7 @@ open class DesktopModeWindowDecorViewModelTestsBase : ShellTestCase() {
    protected val mockRecentsTransitionHandler = mock<RecentsTransitionHandler>()
    protected val motionEvent = mock<MotionEvent>()
    val displayLayout = mock<DisplayLayout>()
    val display = mock<Display>()
    protected lateinit var spyContext: TestableContext
    private lateinit var desktopModeEventLogger: DesktopModeEventLogger

@@ -183,6 +185,7 @@ open class DesktopModeWindowDecorViewModelTestsBase : ShellTestCase() {
        desktopModeEventLogger = mock<DesktopModeEventLogger>()
        whenever(mockDesktopUserRepositories.current).thenReturn(mockDesktopRepository)
        whenever(mockDisplayController.getDisplayContext(any())).thenReturn(spyContext)
        whenever(mockDisplayController.getDisplay(any())).thenReturn(display)
        whenever(mockDesktopUserRepositories.getProfile(anyInt()))
            .thenReturn(mockDesktopRepository)
        desktopModeWindowDecorViewModel = DesktopModeWindowDecorViewModel(