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

Commit fc43f970 authored by Louis Chang's avatar Louis Chang Committed by Android (Google) Code Review
Browse files

Merge "Drop the pointer-down-outside-focus event" into main

parents 4e4bcefe 9ace7069
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)) {