Loading services/core/java/com/android/server/input/InputManagerService.java +10 −0 Original line number Diff line number Diff line Loading @@ -2089,6 +2089,16 @@ public class InputManagerService extends IInputManager.Stub } } // Native callback private void notifyUntrustedTouch(String packageName) { // TODO(b/169067926): Remove toast after gathering feedback on dogfood. DisplayThread.getHandler().post(() -> Toast.makeText(mContext, "Touch obscured by " + packageName + " will be blocked. Check go/s-untrusted-touches", Toast.LENGTH_SHORT).show()); } // Native callback. private long notifyANR(InputApplicationHandle inputApplicationHandle, IBinder token, String reason) { Loading services/core/jni/com_android_server_input_InputManagerService.cpp +16 −0 Original line number Diff line number Diff line Loading @@ -99,6 +99,7 @@ static struct { jmethodID notifyInputChannelBroken; jmethodID notifyANR; jmethodID notifyFocusChanged; jmethodID notifyUntrustedTouch; jmethodID filterInputEvent; jmethodID interceptKeyBeforeQueueing; jmethodID interceptMotionBeforeQueueingNonInteractive; Loading Loading @@ -256,6 +257,7 @@ public: const sp<IBinder>& token, const std::string& reason) override; void notifyInputChannelBroken(const sp<IBinder>& token) override; void notifyFocusChanged(const sp<IBinder>& oldToken, const sp<IBinder>& newToken) override; void notifyUntrustedTouch(const std::string& obscuringPackage) override; bool filterInputEvent(const InputEvent* inputEvent, uint32_t policyFlags) override; void getDispatcherConfiguration(InputDispatcherConfiguration* outConfig) override; void interceptKeyBeforeQueueing(const KeyEvent* keyEvent, uint32_t& policyFlags) override; Loading Loading @@ -755,6 +757,17 @@ void NativeInputManager::notifyInputChannelBroken(const sp<IBinder>& token) { } } void NativeInputManager::notifyUntrustedTouch(const std::string& obscuringPackage) { #if DEBUG_INPUT_DISPATCHER_POLICY ALOGD("notifyUntrustedTouch - obscuringPackage=%s", obscuringPackage.c_str()); #endif ATRACE_CALL(); JNIEnv* env = jniEnv(); jstring jPackage = env->NewStringUTF(obscuringPackage.c_str()); env->CallVoidMethod(mServiceObj, gServiceClassInfo.notifyUntrustedTouch, jPackage); checkAndClearExceptionFromCallback(env, "notifyUntrustedTouch"); } void NativeInputManager::notifyFocusChanged(const sp<IBinder>& oldToken, const sp<IBinder>& newToken) { #if DEBUG_INPUT_DISPATCHER_POLICY Loading Loading @@ -1893,6 +1906,9 @@ int register_android_server_InputManager(JNIEnv* env) { GET_METHOD_ID(gServiceClassInfo.notifyFocusChanged, clazz, "notifyFocusChanged", "(Landroid/os/IBinder;Landroid/os/IBinder;)V"); GET_METHOD_ID(gServiceClassInfo.notifyUntrustedTouch, clazz, "notifyUntrustedTouch", "(Ljava/lang/String;)V"); GET_METHOD_ID(gServiceClassInfo.notifyANR, clazz, "notifyANR", "(Landroid/view/InputApplicationHandle;Landroid/os/IBinder;Ljava/lang/String;)J"); Loading Loading
services/core/java/com/android/server/input/InputManagerService.java +10 −0 Original line number Diff line number Diff line Loading @@ -2089,6 +2089,16 @@ public class InputManagerService extends IInputManager.Stub } } // Native callback private void notifyUntrustedTouch(String packageName) { // TODO(b/169067926): Remove toast after gathering feedback on dogfood. DisplayThread.getHandler().post(() -> Toast.makeText(mContext, "Touch obscured by " + packageName + " will be blocked. Check go/s-untrusted-touches", Toast.LENGTH_SHORT).show()); } // Native callback. private long notifyANR(InputApplicationHandle inputApplicationHandle, IBinder token, String reason) { Loading
services/core/jni/com_android_server_input_InputManagerService.cpp +16 −0 Original line number Diff line number Diff line Loading @@ -99,6 +99,7 @@ static struct { jmethodID notifyInputChannelBroken; jmethodID notifyANR; jmethodID notifyFocusChanged; jmethodID notifyUntrustedTouch; jmethodID filterInputEvent; jmethodID interceptKeyBeforeQueueing; jmethodID interceptMotionBeforeQueueingNonInteractive; Loading Loading @@ -256,6 +257,7 @@ public: const sp<IBinder>& token, const std::string& reason) override; void notifyInputChannelBroken(const sp<IBinder>& token) override; void notifyFocusChanged(const sp<IBinder>& oldToken, const sp<IBinder>& newToken) override; void notifyUntrustedTouch(const std::string& obscuringPackage) override; bool filterInputEvent(const InputEvent* inputEvent, uint32_t policyFlags) override; void getDispatcherConfiguration(InputDispatcherConfiguration* outConfig) override; void interceptKeyBeforeQueueing(const KeyEvent* keyEvent, uint32_t& policyFlags) override; Loading Loading @@ -755,6 +757,17 @@ void NativeInputManager::notifyInputChannelBroken(const sp<IBinder>& token) { } } void NativeInputManager::notifyUntrustedTouch(const std::string& obscuringPackage) { #if DEBUG_INPUT_DISPATCHER_POLICY ALOGD("notifyUntrustedTouch - obscuringPackage=%s", obscuringPackage.c_str()); #endif ATRACE_CALL(); JNIEnv* env = jniEnv(); jstring jPackage = env->NewStringUTF(obscuringPackage.c_str()); env->CallVoidMethod(mServiceObj, gServiceClassInfo.notifyUntrustedTouch, jPackage); checkAndClearExceptionFromCallback(env, "notifyUntrustedTouch"); } void NativeInputManager::notifyFocusChanged(const sp<IBinder>& oldToken, const sp<IBinder>& newToken) { #if DEBUG_INPUT_DISPATCHER_POLICY Loading Loading @@ -1893,6 +1906,9 @@ int register_android_server_InputManager(JNIEnv* env) { GET_METHOD_ID(gServiceClassInfo.notifyFocusChanged, clazz, "notifyFocusChanged", "(Landroid/os/IBinder;Landroid/os/IBinder;)V"); GET_METHOD_ID(gServiceClassInfo.notifyUntrustedTouch, clazz, "notifyUntrustedTouch", "(Ljava/lang/String;)V"); GET_METHOD_ID(gServiceClassInfo.notifyANR, clazz, "notifyANR", "(Landroid/view/InputApplicationHandle;Landroid/os/IBinder;Ljava/lang/String;)J"); Loading