diff options
3 files changed, 25 insertions, 45 deletions
diff --git a/services/core/java/com/android/server/wm/InputMonitor.java b/services/core/java/com/android/server/wm/InputMonitor.java index 8389dbde3e14..2ce333d5438b 100644 --- a/services/core/java/com/android/server/wm/InputMonitor.java +++ b/services/core/java/com/android/server/wm/InputMonitor.java @@ -64,7 +64,10 @@ import android.view.SurfaceControl; import android.view.WindowManager; import com.android.internal.annotations.VisibleForTesting; +import com.android.internal.inputmethod.SoftInputShowHideReason; import com.android.internal.protolog.common.ProtoLog; +import com.android.server.LocalServices; +import com.android.server.inputmethod.InputMethodManagerInternal; import java.io.PrintWriter; import java.lang.ref.WeakReference; @@ -405,8 +408,28 @@ final class InputMonitor { // Shell transitions doesn't use RecentsAnimationController || getWeak(mActiveRecentsActivity) != null && focus.inTransition(); if (shouldApplyRecentsInputConsumer) { - requestFocus(recentsAnimationInputConsumer.mWindowHandle.token, - recentsAnimationInputConsumer.mName); + if (mInputFocus != recentsAnimationInputConsumer.mWindowHandle.token) { + requestFocus(recentsAnimationInputConsumer.mWindowHandle.token, + recentsAnimationInputConsumer.mName); + // Hiding IME/IME icon when recents input consumer gain focus. + if (!mDisplayContent.isImeAttachedToApp()) { + // Hiding IME if IME window is not attached to app since it's not proper to + // snapshot Task with IME window to animate together in this case. + final InputMethodManagerInternal inputMethodManagerInternal = + LocalServices.getService(InputMethodManagerInternal.class); + if (inputMethodManagerInternal != null) { + inputMethodManagerInternal.hideCurrentInputMethod( + SoftInputShowHideReason.HIDE_RECENTS_ANIMATION); + } + } else { + // Disable IME icon explicitly when IME attached to the app in case + // IME icon might flickering while swiping to the next app task still + // in animating before the next app window focused, or IME icon + // persists on the bottom when swiping the task to recents. + InputMethodManagerInternal.get().updateImeWindowStatus( + true /* disableImeIcon */); + } + } return; } } diff --git a/services/core/java/com/android/server/wm/RecentsAnimationController.java b/services/core/java/com/android/server/wm/RecentsAnimationController.java index e8a63d453004..08bf7bca93c4 100644 --- a/services/core/java/com/android/server/wm/RecentsAnimationController.java +++ b/services/core/java/com/android/server/wm/RecentsAnimationController.java @@ -70,7 +70,6 @@ import android.window.PictureInPictureSurfaceTransaction; import android.window.TaskSnapshot; import com.android.internal.annotations.VisibleForTesting; -import com.android.internal.inputmethod.SoftInputShowHideReason; import com.android.internal.protolog.common.ProtoLog; import com.android.internal.util.function.pooled.PooledConsumer; import com.android.internal.util.function.pooled.PooledLambda; @@ -326,26 +325,6 @@ public class RecentsAnimationController implements DeathRecipient { } } InputMethodManagerInternal.get().maybeFinishStylusHandwriting(); - if (!behindSystemBars) { - // Hiding IME if IME window is not attached to app. - // Since some windowing mode is not proper to snapshot Task with IME window - // while the app transitioning to the next task (e.g. split-screen mode) - if (!mDisplayContent.isImeAttachedToApp()) { - final InputMethodManagerInternal inputMethodManagerInternal = - LocalServices.getService(InputMethodManagerInternal.class); - if (inputMethodManagerInternal != null) { - inputMethodManagerInternal.hideCurrentInputMethod( - SoftInputShowHideReason.HIDE_RECENTS_ANIMATION); - } - } else { - // Disable IME icon explicitly when IME attached to the app in case - // IME icon might flickering while swiping to the next app task still - // in animating before the next app window focused, or IME icon - // persists on the bottom when swiping the task to recents. - InputMethodManagerInternal.get().updateImeWindowStatus( - true /* disableImeIcon */); - } - } mService.mWindowPlacerLocked.requestTraversal(); } } finally { diff --git a/services/core/java/com/android/server/wm/Transition.java b/services/core/java/com/android/server/wm/Transition.java index 5ad5a55bf6db..91f69a55d400 100644 --- a/services/core/java/com/android/server/wm/Transition.java +++ b/services/core/java/com/android/server/wm/Transition.java @@ -85,11 +85,9 @@ import android.window.TransitionInfo; import com.android.internal.annotations.VisibleForTesting; import com.android.internal.graphics.ColorUtils; -import com.android.internal.inputmethod.SoftInputShowHideReason; import com.android.internal.protolog.ProtoLogGroup; import com.android.internal.protolog.common.ProtoLog; import com.android.internal.util.function.pooled.PooledLambda; -import com.android.server.LocalServices; import com.android.server.inputmethod.InputMethodManagerInternal; import java.lang.annotation.Retention; @@ -959,26 +957,6 @@ class Transition extends Binder implements BLASTSyncEngine.TransactionReadyListe } } - // Hiding IME/IME icon when starting quick-step with resents animation. - if (!mTargetDisplays.get(mRecentsDisplayId).isImeAttachedToApp()) { - // Hiding IME if IME window is not attached to app. - // Since some windowing mode is not proper to snapshot Task with IME window - // while the app transitioning to the next task (e.g. split-screen mode) - final InputMethodManagerInternal inputMethodManagerInternal = - LocalServices.getService(InputMethodManagerInternal.class); - if (inputMethodManagerInternal != null) { - inputMethodManagerInternal.hideCurrentInputMethod( - SoftInputShowHideReason.HIDE_RECENTS_ANIMATION); - } - } else { - // Disable IME icon explicitly when IME attached to the app in case - // IME icon might flickering while swiping to the next app task still - // in animating before the next app window focused, or IME icon - // persists on the bottom when swiping the task to recents. - InputMethodManagerInternal.get().updateImeWindowStatus( - true /* disableImeIcon */); - } - // The rest of this function handles nav-bar reparenting if (!dc.getDisplayPolicy().shouldAttachNavBarToAppDuringTransition() |