Fixed IBinder cast to IWindow for mFocusedWindow (1/3)
Use the correct cast from IBinder to IWindow
Bug: 121122996
Test: mFocusedWindow no longer remains null
Change-Id: Ia208e129a8cce960620c5edd42f55af0d89914fc
diff --git a/services/core/java/com/android/server/input/InputManagerService.java b/services/core/java/com/android/server/input/InputManagerService.java
index 8810d1d..45a9bc0 100644
--- a/services/core/java/com/android/server/input/InputManagerService.java
+++ b/services/core/java/com/android/server/input/InputManagerService.java
@@ -1761,14 +1761,13 @@
// Native callback
private void notifyFocusChanged(IBinder token) {
- if (mFocusedWindow != token) {
- if (mFocusedWindowHasCapture) {
- setPointerCapture(false);
- }
- if (token instanceof IWindow) {
- mFocusedWindow = (IWindow) token;
- }
+ if (mFocusedWindow.asBinder() == token) {
+ Log.w(TAG, "notifyFocusChanged called with unchanged mFocusedWindow=" + mFocusedWindow);
+ return;
}
+
+ setPointerCapture(false);
+ mFocusedWindow = IWindow.Stub.asInterface(token);
}
// Native callback.