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

Commit 47eb0c10 authored by Dianne Hackborn's avatar Dianne Hackborn Committed by Android Git Automerger
Browse files

am 2ea9bae7: Fix issue #7457380: IME leaves a mark after user switching

* commit '2ea9bae7':
  Fix issue #7457380: IME leaves a mark after user switching
parents 934d0835 2ea9bae7
Loading
Loading
Loading
Loading
+37 −2
Original line number Original line Diff line number Diff line
@@ -4500,6 +4500,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
                // oh well
                // oh well
            }
            }
        }
        }
        setLastInputMethodWindowLw(null, null);
    }
    }


    @Override
    @Override
@@ -4581,8 +4582,42 @@ public class PhoneWindowManager implements WindowManagerPolicy {
        pw.print(prefix); pw.print("mShowingLockscreen="); pw.print(mShowingLockscreen);
        pw.print(prefix); pw.print("mShowingLockscreen="); pw.print(mShowingLockscreen);
                pw.print(" mShowingDream="); pw.print(mShowingDream);
                pw.print(" mShowingDream="); pw.print(mShowingDream);
                pw.print(" mDreamingLockscreen="); pw.println(mDreamingLockscreen);
                pw.print(" mDreamingLockscreen="); pw.println(mDreamingLockscreen);
        if (mLastInputMethodWindow != null) {
            pw.print(prefix); pw.print("mLastInputMethodWindow=");
                    pw.println(mLastInputMethodWindow);
        }
        if (mLastInputMethodTargetWindow != null) {
            pw.print(prefix); pw.print("mLastInputMethodTargetWindow=");
                    pw.println(mLastInputMethodTargetWindow);
        }
        if (mStatusBar != null) {
            pw.print(prefix); pw.print("mStatusBar=");
                    pw.println(mStatusBar);
        }
        if (mNavigationBar != null) {
            pw.print(prefix); pw.print("mNavigationBar=");
                    pw.println(mNavigationBar);
        }
        if (mKeyguard != null) {
            pw.print(prefix); pw.print("mKeyguard=");
                    pw.println(mKeyguard);
        }
        if (mFocusedWindow != null) {
            pw.print(prefix); pw.print("mFocusedWindow=");
                    pw.println(mFocusedWindow);
        }
        if (mFocusedApp != null) {
            pw.print(prefix); pw.print("mFocusedApp=");
                    pw.println(mFocusedApp);
        }
        if (mWinDismissingKeyguard != null) {
            pw.print(prefix); pw.print("mWinDismissingKeyguard=");
                    pw.println(mWinDismissingKeyguard);
        }
        if (mTopFullscreenOpaqueWindowState != null) {
            pw.print(prefix); pw.print("mTopFullscreenOpaqueWindowState=");
            pw.print(prefix); pw.print("mTopFullscreenOpaqueWindowState=");
                    pw.println(mTopFullscreenOpaqueWindowState);
                    pw.println(mTopFullscreenOpaqueWindowState);
        }
        pw.print(prefix); pw.print("mTopIsFullscreen="); pw.print(mTopIsFullscreen);
        pw.print(prefix); pw.print("mTopIsFullscreen="); pw.print(mTopIsFullscreen);
                pw.print(" mHideLockScreen="); pw.println(mHideLockScreen);
                pw.print(" mHideLockScreen="); pw.println(mHideLockScreen);
        pw.print(prefix); pw.print("mForceStatusBar="); pw.print(mForceStatusBar);
        pw.print(prefix); pw.print("mForceStatusBar="); pw.print(mForceStatusBar);
+7 −7
Original line number Original line Diff line number Diff line
@@ -730,7 +730,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
            if (!updateOnlyWhenLocaleChanged) {
            if (!updateOnlyWhenLocaleChanged) {
                hideCurrentInputLocked(0, null);
                hideCurrentInputLocked(0, null);
                mCurMethodId = null;
                mCurMethodId = null;
                unbindCurrentMethodLocked(true);
                unbindCurrentMethodLocked(true, false);
            }
            }
            if (DEBUG) {
            if (DEBUG) {
                Slog.i(TAG, "Locale has been changed to " + newLocale);
                Slog.i(TAG, "Locale has been changed to " + newLocale);
@@ -1201,7 +1201,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
            throw new IllegalArgumentException("Unknown id: " + mCurMethodId);
            throw new IllegalArgumentException("Unknown id: " + mCurMethodId);
        }
        }


        unbindCurrentMethodLocked(false);
        unbindCurrentMethodLocked(false, true);


        mCurIntent = new Intent(InputMethod.SERVICE_INTERFACE);
        mCurIntent = new Intent(InputMethod.SERVICE_INTERFACE);
        mCurIntent.setComponent(info.getComponent());
        mCurIntent.setComponent(info.getComponent());
@@ -1257,7 +1257,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
                mCurMethod = IInputMethod.Stub.asInterface(service);
                mCurMethod = IInputMethod.Stub.asInterface(service);
                if (mCurToken == null) {
                if (mCurToken == null) {
                    Slog.w(TAG, "Service connected without a token!");
                    Slog.w(TAG, "Service connected without a token!");
                    unbindCurrentMethodLocked(false);
                    unbindCurrentMethodLocked(false, false);
                    return;
                    return;
                }
                }
                if (DEBUG) Slog.v(TAG, "Initiating attach with token: " + mCurToken);
                if (DEBUG) Slog.v(TAG, "Initiating attach with token: " + mCurToken);
@@ -1292,7 +1292,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
        }
        }
    }
    }


    void unbindCurrentMethodLocked(boolean reportToClient) {
    void unbindCurrentMethodLocked(boolean reportToClient, boolean savePosition) {
        if (mVisibleBound) {
        if (mVisibleBound) {
            mContext.unbindService(mVisibleConnection);
            mContext.unbindService(mVisibleConnection);
            mVisibleBound = false;
            mVisibleBound = false;
@@ -1306,7 +1306,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
        if (mCurToken != null) {
        if (mCurToken != null) {
            try {
            try {
                if (DEBUG) Slog.v(TAG, "Removing window token: " + mCurToken);
                if (DEBUG) Slog.v(TAG, "Removing window token: " + mCurToken);
                if ((mImeWindowVis & InputMethodService.IME_ACTIVE) != 0) {
                if ((mImeWindowVis & InputMethodService.IME_ACTIVE) != 0 && savePosition) {
                    // The current IME is shown. Hence an IME switch (transition) is happening.
                    // The current IME is shown. Hence an IME switch (transition) is happening.
                    mWindowManagerService.saveLastInputMethodWindowForTransition();
                    mWindowManagerService.saveLastInputMethodWindowForTransition();
                }
                }
@@ -1589,13 +1589,13 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
            } catch (IllegalArgumentException e) {
            } catch (IllegalArgumentException e) {
                Slog.w(TAG, "Unknown input method from prefs: " + id, e);
                Slog.w(TAG, "Unknown input method from prefs: " + id, e);
                mCurMethodId = null;
                mCurMethodId = null;
                unbindCurrentMethodLocked(true);
                unbindCurrentMethodLocked(true, false);
            }
            }
            mShortcutInputMethodsAndSubtypes.clear();
            mShortcutInputMethodsAndSubtypes.clear();
        } else {
        } else {
            // There is no longer an input method set, so stop any current one.
            // There is no longer an input method set, so stop any current one.
            mCurMethodId = null;
            mCurMethodId = null;
            unbindCurrentMethodLocked(true);
            unbindCurrentMethodLocked(true, false);
        }
        }
    }
    }


+3 −2
Original line number Original line Diff line number Diff line
@@ -296,8 +296,9 @@ public class WindowAnimator {
                    }
                    }
                }
                }
                if (WindowManagerService.DEBUG_WALLPAPER_LIGHT && !token.hidden) Slog.d(TAG,
                if (WindowManagerService.DEBUG_WALLPAPER_LIGHT && !token.hidden) Slog.d(TAG,
                        "Hiding wallpaper " + token + " from " + w + "\n"
                        "Hiding wallpaper " + token + " from " + w
                        + Debug.getCallers(5, "  "));
                        + " target=" + wallpaperTarget + " lower=" + lowerWallpaperTarget
                        + "\n" + Debug.getCallers(5, "  "));
                token.hidden = true;
                token.hidden = true;
            }
            }
        }
        }
+19 −4
Original line number Original line Diff line number Diff line
@@ -1566,6 +1566,7 @@ public class WindowManagerService extends IWindowManager.Stub
    int adjustWallpaperWindowsLocked() {
    int adjustWallpaperWindowsLocked() {
        mInnerFields.mWallpaperMayChange = false;
        mInnerFields.mWallpaperMayChange = false;
        int changed = 0;
        int changed = 0;
        boolean targetChanged = false;


        // TODO(multidisplay): Wallpapers on main screen only.
        // TODO(multidisplay): Wallpapers on main screen only.
        final DisplayInfo displayInfo = getDefaultDisplayContentLocked().getDisplayInfo();
        final DisplayInfo displayInfo = getDefaultDisplayContentLocked().getDisplayInfo();
@@ -1608,7 +1609,7 @@ public class WindowManagerService extends IWindowManager.Stub
            if ((w.mAttrs.flags&FLAG_SHOW_WALLPAPER) != 0 && w.isReadyForDisplay()
            if ((w.mAttrs.flags&FLAG_SHOW_WALLPAPER) != 0 && w.isReadyForDisplay()
                    && (mWallpaperTarget == w || w.isDrawnLw())) {
                    && (mWallpaperTarget == w || w.isDrawnLw())) {
                if (DEBUG_WALLPAPER) Slog.v(TAG,
                if (DEBUG_WALLPAPER) Slog.v(TAG,
                        "Found wallpaper activity: #" + i + "=" + w);
                        "Found wallpaper target: #" + i + "=" + w);
                foundW = w;
                foundW = w;
                foundI = i;
                foundI = i;
                if (w == mWallpaperTarget && w.mWinAnimator.isAnimating()) {
                if (w == mWallpaperTarget && w.mWinAnimator.isAnimating()) {
@@ -1665,6 +1666,7 @@ public class WindowManagerService extends IWindowManager.Stub


            WindowState oldW = mWallpaperTarget;
            WindowState oldW = mWallpaperTarget;
            mWallpaperTarget = foundW;
            mWallpaperTarget = foundW;
            targetChanged = true;


            // Now what is happening...  if the current and new targets are
            // Now what is happening...  if the current and new targets are
            // animating, then we are in our super special mode!
            // animating, then we are in our super special mode!
@@ -1738,6 +1740,8 @@ public class WindowManagerService extends IWindowManager.Stub
                }
                }
                mLowerWallpaperTarget = null;
                mLowerWallpaperTarget = null;
                mUpperWallpaperTarget = null;
                mUpperWallpaperTarget = null;
                mWallpaperTarget = foundW;
                targetChanged = true;
            }
            }
        }
        }


@@ -1872,6 +1876,12 @@ public class WindowManagerService extends IWindowManager.Stub
            }
            }
        }
        }


        if (targetChanged && DEBUG_WALLPAPER_LIGHT) {
            Slog.d(TAG, "New wallpaper: target=" + mWallpaperTarget
                    + " lower=" + mLowerWallpaperTarget + " upper="
                    + mUpperWallpaperTarget);
        }

        return changed;
        return changed;
    }
    }


@@ -9696,9 +9706,9 @@ public class WindowManagerService extends IWindowManager.Stub
                if (mWallpaperTarget != layoutToAnim.mWallpaperTarget
                if (mWallpaperTarget != layoutToAnim.mWallpaperTarget
                        || mLowerWallpaperTarget != layoutToAnim.mLowerWallpaperTarget
                        || mLowerWallpaperTarget != layoutToAnim.mLowerWallpaperTarget
                        || mUpperWallpaperTarget != layoutToAnim.mUpperWallpaperTarget) {
                        || mUpperWallpaperTarget != layoutToAnim.mUpperWallpaperTarget) {
                    Slog.d(TAG, "Pushing anim wallpaper: target=" + layoutToAnim.mWallpaperTarget
                    Slog.d(TAG, "Pushing anim wallpaper: target=" + mWallpaperTarget
                            + " lower=" + layoutToAnim.mLowerWallpaperTarget + " upper="
                            + " lower=" + mLowerWallpaperTarget + " upper="
                            + layoutToAnim.mUpperWallpaperTarget + "\n" + Debug.getCallers(5, "  "));
                            + mUpperWallpaperTarget + "\n" + Debug.getCallers(5, "  "));
                }
                }
            }
            }
            layoutToAnim.mWallpaperTarget = mWallpaperTarget;
            layoutToAnim.mWallpaperTarget = mWallpaperTarget;
@@ -10063,6 +10073,11 @@ public class WindowManagerService extends IWindowManager.Stub


        mInputMonitor.freezeInputDispatchingLw();
        mInputMonitor.freezeInputDispatchingLw();


        // Clear the last input window -- that is just used for
        // clean transitions between IMEs, and if we are freezing
        // the screen then the whole world is changing behind the scenes.
        mPolicy.setLastInputMethodWindowLw(null, null);

        if (mNextAppTransition != WindowManagerPolicy.TRANSIT_UNSET) {
        if (mNextAppTransition != WindowManagerPolicy.TRANSIT_UNSET) {
            mNextAppTransition = WindowManagerPolicy.TRANSIT_UNSET;
            mNextAppTransition = WindowManagerPolicy.TRANSIT_UNSET;
            mNextAppTransitionType = ActivityOptions.ANIM_NONE;
            mNextAppTransitionType = ActivityOptions.ANIM_NONE;