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

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

Fix a redundant assignRelativeLayerForIme case

Somehow in FlickerTest#CloseAppBackButtonTest
with enabling shell-transition flag will see a weird case is that first
launcher be set relativeZ to above IME container during closing the IME
actiivty, which is understandable since home activity is not IME target
during transient launch,

but soonly in assignRelativeLayerForIme will
set IME container's relativeZ to be above launcher after recents
animation finish.

This action will confuse SurfaceFlinger side while invoking
Layer::isHiddenByPolicy() to traverse all layers using relativeZ and
cause stack-overflow due to circulated relativeZ relationship in between
launcher and IME container.

As we don't need to set relative layer if the IME target in non-multi-window
mode is the activity main window since updateImeParent will ensure the IME
surface be attached on the fullscreen activity.

Add a check in assignRelativeLayerForIme to not set RelativeZ if
the IME target is the full screen activity, to break out circulated
RelativeZ in between ImeContainer & Launcher window layer.

Fix: 219774897
Test: atest ZOrderingTest
Test: atest FlickerTests#CloseAppBackButtonTest --iterations 20

Change-Id: I5abff1980328dc47ee193429a76a5d39a8625899
parent 038fd80c
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -5009,6 +5009,10 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
            final boolean canImeTargetSetRelativeLayer = imeTarget.getSurfaceControl() != null
                    && imeTarget.mToken == imeControlTargetToken
                    && !imeTarget.inMultiWindowMode()
                    // We don't need to set relative layer if the IME target in non-multi-window
                    // mode is the activity main window since updateImeParent will ensure the IME
                    // surface be attached on the fullscreen activity.
                    && imeTarget.mAttrs.type != TYPE_BASE_APPLICATION
                    && imeTarget.mToken.getActivity(app -> app.isAnimating(TRANSITION | PARENTS,
                            ANIMATION_TYPE_ALL & ~ANIMATION_TYPE_RECENTS)) == null;
            if (canImeTargetSetRelativeLayer) {
+2 −1
Original line number Diff line number Diff line
@@ -293,7 +293,8 @@ public class ZOrderingTests extends WindowTestsBase {
    public void testAssignWindowLayers_ForImeWithAppTargetAndAppAbove() {
        final WindowState appBelowImeTarget = createWindow("appBelowImeTarget");
        final WindowState imeAppTarget = createWindow("imeAppTarget");
        final WindowState appAboveImeTarget = createWindow("appAboveImeTarget");
        final WindowState appAboveImeTarget = createWindow(imeAppTarget, TYPE_APPLICATION,
                "appAboveImeTarget");

        mDisplayContent.setImeLayeringTarget(imeAppTarget);
        mDisplayContent.setImeControlTarget(imeAppTarget);