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

Commit 54c07fc4 authored by Louis Chang's avatar Louis Chang Committed by Automerger Merge Worker
Browse files

Merge "Skip moving the focused Task to top if it is already on top" into tm-qpr-dev am: be9d1c78

parents bd58f61b be9d1c78
Loading
Loading
Loading
Loading
+12 −6
Original line number Original line Diff line number Diff line
@@ -2605,6 +2605,12 @@
      "group": "WM_DEBUG_STATES",
      "group": "WM_DEBUG_STATES",
      "at": "com\/android\/server\/wm\/TaskFragment.java"
      "at": "com\/android\/server\/wm\/TaskFragment.java"
    },
    },
    "385237117": {
      "message": "moveFocusableActivityToTop: already on top and focused, activity=%s",
      "level": "DEBUG",
      "group": "WM_DEBUG_FOCUS",
      "at": "com\/android\/server\/wm\/ActivityRecord.java"
    },
    "385595355": {
    "385595355": {
      "message": "Starting animation on %s: type=%d, anim=%s",
      "message": "Starting animation on %s: type=%d, anim=%s",
      "level": "VERBOSE",
      "level": "VERBOSE",
@@ -3409,6 +3415,12 @@
      "group": "WM_DEBUG_BOOT",
      "group": "WM_DEBUG_BOOT",
      "at": "com\/android\/server\/wm\/WindowManagerService.java"
      "at": "com\/android\/server\/wm\/WindowManagerService.java"
    },
    },
    "1239439010": {
      "message": "moveFocusableActivityToTop: set focused, activity=%s",
      "level": "DEBUG",
      "group": "WM_DEBUG_FOCUS",
      "at": "com\/android\/server\/wm\/ActivityRecord.java"
    },
    "1252594551": {
    "1252594551": {
      "message": "Window types in WindowContext and LayoutParams.type should match! Type from LayoutParams is %d, but type from WindowContext is %d",
      "message": "Window types in WindowContext and LayoutParams.type should match! Type from LayoutParams is %d, but type from WindowContext is %d",
      "level": "WARN",
      "level": "WARN",
@@ -3991,12 +4003,6 @@
      "group": "WM_DEBUG_STARTING_WINDOW",
      "group": "WM_DEBUG_STARTING_WINDOW",
      "at": "com\/android\/server\/wm\/ActivityRecord.java"
      "at": "com\/android\/server\/wm\/ActivityRecord.java"
    },
    },
    "1856211951": {
      "message": "moveFocusableActivityToTop: already on top, activity=%s",
      "level": "DEBUG",
      "group": "WM_DEBUG_FOCUS",
      "at": "com\/android\/server\/wm\/ActivityRecord.java"
    },
    "1856783490": {
    "1856783490": {
      "message": "resumeTopActivity: Restarting %s",
      "message": "resumeTopActivity: Restarting %s",
      "level": "DEBUG",
      "level": "DEBUG",
+22 −5
Original line number Original line Diff line number Diff line
@@ -3215,12 +3215,29 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
            return false;
            return false;
        }
        }


        if (mRootWindowContainer.getTopResumedActivity() == this
        // If this activity already positions on the top focused task, moving the task to front
                && getDisplayContent().mFocusedApp == this) {
        // is not needed. But we still need to ensure this activity is focused because the
            ProtoLog.d(WM_DEBUG_FOCUS, "moveFocusableActivityToTop: already on top, "
        // current focused activity could be another activity in the same Task if activities are
        // displayed on adjacent TaskFragments.
        final ActivityRecord currentFocusedApp = mDisplayContent.mFocusedApp;
        if (currentFocusedApp != null && currentFocusedApp.task == task) {
            final Task topFocusableTask = mDisplayContent.getTask(
                    (t) -> t.isLeafTask() && t.isFocusable(), true /*  traverseTopToBottom */);
            if (task == topFocusableTask) {
                if (currentFocusedApp == this) {
                    ProtoLog.d(WM_DEBUG_FOCUS, "moveFocusableActivityToTop: already on top "
                            + "and focused, activity=%s", this);
                } else {
                    ProtoLog.d(WM_DEBUG_FOCUS, "moveFocusableActivityToTop: set focused, "
                            + "activity=%s", this);
                            + "activity=%s", this);
                    mDisplayContent.setFocusedApp(this);
                    mAtmService.mWindowManager.updateFocusedWindowLocked(UPDATE_FOCUS_NORMAL,
                            true /* updateInputWindows */);
                }
                return !isState(RESUMED);
                return !isState(RESUMED);
            }
            }
        }

        ProtoLog.d(WM_DEBUG_FOCUS, "moveFocusableActivityToTop: activity=%s", this);
        ProtoLog.d(WM_DEBUG_FOCUS, "moveFocusableActivityToTop: activity=%s", this);


        rootTask.moveToFront(reason, task);
        rootTask.moveToFront(reason, task);
+8 −0
Original line number Original line Diff line number Diff line
@@ -475,5 +475,13 @@ public class TaskFragmentTest extends WindowTestsBase {
        assertFalse(activity0.isLetterboxedForFixedOrientationAndAspectRatio());
        assertFalse(activity0.isLetterboxedForFixedOrientationAndAspectRatio());
        assertFalse(activity1.isLetterboxedForFixedOrientationAndAspectRatio());
        assertFalse(activity1.isLetterboxedForFixedOrientationAndAspectRatio());
        assertEquals(SCREEN_ORIENTATION_UNSET, task.getOrientation());
        assertEquals(SCREEN_ORIENTATION_UNSET, task.getOrientation());

        tf0.setResumedActivity(activity0, "test");
        tf1.setResumedActivity(activity1, "test");
        mDisplayContent.mFocusedApp = activity1;

        // Making the activity0 be the focused activity and ensure the focused app is updated.
        activity0.moveFocusableActivityToTop("test");
        assertEquals(activity0, mDisplayContent.mFocusedApp);
    }
    }
}
}