Loading core/java/android/hardware/input/InputManagerInternal.java +13 −0 Original line number Diff line number Diff line Loading @@ -16,8 +16,11 @@ package android.hardware.input; import android.annotation.Nullable; import android.hardware.display.DisplayViewport; import android.view.InputEvent; import android.view.inputmethod.InputMethodInfo; import android.view.inputmethod.InputMethodSubtype; /** * Input manager local system service interface. Loading @@ -39,4 +42,14 @@ public abstract class InputManagerInternal { * watching for wake events. */ public abstract void setInteractive(boolean interactive); /** * Notifies that InputMethodManagerService switched the current input method subtype. * * @param userId user id that indicates who is using the specified input method and subtype. * @param inputMethodInfo {@code null} when no input method is selected. * @param subtype {@code null} when {@code inputMethodInfo} does has no subtype. */ public abstract void onInputMethodSubtypeChanged(int userId, @Nullable InputMethodInfo inputMethodInfo, @Nullable InputMethodSubtype subtype); } services/core/java/com/android/server/InputMethodManagerService.java +16 −0 Original line number Diff line number Diff line Loading @@ -70,6 +70,7 @@ import android.content.res.Resources; import android.content.res.TypedArray; import android.database.ContentObserver; import android.graphics.drawable.Drawable; import android.hardware.input.InputManagerInternal; import android.inputmethodservice.InputMethodService; import android.net.Uri; import android.os.Binder; Loading Loading @@ -1930,6 +1931,16 @@ public class InputMethodManagerService extends IInputMethodManager.Stub } } private void notifyInputMethodSubtypeChanged(final int userId, @Nullable final InputMethodInfo inputMethodInfo, @Nullable final InputMethodSubtype subtype) { final InputManagerInternal inputManagerInternal = LocalServices.getService(InputManagerInternal.class); if (inputManagerInternal != null) { inputManagerInternal.onInputMethodSubtypeChanged(userId, inputMethodInfo, subtype); } } /* package */ void setInputMethodLocked(String id, int subtypeId) { InputMethodInfo info = mMethodMap.get(id); if (info == null) { Loading Loading @@ -1972,8 +1983,10 @@ public class InputMethodManagerService extends IInputMethodManager.Stub mCurMethod.changeInputMethodSubtype(newSubtype); } catch (RemoteException e) { Slog.w(TAG, "Failed to call changeInputMethodSubtype"); return; } } notifyInputMethodSubtypeChanged(mSettings.getCurrentUserId(), info, newSubtype); } return; } Loading @@ -1999,6 +2012,9 @@ public class InputMethodManagerService extends IInputMethodManager.Stub } finally { Binder.restoreCallingIdentity(ident); } notifyInputMethodSubtypeChanged(mSettings.getCurrentUserId(), info, getCurrentInputMethodSubtypeLocked()); } @Override Loading services/core/java/com/android/server/input/InputManagerService.java +35 −1 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package com.android.server.input; import android.annotation.Nullable; import android.view.Display; import com.android.internal.os.SomeArgs; import com.android.internal.R; Loading Loading @@ -83,6 +84,9 @@ import android.view.PointerIcon; import android.view.Surface; import android.view.ViewConfiguration; import android.view.WindowManagerPolicy; import android.view.inputmethod.InputMethod; import android.view.inputmethod.InputMethodInfo; import android.view.inputmethod.InputMethodSubtype; import android.widget.Toast; import java.io.File; Loading Loading @@ -116,6 +120,7 @@ public class InputManagerService extends IInputManager.Stub private static final int MSG_UPDATE_KEYBOARD_LAYOUTS = 4; private static final int MSG_RELOAD_DEVICE_ALIASES = 5; private static final int MSG_DELIVER_TABLET_MODE_CHANGED = 6; private static final int MSG_INPUT_METHOD_SUBTYPE_CHANGED = 7; // Pointer to native input manager service object. private final long mPtr; Loading Loading @@ -1206,6 +1211,15 @@ public class InputManagerService extends IInputManager.Stub } } // Must be called on handler. private void handleSwitchInputMethodSubtype(int userId, @Nullable InputMethodInfo inputMethodInfo, @Nullable InputMethodSubtype subtype) { if (DEBUG) { Slog.i(TAG, "InputMethodSubtype changed: userId=" + userId + " ime=" + inputMethodInfo + " subtype=" + subtype); } } public void switchKeyboardLayout(int deviceId, int direction) { mHandler.obtainMessage(MSG_SWITCH_KEYBOARD_LAYOUT, deviceId, direction).sendToTarget(); } Loading Loading @@ -1757,13 +1771,23 @@ public class InputManagerService extends IInputManager.Stub case MSG_RELOAD_DEVICE_ALIASES: reloadDeviceAliases(); break; case MSG_DELIVER_TABLET_MODE_CHANGED: case MSG_DELIVER_TABLET_MODE_CHANGED: { SomeArgs args = (SomeArgs) msg.obj; long whenNanos = (args.argi1 & 0xFFFFFFFFl) | ((long) args.argi2 << 32); boolean inTabletMode = (boolean) args.arg1; deliverTabletModeChanged(whenNanos, inTabletMode); break; } case MSG_INPUT_METHOD_SUBTYPE_CHANGED: { final int userId = msg.arg1; final SomeArgs args = (SomeArgs) msg.obj; final InputMethodInfo inputMethodInfo = (InputMethodInfo) args.arg1; final InputMethodSubtype subtype = (InputMethodSubtype) args.arg2; args.recycle(); handleSwitchInputMethodSubtype(userId, inputMethodInfo, subtype); break; } } } } Loading Loading @@ -1920,5 +1944,15 @@ public class InputManagerService extends IInputManager.Stub public void setInteractive(boolean interactive) { nativeSetInteractive(mPtr, interactive); } @Override public void onInputMethodSubtypeChanged(int userId, @Nullable InputMethodInfo inputMethodInfo, @Nullable InputMethodSubtype subtype) { final SomeArgs someArgs = SomeArgs.obtain(); someArgs.arg1 = inputMethodInfo; someArgs.arg2 = subtype; mHandler.obtainMessage(MSG_INPUT_METHOD_SUBTYPE_CHANGED, userId, 0, someArgs) .sendToTarget(); } } } Loading
core/java/android/hardware/input/InputManagerInternal.java +13 −0 Original line number Diff line number Diff line Loading @@ -16,8 +16,11 @@ package android.hardware.input; import android.annotation.Nullable; import android.hardware.display.DisplayViewport; import android.view.InputEvent; import android.view.inputmethod.InputMethodInfo; import android.view.inputmethod.InputMethodSubtype; /** * Input manager local system service interface. Loading @@ -39,4 +42,14 @@ public abstract class InputManagerInternal { * watching for wake events. */ public abstract void setInteractive(boolean interactive); /** * Notifies that InputMethodManagerService switched the current input method subtype. * * @param userId user id that indicates who is using the specified input method and subtype. * @param inputMethodInfo {@code null} when no input method is selected. * @param subtype {@code null} when {@code inputMethodInfo} does has no subtype. */ public abstract void onInputMethodSubtypeChanged(int userId, @Nullable InputMethodInfo inputMethodInfo, @Nullable InputMethodSubtype subtype); }
services/core/java/com/android/server/InputMethodManagerService.java +16 −0 Original line number Diff line number Diff line Loading @@ -70,6 +70,7 @@ import android.content.res.Resources; import android.content.res.TypedArray; import android.database.ContentObserver; import android.graphics.drawable.Drawable; import android.hardware.input.InputManagerInternal; import android.inputmethodservice.InputMethodService; import android.net.Uri; import android.os.Binder; Loading Loading @@ -1930,6 +1931,16 @@ public class InputMethodManagerService extends IInputMethodManager.Stub } } private void notifyInputMethodSubtypeChanged(final int userId, @Nullable final InputMethodInfo inputMethodInfo, @Nullable final InputMethodSubtype subtype) { final InputManagerInternal inputManagerInternal = LocalServices.getService(InputManagerInternal.class); if (inputManagerInternal != null) { inputManagerInternal.onInputMethodSubtypeChanged(userId, inputMethodInfo, subtype); } } /* package */ void setInputMethodLocked(String id, int subtypeId) { InputMethodInfo info = mMethodMap.get(id); if (info == null) { Loading Loading @@ -1972,8 +1983,10 @@ public class InputMethodManagerService extends IInputMethodManager.Stub mCurMethod.changeInputMethodSubtype(newSubtype); } catch (RemoteException e) { Slog.w(TAG, "Failed to call changeInputMethodSubtype"); return; } } notifyInputMethodSubtypeChanged(mSettings.getCurrentUserId(), info, newSubtype); } return; } Loading @@ -1999,6 +2012,9 @@ public class InputMethodManagerService extends IInputMethodManager.Stub } finally { Binder.restoreCallingIdentity(ident); } notifyInputMethodSubtypeChanged(mSettings.getCurrentUserId(), info, getCurrentInputMethodSubtypeLocked()); } @Override Loading
services/core/java/com/android/server/input/InputManagerService.java +35 −1 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package com.android.server.input; import android.annotation.Nullable; import android.view.Display; import com.android.internal.os.SomeArgs; import com.android.internal.R; Loading Loading @@ -83,6 +84,9 @@ import android.view.PointerIcon; import android.view.Surface; import android.view.ViewConfiguration; import android.view.WindowManagerPolicy; import android.view.inputmethod.InputMethod; import android.view.inputmethod.InputMethodInfo; import android.view.inputmethod.InputMethodSubtype; import android.widget.Toast; import java.io.File; Loading Loading @@ -116,6 +120,7 @@ public class InputManagerService extends IInputManager.Stub private static final int MSG_UPDATE_KEYBOARD_LAYOUTS = 4; private static final int MSG_RELOAD_DEVICE_ALIASES = 5; private static final int MSG_DELIVER_TABLET_MODE_CHANGED = 6; private static final int MSG_INPUT_METHOD_SUBTYPE_CHANGED = 7; // Pointer to native input manager service object. private final long mPtr; Loading Loading @@ -1206,6 +1211,15 @@ public class InputManagerService extends IInputManager.Stub } } // Must be called on handler. private void handleSwitchInputMethodSubtype(int userId, @Nullable InputMethodInfo inputMethodInfo, @Nullable InputMethodSubtype subtype) { if (DEBUG) { Slog.i(TAG, "InputMethodSubtype changed: userId=" + userId + " ime=" + inputMethodInfo + " subtype=" + subtype); } } public void switchKeyboardLayout(int deviceId, int direction) { mHandler.obtainMessage(MSG_SWITCH_KEYBOARD_LAYOUT, deviceId, direction).sendToTarget(); } Loading Loading @@ -1757,13 +1771,23 @@ public class InputManagerService extends IInputManager.Stub case MSG_RELOAD_DEVICE_ALIASES: reloadDeviceAliases(); break; case MSG_DELIVER_TABLET_MODE_CHANGED: case MSG_DELIVER_TABLET_MODE_CHANGED: { SomeArgs args = (SomeArgs) msg.obj; long whenNanos = (args.argi1 & 0xFFFFFFFFl) | ((long) args.argi2 << 32); boolean inTabletMode = (boolean) args.arg1; deliverTabletModeChanged(whenNanos, inTabletMode); break; } case MSG_INPUT_METHOD_SUBTYPE_CHANGED: { final int userId = msg.arg1; final SomeArgs args = (SomeArgs) msg.obj; final InputMethodInfo inputMethodInfo = (InputMethodInfo) args.arg1; final InputMethodSubtype subtype = (InputMethodSubtype) args.arg2; args.recycle(); handleSwitchInputMethodSubtype(userId, inputMethodInfo, subtype); break; } } } } Loading Loading @@ -1920,5 +1944,15 @@ public class InputManagerService extends IInputManager.Stub public void setInteractive(boolean interactive) { nativeSetInteractive(mPtr, interactive); } @Override public void onInputMethodSubtypeChanged(int userId, @Nullable InputMethodInfo inputMethodInfo, @Nullable InputMethodSubtype subtype) { final SomeArgs someArgs = SomeArgs.obtain(); someArgs.arg1 = inputMethodInfo; someArgs.arg2 = subtype; mHandler.obtainMessage(MSG_INPUT_METHOD_SUBTYPE_CHANGED, userId, 0, someArgs) .sendToTarget(); } } }