diff options
author | Dianne Hackborn <hackbod@google.com> | 2012-11-02 18:43:48 -0700 |
---|---|---|
committer | Dianne Hackborn <hackbod@google.com> | 2012-11-02 18:56:01 -0700 |
commit | 2ea9bae7121f1df5461437d7d08fa550cdf6e0b0 (patch) | |
tree | 9f06023f39086e48edf0e60f6abfa93a628e5ad2 /services/java | |
parent | 841ce670b29180a157a084a9c0e803b13e92020c (diff) | |
download | frameworks_base-2ea9bae7121f1df5461437d7d08fa550cdf6e0b0.zip frameworks_base-2ea9bae7121f1df5461437d7d08fa550cdf6e0b0.tar.gz frameworks_base-2ea9bae7121f1df5461437d7d08fa550cdf6e0b0.tar.bz2 |
Fix issue #7457380: IME leaves a mark after user switching
The gnarly stuff where we keep track of the old input method
window as if it was still there was sitting around leaving things
in a stuck state. Now we clear this out at key points in the
window manager (freezing screen, user change), and the input
method manager service is less aggressive about asking the window
manager to do it.
Also fixed a problem that was causing flickers during some
wallpaper transitions -- when we are animating two things on
top of the wallpaper and one of them disappears, we need to
make sure the wallpaper target points to whatever the current
target should be (if any), not left pointing to the old target
that has gone away.
Change-Id: I2fb9600f569a5bd5e3528aaf24cde9340af56cb0
Diffstat (limited to 'services/java')
3 files changed, 29 insertions, 13 deletions
diff --git a/services/java/com/android/server/InputMethodManagerService.java b/services/java/com/android/server/InputMethodManagerService.java index 0e51c47..c9ff595 100644 --- a/services/java/com/android/server/InputMethodManagerService.java +++ b/services/java/com/android/server/InputMethodManagerService.java @@ -730,7 +730,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub if (!updateOnlyWhenLocaleChanged) { hideCurrentInputLocked(0, null); mCurMethodId = null; - unbindCurrentMethodLocked(true); + unbindCurrentMethodLocked(true, false); } if (DEBUG) { 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); } - unbindCurrentMethodLocked(false); + unbindCurrentMethodLocked(false, true); mCurIntent = new Intent(InputMethod.SERVICE_INTERFACE); mCurIntent.setComponent(info.getComponent()); @@ -1257,7 +1257,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub mCurMethod = IInputMethod.Stub.asInterface(service); if (mCurToken == null) { Slog.w(TAG, "Service connected without a token!"); - unbindCurrentMethodLocked(false); + unbindCurrentMethodLocked(false, false); return; } 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) { mContext.unbindService(mVisibleConnection); mVisibleBound = false; @@ -1306,7 +1306,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub if (mCurToken != null) { try { 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. mWindowManagerService.saveLastInputMethodWindowForTransition(); } @@ -1589,13 +1589,13 @@ public class InputMethodManagerService extends IInputMethodManager.Stub } catch (IllegalArgumentException e) { Slog.w(TAG, "Unknown input method from prefs: " + id, e); mCurMethodId = null; - unbindCurrentMethodLocked(true); + unbindCurrentMethodLocked(true, false); } mShortcutInputMethodsAndSubtypes.clear(); } else { // There is no longer an input method set, so stop any current one. mCurMethodId = null; - unbindCurrentMethodLocked(true); + unbindCurrentMethodLocked(true, false); } } diff --git a/services/java/com/android/server/wm/WindowAnimator.java b/services/java/com/android/server/wm/WindowAnimator.java index eecc74e..54914c2 100644 --- a/services/java/com/android/server/wm/WindowAnimator.java +++ b/services/java/com/android/server/wm/WindowAnimator.java @@ -296,8 +296,9 @@ public class WindowAnimator { } } if (WindowManagerService.DEBUG_WALLPAPER_LIGHT && !token.hidden) Slog.d(TAG, - "Hiding wallpaper " + token + " from " + w + "\n" - + Debug.getCallers(5, " ")); + "Hiding wallpaper " + token + " from " + w + + " target=" + wallpaperTarget + " lower=" + lowerWallpaperTarget + + "\n" + Debug.getCallers(5, " ")); token.hidden = true; } } diff --git a/services/java/com/android/server/wm/WindowManagerService.java b/services/java/com/android/server/wm/WindowManagerService.java index d2034fe..0659409 100755 --- a/services/java/com/android/server/wm/WindowManagerService.java +++ b/services/java/com/android/server/wm/WindowManagerService.java @@ -1566,6 +1566,7 @@ public class WindowManagerService extends IWindowManager.Stub int adjustWallpaperWindowsLocked() { mInnerFields.mWallpaperMayChange = false; int changed = 0; + boolean targetChanged = false; // TODO(multidisplay): Wallpapers on main screen only. 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() && (mWallpaperTarget == w || w.isDrawnLw())) { if (DEBUG_WALLPAPER) Slog.v(TAG, - "Found wallpaper activity: #" + i + "=" + w); + "Found wallpaper target: #" + i + "=" + w); foundW = w; foundI = i; if (w == mWallpaperTarget && w.mWinAnimator.isAnimating()) { @@ -1665,6 +1666,7 @@ public class WindowManagerService extends IWindowManager.Stub WindowState oldW = mWallpaperTarget; mWallpaperTarget = foundW; + targetChanged = true; // Now what is happening... if the current and new targets are // animating, then we are in our super special mode! @@ -1738,6 +1740,8 @@ public class WindowManagerService extends IWindowManager.Stub } mLowerWallpaperTarget = 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; } @@ -9696,9 +9706,9 @@ public class WindowManagerService extends IWindowManager.Stub if (mWallpaperTarget != layoutToAnim.mWallpaperTarget || mLowerWallpaperTarget != layoutToAnim.mLowerWallpaperTarget || mUpperWallpaperTarget != layoutToAnim.mUpperWallpaperTarget) { - Slog.d(TAG, "Pushing anim wallpaper: target=" + layoutToAnim.mWallpaperTarget - + " lower=" + layoutToAnim.mLowerWallpaperTarget + " upper=" - + layoutToAnim.mUpperWallpaperTarget + "\n" + Debug.getCallers(5, " ")); + Slog.d(TAG, "Pushing anim wallpaper: target=" + mWallpaperTarget + + " lower=" + mLowerWallpaperTarget + " upper=" + + mUpperWallpaperTarget + "\n" + Debug.getCallers(5, " ")); } } layoutToAnim.mWallpaperTarget = mWallpaperTarget; @@ -10063,6 +10073,11 @@ public class WindowManagerService extends IWindowManager.Stub 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) { mNextAppTransition = WindowManagerPolicy.TRANSIT_UNSET; mNextAppTransitionType = ActivityOptions.ANIM_NONE; |