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

Commit 67535ba6 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Fix NPE in updateDisplayWindowingMode" into main

parents 91264060 5ce57237
Loading
Loading
Loading
Loading
+15 −4
Original line number Diff line number Diff line
@@ -97,9 +97,16 @@ class DesktopDisplayModeController(
    }

    private fun updateDisplayWindowingMode(displayId: Int, targetDisplayWindowingMode: Int) {
        val tdaInfo =
            requireNotNull(rootTaskDisplayAreaOrganizer.getDisplayAreaInfo(displayId)) {
                "DisplayAreaInfo of display#$displayId must be non-null."
        val tdaInfo = rootTaskDisplayAreaOrganizer.getDisplayAreaInfo(displayId)
        // A non-organized display (e.g., non-trusted virtual displays used in CTS) doesn't have
        // TDA.
        if (tdaInfo == null) {
            logW(
                "updateDisplayWindowingMode cannot find DisplayAreaInfo for displayId=%d. This " +
                    " could happen when the display is a non-trusted virtual display.",
                displayId,
            )
            return
        }
        val currentDisplayWindowingMode = tdaInfo.configuration.windowConfiguration.windowingMode
        if (currentDisplayWindowingMode == targetDisplayWindowingMode) {
@@ -220,6 +227,10 @@ class DesktopDisplayModeController(
        ProtoLog.v(WM_SHELL_DESKTOP_MODE, "%s: $msg", TAG, *arguments)
    }

    private fun logW(msg: String, vararg arguments: Any?) {
        ProtoLog.w(WM_SHELL_DESKTOP_MODE, "%s: $msg", TAG, *arguments)
    }

    companion object {
        private const val TAG = "DesktopDisplayModeController"
    }