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

Commit aaf1ef41 authored by Ming-Shin Lu's avatar Ming-Shin Lu Committed by Android (Google) Code Review
Browse files

Merge "Better IME transition while switching app with recents (1/N)"

parents d573aae5 60222bf6
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -3374,6 +3374,14 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
        mUpdateImeTarget = updateImeTarget;
        WindowState target = getWindow(mComputeImeTargetPredicate);

        // Keeps the IME target with the last window while swiping up to recents to prevent
        // flickering due to IME hide animation on top of recents.
        // TODO(b/166736352): This logic should go away once we switch over target immediately
        //  and do the screenshot to preserve IME on disappearing target
        if (target != null && curTarget != null && target.isActivityTypeHome()
                && curTarget.getInsetsState().getSource(ITYPE_IME).isVisible()) {
            return curTarget;
        }

        // Yet more tricksyness!  If this window is a "starting" window, we do actually want
        // to be on top of it, but it is not -really- where input will go. So look down below
@@ -3546,7 +3554,7 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
        );
    }

    private void updateImeParent() {
    void updateImeParent() {
        final SurfaceControl newParent = computeImeParent();
        if (newParent != null) {
            getPendingTransaction().reparent(mImeWindowsContainers.mSurfaceControl, newParent);
+14 −0
Original line number Diff line number Diff line
@@ -283,6 +283,20 @@ public class RecentsAnimationController implements DeathRecipient {
        public void hideCurrentInputMethod() {
            final long token = Binder.clearCallingIdentity();
            try {
                synchronized (mService.getWindowManagerLock()) {
                    // Make sure to update the correct IME parent in case that the IME parent may
                    // be computed as display layer when re-layout window happens during rotation
                    // but there is intermediate state that the bounds of task and the IME
                    // target's activity is not the same during rotating.
                    mDisplayContent.updateImeParent();

                    // Ignore hiding IME if IME window is attached to app.
                    // Since we would like to snapshot Task with IME window while transitioning
                    // to recents.
                    if (mDisplayContent.isImeAttachedToApp()) {
                        return;
                    }
                }
                final InputMethodManagerInternal inputMethodManagerInternal =
                        LocalServices.getService(InputMethodManagerInternal.class);
                if (inputMethodManagerInternal != null) {
+2 −1
Original line number Diff line number Diff line
@@ -368,7 +368,8 @@ class TaskSnapshotController {

        SurfaceControl[] excludeLayers;
        final WindowState imeWindow = task.getDisplayContent().mInputMethodWindow;
        if (imeWindow != null) {
        // Exclude IME window snapshot when IME isn't proper to attach to app.
        if (imeWindow != null && !task.getDisplayContent().isImeAttachedToApp()) {
            excludeLayers = new SurfaceControl[1];
            excludeLayers[0] = imeWindow.getSurfaceControl();
        } else {