diff options
| author | 2019-01-11 22:48:47 +0000 | |
|---|---|---|
| committer | 2019-01-11 22:48:47 +0000 | |
| commit | 094be7fbf1457aa543f20a05e7a2ab33bc96bd2c (patch) | |
| tree | 4321d4f465b2c6bdc8f0c2965907ee5d34024285 | |
| parent | 56ac01ebb4475440669f5f009c453dba0a86f6dd (diff) | |
| parent | 91089864b915861e02eade7c374ad441e3673f7c (diff) | |
Merge "Added last focused window to notifyFocusChanged callback (2/3)"
| -rw-r--r-- | services/core/java/com/android/server/input/InputManagerService.java | 6 | ||||
| -rw-r--r-- | services/core/jni/com_android_server_input_InputManagerService.cpp | 18 |
2 files changed, 12 insertions, 12 deletions
diff --git a/services/core/java/com/android/server/input/InputManagerService.java b/services/core/java/com/android/server/input/InputManagerService.java index 45a9bc01223c..df28f30d9127 100644 --- a/services/core/java/com/android/server/input/InputManagerService.java +++ b/services/core/java/com/android/server/input/InputManagerService.java @@ -1760,14 +1760,14 @@ public class InputManagerService extends IInputManager.Stub } // Native callback - private void notifyFocusChanged(IBinder token) { - if (mFocusedWindow.asBinder() == token) { + private void notifyFocusChanged(IBinder oldToken, IBinder newToken) { + if (mFocusedWindow.asBinder() == newToken) { Log.w(TAG, "notifyFocusChanged called with unchanged mFocusedWindow=" + mFocusedWindow); return; } setPointerCapture(false); - mFocusedWindow = IWindow.Stub.asInterface(token); + mFocusedWindow = IWindow.Stub.asInterface(newToken); } // Native callback. diff --git a/services/core/jni/com_android_server_input_InputManagerService.cpp b/services/core/jni/com_android_server_input_InputManagerService.cpp index 6f105ec90836..641200769cf0 100644 --- a/services/core/jni/com_android_server_input_InputManagerService.cpp +++ b/services/core/jni/com_android_server_input_InputManagerService.cpp @@ -244,7 +244,7 @@ public: const sp<IBinder>& token, const std::string& reason); virtual void notifyInputChannelBroken(const sp<IBinder>& token); - virtual void notifyFocusChanged(const sp<IBinder>& token); + virtual void notifyFocusChanged(const sp<IBinder>& oldToken, const sp<IBinder>& newToken); virtual bool filterInputEvent(const InputEvent* inputEvent, uint32_t policyFlags); virtual void getDispatcherConfiguration(InputDispatcherConfiguration* outConfig); virtual void interceptKeyBeforeQueueing(const KeyEvent* keyEvent, uint32_t& policyFlags); @@ -738,7 +738,8 @@ void NativeInputManager::notifyInputChannelBroken(const sp<IBinder>& token) { } } -void NativeInputManager::notifyFocusChanged(const sp<IBinder>& token) { +void NativeInputManager::notifyFocusChanged(const sp<IBinder>& oldToken, + const sp<IBinder>& newToken) { #if DEBUG_INPUT_DISPATCHER_POLICY ALOGD("notifyFocusChanged"); #endif @@ -746,12 +747,11 @@ void NativeInputManager::notifyFocusChanged(const sp<IBinder>& token) { JNIEnv* env = jniEnv(); - jobject tokenObj = javaObjectForIBinder(env, token); - if (tokenObj) { - env->CallVoidMethod(mServiceObj, gServiceClassInfo.notifyFocusChanged, - tokenObj); - checkAndClearExceptionFromCallback(env, "notifyFocusChanged"); - } + jobject oldTokenObj = javaObjectForIBinder(env, oldToken); + jobject newTokenObj = javaObjectForIBinder(env, newToken); + env->CallVoidMethod(mServiceObj, gServiceClassInfo.notifyFocusChanged, + oldTokenObj, newTokenObj); + checkAndClearExceptionFromCallback(env, "notifyFocusChanged"); } void NativeInputManager::getDispatcherConfiguration(InputDispatcherConfiguration* outConfig) { @@ -1762,7 +1762,7 @@ int register_android_server_InputManager(JNIEnv* env) { "notifyInputChannelBroken", "(Landroid/os/IBinder;)V"); GET_METHOD_ID(gServiceClassInfo.notifyFocusChanged, clazz, - "notifyFocusChanged", "(Landroid/os/IBinder;)V"); + "notifyFocusChanged", "(Landroid/os/IBinder;Landroid/os/IBinder;)V"); GET_METHOD_ID(gServiceClassInfo.notifyANR, clazz, "notifyANR", |