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

Commit 5498ee18 authored by Winson Chung's avatar Winson Chung
Browse files

Account for the focused window before requesting input consumer focus

- The original patch for ag/13732971 was right -- we need to only apply
  this if the calculated focused window is being animated by the recents
  animation, not only if there is a recents animation input consumer
  applied

Fixes: 191058092
Bug: 177923822
Test: With live tile enabled, open app in overview and try to reply
      in a HUN
Change-Id: Ib13ada79971ea09dba27c6e0acc2e50017a92951
parent 5d552869
Loading
Loading
Loading
Loading
+16 −14
Original line number Diff line number Diff line
@@ -394,10 +394,23 @@ final class InputMonitor {
    /**
     * Called when the current input focus changes.
     */
    private void updateInputFocusRequest() {
    private void updateInputFocusRequest(InputConsumerImpl recentsAnimationInputConsumer) {
        final WindowState focus = mDisplayContent.mCurrentFocus;
        final IBinder focusToken = focus != null ? focus.mInputChannelToken : null;
        // Request focus for the recents animation input consumer if an input consumer should
        // be applied for the window.
        if (recentsAnimationInputConsumer != null && focus != null) {
            final RecentsAnimationController recentsAnimationController =
                    mService.getRecentsAnimationController();
            final boolean shouldApplyRecentsInputConsumer = recentsAnimationController != null
                    && recentsAnimationController.shouldApplyInputConsumer(focus.mActivityRecord);
            if (shouldApplyRecentsInputConsumer) {
                requestFocus(recentsAnimationInputConsumer.mWindowHandle.token,
                        recentsAnimationInputConsumer.mName);
                return;
            }
        }

        final IBinder focusToken = focus != null ? focus.mInputChannelToken : null;
        if (focusToken == null) {
            mInputFocus = null;
            return;
@@ -474,8 +487,6 @@ final class InputMonitor {

        boolean mInDrag;

        private boolean mRecentsAnimationFocusOverride;

        private void updateInputWindows(boolean inDrag) {
            Trace.traceBegin(TRACE_TAG_WINDOW_MANAGER, "updateInputWindows");

@@ -491,16 +502,8 @@ final class InputMonitor {
            mInDrag = inDrag;

            resetInputConsumers(mInputTransaction);
            mRecentsAnimationFocusOverride = false;
            mDisplayContent.forAllWindows(this, true /* traverseTopToBottom */);

            if (mRecentsAnimationFocusOverride) {
                requestFocus(mRecentsAnimationInputConsumer.mWindowHandle.token,
                        mRecentsAnimationInputConsumer.mName);
            } else {
                updateInputFocusRequest();
            }

            updateInputFocusRequest(mRecentsAnimationInputConsumer);

            if (!mUpdateInputWindowsImmediately) {
                mDisplayContent.getPendingTransaction().merge(mInputTransaction);
@@ -538,7 +541,6 @@ final class InputMonitor {
                        mRecentsAnimationInputConsumer.mWindowHandle)) {
                    mRecentsAnimationInputConsumer.show(mInputTransaction, w.mActivityRecord);
                    mAddRecentsAnimationInputConsumerHandle = false;
                    mRecentsAnimationFocusOverride = true;
                }
            }