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

Commit 933d70b4 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Fix IME flickering when swiping out to home" into sc-dev

parents 9ed31b86 0b44f104
Loading
Loading
Loading
Loading
+5 −7
Original line number Diff line number Diff line
@@ -2582,14 +2582,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
@@ -1165,10 +1165,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;
    }
@@ -1252,7 +1252,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
@@ -445,8 +445,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
@@ -2816,13 +2816,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);

@@ -2831,15 +2826,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);
        }
@@ -7536,28 +7545,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