Loading services/core/java/com/android/server/input/InputManagerService.java +20 −1 Original line number Diff line number Diff line Loading @@ -171,7 +171,6 @@ public class InputManagerService extends IInputManager.Stub private final ArrayList<InputDevice> mTempFullKeyboards = new ArrayList<InputDevice>(); // handler thread only private boolean mKeyboardLayoutNotificationShown; private PendingIntent mKeyboardLayoutIntent; private Toast mSwitchedKeyboardLayoutToast; // State for vibrator tokens. Loading Loading @@ -205,6 +204,7 @@ public class InputManagerService extends IInputManager.Stub private static native void nativeUnregisterInputChannel(long ptr, InputChannel inputChannel); private static native void nativePilferPointers(long ptr, IBinder token); private static native void nativeSetInputFilterEnabled(long ptr, boolean enable); private static native void nativeSetInTouchMode(long ptr, boolean inTouchMode); private static native int nativeInjectInputEvent(long ptr, InputEvent event, int injectorPid, int injectorUid, int syncMode, int timeoutMillis, int policyFlags); Loading Loading @@ -603,6 +603,25 @@ public class InputManagerService extends IInputManager.Stub } } /** * Set the state of the touch mode. * * WindowManager remains the source of truth of the touch mode state. * However, we need to keep a copy of this state in input. * * The apps determine the touch mode state. Therefore, a single app will * affect the global state. That state change needs to be propagated to * other apps, when they become focused. * * When input dispatches focus to the apps, the touch mode state * will be sent together with the focus change. * * @param inTouchMode true if the device is in touch mode. */ public void setInTouchMode(boolean inTouchMode) { nativeSetInTouchMode(mPtr, inTouchMode); } @Override // Binder call public boolean injectInputEvent(InputEvent event, int mode) { return injectInputEventInternal(event, mode); Loading services/core/java/com/android/server/wm/WindowManagerService.java +2 −0 Original line number Diff line number Diff line Loading @@ -1104,6 +1104,7 @@ public class WindowManagerService extends IWindowManager.Stub com.android.internal.R.bool.config_hasPermanentDpad); mInTouchMode = context.getResources().getBoolean( com.android.internal.R.bool.config_defaultInTouchMode); inputManager.setInTouchMode(mInTouchMode); mDrawLockTimeoutMillis = context.getResources().getInteger( com.android.internal.R.integer.config_drawLockTimeoutMillis); mAllowAnimationsInLowPowerMode = context.getResources().getBoolean( Loading Loading @@ -3402,6 +3403,7 @@ public class WindowManagerService extends IWindowManager.Stub synchronized (mGlobalLock) { mInTouchMode = mode; } mInputManager.setInTouchMode(mode); } public void showEmulatorDisplayOverlayIfNeeded() { Loading services/core/jni/com_android_server_input_InputManagerService.cpp +9 −0 Original line number Diff line number Diff line Loading @@ -1502,6 +1502,13 @@ static void nativeSetInputFilterEnabled(JNIEnv* /* env */, jclass /* clazz */, im->getInputManager()->getDispatcher()->setInputFilterEnabled(enabled); } static void nativeSetInTouchMode(JNIEnv* /* env */, jclass /* clazz */, jlong ptr, jboolean inTouchMode) { NativeInputManager* im = reinterpret_cast<NativeInputManager*>(ptr); im->getInputManager()->getDispatcher()->setInTouchMode(inTouchMode); } static jint nativeInjectInputEvent(JNIEnv* env, jclass /* clazz */, jlong ptr, jobject inputEventObj, jint injectorPid, jint injectorUid, jint syncMode, jint timeoutMillis, jint policyFlags) { Loading Loading @@ -1781,6 +1788,8 @@ static const JNINativeMethod gInputManagerMethods[] = { (void*) nativePilferPointers }, { "nativeSetInputFilterEnabled", "(JZ)V", (void*) nativeSetInputFilterEnabled }, { "nativeSetInTouchMode", "(JZ)V", (void*) nativeSetInTouchMode }, { "nativeInjectInputEvent", "(JLandroid/view/InputEvent;IIIII)I", (void*) nativeInjectInputEvent }, { "nativeToggleCapsLock", "(JI)V", Loading Loading
services/core/java/com/android/server/input/InputManagerService.java +20 −1 Original line number Diff line number Diff line Loading @@ -171,7 +171,6 @@ public class InputManagerService extends IInputManager.Stub private final ArrayList<InputDevice> mTempFullKeyboards = new ArrayList<InputDevice>(); // handler thread only private boolean mKeyboardLayoutNotificationShown; private PendingIntent mKeyboardLayoutIntent; private Toast mSwitchedKeyboardLayoutToast; // State for vibrator tokens. Loading Loading @@ -205,6 +204,7 @@ public class InputManagerService extends IInputManager.Stub private static native void nativeUnregisterInputChannel(long ptr, InputChannel inputChannel); private static native void nativePilferPointers(long ptr, IBinder token); private static native void nativeSetInputFilterEnabled(long ptr, boolean enable); private static native void nativeSetInTouchMode(long ptr, boolean inTouchMode); private static native int nativeInjectInputEvent(long ptr, InputEvent event, int injectorPid, int injectorUid, int syncMode, int timeoutMillis, int policyFlags); Loading Loading @@ -603,6 +603,25 @@ public class InputManagerService extends IInputManager.Stub } } /** * Set the state of the touch mode. * * WindowManager remains the source of truth of the touch mode state. * However, we need to keep a copy of this state in input. * * The apps determine the touch mode state. Therefore, a single app will * affect the global state. That state change needs to be propagated to * other apps, when they become focused. * * When input dispatches focus to the apps, the touch mode state * will be sent together with the focus change. * * @param inTouchMode true if the device is in touch mode. */ public void setInTouchMode(boolean inTouchMode) { nativeSetInTouchMode(mPtr, inTouchMode); } @Override // Binder call public boolean injectInputEvent(InputEvent event, int mode) { return injectInputEventInternal(event, mode); Loading
services/core/java/com/android/server/wm/WindowManagerService.java +2 −0 Original line number Diff line number Diff line Loading @@ -1104,6 +1104,7 @@ public class WindowManagerService extends IWindowManager.Stub com.android.internal.R.bool.config_hasPermanentDpad); mInTouchMode = context.getResources().getBoolean( com.android.internal.R.bool.config_defaultInTouchMode); inputManager.setInTouchMode(mInTouchMode); mDrawLockTimeoutMillis = context.getResources().getInteger( com.android.internal.R.integer.config_drawLockTimeoutMillis); mAllowAnimationsInLowPowerMode = context.getResources().getBoolean( Loading Loading @@ -3402,6 +3403,7 @@ public class WindowManagerService extends IWindowManager.Stub synchronized (mGlobalLock) { mInTouchMode = mode; } mInputManager.setInTouchMode(mode); } public void showEmulatorDisplayOverlayIfNeeded() { Loading
services/core/jni/com_android_server_input_InputManagerService.cpp +9 −0 Original line number Diff line number Diff line Loading @@ -1502,6 +1502,13 @@ static void nativeSetInputFilterEnabled(JNIEnv* /* env */, jclass /* clazz */, im->getInputManager()->getDispatcher()->setInputFilterEnabled(enabled); } static void nativeSetInTouchMode(JNIEnv* /* env */, jclass /* clazz */, jlong ptr, jboolean inTouchMode) { NativeInputManager* im = reinterpret_cast<NativeInputManager*>(ptr); im->getInputManager()->getDispatcher()->setInTouchMode(inTouchMode); } static jint nativeInjectInputEvent(JNIEnv* env, jclass /* clazz */, jlong ptr, jobject inputEventObj, jint injectorPid, jint injectorUid, jint syncMode, jint timeoutMillis, jint policyFlags) { Loading Loading @@ -1781,6 +1788,8 @@ static const JNINativeMethod gInputManagerMethods[] = { (void*) nativePilferPointers }, { "nativeSetInputFilterEnabled", "(JZ)V", (void*) nativeSetInputFilterEnabled }, { "nativeSetInTouchMode", "(JZ)V", (void*) nativeSetInTouchMode }, { "nativeInjectInputEvent", "(JLandroid/view/InputEvent;IIIII)I", (void*) nativeInjectInputEvent }, { "nativeToggleCapsLock", "(JI)V", Loading