Loading core/java/android/view/WindowManagerPolicy.java +7 −0 Original line number Diff line number Diff line Loading @@ -446,6 +446,13 @@ public interface WindowManagerPolicy { */ public void switchKeyboardLayout(int deviceId, int direction); /** * Switch the input method, to be precise, input method subtype. * * @param forwardDirection {@code true} to rotate in a forward direction. */ public void switchInputMethod(boolean forwardDirection); public void shutdown(boolean confirm); public void rebootSafeMode(boolean confirm); Loading core/java/android/view/inputmethod/InputMethodManagerInternal.java +6 −1 Original line number Diff line number Diff line Loading @@ -26,5 +26,10 @@ public interface InputMethodManagerInternal { * Called by the power manager to tell the input method manager whether it * should start watching for wake events. */ public void setInteractive(boolean interactive); void setInteractive(boolean interactive); /** * Called by the window manager to let the input method manager rotate the input method. */ void switchInputMethod(boolean forwardDirection); } services/core/java/com/android/server/InputMethodManagerService.java +23 −0 Original line number Diff line number Diff line Loading @@ -166,6 +166,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub static final int MSG_SET_ACTIVE = 3020; static final int MSG_SET_INTERACTIVE = 3030; static final int MSG_SET_USER_ACTION_NOTIFICATION_SEQUENCE_NUMBER = 3040; static final int MSG_SWITCH_IME = 3050; static final int MSG_HARD_KEYBOARD_SWITCH_CHANGED = 4000; Loading Loading @@ -2851,6 +2852,9 @@ public class InputMethodManagerService extends IInputMethodManager.Stub case MSG_SET_INTERACTIVE: handleSetInteractive(msg.arg1 != 0); return true; case MSG_SWITCH_IME: handleSwitchInputMethod(msg.arg1 != 0); return true; case MSG_SET_USER_ACTION_NOTIFICATION_SEQUENCE_NUMBER: { final int sequenceNumber = msg.arg1; final ClientState clientState = (ClientState)msg.obj; Loading Loading @@ -2887,6 +2891,18 @@ public class InputMethodManagerService extends IInputMethodManager.Stub } } private void handleSwitchInputMethod(final boolean forwardDirection) { synchronized (mMethodMap) { // TODO: Support forwardDirection. final ImeSubtypeListItem nextSubtype = mSwitchingController.getNextInputMethodLocked( false, mMethodMap.get(mCurMethodId), mCurrentSubtype); if (nextSubtype == null) { return; } setInputMethodLocked(nextSubtype.mImi.getId(), nextSubtype.mSubtypeId); } } private boolean chooseNewDefaultIMELocked() { final InputMethodInfo imi = InputMethodUtils.getMostApplicableDefaultIME( mSettings.getEnabledInputMethodListLocked()); Loading Loading @@ -3734,6 +3750,13 @@ public class InputMethodManagerService extends IInputMethodManager.Stub mHandler.sendMessage(mHandler.obtainMessage(MSG_SET_INTERACTIVE, interactive ? 1 : 0, 0)); } @Override public void switchInputMethod(boolean forwardDirection) { // Do everything in handler so as not to block the caller. mHandler.sendMessage(mHandler.obtainMessage(MSG_SWITCH_IME, forwardDirection ? 1 : 0, 0)); } } @Override Loading services/core/java/com/android/server/policy/PhoneWindowManager.java +13 −4 Original line number Diff line number Diff line Loading @@ -3056,13 +3056,22 @@ public class PhoneWindowManager implements WindowManagerPolicy { hideRecentApps(true, false); } // Handle keyboard language switching. // Handle keyboard layout switching. // TODO: Deprecate this behavior when we fully migrate to IME subtype-based layout rotation. if (down && repeatCount == 0 && keyCode == KeyEvent.KEYCODE_SPACE && ((metaState & KeyEvent.META_CTRL_MASK) != 0)) { int direction = (metaState & KeyEvent.META_SHIFT_MASK) != 0 ? -1 : 1; mWindowManagerFuncs.switchKeyboardLayout(event.getDeviceId(), direction); return -1; } // Handle input method switching. if (down && repeatCount == 0 && (keyCode == KeyEvent.KEYCODE_LANGUAGE_SWITCH || (keyCode == KeyEvent.KEYCODE_SPACE && (metaState & KeyEvent.META_CTRL_MASK) != 0))) { int direction = (metaState & KeyEvent.META_SHIFT_MASK) != 0 ? -1 : 1; mWindowManagerFuncs.switchKeyboardLayout(event.getDeviceId(), direction); && (metaState & KeyEvent.META_META_MASK) != 0))) { final boolean forwardDirection = (metaState & KeyEvent.META_SHIFT_MASK) == 0; mWindowManagerFuncs.switchInputMethod(forwardDirection); return -1; } if (mLanguageSwitchKeyPressed && !down Loading services/core/java/com/android/server/wm/WindowManagerService.java +11 −0 Original line number Diff line number Diff line Loading @@ -186,6 +186,7 @@ import android.view.WindowManagerInternal; import android.view.WindowManagerPolicy; import android.view.WindowManagerPolicy.PointerEventListener; import android.view.animation.Animation; import android.view.inputmethod.InputMethodManagerInternal; import android.widget.Toast; import com.android.internal.R; Loading Loading @@ -5295,6 +5296,16 @@ public class WindowManagerService extends IWindowManager.Stub mInputManager.switchKeyboardLayout(deviceId, direction); } // Called by window manager policy. Not exposed externally. @Override public void switchInputMethod(boolean forwardDirection) { final InputMethodManagerInternal inputMethodManagerInternal = LocalServices.getService(InputMethodManagerInternal.class); if (inputMethodManagerInternal != null) { inputMethodManagerInternal.switchInputMethod(forwardDirection); } } // Called by window manager policy. Not exposed externally. @Override public void shutdown(boolean confirm) { Loading Loading
core/java/android/view/WindowManagerPolicy.java +7 −0 Original line number Diff line number Diff line Loading @@ -446,6 +446,13 @@ public interface WindowManagerPolicy { */ public void switchKeyboardLayout(int deviceId, int direction); /** * Switch the input method, to be precise, input method subtype. * * @param forwardDirection {@code true} to rotate in a forward direction. */ public void switchInputMethod(boolean forwardDirection); public void shutdown(boolean confirm); public void rebootSafeMode(boolean confirm); Loading
core/java/android/view/inputmethod/InputMethodManagerInternal.java +6 −1 Original line number Diff line number Diff line Loading @@ -26,5 +26,10 @@ public interface InputMethodManagerInternal { * Called by the power manager to tell the input method manager whether it * should start watching for wake events. */ public void setInteractive(boolean interactive); void setInteractive(boolean interactive); /** * Called by the window manager to let the input method manager rotate the input method. */ void switchInputMethod(boolean forwardDirection); }
services/core/java/com/android/server/InputMethodManagerService.java +23 −0 Original line number Diff line number Diff line Loading @@ -166,6 +166,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub static final int MSG_SET_ACTIVE = 3020; static final int MSG_SET_INTERACTIVE = 3030; static final int MSG_SET_USER_ACTION_NOTIFICATION_SEQUENCE_NUMBER = 3040; static final int MSG_SWITCH_IME = 3050; static final int MSG_HARD_KEYBOARD_SWITCH_CHANGED = 4000; Loading Loading @@ -2851,6 +2852,9 @@ public class InputMethodManagerService extends IInputMethodManager.Stub case MSG_SET_INTERACTIVE: handleSetInteractive(msg.arg1 != 0); return true; case MSG_SWITCH_IME: handleSwitchInputMethod(msg.arg1 != 0); return true; case MSG_SET_USER_ACTION_NOTIFICATION_SEQUENCE_NUMBER: { final int sequenceNumber = msg.arg1; final ClientState clientState = (ClientState)msg.obj; Loading Loading @@ -2887,6 +2891,18 @@ public class InputMethodManagerService extends IInputMethodManager.Stub } } private void handleSwitchInputMethod(final boolean forwardDirection) { synchronized (mMethodMap) { // TODO: Support forwardDirection. final ImeSubtypeListItem nextSubtype = mSwitchingController.getNextInputMethodLocked( false, mMethodMap.get(mCurMethodId), mCurrentSubtype); if (nextSubtype == null) { return; } setInputMethodLocked(nextSubtype.mImi.getId(), nextSubtype.mSubtypeId); } } private boolean chooseNewDefaultIMELocked() { final InputMethodInfo imi = InputMethodUtils.getMostApplicableDefaultIME( mSettings.getEnabledInputMethodListLocked()); Loading Loading @@ -3734,6 +3750,13 @@ public class InputMethodManagerService extends IInputMethodManager.Stub mHandler.sendMessage(mHandler.obtainMessage(MSG_SET_INTERACTIVE, interactive ? 1 : 0, 0)); } @Override public void switchInputMethod(boolean forwardDirection) { // Do everything in handler so as not to block the caller. mHandler.sendMessage(mHandler.obtainMessage(MSG_SWITCH_IME, forwardDirection ? 1 : 0, 0)); } } @Override Loading
services/core/java/com/android/server/policy/PhoneWindowManager.java +13 −4 Original line number Diff line number Diff line Loading @@ -3056,13 +3056,22 @@ public class PhoneWindowManager implements WindowManagerPolicy { hideRecentApps(true, false); } // Handle keyboard language switching. // Handle keyboard layout switching. // TODO: Deprecate this behavior when we fully migrate to IME subtype-based layout rotation. if (down && repeatCount == 0 && keyCode == KeyEvent.KEYCODE_SPACE && ((metaState & KeyEvent.META_CTRL_MASK) != 0)) { int direction = (metaState & KeyEvent.META_SHIFT_MASK) != 0 ? -1 : 1; mWindowManagerFuncs.switchKeyboardLayout(event.getDeviceId(), direction); return -1; } // Handle input method switching. if (down && repeatCount == 0 && (keyCode == KeyEvent.KEYCODE_LANGUAGE_SWITCH || (keyCode == KeyEvent.KEYCODE_SPACE && (metaState & KeyEvent.META_CTRL_MASK) != 0))) { int direction = (metaState & KeyEvent.META_SHIFT_MASK) != 0 ? -1 : 1; mWindowManagerFuncs.switchKeyboardLayout(event.getDeviceId(), direction); && (metaState & KeyEvent.META_META_MASK) != 0))) { final boolean forwardDirection = (metaState & KeyEvent.META_SHIFT_MASK) == 0; mWindowManagerFuncs.switchInputMethod(forwardDirection); return -1; } if (mLanguageSwitchKeyPressed && !down Loading
services/core/java/com/android/server/wm/WindowManagerService.java +11 −0 Original line number Diff line number Diff line Loading @@ -186,6 +186,7 @@ import android.view.WindowManagerInternal; import android.view.WindowManagerPolicy; import android.view.WindowManagerPolicy.PointerEventListener; import android.view.animation.Animation; import android.view.inputmethod.InputMethodManagerInternal; import android.widget.Toast; import com.android.internal.R; Loading Loading @@ -5295,6 +5296,16 @@ public class WindowManagerService extends IWindowManager.Stub mInputManager.switchKeyboardLayout(deviceId, direction); } // Called by window manager policy. Not exposed externally. @Override public void switchInputMethod(boolean forwardDirection) { final InputMethodManagerInternal inputMethodManagerInternal = LocalServices.getService(InputMethodManagerInternal.class); if (inputMethodManagerInternal != null) { inputMethodManagerInternal.switchInputMethod(forwardDirection); } } // Called by window manager policy. Not exposed externally. @Override public void shutdown(boolean confirm) { Loading