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

Commit fee130dd authored by Winson Chung's avatar Winson Chung Committed by Automerger Merge Worker
Browse files

Merge "Account for the focused window before requesting input consumer focus"...

Merge "Account for the focused window before requesting input consumer focus" into sc-dev am: a0a4985d am: 03d643fa

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15014045

Change-Id: Icec6334799dddb5a7f774f014658a122f1e32a19
parents 5d7efc12 03d643fa
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;
                }
            }