Merge "Fix issue #6499411: Characters not displayed (but suggestion bar is working)" into jb-dev

This commit is contained in:
Dianne Hackborn
2012-05-22 13:13:02 -07:00
committed by Android (Google) Code Review
4 changed files with 48 additions and 14 deletions

View File

@ -283,6 +283,7 @@ public final class InputMethodManager {
* The InputConnection that was last retrieved from the served view. * The InputConnection that was last retrieved from the served view.
*/ */
InputConnection mServedInputConnection; InputConnection mServedInputConnection;
ControlledInputConnectionWrapper mServedInputConnectionWrapper;
/** /**
* The completions that were last provided by the served view. * The completions that were last provided by the served view.
*/ */
@ -418,16 +419,22 @@ public final class InputMethodManager {
private static class ControlledInputConnectionWrapper extends IInputConnectionWrapper { private static class ControlledInputConnectionWrapper extends IInputConnectionWrapper {
private final InputMethodManager mParentInputMethodManager; private final InputMethodManager mParentInputMethodManager;
private boolean mActive;
public ControlledInputConnectionWrapper(final Looper mainLooper, final InputConnection conn, public ControlledInputConnectionWrapper(final Looper mainLooper, final InputConnection conn,
final InputMethodManager inputMethodManager) { final InputMethodManager inputMethodManager) {
super(mainLooper, conn); super(mainLooper, conn);
mParentInputMethodManager = inputMethodManager; mParentInputMethodManager = inputMethodManager;
mActive = true;
} }
@Override @Override
public boolean isActive() { public boolean isActive() {
return mParentInputMethodManager.mActive; return mParentInputMethodManager.mActive && mActive;
}
void deactivate() {
mActive = false;
} }
} }
@ -666,6 +673,10 @@ public final class InputMethodManager {
void clearConnectionLocked() { void clearConnectionLocked() {
mCurrentTextBoxAttribute = null; mCurrentTextBoxAttribute = null;
mServedInputConnection = null; mServedInputConnection = null;
if (mServedInputConnectionWrapper != null) {
mServedInputConnectionWrapper.deactivate();
mServedInputConnectionWrapper = null;
}
} }
/** /**
@ -1060,7 +1071,7 @@ public final class InputMethodManager {
// Notify the served view that its previous input connection is finished // Notify the served view that its previous input connection is finished
notifyInputConnectionFinished(); notifyInputConnectionFinished();
mServedInputConnection = ic; mServedInputConnection = ic;
IInputContext servedContext; ControlledInputConnectionWrapper servedContext;
if (ic != null) { if (ic != null) {
mCursorSelStart = tba.initialSelStart; mCursorSelStart = tba.initialSelStart;
mCursorSelEnd = tba.initialSelEnd; mCursorSelEnd = tba.initialSelEnd;
@ -1071,6 +1082,10 @@ public final class InputMethodManager {
} else { } else {
servedContext = null; servedContext = null;
} }
if (mServedInputConnectionWrapper != null) {
mServedInputConnectionWrapper.deactivate();
}
mServedInputConnectionWrapper = servedContext;
try { try {
if (DEBUG) Log.v(TAG, "START INPUT: " + view + " ic=" if (DEBUG) Log.v(TAG, "START INPUT: " + view + " ic="
@ -1286,6 +1301,7 @@ public final class InputMethodManager {
// we'll just do a window focus gain and call it a day. // we'll just do a window focus gain and call it a day.
synchronized (mH) { synchronized (mH) {
try { try {
if (DEBUG) Log.v(TAG, "Reporting focus gain, without startInput");
mService.windowGainedFocus(mClient, rootView.getWindowToken(), mService.windowGainedFocus(mClient, rootView.getWindowToken(),
controlFlags, softInputMode, windowFlags, null, null); controlFlags, softInputMode, windowFlags, null, null);
} catch (RemoteException e) { } catch (RemoteException e) {

View File

@ -1667,7 +1667,8 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
} }
if (mCurFocusedWindow == windowToken) { if (mCurFocusedWindow == windowToken) {
Slog.w(TAG, "Window already focused, ignoring focus gain of: " + client); Slog.w(TAG, "Window already focused, ignoring focus gain of: " + client
+ " attribute=" + attribute);
if (attribute != null) { if (attribute != null) {
return startInputUncheckedLocked(cs, inputContext, attribute, return startInputUncheckedLocked(cs, inputContext, attribute,
controlFlags); controlFlags);

View File

@ -269,9 +269,19 @@ public class WindowAnimator {
mPendingLayoutChanges); mPendingLayoutChanges);
} }
mService.mFocusMayChange = true; mService.mFocusMayChange = true;
} else if (win.isReadyForDisplay()) { }
if (win.isReadyForDisplay()) {
mForceHiding = true; mForceHiding = true;
} }
if (WindowManagerService.DEBUG_VISIBILITY) Slog.v(TAG,
"Force hide " + mForceHiding
+ " hasSurface=" + win.mHasSurface
+ " policyVis=" + win.mPolicyVisibility
+ " destroying=" + win.mDestroying
+ " attHidden=" + win.mAttachedHidden
+ " vis=" + win.mViewVisibility
+ " hidden=" + win.mRootToken.hidden
+ " anim=" + win.mWinAnimator.mAnimation);
} else if (mPolicy.canBeForceHidden(win, win.mAttrs)) { } else if (mPolicy.canBeForceHidden(win, win.mAttrs)) {
final boolean changed; final boolean changed;
if (mForceHiding) { if (mForceHiding) {

View File

@ -1177,7 +1177,9 @@ public class WindowManagerService extends IWindowManager.Stub
if (!w.isVisibleOrAdding()) { if (!w.isVisibleOrAdding()) {
Slog.i(TAG, " mSurface=" + w.mWinAnimator.mSurface Slog.i(TAG, " mSurface=" + w.mWinAnimator.mSurface
+ " relayoutCalled=" + w.mRelayoutCalled + " viewVis=" + w.mViewVisibility + " relayoutCalled=" + w.mRelayoutCalled + " viewVis=" + w.mViewVisibility
+ " policyVis=" + w.mPolicyVisibility + " attachHid=" + w.mAttachedHidden + " policyVis=" + w.mPolicyVisibility
+ " policyVisAfterAnim=" + w.mPolicyVisibilityAfterAnim
+ " attachHid=" + w.mAttachedHidden
+ " exiting=" + w.mExiting + " destroying=" + w.mDestroying); + " exiting=" + w.mExiting + " destroying=" + w.mDestroying);
if (w.mAppToken != null) { if (w.mAppToken != null) {
Slog.i(TAG, " mAppToken.hiddenRequested=" + w.mAppToken.hiddenRequested); Slog.i(TAG, " mAppToken.hiddenRequested=" + w.mAppToken.hiddenRequested);
@ -7234,9 +7236,11 @@ public class WindowManagerService extends IWindowManager.Stub
WindowState imFocus; WindowState imFocus;
if (idx > 0) { if (idx > 0) {
imFocus = mWindows.get(idx-1); imFocus = mWindows.get(idx-1);
//Log.i(TAG, "Desired input method target: " + imFocus); if (DEBUG_INPUT_METHOD) {
//Log.i(TAG, "Current focus: " + this.mCurrentFocus); Slog.i(TAG, "Desired input method target: " + imFocus);
//Log.i(TAG, "Last focus: " + this.mLastFocus); Slog.i(TAG, "Current focus: " + this.mCurrentFocus);
Slog.i(TAG, "Last focus: " + this.mLastFocus);
}
if (imFocus != null) { if (imFocus != null) {
// This may be a starting window, in which case we still want // This may be a starting window, in which case we still want
// to count it as okay. // to count it as okay.
@ -7247,17 +7251,20 @@ public class WindowManagerService extends IWindowManager.Stub
for (int i=0; i<imFocus.mAppToken.windows.size(); i++) { for (int i=0; i<imFocus.mAppToken.windows.size(); i++) {
WindowState w = imFocus.mAppToken.windows.get(i); WindowState w = imFocus.mAppToken.windows.get(i);
if (w != imFocus) { if (w != imFocus) {
//Log.i(TAG, "Switching to real app window: " + w); Log.i(TAG, "Switching to real app window: " + w);
imFocus = w; imFocus = w;
break; break;
} }
} }
} }
//Log.i(TAG, "IM target client: " + imFocus.mSession.mClient); if (DEBUG_INPUT_METHOD) {
//if (imFocus.mSession.mClient != null) { Slog.i(TAG, "IM target client: " + imFocus.mSession.mClient);
// Log.i(TAG, "IM target client binder: " + imFocus.mSession.mClient.asBinder()); if (imFocus.mSession.mClient != null) {
// Log.i(TAG, "Requesting client binder: " + client.asBinder()); Slog.i(TAG, "IM target client binder: "
//} + imFocus.mSession.mClient.asBinder());
Slog.i(TAG, "Requesting client binder: " + client.asBinder());
}
}
if (imFocus.mSession.mClient != null && if (imFocus.mSession.mClient != null &&
imFocus.mSession.mClient.asBinder() == client.asBinder()) { imFocus.mSession.mClient.asBinder() == client.asBinder()) {
return true; return true;