Loading core/java/android/hardware/input/IInputManager.aidl +1 −1 Original line number Diff line number Diff line Loading @@ -94,7 +94,7 @@ interface IInputManager { void setPointerIconType(int typeId); void setCustomPointerIcon(in PointerIcon icon); void requestPointerCapture(IBinder windowToken, boolean enabled); oneway void requestPointerCapture(IBinder inputChannelToken, boolean enabled); /** Create an input monitor for gestures. */ InputMonitor monitorGestureInput(String name, int displayId); Loading core/java/android/view/ViewRootImpl.java +11 −1 Original line number Diff line number Diff line Loading @@ -4667,7 +4667,12 @@ public final class ViewRootImpl implements ViewParent, if (mPointerCapture == enabled) { return; } InputManager.getInstance().requestPointerCapture(mAttachInfo.mWindowToken, enabled); final IBinder inputToken = getInputToken(); if (inputToken == null) { Log.e(mTag, "No input channel to request Pointer Capture."); return; } InputManager.getInstance().requestPointerCapture(inputToken, enabled); } private void handlePointerCaptureChanged(boolean hasCapture) { Loading Loading @@ -8380,6 +8385,11 @@ public final class ViewRootImpl implements ViewParent, windowFocusChanged(hasFocus, inTouchMode); } @Override public void onPointerCaptureEvent(boolean pointerCaptureEnabled) { dispatchPointerCaptureChanged(pointerCaptureEnabled); } @Override public void dispose() { unscheduleConsumeBatchedInput(); Loading services/core/java/com/android/server/input/InputManagerService.java +8 −11 Original line number Diff line number Diff line Loading @@ -285,7 +285,8 @@ public class InputManagerService extends IInputManager.Stub private static native void nativeSetPointerIconType(long ptr, int iconId); private static native void nativeReloadPointerIcons(long ptr); private static native void nativeSetCustomPointerIcon(long ptr, PointerIcon icon); private static native void nativeSetPointerCapture(long ptr, boolean detached); private static native void nativeRequestPointerCapture(long ptr, IBinder windowToken, boolean enabled); private static native boolean nativeCanDispatchToDisplay(long ptr, int deviceId, int displayId); private static native void nativeNotifyPortAssociationsChanged(long ptr); private static native void nativeSetMotionClassifierEnabled(long ptr, boolean enabled); Loading Loading @@ -1611,12 +1612,12 @@ public class InputManagerService extends IInputManager.Stub } @Override public void requestPointerCapture(IBinder windowToken, boolean enabled) { boolean requestConfigurationRefresh = mWindowManagerCallbacks.requestPointerCapture(windowToken, enabled); if (requestConfigurationRefresh) { nativeSetPointerCapture(mPtr, enabled); public void requestPointerCapture(IBinder inputChannelToken, boolean enabled) { if (inputChannelToken == null) { return; } nativeRequestPointerCapture(mPtr, inputChannelToken, enabled); } public void setInputDispatchMode(boolean enabled, boolean frozen) { Loading Loading @@ -2189,11 +2190,7 @@ public class InputManagerService extends IInputManager.Stub // Native callback private void notifyFocusChanged(IBinder oldToken, IBinder newToken) { final boolean requestConfigurationRefresh = mWindowManagerCallbacks.notifyFocusChanged(oldToken, newToken); if (requestConfigurationRefresh) { nativeSetPointerCapture(mPtr, false); } } // Native callback Loading services/core/jni/com_android_server_input_InputManagerService.cpp +26 −20 Original line number Diff line number Diff line Loading @@ -240,8 +240,8 @@ public: void reloadCalibration(); void setPointerIconType(int32_t iconId); void reloadPointerIcons(); void requestPointerCapture(const sp<IBinder>& windowToken, bool enabled); void setCustomPointerIcon(const SpriteIcon& icon); void setPointerCapture(bool enabled); void setMotionClassifierEnabled(bool enabled); /* --- InputReaderPolicyInterface implementation --- */ Loading Loading @@ -280,6 +280,7 @@ public: void pokeUserActivity(nsecs_t eventTime, int32_t eventType) override; bool checkInjectEventsPermissionNonReentrant(int32_t injectorPid, int32_t injectorUid) override; void onPointerDownOutsideFocus(const sp<IBinder>& touchedToken) override; void setPointerCapture(bool enabled) override; /* --- PointerControllerPolicyInterface implementation --- */ Loading Loading @@ -930,20 +931,8 @@ void NativeInputManager::setShowTouches(bool enabled) { InputReaderConfiguration::CHANGE_SHOW_TOUCHES); } void NativeInputManager::setPointerCapture(bool enabled) { { // acquire lock AutoMutex _l(mLock); if (mLocked.pointerCapture == enabled) { return; } ALOGI("Setting pointer capture to %s.", enabled ? "enabled" : "disabled"); mLocked.pointerCapture = enabled; } // release lock mInputManager->getReader()->requestRefreshConfiguration( InputReaderConfiguration::CHANGE_POINTER_CAPTURE); void NativeInputManager::requestPointerCapture(const sp<IBinder>& windowToken, bool enabled) { mInputManager->getDispatcher()->requestPointerCapture(windowToken, enabled); } void NativeInputManager::setInteractive(bool interactive) { Loading Loading @@ -1215,7 +1204,6 @@ void NativeInputManager::pokeUserActivity(nsecs_t eventTime, int32_t eventType) android_server_PowerManagerService_userActivity(eventTime, eventType); } bool NativeInputManager::checkInjectEventsPermissionNonReentrant( int32_t injectorPid, int32_t injectorUid) { ATRACE_CALL(); Loading @@ -1238,6 +1226,22 @@ void NativeInputManager::onPointerDownOutsideFocus(const sp<IBinder>& touchedTok checkAndClearExceptionFromCallback(env, "onPointerDownOutsideFocus"); } void NativeInputManager::setPointerCapture(bool enabled) { { // acquire lock AutoMutex _l(mLock); if (mLocked.pointerCapture == enabled) { return; } ALOGV("%s pointer capture.", enabled ? "Enabling" : "Disabling"); mLocked.pointerCapture = enabled; } // release lock mInputManager->getReader()->requestRefreshConfiguration( InputReaderConfiguration::CHANGE_POINTER_CAPTURE); } void NativeInputManager::loadPointerIcon(SpriteIcon* icon, int32_t displayId) { ATRACE_CALL(); JNIEnv* env = jniEnv(); Loading Loading @@ -1631,11 +1635,12 @@ static void nativeSetFocusedDisplay(JNIEnv* env, jclass /* clazz */, im->setFocusedDisplay(env, displayId); } static void nativeSetPointerCapture(JNIEnv* env, jclass /* clazz */, jlong ptr, jboolean enabled) { static void nativeRequestPointerCapture(JNIEnv* env, jclass /* clazz */, jlong ptr, jobject tokenObj, jboolean enabled) { NativeInputManager* im = reinterpret_cast<NativeInputManager*>(ptr); sp<IBinder> windowToken = ibinderForJavaObject(env, tokenObj); im->setPointerCapture(enabled); im->requestPointerCapture(windowToken, enabled); } static void nativeSetInputDispatchMode(JNIEnv* /* env */, Loading Loading @@ -1941,7 +1946,8 @@ static const JNINativeMethod gInputManagerMethods[] = { {"nativeSetFocusedApplication", "(JILandroid/view/InputApplicationHandle;)V", (void*)nativeSetFocusedApplication}, {"nativeSetFocusedDisplay", "(JI)V", (void*)nativeSetFocusedDisplay}, {"nativeSetPointerCapture", "(JZ)V", (void*)nativeSetPointerCapture}, {"nativeRequestPointerCapture", "(JLandroid/os/IBinder;Z)V", (void*)nativeRequestPointerCapture}, {"nativeSetInputDispatchMode", "(JZZ)V", (void*)nativeSetInputDispatchMode}, {"nativeSetSystemUiLightsOut", "(JZ)V", (void*)nativeSetSystemUiLightsOut}, {"nativeTransferTouchFocus", "(JLandroid/os/IBinder;Landroid/os/IBinder;)Z", Loading Loading
core/java/android/hardware/input/IInputManager.aidl +1 −1 Original line number Diff line number Diff line Loading @@ -94,7 +94,7 @@ interface IInputManager { void setPointerIconType(int typeId); void setCustomPointerIcon(in PointerIcon icon); void requestPointerCapture(IBinder windowToken, boolean enabled); oneway void requestPointerCapture(IBinder inputChannelToken, boolean enabled); /** Create an input monitor for gestures. */ InputMonitor monitorGestureInput(String name, int displayId); Loading
core/java/android/view/ViewRootImpl.java +11 −1 Original line number Diff line number Diff line Loading @@ -4667,7 +4667,12 @@ public final class ViewRootImpl implements ViewParent, if (mPointerCapture == enabled) { return; } InputManager.getInstance().requestPointerCapture(mAttachInfo.mWindowToken, enabled); final IBinder inputToken = getInputToken(); if (inputToken == null) { Log.e(mTag, "No input channel to request Pointer Capture."); return; } InputManager.getInstance().requestPointerCapture(inputToken, enabled); } private void handlePointerCaptureChanged(boolean hasCapture) { Loading Loading @@ -8380,6 +8385,11 @@ public final class ViewRootImpl implements ViewParent, windowFocusChanged(hasFocus, inTouchMode); } @Override public void onPointerCaptureEvent(boolean pointerCaptureEnabled) { dispatchPointerCaptureChanged(pointerCaptureEnabled); } @Override public void dispose() { unscheduleConsumeBatchedInput(); Loading
services/core/java/com/android/server/input/InputManagerService.java +8 −11 Original line number Diff line number Diff line Loading @@ -285,7 +285,8 @@ public class InputManagerService extends IInputManager.Stub private static native void nativeSetPointerIconType(long ptr, int iconId); private static native void nativeReloadPointerIcons(long ptr); private static native void nativeSetCustomPointerIcon(long ptr, PointerIcon icon); private static native void nativeSetPointerCapture(long ptr, boolean detached); private static native void nativeRequestPointerCapture(long ptr, IBinder windowToken, boolean enabled); private static native boolean nativeCanDispatchToDisplay(long ptr, int deviceId, int displayId); private static native void nativeNotifyPortAssociationsChanged(long ptr); private static native void nativeSetMotionClassifierEnabled(long ptr, boolean enabled); Loading Loading @@ -1611,12 +1612,12 @@ public class InputManagerService extends IInputManager.Stub } @Override public void requestPointerCapture(IBinder windowToken, boolean enabled) { boolean requestConfigurationRefresh = mWindowManagerCallbacks.requestPointerCapture(windowToken, enabled); if (requestConfigurationRefresh) { nativeSetPointerCapture(mPtr, enabled); public void requestPointerCapture(IBinder inputChannelToken, boolean enabled) { if (inputChannelToken == null) { return; } nativeRequestPointerCapture(mPtr, inputChannelToken, enabled); } public void setInputDispatchMode(boolean enabled, boolean frozen) { Loading Loading @@ -2189,11 +2190,7 @@ public class InputManagerService extends IInputManager.Stub // Native callback private void notifyFocusChanged(IBinder oldToken, IBinder newToken) { final boolean requestConfigurationRefresh = mWindowManagerCallbacks.notifyFocusChanged(oldToken, newToken); if (requestConfigurationRefresh) { nativeSetPointerCapture(mPtr, false); } } // Native callback Loading
services/core/jni/com_android_server_input_InputManagerService.cpp +26 −20 Original line number Diff line number Diff line Loading @@ -240,8 +240,8 @@ public: void reloadCalibration(); void setPointerIconType(int32_t iconId); void reloadPointerIcons(); void requestPointerCapture(const sp<IBinder>& windowToken, bool enabled); void setCustomPointerIcon(const SpriteIcon& icon); void setPointerCapture(bool enabled); void setMotionClassifierEnabled(bool enabled); /* --- InputReaderPolicyInterface implementation --- */ Loading Loading @@ -280,6 +280,7 @@ public: void pokeUserActivity(nsecs_t eventTime, int32_t eventType) override; bool checkInjectEventsPermissionNonReentrant(int32_t injectorPid, int32_t injectorUid) override; void onPointerDownOutsideFocus(const sp<IBinder>& touchedToken) override; void setPointerCapture(bool enabled) override; /* --- PointerControllerPolicyInterface implementation --- */ Loading Loading @@ -930,20 +931,8 @@ void NativeInputManager::setShowTouches(bool enabled) { InputReaderConfiguration::CHANGE_SHOW_TOUCHES); } void NativeInputManager::setPointerCapture(bool enabled) { { // acquire lock AutoMutex _l(mLock); if (mLocked.pointerCapture == enabled) { return; } ALOGI("Setting pointer capture to %s.", enabled ? "enabled" : "disabled"); mLocked.pointerCapture = enabled; } // release lock mInputManager->getReader()->requestRefreshConfiguration( InputReaderConfiguration::CHANGE_POINTER_CAPTURE); void NativeInputManager::requestPointerCapture(const sp<IBinder>& windowToken, bool enabled) { mInputManager->getDispatcher()->requestPointerCapture(windowToken, enabled); } void NativeInputManager::setInteractive(bool interactive) { Loading Loading @@ -1215,7 +1204,6 @@ void NativeInputManager::pokeUserActivity(nsecs_t eventTime, int32_t eventType) android_server_PowerManagerService_userActivity(eventTime, eventType); } bool NativeInputManager::checkInjectEventsPermissionNonReentrant( int32_t injectorPid, int32_t injectorUid) { ATRACE_CALL(); Loading @@ -1238,6 +1226,22 @@ void NativeInputManager::onPointerDownOutsideFocus(const sp<IBinder>& touchedTok checkAndClearExceptionFromCallback(env, "onPointerDownOutsideFocus"); } void NativeInputManager::setPointerCapture(bool enabled) { { // acquire lock AutoMutex _l(mLock); if (mLocked.pointerCapture == enabled) { return; } ALOGV("%s pointer capture.", enabled ? "Enabling" : "Disabling"); mLocked.pointerCapture = enabled; } // release lock mInputManager->getReader()->requestRefreshConfiguration( InputReaderConfiguration::CHANGE_POINTER_CAPTURE); } void NativeInputManager::loadPointerIcon(SpriteIcon* icon, int32_t displayId) { ATRACE_CALL(); JNIEnv* env = jniEnv(); Loading Loading @@ -1631,11 +1635,12 @@ static void nativeSetFocusedDisplay(JNIEnv* env, jclass /* clazz */, im->setFocusedDisplay(env, displayId); } static void nativeSetPointerCapture(JNIEnv* env, jclass /* clazz */, jlong ptr, jboolean enabled) { static void nativeRequestPointerCapture(JNIEnv* env, jclass /* clazz */, jlong ptr, jobject tokenObj, jboolean enabled) { NativeInputManager* im = reinterpret_cast<NativeInputManager*>(ptr); sp<IBinder> windowToken = ibinderForJavaObject(env, tokenObj); im->setPointerCapture(enabled); im->requestPointerCapture(windowToken, enabled); } static void nativeSetInputDispatchMode(JNIEnv* /* env */, Loading Loading @@ -1941,7 +1946,8 @@ static const JNINativeMethod gInputManagerMethods[] = { {"nativeSetFocusedApplication", "(JILandroid/view/InputApplicationHandle;)V", (void*)nativeSetFocusedApplication}, {"nativeSetFocusedDisplay", "(JI)V", (void*)nativeSetFocusedDisplay}, {"nativeSetPointerCapture", "(JZ)V", (void*)nativeSetPointerCapture}, {"nativeRequestPointerCapture", "(JLandroid/os/IBinder;Z)V", (void*)nativeRequestPointerCapture}, {"nativeSetInputDispatchMode", "(JZZ)V", (void*)nativeSetInputDispatchMode}, {"nativeSetSystemUiLightsOut", "(JZ)V", (void*)nativeSetSystemUiLightsOut}, {"nativeTransferTouchFocus", "(JLandroid/os/IBinder;Landroid/os/IBinder;)Z", Loading