OSDN Git Service

Fine-tune the condition to hide IME switcher
authorYohei Yukawa <yukawa@google.com>
Mon, 31 Jul 2017 22:37:14 +0000 (15:37 -0700)
committerYohei Yukawa <yukawa@google.com>
Mon, 31 Jul 2017 22:37:14 +0000 (15:37 -0700)
This is a follow up CL to a previous CL [1] that aimed to avoid
redundant IME switcher icon/notification on the keyguard, which already
has a keyboard icon to show IME switcher.

What the previous attempt overlooked is that when some other window is
shown over the keyguard and accepting text input, then we instead may
want to show the IME switcher icon/notification in the system UI level
because such a window may or may not have the icon to show IME
switcher.

This CL addresses above case by checking whether the keyguard is also
occluded or not.  Bug 64224022 is also filed to find any other better
solution to stop relying on the keyguard visibility.

 [1]: Ibee9123f4a520e77f4baf8bdd3d75364ab451100
      2c93efc9eb188532472edc9e0c3e1ab8121aa20d

Test: Manually done as follows
      1. Enable multiple IMEs
      2. Set a password to lockscreen
      3. Lock screen
      4. Make sure that IME switcher UI is not shown when typing
         password on the keyguard (Bug 5858903 is still fixed)
      5. Show any window that has EditText over the keyguard
      6. Focus in to that EditText
      7. Make sure that IME switcher UI is shown
Fixes: 63585213
Change-Id: I2ae7fc7676e5b64d8910dbc6833d3042e8d2329a

services/core/java/com/android/server/InputMethodManagerService.java

index bff39b3..192fa3a 100644 (file)
@@ -2088,7 +2088,8 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
     private boolean shouldShowImeSwitcherLocked(int visibility) {
         if (!mShowOngoingImeSwitcherForPhones) return false;
         if (mSwitchingDialog != null) return false;
-        if (isScreenLocked()) return false;
+        if (mWindowManagerInternal.isKeyguardShowingAndNotOccluded()
+                && mKeyguardManager != null && mKeyguardManager.isKeyguardSecure()) return false;
         if ((visibility & InputMethodService.IME_ACTIVE) == 0) return false;
         if (mWindowManagerInternal.isHardKeyboardAvailable()) {
             if (mHardKeyboardBehavior == HardKeyboardBehavior.WIRELESS_AFFORDANCE) {