Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 75a4e742 authored by Ming-Shin Lu's avatar Ming-Shin Lu
Browse files

Update IME window status when KeyguardController#setKeyguardShown

As in IMMS#handleSetInteractive handles the IME icon status (e.g.
Back-key arror or IME picker icon on navigation bar) when the
interactive changed and setting IME icon as invisible when the
keyguard is not the IME client and in shown state.

However, the keyguard state is independent of the screen going
non-interactive and the transition to locked can happen much later
(e.g.the brief flow will be starting from triggering dream service
to notify KeyguardService to update keyguard shown state to WM side),
or even never depens on user settings.

Add InputMethodManagerInternal#setImeWindowState for KeyguardController
to update IME icon status directly to fix the timing issue that
in IMMS side expects to set IME icon as IME_INVISIBLE when
KeyguardManager#isKeyguardLocked is true but sometimes may
return false and still see the IME icon is visible even the
Lockscreen is shown.

Bug: 185763794
Test: manual as below steps
    0) setup PIN lock for the device
    1) launch an app (e.g. Messaging) and show IME
    2) turn-off the screen and then turn-on quickly
    3) verify if the IME icon is invisible when the keyguard shown
Change-Id: Ic12baae9fd7886d2d96a049c8067a79360088549
parent 9dea87c0
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -124,6 +124,11 @@ public abstract class InputMethodManagerInternal {
     */
    public abstract void removeImeSurface();

    /**
     * Updates the IME visibility, back disposition and show IME picker status for SystemUI.
     */
    public abstract void updateImeWindowStatus();

    /**
     * Fake implementation of {@link InputMethodManagerInternal}.  All the methods do nothing.
     */
@@ -175,6 +180,10 @@ public abstract class InputMethodManagerInternal {
                @Override
                public void removeImeSurface() {
                }

                @Override
                public void updateImeWindowStatus() {
                }
            };

    /**
+19 −0
Original line number Diff line number Diff line
@@ -248,6 +248,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
    static final int MSG_CREATE_SESSION = 1050;
    static final int MSG_REMOVE_IME_SURFACE = 1060;
    static final int MSG_REMOVE_IME_SURFACE_FROM_WINDOW = 1061;
    static final int MSG_UPDATE_IME_WINDOW_STATUS = 1070;

    static final int MSG_START_INPUT = 2000;

@@ -2940,6 +2941,12 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
        }
    }

    private void updateImeWindowStatus() {
        synchronized (mMethodMap) {
            updateSystemUiLocked();
        }
    }

    void updateSystemUiLocked() {
        updateSystemUiLocked(mImeWindowVis, mBackDisposition);
    }
@@ -4537,6 +4544,12 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
                }
                return true;
            }
            case MSG_UPDATE_IME_WINDOW_STATUS: {
                synchronized (mMethodMap) {
                    updateSystemUiLocked();
                }
                return true;
            }
            // ---------------------------------------------------------

            case MSG_START_INPUT: {
@@ -5202,6 +5215,12 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
        public void removeImeSurface() {
            mService.mHandler.sendMessage(mService.mHandler.obtainMessage(MSG_REMOVE_IME_SURFACE));
        }

        @Override
        public void updateImeWindowStatus() {
            mService.mHandler.sendMessage(
                    mService.mHandler.obtainMessage(MSG_UPDATE_IME_WINDOW_STATUS));
        }
    }

    @BinderThread
+4 −0
Original line number Diff line number Diff line
@@ -241,6 +241,10 @@ public final class MultiClientInputMethodManagerService {
                        public void removeImeSurface() {
                            reportNotSupported();
                        }

                        @Override
                        public void updateImeWindowStatus() {
                        }
                    });
        }

+2 −0
Original line number Diff line number Diff line
@@ -50,6 +50,7 @@ import android.util.SparseArray;
import android.util.proto.ProtoOutputStream;

import com.android.internal.policy.IKeyguardDismissCallback;
import com.android.server.inputmethod.InputMethodManagerInternal;
import com.android.server.policy.WindowManagerPolicy;

import java.io.PrintWriter;
@@ -191,6 +192,7 @@ class KeyguardController {
        // state when evaluating visibilities.
        updateKeyguardSleepToken();
        mRootWindowContainer.ensureActivitiesVisible(null, 0, !PRESERVE_WINDOWS);
        InputMethodManagerInternal.get().updateImeWindowStatus();
    }

    /**