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

Commit c624b789 authored by Chong Zhang's avatar Chong Zhang Committed by android-build-merger
Browse files

Merge "Fix replacing window timeouts" into nyc-dev

am: a63e1325

* commit 'a63e1325':
  Fix replacing window timeouts

Change-Id: Iea960b772b0eacf6e6bc37fe33e2dfcd554fd3c8
parents 0fcf5474 a63e1325
Loading
Loading
Loading
Loading
+1 −4
Original line number Diff line number Diff line
@@ -582,10 +582,7 @@ class AppWindowToken extends WindowToken {
                w.mSkipEnterAnimationForSeamlessReplacement = !candidate.mAnimateReplacingWindow;

                // if we got a replacement window, reset the timeout to give drawing more time
                service.mH.removeMessages(H.WINDOW_REPLACEMENT_TIMEOUT);
                service.mH.sendMessageDelayed(
                        service.mH.obtainMessage(H.WINDOW_REPLACEMENT_TIMEOUT, this),
                            WINDOW_REPLACEMENT_TIMEOUT_DURATION);
                service.scheduleReplacingWindowTimeouts(this);
            }
        }
        allAppWindows.add(w);
+21 −6
Original line number Diff line number Diff line
@@ -414,6 +414,12 @@ public class WindowManagerService extends IWindowManager.Stub
     */
    final ArrayList<AppWindowToken> mFinishedStarting = new ArrayList<>();

    /**
     * List of app window tokens that are waiting for replacing windows. If the
     * replacement doesn't come in time the stale windows needs to be disposed of.
     */
    final ArrayList<AppWindowToken> mReplacingWindowTimeouts = new ArrayList<>();

    /**
     * The input consumer added to the window manager which consumes input events to windows below
     * it.
@@ -8497,10 +8503,13 @@ public class WindowManagerService extends IWindowManager.Stub
                }
                break;
                case WINDOW_REPLACEMENT_TIMEOUT: {
                    final AppWindowToken token = (AppWindowToken) msg.obj;
                    synchronized (mWindowMap) {
                        for (int i = mReplacingWindowTimeouts.size() - 1; i >= 0; i--) {
                            final AppWindowToken token = mReplacingWindowTimeouts.get(i);
                            token.clearTimedoutReplacesLocked();
                        }
                        mReplacingWindowTimeouts.clear();
                    }
                }
                case NOTIFY_APP_TRANSITION_STARTING: {
                    mAmInternal.notifyAppTransitionStarting(msg.arg1);
@@ -10769,16 +10778,22 @@ public class WindowManagerService extends IWindowManager.Stub
                return;
            }
            if (replacing) {
                mH.removeMessages(H.WINDOW_REPLACEMENT_TIMEOUT);
                mH.sendMessageDelayed(
                        mH.obtainMessage(H.WINDOW_REPLACEMENT_TIMEOUT, appWindowToken),
                        WINDOW_REPLACEMENT_TIMEOUT_DURATION);
                scheduleReplacingWindowTimeouts(appWindowToken);
            } else {
                appWindowToken.resetReplacingWindows();
            }
        }
    }

    void scheduleReplacingWindowTimeouts(AppWindowToken appWindowToken) {
        if (!mReplacingWindowTimeouts.contains(appWindowToken)) {
            mReplacingWindowTimeouts.add(appWindowToken);
        }
        mH.removeMessages(H.WINDOW_REPLACEMENT_TIMEOUT);
        mH.sendEmptyMessageDelayed(
                H.WINDOW_REPLACEMENT_TIMEOUT, WINDOW_REPLACEMENT_TIMEOUT_DURATION);
    }

    @Override
    public int getDockedStackSide() {
        synchronized (mWindowMap) {