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

Commit c7283b63 authored by Daniel Akinola's avatar Daniel Akinola
Browse files

Ensure snap resize toast is shown on correct display

The toast shown when trying to snap resize an app which is non
-resizable was showing on the wrong display, so fixed by using the
display context.

Fix: 440280448
Test: manual testing
Flag: EXEMPT bugfix
Change-Id: I18581a7392daa4a684b803ed51a24fcd61f5df01
parent 2a22330b
Loading
Loading
Loading
Loading
+9 −7
Original line number Diff line number Diff line
@@ -1024,9 +1024,8 @@ class DesktopTasksController(
        val excludedTasks =
            getFocusedNonDesktopTasks(DEFAULT_DISPLAY, userId).map { task -> task.taskId }
        // Preserve focus state on reconnect, regardless if focused task is restored or not.
        val globallyFocusedTask = shellTaskOrganizer.getRunningTaskInfo(
            focusTransitionObserver.globallyFocusedTaskId
        )
        val globallyFocusedTask =
            shellTaskOrganizer.getRunningTaskInfo(focusTransitionObserver.globallyFocusedTaskId)
        mainScope.launch {
            preservedTaskIdsByDeskId.forEach { (preservedDeskId, preservedTaskIds) ->
                val newDeskId =
@@ -2867,8 +2866,9 @@ class DesktopTasksController(
        inputMethod: InputMethod,
    ) {
        if (!isSnapResizingAllowed(taskInfo)) {
            val displayContext = displayController.getDisplayContext(taskInfo.displayId) ?: context
            Toast.makeText(
                    getContext(),
                    displayContext,
                    R.string.desktop_mode_non_resizable_snap_text,
                    Toast.LENGTH_SHORT,
                )
@@ -2912,9 +2912,11 @@ class DesktopTasksController(
                startBounds = currentDragBounds,
                endBounds = dragStartBounds,
                doOnEnd = {
                    val displayContext =
                        displayController.getDisplayContext(taskInfo.displayId) ?: context
                    Toast.makeText(
                            context,
                            com.android.wm.shell.R.string.desktop_mode_non_resizable_snap_text,
                            displayContext,
                            R.string.desktop_mode_non_resizable_snap_text,
                            Toast.LENGTH_SHORT,
                        )
                        .show()