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.
*/
InputConnection mServedInputConnection;
ControlledInputConnectionWrapper mServedInputConnectionWrapper;
/**
* 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 final InputMethodManager mParentInputMethodManager;
private boolean mActive;
public ControlledInputConnectionWrapper(final Looper mainLooper, final InputConnection conn,
final InputMethodManager inputMethodManager) {
super(mainLooper, conn);
mParentInputMethodManager = inputMethodManager;
mActive = true;
}
@Override
public boolean isActive() {
return mParentInputMethodManager.mActive;
return mParentInputMethodManager.mActive && mActive;
}
void deactivate() {
mActive = false;
}
}
@ -666,6 +673,10 @@ public final class InputMethodManager {
void clearConnectionLocked() {
mCurrentTextBoxAttribute = 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
notifyInputConnectionFinished();
mServedInputConnection = ic;
IInputContext servedContext;
ControlledInputConnectionWrapper servedContext;
if (ic != null) {
mCursorSelStart = tba.initialSelStart;
mCursorSelEnd = tba.initialSelEnd;
@ -1071,6 +1082,10 @@ public final class InputMethodManager {
} else {
servedContext = null;
}
if (mServedInputConnectionWrapper != null) {
mServedInputConnectionWrapper.deactivate();
}
mServedInputConnectionWrapper = servedContext;
try {
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.
synchronized (mH) {
try {
if (DEBUG) Log.v(TAG, "Reporting focus gain, without startInput");
mService.windowGainedFocus(mClient, rootView.getWindowToken(),
controlFlags, softInputMode, windowFlags, null, null);
} catch (RemoteException e) {

View File

@ -1667,7 +1667,8 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
}
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) {
return startInputUncheckedLocked(cs, inputContext, attribute,
controlFlags);

View File

@ -269,9 +269,19 @@ public class WindowAnimator {
mPendingLayoutChanges);
}
mService.mFocusMayChange = true;
} else if (win.isReadyForDisplay()) {
}
if (win.isReadyForDisplay()) {
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)) {
final boolean changed;
if (mForceHiding) {

View File

@ -1177,7 +1177,9 @@ public class WindowManagerService extends IWindowManager.Stub
if (!w.isVisibleOrAdding()) {
Slog.i(TAG, " mSurface=" + w.mWinAnimator.mSurface
+ " 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);
if (w.mAppToken != null) {
Slog.i(TAG, " mAppToken.hiddenRequested=" + w.mAppToken.hiddenRequested);
@ -7234,9 +7236,11 @@ public class WindowManagerService extends IWindowManager.Stub
WindowState imFocus;
if (idx > 0) {
imFocus = mWindows.get(idx-1);
//Log.i(TAG, "Desired input method target: " + imFocus);
//Log.i(TAG, "Current focus: " + this.mCurrentFocus);
//Log.i(TAG, "Last focus: " + this.mLastFocus);
if (DEBUG_INPUT_METHOD) {
Slog.i(TAG, "Desired input method target: " + imFocus);
Slog.i(TAG, "Current focus: " + this.mCurrentFocus);
Slog.i(TAG, "Last focus: " + this.mLastFocus);
}
if (imFocus != null) {
// This may be a starting window, in which case we still want
// 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++) {
WindowState w = imFocus.mAppToken.windows.get(i);
if (w != imFocus) {
//Log.i(TAG, "Switching to real app window: " + w);
Log.i(TAG, "Switching to real app window: " + w);
imFocus = w;
break;
}
}
}
//Log.i(TAG, "IM target client: " + imFocus.mSession.mClient);
//if (imFocus.mSession.mClient != null) {
// Log.i(TAG, "IM target client binder: " + imFocus.mSession.mClient.asBinder());
// Log.i(TAG, "Requesting client binder: " + client.asBinder());
//}
if (DEBUG_INPUT_METHOD) {
Slog.i(TAG, "IM target client: " + imFocus.mSession.mClient);
if (imFocus.mSession.mClient != null) {
Slog.i(TAG, "IM target client binder: "
+ imFocus.mSession.mClient.asBinder());
Slog.i(TAG, "Requesting client binder: " + client.asBinder());
}
}
if (imFocus.mSession.mClient != null &&
imFocus.mSession.mClient.asBinder() == client.asBinder()) {
return true;