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

Commit 9ace7069 authored by Louis Chang's avatar Louis Chang
Browse files

Drop the pointer-down-outside-focus event

... if it focused on an Activity that's entirely occluded by
the task top activity.

We don't check the mVisibleRequested state because the activity
behind may still be visible due to the shared-element transition.

Bug: 360385918
Test: Explicitly delay ON_POINTER_DOWN_OUTSIDE_FOCUS 300 ms
Flag: EXEMPT bugfix
Change-Id: I5871ea8cae940842ca57294affc76b485e8e1365
parent b7610715
Loading
Loading
Loading
Loading
+16 −0
Original line number Diff line number Diff line
@@ -8947,6 +8947,22 @@ public class WindowManagerService extends IWindowManager.Stub
            // display it's on to the top since that window won't be able to get focus anyway.
            return;
        }

        final ActivityRecord touchedApp = t.getActivityRecord();
        if (touchedApp != null && touchedApp.getTask() != null) {
            final ActivityRecord top = touchedApp.getTask().topRunningActivity();
            if (top != touchedApp && top.getTaskFragment().getBounds().contains(
                    touchedApp.getTaskFragment().getBounds())) {
                // This is a special case where the pointer-down-outside focus on an Activity that's
                // entirely occluded by the task top running activity, this is possible if the
                // pointer-down-outside-focus event is delayed (after new activity started on top).
                // In that case, drop the event to prevent changing focus to a background activity.
                Slog.w(TAG, "onPointerDownOutsideFocusLocked, drop event because " + touchedApp
                        + " is occluded and should not be focused.");
                return;
            }
        }

        clearPointerDownOutsideFocusRunnable();

        if (shouldDelayTouchOutside(t)) {