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

Commit 93baf238 authored by Android Build Coastguard Worker's avatar Android Build Coastguard Worker
Browse files

Snap for 8363780 from 2f448357 to sc-qpr3-release

Change-Id: I75f8df44d5fd0a795947c851a32f0ce72487b648
parents fd52ddd2 2f448357
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -835,7 +835,8 @@ class MediaCarouselController @Inject constructor(
                    uid,
                    interactedSubcardRank,
                    interactedSubcardCardinality,
                    receivedLatencyMillis
                    receivedLatencyMillis,
                    null // Media cards cannot have subcards.
            )
            /* ktlint-disable max-line-length */
            if (DEBUG) {
+5 −5
Original line number Diff line number Diff line
@@ -4193,17 +4193,17 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
     */
    @VisibleForTesting
    SurfaceControl computeImeParent() {
        if (mImeLayeringTarget != null && mImeInputTarget != null
                && mImeLayeringTarget.mActivityRecord != mImeInputTarget.mActivityRecord) {
            // Do not change parent if the window hasn't requested IME.
            return null;
        }
        // Attach it to app if the target is part of an app and such app is covering the entire
        // screen. If it's not covering the entire screen the IME might extend beyond the apps
        // bounds.
        if (shouldImeAttachedToApp()) {
            if (mImeLayeringTarget.mActivityRecord != mImeInputTarget.mActivityRecord) {
                // Do not change parent if the window hasn't requested IME.
                return null;
            }
            return mImeLayeringTarget.mActivityRecord.getSurfaceControl();
        }

        // Otherwise, we just attach it to where the display area policy put it.
        return mImeWindowsContainer.getParent() != null
                ? mImeWindowsContainer.getParent().getSurfaceControl() : null;
+4 −6
Original line number Diff line number Diff line
@@ -265,14 +265,12 @@ class InsetsPolicy {
                return state;
            }
        } else if (w.mActivityRecord != null && w.mActivityRecord.mImeInsetsFrozenUntilStartInput) {
            // During switching tasks with gestural navigation, if the IME is attached to
            // one app window on that time, even the next app window is behind the IME window,
            // conceptually the window should not receive the IME insets if the next window is
            // not eligible IME requester and ready to show IME on top of it.
            final boolean shouldImeAttachedToApp = mDisplayContent.shouldImeAttachedToApp();
            // During switching tasks with gestural navigation, before the next IME input target
            // starts the input, we should adjust and freeze the last IME visibility of the window
            // in case delivering obsoleted IME insets state during transitioning.
            final InsetsSource originalImeSource = originalState.peekSource(ITYPE_IME);

            if (shouldImeAttachedToApp && originalImeSource != null) {
            if (originalImeSource != null) {
                final boolean imeVisibility =
                        w.mActivityRecord.mLastImeShown || w.getRequestedVisibility(ITYPE_IME);
                final InsetsState state = copyState ? new InsetsState(originalState)
+2 −2
Original line number Diff line number Diff line
@@ -3065,11 +3065,11 @@ public class ActivityRecordTests extends WindowTestsBase {

        // Simulate app re-start input or turning screen off/on then unlocked by un-secure
        // keyguard to back to the app, expect IME insets is not frozen
        mDisplayContent.updateImeInputAndControlTarget(app);
        assertFalse(app.mActivityRecord.mImeInsetsFrozenUntilStartInput);
        imeSource.setFrame(new Rect(100, 400, 500, 500));
        app.getInsetsState().addSource(imeSource);
        app.getInsetsState().setSourceVisible(ITYPE_IME, true);
        mDisplayContent.updateImeInputAndControlTarget(app);
        assertFalse(app.mActivityRecord.mImeInsetsFrozenUntilStartInput);

        // Verify when IME is visible and the app can receive the right IME insets from policy.
        makeWindowVisibleAndDrawn(app, mImeWindow);
+15 −0
Original line number Diff line number Diff line
@@ -1075,6 +1075,21 @@ public class DisplayContentTests extends WindowTestsBase {
        assertEquals(dc.getImeContainer().getParentSurfaceControl(), dc.computeImeParent());
    }

    @UseTestDisplay(addWindows = W_ACTIVITY)
    @Test
    public void testComputeImeParent_inputTargetNotUpdate() throws Exception {
        WindowState app1 = createWindow(null, TYPE_BASE_APPLICATION, "app1");
        WindowState app2 = createWindow(null, TYPE_BASE_APPLICATION, "app2");
        doReturn(true).when(mDisplayContent).shouldImeAttachedToApp();
        mDisplayContent.setImeLayeringTarget(app1);
        mDisplayContent.setImeInputTarget(app1);
        assertEquals(app1.mActivityRecord.getSurfaceControl(), mDisplayContent.computeImeParent());
        mDisplayContent.setImeLayeringTarget(app2);
        // Expect null means no change IME parent when the IME layering target not yet
        // request IME to be the input target.
        assertNull(mDisplayContent.computeImeParent());
    }

    @Test
    public void testInputMethodInputTarget_isClearedWhenWindowStateIsRemoved() throws Exception {
        final DisplayContent dc = createNewDisplay();
Loading