Loading services/core/java/com/android/server/input/InputManagerService.java +12 −20 Original line number Diff line number Diff line Loading @@ -2328,33 +2328,25 @@ public class InputManagerService extends IInputManager.Stub } // Native callback private void notifyConnectionUnresponsive(IBinder token, String reason) { Integer gestureMonitorPid; synchronized (mGestureMonitorPidsLock) { gestureMonitorPid = mGestureMonitorPidsByToken.get(token); } if (gestureMonitorPid != null) { mWindowManagerCallbacks.notifyGestureMonitorUnresponsive(gestureMonitorPid, reason); return; } // If we couldn't find a gesture monitor for this token, it's a window private void notifyWindowUnresponsive(IBinder token, String reason) { mWindowManagerCallbacks.notifyWindowUnresponsive(token, reason); } // Native callback private void notifyConnectionResponsive(IBinder token) { Integer gestureMonitorPid; synchronized (mGestureMonitorPidsLock) { gestureMonitorPid = mGestureMonitorPidsByToken.get(token); } if (gestureMonitorPid != null) { mWindowManagerCallbacks.notifyGestureMonitorResponsive(gestureMonitorPid); return; private void notifyMonitorUnresponsive(int pid, String reason) { mWindowManagerCallbacks.notifyGestureMonitorUnresponsive(pid, reason); } // If we couldn't find a gesture monitor for this token, it's a window // Native callback private void notifyWindowResponsive(IBinder token) { mWindowManagerCallbacks.notifyWindowResponsive(token); } // Native callback private void notifyMonitorResponsive(int pid) { mWindowManagerCallbacks.notifyGestureMonitorResponsive(pid); } // Native callback. private void notifySensorEvent(int deviceId, int sensorType, int accuracy, long timestamp, float[] values) { Loading services/core/jni/com_android_server_input_InputManagerService.cpp +57 −16 Original line number Diff line number Diff line Loading @@ -98,8 +98,10 @@ static struct { jmethodID notifySwitch; jmethodID notifyInputChannelBroken; jmethodID notifyNoFocusedWindowAnr; jmethodID notifyConnectionUnresponsive; jmethodID notifyConnectionResponsive; jmethodID notifyWindowUnresponsive; jmethodID notifyWindowResponsive; jmethodID notifyMonitorUnresponsive; jmethodID notifyMonitorResponsive; jmethodID notifyFocusChanged; jmethodID notifySensorEvent; jmethodID notifySensorAccuracy; Loading Loading @@ -288,9 +290,13 @@ public: void notifySwitch(nsecs_t when, uint32_t switchValues, uint32_t switchMask, uint32_t policyFlags) override; void notifyConfigurationChanged(nsecs_t when) override; // ANR-related callbacks -- start void notifyNoFocusedWindowAnr(const std::shared_ptr<InputApplicationHandle>& handle) override; void notifyConnectionUnresponsive(const sp<IBinder>& token, const std::string& reason) override; void notifyConnectionResponsive(const sp<IBinder>& token) override; void notifyWindowUnresponsive(const sp<IBinder>& token, const std::string& reason) override; void notifyWindowResponsive(const sp<IBinder>& token) override; void notifyMonitorUnresponsive(int32_t pid, const std::string& reason) override; void notifyMonitorResponsive(int32_t pid) override; // ANR-related callbacks -- end void notifyInputChannelBroken(const sp<IBinder>& token) override; void notifyFocusChanged(const sp<IBinder>& oldToken, const sp<IBinder>& newToken) override; void notifySensorEvent(int32_t deviceId, InputDeviceSensorType sensorType, Loading Loading @@ -775,10 +781,10 @@ void NativeInputManager::notifyNoFocusedWindowAnr( checkAndClearExceptionFromCallback(env, "notifyNoFocusedWindowAnr"); } void NativeInputManager::notifyConnectionUnresponsive(const sp<IBinder>& token, void NativeInputManager::notifyWindowUnresponsive(const sp<IBinder>& token, const std::string& reason) { #if DEBUG_INPUT_DISPATCHER_POLICY ALOGD("notifyConnectionUnresponsive"); ALOGD("notifyWindowUnresponsive"); #endif ATRACE_CALL(); Loading @@ -788,14 +794,14 @@ void NativeInputManager::notifyConnectionUnresponsive(const sp<IBinder>& token, jobject tokenObj = javaObjectForIBinder(env, token); ScopedLocalRef<jstring> reasonObj(env, env->NewStringUTF(reason.c_str())); env->CallVoidMethod(mServiceObj, gServiceClassInfo.notifyConnectionUnresponsive, tokenObj, env->CallVoidMethod(mServiceObj, gServiceClassInfo.notifyWindowUnresponsive, tokenObj, reasonObj.get()); checkAndClearExceptionFromCallback(env, "notifyConnectionUnresponsive"); checkAndClearExceptionFromCallback(env, "notifyWindowUnresponsive"); } void NativeInputManager::notifyConnectionResponsive(const sp<IBinder>& token) { void NativeInputManager::notifyWindowResponsive(const sp<IBinder>& token) { #if DEBUG_INPUT_DISPATCHER_POLICY ALOGD("notifyConnectionResponsive"); ALOGD("notifyWindowResponsive"); #endif ATRACE_CALL(); Loading @@ -804,8 +810,37 @@ void NativeInputManager::notifyConnectionResponsive(const sp<IBinder>& token) { jobject tokenObj = javaObjectForIBinder(env, token); env->CallVoidMethod(mServiceObj, gServiceClassInfo.notifyConnectionResponsive, tokenObj); checkAndClearExceptionFromCallback(env, "notifyConnectionResponsive"); env->CallVoidMethod(mServiceObj, gServiceClassInfo.notifyWindowResponsive, tokenObj); checkAndClearExceptionFromCallback(env, "notifyWindowResponsive"); } void NativeInputManager::notifyMonitorUnresponsive(int32_t pid, const std::string& reason) { #if DEBUG_INPUT_DISPATCHER_POLICY ALOGD("notifyMonitorUnresponsive"); #endif ATRACE_CALL(); JNIEnv* env = jniEnv(); ScopedLocalFrame localFrame(env); ScopedLocalRef<jstring> reasonObj(env, env->NewStringUTF(reason.c_str())); env->CallVoidMethod(mServiceObj, gServiceClassInfo.notifyMonitorUnresponsive, pid, reasonObj.get()); checkAndClearExceptionFromCallback(env, "notifyMonitorUnresponsive"); } void NativeInputManager::notifyMonitorResponsive(int32_t pid) { #if DEBUG_INPUT_DISPATCHER_POLICY ALOGD("notifyMonitorResponsive"); #endif ATRACE_CALL(); JNIEnv* env = jniEnv(); ScopedLocalFrame localFrame(env); env->CallVoidMethod(mServiceObj, gServiceClassInfo.notifyMonitorResponsive, pid); checkAndClearExceptionFromCallback(env, "notifyMonitorResponsive"); } void NativeInputManager::notifyInputChannelBroken(const sp<IBinder>& token) { Loading Loading @@ -2202,12 +2237,18 @@ int register_android_server_InputManager(JNIEnv* env) { GET_METHOD_ID(gServiceClassInfo.notifyNoFocusedWindowAnr, clazz, "notifyNoFocusedWindowAnr", "(Landroid/view/InputApplicationHandle;)V"); GET_METHOD_ID(gServiceClassInfo.notifyConnectionUnresponsive, clazz, "notifyConnectionUnresponsive", "(Landroid/os/IBinder;Ljava/lang/String;)V"); GET_METHOD_ID(gServiceClassInfo.notifyWindowUnresponsive, clazz, "notifyWindowUnresponsive", "(Landroid/os/IBinder;Ljava/lang/String;)V"); GET_METHOD_ID(gServiceClassInfo.notifyConnectionResponsive, clazz, "notifyConnectionResponsive", GET_METHOD_ID(gServiceClassInfo.notifyMonitorUnresponsive, clazz, "notifyMonitorUnresponsive", "(ILjava/lang/String;)V"); GET_METHOD_ID(gServiceClassInfo.notifyWindowResponsive, clazz, "notifyWindowResponsive", "(Landroid/os/IBinder;)V"); GET_METHOD_ID(gServiceClassInfo.notifyMonitorResponsive, clazz, "notifyMonitorResponsive", "(I)V"); GET_METHOD_ID(gServiceClassInfo.filterInputEvent, clazz, "filterInputEvent", "(Landroid/view/InputEvent;I)Z"); Loading Loading
services/core/java/com/android/server/input/InputManagerService.java +12 −20 Original line number Diff line number Diff line Loading @@ -2328,33 +2328,25 @@ public class InputManagerService extends IInputManager.Stub } // Native callback private void notifyConnectionUnresponsive(IBinder token, String reason) { Integer gestureMonitorPid; synchronized (mGestureMonitorPidsLock) { gestureMonitorPid = mGestureMonitorPidsByToken.get(token); } if (gestureMonitorPid != null) { mWindowManagerCallbacks.notifyGestureMonitorUnresponsive(gestureMonitorPid, reason); return; } // If we couldn't find a gesture monitor for this token, it's a window private void notifyWindowUnresponsive(IBinder token, String reason) { mWindowManagerCallbacks.notifyWindowUnresponsive(token, reason); } // Native callback private void notifyConnectionResponsive(IBinder token) { Integer gestureMonitorPid; synchronized (mGestureMonitorPidsLock) { gestureMonitorPid = mGestureMonitorPidsByToken.get(token); } if (gestureMonitorPid != null) { mWindowManagerCallbacks.notifyGestureMonitorResponsive(gestureMonitorPid); return; private void notifyMonitorUnresponsive(int pid, String reason) { mWindowManagerCallbacks.notifyGestureMonitorUnresponsive(pid, reason); } // If we couldn't find a gesture monitor for this token, it's a window // Native callback private void notifyWindowResponsive(IBinder token) { mWindowManagerCallbacks.notifyWindowResponsive(token); } // Native callback private void notifyMonitorResponsive(int pid) { mWindowManagerCallbacks.notifyGestureMonitorResponsive(pid); } // Native callback. private void notifySensorEvent(int deviceId, int sensorType, int accuracy, long timestamp, float[] values) { Loading
services/core/jni/com_android_server_input_InputManagerService.cpp +57 −16 Original line number Diff line number Diff line Loading @@ -98,8 +98,10 @@ static struct { jmethodID notifySwitch; jmethodID notifyInputChannelBroken; jmethodID notifyNoFocusedWindowAnr; jmethodID notifyConnectionUnresponsive; jmethodID notifyConnectionResponsive; jmethodID notifyWindowUnresponsive; jmethodID notifyWindowResponsive; jmethodID notifyMonitorUnresponsive; jmethodID notifyMonitorResponsive; jmethodID notifyFocusChanged; jmethodID notifySensorEvent; jmethodID notifySensorAccuracy; Loading Loading @@ -288,9 +290,13 @@ public: void notifySwitch(nsecs_t when, uint32_t switchValues, uint32_t switchMask, uint32_t policyFlags) override; void notifyConfigurationChanged(nsecs_t when) override; // ANR-related callbacks -- start void notifyNoFocusedWindowAnr(const std::shared_ptr<InputApplicationHandle>& handle) override; void notifyConnectionUnresponsive(const sp<IBinder>& token, const std::string& reason) override; void notifyConnectionResponsive(const sp<IBinder>& token) override; void notifyWindowUnresponsive(const sp<IBinder>& token, const std::string& reason) override; void notifyWindowResponsive(const sp<IBinder>& token) override; void notifyMonitorUnresponsive(int32_t pid, const std::string& reason) override; void notifyMonitorResponsive(int32_t pid) override; // ANR-related callbacks -- end void notifyInputChannelBroken(const sp<IBinder>& token) override; void notifyFocusChanged(const sp<IBinder>& oldToken, const sp<IBinder>& newToken) override; void notifySensorEvent(int32_t deviceId, InputDeviceSensorType sensorType, Loading Loading @@ -775,10 +781,10 @@ void NativeInputManager::notifyNoFocusedWindowAnr( checkAndClearExceptionFromCallback(env, "notifyNoFocusedWindowAnr"); } void NativeInputManager::notifyConnectionUnresponsive(const sp<IBinder>& token, void NativeInputManager::notifyWindowUnresponsive(const sp<IBinder>& token, const std::string& reason) { #if DEBUG_INPUT_DISPATCHER_POLICY ALOGD("notifyConnectionUnresponsive"); ALOGD("notifyWindowUnresponsive"); #endif ATRACE_CALL(); Loading @@ -788,14 +794,14 @@ void NativeInputManager::notifyConnectionUnresponsive(const sp<IBinder>& token, jobject tokenObj = javaObjectForIBinder(env, token); ScopedLocalRef<jstring> reasonObj(env, env->NewStringUTF(reason.c_str())); env->CallVoidMethod(mServiceObj, gServiceClassInfo.notifyConnectionUnresponsive, tokenObj, env->CallVoidMethod(mServiceObj, gServiceClassInfo.notifyWindowUnresponsive, tokenObj, reasonObj.get()); checkAndClearExceptionFromCallback(env, "notifyConnectionUnresponsive"); checkAndClearExceptionFromCallback(env, "notifyWindowUnresponsive"); } void NativeInputManager::notifyConnectionResponsive(const sp<IBinder>& token) { void NativeInputManager::notifyWindowResponsive(const sp<IBinder>& token) { #if DEBUG_INPUT_DISPATCHER_POLICY ALOGD("notifyConnectionResponsive"); ALOGD("notifyWindowResponsive"); #endif ATRACE_CALL(); Loading @@ -804,8 +810,37 @@ void NativeInputManager::notifyConnectionResponsive(const sp<IBinder>& token) { jobject tokenObj = javaObjectForIBinder(env, token); env->CallVoidMethod(mServiceObj, gServiceClassInfo.notifyConnectionResponsive, tokenObj); checkAndClearExceptionFromCallback(env, "notifyConnectionResponsive"); env->CallVoidMethod(mServiceObj, gServiceClassInfo.notifyWindowResponsive, tokenObj); checkAndClearExceptionFromCallback(env, "notifyWindowResponsive"); } void NativeInputManager::notifyMonitorUnresponsive(int32_t pid, const std::string& reason) { #if DEBUG_INPUT_DISPATCHER_POLICY ALOGD("notifyMonitorUnresponsive"); #endif ATRACE_CALL(); JNIEnv* env = jniEnv(); ScopedLocalFrame localFrame(env); ScopedLocalRef<jstring> reasonObj(env, env->NewStringUTF(reason.c_str())); env->CallVoidMethod(mServiceObj, gServiceClassInfo.notifyMonitorUnresponsive, pid, reasonObj.get()); checkAndClearExceptionFromCallback(env, "notifyMonitorUnresponsive"); } void NativeInputManager::notifyMonitorResponsive(int32_t pid) { #if DEBUG_INPUT_DISPATCHER_POLICY ALOGD("notifyMonitorResponsive"); #endif ATRACE_CALL(); JNIEnv* env = jniEnv(); ScopedLocalFrame localFrame(env); env->CallVoidMethod(mServiceObj, gServiceClassInfo.notifyMonitorResponsive, pid); checkAndClearExceptionFromCallback(env, "notifyMonitorResponsive"); } void NativeInputManager::notifyInputChannelBroken(const sp<IBinder>& token) { Loading Loading @@ -2202,12 +2237,18 @@ int register_android_server_InputManager(JNIEnv* env) { GET_METHOD_ID(gServiceClassInfo.notifyNoFocusedWindowAnr, clazz, "notifyNoFocusedWindowAnr", "(Landroid/view/InputApplicationHandle;)V"); GET_METHOD_ID(gServiceClassInfo.notifyConnectionUnresponsive, clazz, "notifyConnectionUnresponsive", "(Landroid/os/IBinder;Ljava/lang/String;)V"); GET_METHOD_ID(gServiceClassInfo.notifyWindowUnresponsive, clazz, "notifyWindowUnresponsive", "(Landroid/os/IBinder;Ljava/lang/String;)V"); GET_METHOD_ID(gServiceClassInfo.notifyConnectionResponsive, clazz, "notifyConnectionResponsive", GET_METHOD_ID(gServiceClassInfo.notifyMonitorUnresponsive, clazz, "notifyMonitorUnresponsive", "(ILjava/lang/String;)V"); GET_METHOD_ID(gServiceClassInfo.notifyWindowResponsive, clazz, "notifyWindowResponsive", "(Landroid/os/IBinder;)V"); GET_METHOD_ID(gServiceClassInfo.notifyMonitorResponsive, clazz, "notifyMonitorResponsive", "(I)V"); GET_METHOD_ID(gServiceClassInfo.filterInputEvent, clazz, "filterInputEvent", "(Landroid/view/InputEvent;I)Z"); Loading