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

Commit ca84c998 authored by Riddle Hsu's avatar Riddle Hsu Committed by Android (Google) Code Review
Browse files

Merge "Do not skip IME in forAllWindows if its target is invisible" into main

parents 44acf2ef 0ff4ed6f
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -18,6 +18,16 @@ flag {
    }
}

flag {
    name: "do_not_skip_ime_by_target_visibility"
    namespace: "windowing_frontend"
    description: "Avoid window traversal missing IME"
    bug: "339375944"
    metadata {
        purpose: PURPOSE_BUGFIX
    }
}

flag {
    name: "apply_lifecycle_on_pip_change"
    namespace: "windowing_frontend"
+10 −8
Original line number Diff line number Diff line
@@ -4648,6 +4648,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
        if (!isImeLayeringTarget()) {
            return false;
        }
        if (!com.android.window.flags.Flags.doNotSkipImeByTargetVisibility()) {
            // Note that we don't process IME window if the IME input target is not on the screen.
            // In case some unexpected IME visibility cases happen like starting the remote
            // animation on the keyguard but seeing the IME window that originally on the app
@@ -4657,6 +4658,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
                    && !(imeInputTarget.isDrawn() || imeInputTarget.isVisibleRequested())) {
                return false;
            }
        }
        return mDisplayContent.forAllImeWindows(callback, traverseTopToBottom);
    }

+2 −0
Original line number Diff line number Diff line
@@ -747,6 +747,8 @@ public class RemoteAnimationControllerTest extends WindowTestsBase {
        }
    }

    @android.platform.test.annotations.RequiresFlagsDisabled(
            com.android.window.flags.Flags.FLAG_DO_NOT_SKIP_IME_BY_TARGET_VISIBILITY)
    @SetupWindows(addWindows = W_INPUT_METHOD)
    @Test
    public void testLaunchRemoteAnimationWithoutImeBehind() {
+21 −0
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@ import static android.view.WindowManager.LayoutParams.TYPE_BASE_APPLICATION;
import static com.android.dx.mockito.inline.extended.ExtendedMockito.mock;
import static com.android.dx.mockito.inline.extended.ExtendedMockito.verify;

import static org.junit.Assert.assertTrue;
import static org.mockito.Matchers.eq;

import android.platform.test.annotations.Presubmit;
@@ -60,4 +61,24 @@ public class WindowContainerTraversalTests extends WindowTestsBase {
        verify(c).accept(eq(mDockedDividerWindow));
        verify(c).accept(eq(mImeWindow));
    }

    @android.platform.test.annotations.RequiresFlagsEnabled(
            com.android.window.flags.Flags.FLAG_DO_NOT_SKIP_IME_BY_TARGET_VISIBILITY)
    @SetupWindows(addWindows = { W_ACTIVITY, W_INPUT_METHOD })
    @Test
    public void testTraverseImeRegardlessOfImeTarget() {
        mDisplayContent.setImeLayeringTarget(mAppWindow);
        mDisplayContent.setImeInputTarget(mAppWindow);
        mAppWindow.mHasSurface = false;
        mAppWindow.mActivityRecord.setVisibleRequested(false);
        mAppWindow.mActivityRecord.setVisible(false);

        final boolean[] foundIme = { false };
        mDisplayContent.forAllWindows(w -> {
            if (w == mImeWindow) {
                foundIme[0] = true;
            }
        }, true /* traverseTopToBottom */);
        assertTrue("IME must be found", foundIme[0]);
    }
}