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

Commit 4ffd84fa authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Fix IME flickering when swiping out to home" into sc-qpr1-dev am: c300c9d7

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

Change-Id: Ie130532ef5fd2032e49437f4d0aacc8e80f5f3b4
parents 5020a15a c300c9d7
Loading
Loading
Loading
Loading
+5 −7
Original line number Diff line number Diff line
@@ -2581,14 +2581,12 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
        }

        if (mCurToken != null) {
            try {
            if (DEBUG) {
                Slog.v(TAG, "Removing window token: " + mCurToken + " for display: "
                        + mCurTokenDisplayId);
            }
                mIWindowManager.removeWindowToken(mCurToken, mCurTokenDisplayId);
            } catch (RemoteException e) {
            }
            mWindowManagerInternal.removeWindowToken(mCurToken, false /* removeWindows */,
                    false /* animateExit */, mCurTokenDisplayId);
            // Set IME window status as invisible when unbind current method.
            mImeWindowVis = 0;
            mBackDisposition = InputMethodService.BACK_DISPOSITION_DEFAULT;
+3 −3
Original line number Diff line number Diff line
@@ -1207,10 +1207,10 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
        }
    }

    WindowToken removeWindowToken(IBinder binder) {
    WindowToken removeWindowToken(IBinder binder, boolean animateExit) {
        final WindowToken token = mTokenMap.remove(binder);
        if (token != null && token.asActivityRecord() == null) {
            token.setExiting();
            token.setExiting(animateExit);
        }
        return token;
    }
@@ -1288,7 +1288,7 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
    }

    void removeAppToken(IBinder binder) {
        final WindowToken token = removeWindowToken(binder);
        final WindowToken token = removeWindowToken(binder, true /* animateExit */);
        if (token == null) {
            Slog.w(TAG_WM, "removeAppToken: Attempted to remove non-existing token: " + binder);
            return;
+2 −2
Original line number Diff line number Diff line
@@ -66,8 +66,8 @@ class WallpaperWindowToken extends WindowToken {
    }

    @Override
    void setExiting() {
        super.setExiting();
    void setExiting(boolean animateExit) {
        super.setExiting(animateExit);
        mDisplayContent.mWallpaperController.removeWallpaperToken(this);
    }

+14 −1
Original line number Diff line number Diff line
@@ -462,8 +462,21 @@ public abstract class WindowManagerInternal {
     * @param removeWindows Whether to also remove the windows associated with the token.
     * @param displayId The display to remove the token from.
     */
    public final void removeWindowToken(android.os.IBinder token, boolean removeWindows,
            int displayId) {
        removeWindowToken(token, removeWindows, true /* animateExit */, displayId);
    }

    /**
     * Removes a window token.
     *
     * @param token The toke to remove.
     * @param removeWindows Whether to also remove the windows associated with the token.
     * @param animateExit Whether to play the windows exit animation after the token removal.
     * @param displayId The display to remove the token from.
     */
    public abstract void removeWindowToken(android.os.IBinder token, boolean removeWindows,
            int displayId);
            boolean animateExit, int displayId);

    /**
     * Registers a listener to be notified about app transition events.
+30 −39
Original line number Diff line number Diff line
@@ -2810,13 +2810,8 @@ public class WindowManagerService extends IWindowManager.Stub

    }

    @Override
    public void removeWindowToken(IBinder binder, int displayId) {
        if (!checkCallingPermission(MANAGE_APP_TOKENS, "removeWindowToken()")) {
            throw new SecurityException("Requires MANAGE_APP_TOKENS permission");
        }
        final long origId = Binder.clearCallingIdentity();
        try {
    void removeWindowToken(IBinder binder, boolean removeWindows, boolean animateExit,
            int displayId) {
        synchronized (mGlobalLock) {
            final DisplayContent dc = mRoot.getDisplayContent(displayId);

@@ -2825,15 +2820,29 @@ public class WindowManagerService extends IWindowManager.Stub
                        + " for non-exiting displayId=%d", binder, displayId);
                return;
            }
                final WindowToken token = dc.removeWindowToken(binder);
            final WindowToken token = dc.removeWindowToken(binder, animateExit);
            if (token == null) {
                ProtoLog.w(WM_ERROR,
                        "removeWindowToken: Attempted to remove non-existing token: %s",
                        binder);
                return;
            }

            if (removeWindows) {
                token.removeAllWindowsIfPossible();
            }
            dc.getInputMonitor().updateInputWindowsLw(true /* force */);
        }
    }

    @Override
    public void removeWindowToken(IBinder binder, int displayId) {
        if (!checkCallingPermission(MANAGE_APP_TOKENS, "removeWindowToken()")) {
            throw new SecurityException("Requires MANAGE_APP_TOKENS permission");
        }
        final long origId = Binder.clearCallingIdentity();
        try {
            removeWindowToken(binder, false /* removeWindows */, true /* animateExit */, displayId);
        } finally {
            Binder.restoreCallingIdentity(origId);
        }
@@ -7551,28 +7560,10 @@ public class WindowManagerService extends IWindowManager.Stub
        }

        @Override
        public void removeWindowToken(IBinder binder, boolean removeWindows, int displayId) {
            synchronized (mGlobalLock) {
                if (removeWindows) {
                    final DisplayContent dc = mRoot.getDisplayContent(displayId);
                    if (dc == null) {
                        ProtoLog.w(WM_ERROR, "removeWindowToken: Attempted to remove token: %s"
                                + " for non-exiting displayId=%d", binder, displayId);
                        return;
                    }

                    final WindowToken token = dc.removeWindowToken(binder);
                    if (token == null) {
                        ProtoLog.w(WM_ERROR,
                                "removeWindowToken: Attempted to remove non-existing token: %s",
                                binder);
                        return;
                    }

                    token.removeAllWindowsIfPossible();
                }
                WindowManagerService.this.removeWindowToken(binder, displayId);
            }
        public void removeWindowToken(IBinder binder, boolean removeWindows, boolean animateExit,
                int displayId) {
            WindowManagerService.this.removeWindowToken(binder, removeWindows, animateExit,
                    displayId);
        }

        @Override
Loading