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

Commit b54270fb authored by Evan Rosky's avatar Evan Rosky
Browse files

Don't hide IME windows in transition player

IME windows, like wallpaper windows, have their visibilities
managed outside of the transition system. This means that
altering their visibilities can get us stuck in situations
that can't be undone. So, like wallpaper, just check and
skip explicit visibility changes on IME windows.

Bug: 230733128
Test: messages in portrait, open ime, swipe to home, open
      messages in landscape, swipe home, open messages in
      portrait again (ime should be visible).
Change-Id: I0df284cce19f367003570a4e882dd6ffbc8dbef6
parent 03ffb3ba
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -107,8 +107,11 @@ public final class TransitionInfo implements Parcelable {
     */
    public static final int FLAG_DISPLAY_HAS_ALERT_WINDOWS = 1 << 7;

    /** The container is an input-method window. */
    public static final int FLAG_IS_INPUT_METHOD = 1 << 8;

    /** The first unused bit. This can be used by remotes to attach custom flags to this change. */
    public static final int FLAG_FIRST_CUSTOM = 1 << 8;
    public static final int FLAG_FIRST_CUSTOM = 1 << 9;

    /** @hide */
    @IntDef(prefix = { "FLAG_" }, value = {
@@ -121,6 +124,7 @@ public final class TransitionInfo implements Parcelable {
            FLAG_IS_DISPLAY,
            FLAG_OCCLUDES_KEYGUARD,
            FLAG_DISPLAY_HAS_ALERT_WINDOWS,
            FLAG_IS_INPUT_METHOD,
            FLAG_FIRST_CUSTOM
    })
    public @interface ChangeFlags {}
@@ -300,6 +304,9 @@ public final class TransitionInfo implements Parcelable {
        if ((flags & FLAG_IS_WALLPAPER) != 0) {
            sb.append("IS_WALLPAPER");
        }
        if ((flags & FLAG_IS_INPUT_METHOD) != 0) {
            sb.append("IS_INPUT_METHOD");
        }
        if ((flags & FLAG_TRANSLUCENT) != 0) {
            sb.append((sb.length() == 0 ? "" : "|") + "TRANSLUCENT");
        }
+9 −6
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@ import static android.view.WindowManager.TRANSIT_KEYGUARD_GOING_AWAY;
import static android.view.WindowManager.TRANSIT_OPEN;
import static android.view.WindowManager.TRANSIT_TO_BACK;
import static android.view.WindowManager.TRANSIT_TO_FRONT;
import static android.window.TransitionInfo.FLAG_IS_INPUT_METHOD;
import static android.window.TransitionInfo.FLAG_IS_WALLPAPER;
import static android.window.TransitionInfo.FLAG_STARTING_WINDOW_TRANSFER_RECIPIENT;

@@ -287,12 +288,14 @@ public class Transitions implements RemoteCallable<Transitions> {
                    finishT.setAlpha(leash, 1.f);
                }
            } else if (mode == TRANSIT_CLOSE || mode == TRANSIT_TO_BACK) {
                // Wallpaper is a bit of an anomaly: it's visibility is tied to other WindowStates.
                // As a result, we actually can't hide it's WindowToken because there may not be a
                // transition associated with it becoming visible again. Fortunately, since it is
                // always z-ordered to the back, we don't have to worry about it flickering to the
                // front during reparenting, so the hide here isn't necessary for it.
                if ((change.getFlags() & FLAG_IS_WALLPAPER) == 0) {
                // Wallpaper/IME are anomalies: their visibility is tied to other WindowStates.
                // As a result, we actually can't hide their WindowTokens because there may not be a
                // transition associated with them becoming visible again. Fortunately, since
                // wallpapers are always z-ordered to the back, we don't have to worry about it
                // flickering to the front during reparenting. Similarly, the IME is reparented to
                // the associated app, so its visibility is coupled. So, an explicit hide is not
                // needed visually anyways.
                if ((change.getFlags() & (FLAG_IS_WALLPAPER | FLAG_IS_INPUT_METHOD)) == 0) {
                    finishT.hide(leash);
                }
            }
+9 −0
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@ import static android.view.WindowManager.INPUT_CONSUMER_RECENTS_ANIMATION;
import static android.view.WindowManager.LayoutParams.ROTATION_ANIMATION_SEAMLESS;
import static android.view.WindowManager.LayoutParams.ROTATION_ANIMATION_UNSPECIFIED;
import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_STARTING;
import static android.view.WindowManager.LayoutParams.TYPE_INPUT_METHOD;
import static android.view.WindowManager.TRANSIT_CHANGE;
import static android.view.WindowManager.TRANSIT_CLOSE;
import static android.view.WindowManager.TRANSIT_FLAG_IS_RECENTS;
@@ -45,6 +46,7 @@ import static android.view.WindowManager.TransitionType;
import static android.view.WindowManager.transitTypeToString;
import static android.window.TransitionInfo.FLAG_DISPLAY_HAS_ALERT_WINDOWS;
import static android.window.TransitionInfo.FLAG_IS_DISPLAY;
import static android.window.TransitionInfo.FLAG_IS_INPUT_METHOD;
import static android.window.TransitionInfo.FLAG_IS_VOICE_INTERACTION;
import static android.window.TransitionInfo.FLAG_IS_WALLPAPER;
import static android.window.TransitionInfo.FLAG_OCCLUDES_KEYGUARD;
@@ -1025,6 +1027,10 @@ class Transition extends Binder implements BLASTSyncEngine.TransactionReadyListe
        return wc.asWallpaperToken() != null;
    }

    private static boolean isInputMethod(WindowContainer wc) {
        return wc.getWindowType() == TYPE_INPUT_METHOD;
    }

    private static boolean occludesKeyguard(WindowContainer wc) {
        final ActivityRecord ar = wc.asActivityRecord();
        if (ar != null) {
@@ -1614,6 +1620,9 @@ class Transition extends Binder implements BLASTSyncEngine.TransactionReadyListe
            if (isWallpaper(wc)) {
                flags |= FLAG_IS_WALLPAPER;
            }
            if (isInputMethod(wc)) {
                flags |= FLAG_IS_INPUT_METHOD;
            }
            if (occludesKeyguard(wc)) {
                flags |= FLAG_OCCLUDES_KEYGUARD;
            }