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

Commit 8e01ec8c authored by wilsonshih's avatar wilsonshih
Browse files

Clear preferred focusable task when finishing an activity.

...when the task is also going to be removed.
The DisplayArea will have the next preferred focusable task when the
next activity is started.

Flag: com.android.window.flags.polish_close_wallpaper_includes_open_change
Bug: 421436197
Test: atest AssistantStackTests DreamManagerServiceTests KeyguardTests
Change-Id: I2a64533e5cec90727e9436d6c531f3de4b843aa4
parent d6b5b5cf
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -3624,6 +3624,13 @@ final class ActivityRecord extends WindowToken {
            if (chain.isCollecting()) {
                chain.getTransition().collectClose(trigger);
            }

            if (Flags.polishCloseWallpaperIncludesOpenChange() && endTask) {
                final TaskDisplayArea displayArea = getDisplayArea();
                if (displayArea != null && rootTask == displayArea.mPreferredTopFocusableRootTask) {
                    displayArea.clearPreferredTopFocusableRootTask();
                }
            }
            // We are finishing the top focused activity and its task has nothing to be focused so
            // the next focusable task should be focused.
            if (mayAdjustTop && task.topRunningActivity(true /* focusableOnly */)