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

Commit 11f7c7e0 authored by Chris Tate's avatar Chris Tate Committed by Android (Google) Code Review
Browse files

Merge "Fix spurious ANRs involving window shuffling and non-fullscreen activities"

parents 93c0a0d9 136b1f92
Loading
Loading
Loading
Loading
+8 −12
Original line number Diff line number Diff line
@@ -5610,7 +5610,7 @@ public class WindowManagerService extends IWindowManager.Stub
                            // If an app switch key has been pressed, and we have
                            // waited too long for the current app to finish
                            // processing keys, then wait no more!
                            doFinishedKeyLocked(true);
                            doFinishedKeyLocked(false);
                            continue;
                        }
                        long switchTimeout = mTimeToSwitch - now;
@@ -6008,7 +6008,7 @@ public class WindowManagerService extends IWindowManager.Stub
                        + ((mLastWin != null) ? mLastWin.mToken.paused : "null"));
                    if (mLastWin != null && (!mLastWin.mToken.paused || force
                            || !mEventDispatching)) {
                        doFinishedKeyLocked(false);
                        doFinishedKeyLocked(true);
                    } else {
                        // Make sure to wake up anyone currently waiting to
                        // dispatch a key, so they can re-evaluate their
@@ -6086,14 +6086,10 @@ public class WindowManagerService extends IWindowManager.Stub
                        // The new window is above the old; finish pending input to the last
                        // window and start directing it to the new one.
                        mLastWin.mToken.paused = false;
                        doFinishedKeyLocked(true);  // does a notifyAll()
                    }
                    // Either the new window is lower, so there is no need to wake key waiters,
                    // or we just finished key input to the previous window, which implicitly
                    // notified the key waiters.  In both cases, we don't need to issue the
                    // notification here.
                        doFinishedKeyLocked(false);  // does a notifyAll()
                        return;
                    }
                }

                // Now that we've put a new window state in place, make the event waiter
                // take notice and retarget its attentions.
@@ -6134,7 +6130,7 @@ public class WindowManagerService extends IWindowManager.Stub
                        + token.paused);
                    token.paused = false;
                    if (mLastWin != null && mLastWin.mToken == token && mFinished) {
                        doFinishedKeyLocked(true);
                        doFinishedKeyLocked(false);
                    } else {
                        notifyAll();
                    }
@@ -6162,13 +6158,13 @@ public class WindowManagerService extends IWindowManager.Stub
            }
        }

        private final void doFinishedKeyLocked(boolean doRecycle) {
        private final void doFinishedKeyLocked(boolean force) {
            if (mLastWin != null) {
                releasePendingPointerLocked(mLastWin.mSession);
                releasePendingTrackballLocked(mLastWin.mSession);
            }

            if (mLastWin == null || !mLastWin.mToken.paused
            if (force || mLastWin == null || !mLastWin.mToken.paused
                    || !mLastWin.isVisibleLw()) {
                // If the current window has been paused, we aren't -really-
                // finished...  so let the waiters still wait.