diff options
4 files changed, 16 insertions, 9 deletions
diff --git a/core/java/android/view/InsetsSourceControl.java b/core/java/android/view/InsetsSourceControl.java index 78773529294a..acbd95bf6810 100644 --- a/core/java/android/view/InsetsSourceControl.java +++ b/core/java/android/view/InsetsSourceControl.java @@ -212,8 +212,7 @@ public class InsetsSourceControl implements Parcelable { && mInitiallyVisible == that.mInitiallyVisible && mSurfacePosition.equals(that.mSurfacePosition) && mInsetsHint.equals(that.mInsetsHint) - && mSkipAnimationOnce == that.mSkipAnimationOnce - && Objects.equals(mImeStatsToken, that.mImeStatsToken); + && mSkipAnimationOnce == that.mSkipAnimationOnce; } @Override diff --git a/services/core/java/com/android/server/wm/DisplayPolicy.java b/services/core/java/com/android/server/wm/DisplayPolicy.java index 8627a473a1ff..ee07d2e58389 100644 --- a/services/core/java/com/android/server/wm/DisplayPolicy.java +++ b/services/core/java/com/android/server/wm/DisplayPolicy.java @@ -1735,9 +1735,9 @@ public class DisplayPolicy { } // Show IME over the keyguard if the target allows it. - final boolean showImeOverKeyguard = imeTarget != null && imeTarget.isVisible() - && win.mIsImWindow && (imeTarget.canShowWhenLocked() - || !imeTarget.canBeHiddenByKeyguard()); + final boolean showImeOverKeyguard = + imeTarget != null && imeTarget.isOnScreen() && win.mIsImWindow && ( + imeTarget.canShowWhenLocked() || !imeTarget.canBeHiddenByKeyguard()); if (showImeOverKeyguard) { return false; } diff --git a/services/core/java/com/android/server/wm/ImeInsetsSourceProvider.java b/services/core/java/com/android/server/wm/ImeInsetsSourceProvider.java index e9c6e93891df..71adb80871b4 100644 --- a/services/core/java/com/android/server/wm/ImeInsetsSourceProvider.java +++ b/services/core/java/com/android/server/wm/ImeInsetsSourceProvider.java @@ -100,13 +100,13 @@ final class ImeInsetsSourceProvider extends InsetsSourceProvider { // isLeashReadyForDispatching (used to dispatch the leash of the control) is // depending on mGivenInsetsReady. Therefore, triggering notifyControlChanged here // again, so that the control with leash can be eventually dispatched - if (!mGivenInsetsReady && mServerVisible && !givenInsetsPending) { + if (!mGivenInsetsReady && isServerVisible() && !givenInsetsPending) { mGivenInsetsReady = true; ImeTracker.forLogging().onProgress(mStatsToken, ImeTracker.PHASE_WM_POST_LAYOUT_NOTIFY_CONTROLS_CHANGED); mStateController.notifyControlChanged(mControlTarget, this); setImeShowing(true); - } else if (wasServerVisible && mServerVisible && mGivenInsetsReady + } else if (wasServerVisible && isServerVisible() && mGivenInsetsReady && givenInsetsPending) { // If the server visibility didn't change (still visible), and mGivenInsetsReady // is set, we won't call into notifyControlChanged. Therefore, we can reset the @@ -114,7 +114,7 @@ final class ImeInsetsSourceProvider extends InsetsSourceProvider { ImeTracker.forLogging().onCancelled(mStatsToken, ImeTracker.PHASE_WM_POST_LAYOUT_NOTIFY_CONTROLS_CHANGED); mStatsToken = null; - } else if (wasServerVisible && !mServerVisible) { + } else if (wasServerVisible && !isServerVisible()) { setImeShowing(false); } } @@ -134,11 +134,15 @@ final class ImeInsetsSourceProvider extends InsetsSourceProvider { @Override protected boolean isLeashReadyForDispatching() { if (android.view.inputmethod.Flags.refactorInsetsController()) { + // We should only dispatch the leash, if the following conditions are fulfilled: + // 1. parent isLeashReadyForDispatching, 2. mGivenInsetsReady (means there are no + // givenInsetsPending), 3. the IME surface is drawn, 4. either the IME is + // serverVisible (the unfrozen state) final WindowState ws = mWindowContainer != null ? mWindowContainer.asWindowState() : null; final boolean isDrawn = ws != null && ws.isDrawn(); return super.isLeashReadyForDispatching() - && mServerVisible && isDrawn && mGivenInsetsReady; + && isServerVisible() && isDrawn && mGivenInsetsReady; } else { return super.isLeashReadyForDispatching(); } diff --git a/services/core/java/com/android/server/wm/InsetsSourceProvider.java b/services/core/java/com/android/server/wm/InsetsSourceProvider.java index 1d4d6eb82c44..7276007481ab 100644 --- a/services/core/java/com/android/server/wm/InsetsSourceProvider.java +++ b/services/core/java/com/android/server/wm/InsetsSourceProvider.java @@ -730,6 +730,10 @@ class InsetsSourceProvider { return mFakeControlTarget; } + boolean isServerVisible() { + return mServerVisible; + } + boolean isClientVisible() { return mClientVisible; } |