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

Commit a209eafe authored by b0202.jung's avatar b0202.jung
Browse files

Fix focused error of embedded task fragments

If a display has freeform windowing environments such as Desktop
or XR device, then resumed activity of task fragment will be set
to focused app. However, it can break focused state in embedded
task fragments.

Thus, allow it only if a focused task is different from a next task.

Bug: 343252725
Test: Settings(AE) > Launch SubSettings > Check focused app/window
Change-Id: Ib62ecb7c8e0fe453149f51c610c34d97bbde7cb1
parent e4016645
Loading
Loading
Loading
Loading
+7 −4
Original line number Diff line number Diff line
@@ -1257,11 +1257,14 @@ class TaskFragment extends WindowContainer<WindowContainer> {

            // In a multi-resumed environment, like in a freeform device, the top
            // activity can be resumed, but it might not be the focused app.
            // Set focused app when top activity is resumed
            if (taskDisplayArea.inMultiWindowMode() && taskDisplayArea.mDisplayContent != null
                    && taskDisplayArea.mDisplayContent.mFocusedApp != next) {
            // Set focused app when top activity is resumed. However, we shouldn't do it for a
            // same task because it can break focused state. (e.g. activity embedding)
            if (taskDisplayArea.inMultiWindowMode() && taskDisplayArea.mDisplayContent != null) {
                final ActivityRecord focusedApp = taskDisplayArea.mDisplayContent.mFocusedApp;
                if (focusedApp == null || focusedApp.getTask() != next.getTask()) {
                    taskDisplayArea.mDisplayContent.setFocusedApp(next);
                }
            }
            ProtoLog.d(WM_DEBUG_STATES, "resumeTopActivity: Top activity "
                    + "resumed %s", next);
            return false;