Fix not hiding soft-input when quick switch start

After Ia6722e1cb, soft-input hiding logic has been migrated to
setAnimationTargetsBehindSystemBars. However, Launcher invokes
setAnimationTargetsBehindSystemBars when the center most task changed
while in quick switch. Update to hide the soft-input when recents input
consumer gains focus.

Fix: 193990612
Test: enter split screen and verified quick-switch will hide soft-input
      immediately.
Change-Id: Ibfcd48e623336c4690b71c4db0ce1ad8f5b26fc9
This commit is contained in:
Jerry Chang
2022-07-14 02:19:06 +00:00
parent 367ff5a1d8
commit 22fa715662
3 changed files with 25 additions and 45 deletions

View File

@@ -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;
}
}

View File

@@ -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 {

View File

@@ -84,11 +84,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;
@@ -958,26 +956,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()