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

Commit 63d593c9 authored by Louis Chang's avatar Louis Chang
Browse files

Fixes the touched activity not getting focus in AE

The #setFocusedTask was return early because the top
running activity in the task was the top resumed activity.

Bug: 278644407
Test: TaskFragmentTest
Change-Id: I0cfd99e9fa9e47b7a86755f413afae7b7cd6900e
parent 6218576e
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -2012,7 +2012,8 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
            return;
        }

        if (r.isState(RESUMED) && r == mRootWindowContainer.getTopResumedActivity()) {
        if ((touchedActivity == null || r == touchedActivity) && r.isState(RESUMED)
                && r == mRootWindowContainer.getTopResumedActivity()) {
            setLastResumedActivityUncheckLocked(r, "setFocusedTask-alreadyTop");
            return;
        }
+9 −0
Original line number Diff line number Diff line
@@ -586,6 +586,15 @@ public class TaskFragmentTest extends WindowTestsBase {
        // Making the activity0 be the focused activity and ensure the focused app is updated.
        activity0.moveFocusableActivityToTop("test");
        assertEquals(activity0, mDisplayContent.mFocusedApp);

        // Moving activity1 to top and make both the two activities resumed.
        activity1.moveFocusableActivityToTop("test");
        activity0.setState(RESUMED, "test");
        activity1.setState(RESUMED, "test");

        // Verifies that the focus app can be updated to an Activity in the adjacent TF
        mAtm.setFocusedTask(task.mTaskId, activity0);
        assertEquals(activity0, mDisplayContent.mFocusedApp);
    }

    @Test