OSDN Git Service

Propagate setImeWindowStatus() to WMS
authorYohei Yukawa <yukawa@google.com>
Mon, 13 Feb 2017 20:04:50 +0000 (12:04 -0800)
committerYohei Yukawa <yukawa@google.com>
Mon, 13 Feb 2017 20:04:50 +0000 (12:04 -0800)
setImeWindowStatus() introduced in the previous CL [1] can help
WindowManagerService (WMS) address Bug 34628091.  As a preparation
this CL has InputMethodManagerService propagate relevant information
to WMS WMS for later use.

 [1]: I9921b381e02106dbffff5e0b3d13f0a1245ce807
      db2afde0e584904ee4ce115ce176a4dfe1773990

Test: Verified the callback in WindowManagerService as follows:
       1. Rebuild the system with DEBUG_INPUT_METHOD=true
       2. adb logcat -s WindowManager:*
            to make sure the visibility passed to
            WindowManagerService#updateInputMethodWindowStatus matches
            to the actual IME window visibility
Bug: 34628091
Bug: 35079353
Change-Id: I54fb1faf513883a54293a756e4c9d2ae9453d778

core/java/android/view/WindowManagerInternal.java
services/core/java/com/android/server/InputMethodManagerService.java
services/core/java/com/android/server/wm/WindowManagerService.java

index 6e2a92c..7a5e670 100644 (file)
@@ -282,6 +282,25 @@ public abstract class WindowManagerInternal {
     public abstract void clearLastInputMethodWindowForTransition();
 
     /**
+     * Notifies WindowManagerService that the current IME window status is being changed.
+     *
+     * <p>Only {@link com.android.server.InputMethodManagerService} is the expected and tested
+     * caller of this method.</p>
+     *
+     * @param imeToken token to track the active input method. Corresponding IME windows can be
+     *                 identified by checking {@link android.view.WindowManager.LayoutParams#token}.
+     *                 Note that there is no guarantee that the corresponding window is already
+     *                 created
+     * @param imeWindowVisible whether the active IME thinks that its window should be visible or
+     *                         hidden, no matter how WindowManagerService will react / has reacted
+     *                         to corresponding API calls.  Note that this state is not guaranteed
+     *                         to be synchronized with state in WindowManagerService.
+     * @param targetWindowToken token to identify the target window that the IME is associated with.
+     */
+    public abstract void updateInputMethodWindowStatus(IBinder imeToken, boolean imeWindowVisible,
+            IBinder targetWindowToken);
+
+    /**
       * Returns true when the hardware keyboard is available.
       */
     public abstract boolean isHardKeyboardAvailable();
index b6a0e5c..1dadcf5 100644 (file)
@@ -1856,8 +1856,9 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
             return;
         }
 
+        final StartInputInfo info;
         synchronized (mMethodMap) {
-            final StartInputInfo info = mStartInputMap.get(startInputToken);
+            info = mStartInputMap.get(startInputToken);
             if (info == null) {
                 throw new InvalidParameterException("Unknown startInputToken=" + startInputToken);
             }
@@ -1865,6 +1866,8 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
             mBackDisposition = backDisposition;
             updateSystemUiLocked(token, vis, backDisposition);
         }
+        mWindowManagerInternal.updateInputMethodWindowStatus(info.mImeToken,
+                (vis & InputMethodService.IME_VISIBLE) != 0, info.mTargetWindow);
     }
 
     private void updateSystemUi(IBinder token, int vis, int backDisposition) {
index be0771a..150e456 100644 (file)
@@ -75,6 +75,7 @@ import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_CONFIGURATION
 import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_DRAG;
 import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_FOCUS;
 import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_FOCUS_LIGHT;
+import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_INPUT_METHOD;
 import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_KEEP_SCREEN_ON;
 import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_LAYOUT;
 import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_ORIENTATION;
@@ -7903,6 +7904,17 @@ public class WindowManagerService extends IWindowManager.Stub
         }
 
         @Override
+        public void updateInputMethodWindowStatus(IBinder imeToken, boolean imeWindowVisible,
+                IBinder targetWindowToken) {
+            // TODO (b/34628091): Use this method to address the window animation issue.
+            if (DEBUG_INPUT_METHOD) {
+                Slog.w(TAG_WM, "updateInputMethodWindowStatus: imeToken=" + imeToken
+                        + " imeWindowVisible=" + imeWindowVisible
+                        + " targetWindowToken=" + targetWindowToken);
+            }
+        }
+
+        @Override
         public boolean isHardKeyboardAvailable() {
             synchronized (mWindowMap) {
                 return mHardKeyboardAvailable;