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

Commit 92ee1334 authored by Maryam Dehaini's avatar Maryam Dehaini
Browse files

Check if display allows for app header/handle to be shown even for

freeform windows

Freeform windows forced to open on displays that do not support desktop
windowing (i.e. via adb or cts tests) should not show the app header.

Bug: 434025200
Test: atest FreeformWindowingModeTests, manual
Flag: EXEMPT minor bugfix
Change-Id: I78754317ec8d9760c91332effc67af325503539a
parent 52b01a20
Loading
Loading
Loading
Loading
+7 −8
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ package com.android.wm.shell.windowdecor.common

import android.app.ActivityManager
import android.app.WindowConfiguration
import android.app.WindowConfiguration.WINDOWING_MODE_FREEFORM
import android.view.Display
import android.view.WindowManager
import android.window.DesktopExperienceFlags.ENABLE_PROJECTED_DISPLAY_DESKTOP_MODE
@@ -48,15 +49,9 @@ class AppHandleAndHeaderVisibilityHelper(
     */
    fun shouldShowAppHandleOrHeader(taskInfo: ActivityManager.RunningTaskInfo): Boolean {

        // If DisplayController doesn't have it tracked, it could be a private/managed display, so
        // return false if display is null
        val display = displayController.getDisplay(taskInfo.displayId) ?: return false
        if (display == null) {
            // If DisplayController doesn't have it tracked, it could be a private/managed display.
            return false
        }
        // All freeform windows should show the app header.
        if (taskInfo.windowingMode == WindowConfiguration.WINDOWING_MODE_FREEFORM) {
            return true
        }

        if (!ENABLE_PROJECTED_DISPLAY_DESKTOP_MODE.isTrue) {
            return allowedForTask(taskInfo, display)
@@ -68,6 +63,10 @@ class AppHandleAndHeaderVisibilityHelper(
        taskInfo: ActivityManager.RunningTaskInfo,
        display: Display,
    ): Boolean {
        if (taskInfo.windowingMode == WINDOWING_MODE_FREEFORM) {
            return true
        }

        if (splitScreenController?.isTaskRootOrStageRoot(taskInfo.taskId) == true) {
            return false
        }