Loading core/java/android/inputmethodservice/InputMethodService.java +3 −12 Original line number Diff line number Diff line Loading @@ -1714,18 +1714,9 @@ public class InputMethodService extends AbstractInputMethodService { private void clearInsetOfPreviousIme() { if (DEBUG) Log.v(TAG, "clearInsetOfPreviousIme() " + " mShouldClearInsetOfPreviousIme=" + mShouldClearInsetOfPreviousIme); if (!mShouldClearInsetOfPreviousIme || mWindow == null) return; try { // We do not call onWindowShown() and onWindowHidden() so as not to make the IME author // confused. // TODO: Find out a better way which has less side-effect. mWindow.show(); mWindow.hide(); } catch (WindowManager.BadTokenException e) { if (DEBUG) Log.v(TAG, "clearInsetOfPreviousIme: BadTokenException: IME is done."); mWindowVisible = false; mWindowAdded = false; } if (!mShouldClearInsetOfPreviousIme) return; mImm.clearLastInputMethodWindowForTransition(mToken); mShouldClearInsetOfPreviousIme = false; } Loading core/java/android/view/WindowManagerInternal.java +7 −0 Original line number Diff line number Diff line Loading @@ -260,6 +260,13 @@ public abstract class WindowManagerInternal { */ public abstract void saveLastInputMethodWindowForTransition(); /** * Clears last input method window for transition. * * Note that it is assumed that this method is called only by InputMethodManagerService. */ public abstract void clearLastInputMethodWindowForTransition(); /** * Returns true when the hardware keyboard is available. */ Loading core/java/android/view/inputmethod/InputMethodManager.java +22 −0 Original line number Diff line number Diff line Loading @@ -2139,6 +2139,28 @@ public final class InputMethodManager { } } /** * Tells the system that the IME decided to not show a window and the system no longer needs to * use the previous IME's inset. * * <p>Caveat: {@link android.inputmethodservice.InputMethodService#clearInsetOfPreviousIme()} * is the only expected caller of this method. Do not depend on this anywhere else.</p> * * <p>TODO: We probably need to reconsider how IME should be handled.</p> * @hide * @param token Supplies the identifying token given to an input method when it was started, * which allows it to perform this operation on itself. */ public void clearLastInputMethodWindowForTransition(final IBinder token) { synchronized (mH) { try { mService.clearLastInputMethodWindowForTransition(token); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } } /** * Force switch to the last used input method and subtype. If the last input method didn't have * any subtypes, the framework will simply switch to the last input method with no subtype Loading core/java/com/android/internal/view/IInputMethodManager.aidl +2 −0 Original line number Diff line number Diff line Loading @@ -79,5 +79,7 @@ interface IInputMethodManager { boolean setInputMethodEnabled(String id, boolean enabled); void setAdditionalInputMethodSubtypes(String id, in InputMethodSubtype[] subtypes); int getInputMethodWindowVisibleHeight(); void clearLastInputMethodWindowForTransition(in IBinder token); oneway void notifyUserAction(int sequenceNumber); } services/core/java/com/android/server/InputMethodManagerService.java +21 −0 Original line number Diff line number Diff line Loading @@ -2642,6 +2642,27 @@ public class InputMethodManagerService extends IInputMethodManager.Stub return mWindowManagerInternal.getInputMethodWindowVisibleHeight(); } @Override public void clearLastInputMethodWindowForTransition(IBinder token) { if (!calledFromValidUser()) { return; } final long ident = Binder.clearCallingIdentity(); try { synchronized (mMethodMap) { if (!calledWithValidToken(token)) { final int uid = Binder.getCallingUid(); Slog.e(TAG, "Ignoring clearLastInputMethodWindowForTransition due to an " + "invalid token. uid:" + uid + " token:" + token); return; } } mWindowManagerInternal.clearLastInputMethodWindowForTransition(); } finally { Binder.restoreCallingIdentity(ident); } } @Override public void notifyUserAction(int sequenceNumber) { if (DEBUG) { Loading Loading
core/java/android/inputmethodservice/InputMethodService.java +3 −12 Original line number Diff line number Diff line Loading @@ -1714,18 +1714,9 @@ public class InputMethodService extends AbstractInputMethodService { private void clearInsetOfPreviousIme() { if (DEBUG) Log.v(TAG, "clearInsetOfPreviousIme() " + " mShouldClearInsetOfPreviousIme=" + mShouldClearInsetOfPreviousIme); if (!mShouldClearInsetOfPreviousIme || mWindow == null) return; try { // We do not call onWindowShown() and onWindowHidden() so as not to make the IME author // confused. // TODO: Find out a better way which has less side-effect. mWindow.show(); mWindow.hide(); } catch (WindowManager.BadTokenException e) { if (DEBUG) Log.v(TAG, "clearInsetOfPreviousIme: BadTokenException: IME is done."); mWindowVisible = false; mWindowAdded = false; } if (!mShouldClearInsetOfPreviousIme) return; mImm.clearLastInputMethodWindowForTransition(mToken); mShouldClearInsetOfPreviousIme = false; } Loading
core/java/android/view/WindowManagerInternal.java +7 −0 Original line number Diff line number Diff line Loading @@ -260,6 +260,13 @@ public abstract class WindowManagerInternal { */ public abstract void saveLastInputMethodWindowForTransition(); /** * Clears last input method window for transition. * * Note that it is assumed that this method is called only by InputMethodManagerService. */ public abstract void clearLastInputMethodWindowForTransition(); /** * Returns true when the hardware keyboard is available. */ Loading
core/java/android/view/inputmethod/InputMethodManager.java +22 −0 Original line number Diff line number Diff line Loading @@ -2139,6 +2139,28 @@ public final class InputMethodManager { } } /** * Tells the system that the IME decided to not show a window and the system no longer needs to * use the previous IME's inset. * * <p>Caveat: {@link android.inputmethodservice.InputMethodService#clearInsetOfPreviousIme()} * is the only expected caller of this method. Do not depend on this anywhere else.</p> * * <p>TODO: We probably need to reconsider how IME should be handled.</p> * @hide * @param token Supplies the identifying token given to an input method when it was started, * which allows it to perform this operation on itself. */ public void clearLastInputMethodWindowForTransition(final IBinder token) { synchronized (mH) { try { mService.clearLastInputMethodWindowForTransition(token); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } } /** * Force switch to the last used input method and subtype. If the last input method didn't have * any subtypes, the framework will simply switch to the last input method with no subtype Loading
core/java/com/android/internal/view/IInputMethodManager.aidl +2 −0 Original line number Diff line number Diff line Loading @@ -79,5 +79,7 @@ interface IInputMethodManager { boolean setInputMethodEnabled(String id, boolean enabled); void setAdditionalInputMethodSubtypes(String id, in InputMethodSubtype[] subtypes); int getInputMethodWindowVisibleHeight(); void clearLastInputMethodWindowForTransition(in IBinder token); oneway void notifyUserAction(int sequenceNumber); }
services/core/java/com/android/server/InputMethodManagerService.java +21 −0 Original line number Diff line number Diff line Loading @@ -2642,6 +2642,27 @@ public class InputMethodManagerService extends IInputMethodManager.Stub return mWindowManagerInternal.getInputMethodWindowVisibleHeight(); } @Override public void clearLastInputMethodWindowForTransition(IBinder token) { if (!calledFromValidUser()) { return; } final long ident = Binder.clearCallingIdentity(); try { synchronized (mMethodMap) { if (!calledWithValidToken(token)) { final int uid = Binder.getCallingUid(); Slog.e(TAG, "Ignoring clearLastInputMethodWindowForTransition due to an " + "invalid token. uid:" + uid + " token:" + token); return; } } mWindowManagerInternal.clearLastInputMethodWindowForTransition(); } finally { Binder.restoreCallingIdentity(ident); } } @Override public void notifyUserAction(int sequenceNumber) { if (DEBUG) { Loading