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

Commit 1cd69247 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Fix condition to dispatch config for visible window" into tm-qpr-dev

parents 580e9514 935b474b
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -8482,6 +8482,10 @@ public final class ViewRootImpl implements ViewParent,
        if (mLocalSyncState != LOCAL_SYNC_NONE) {
            writer.println(innerPrefix + "mLocalSyncState=" + mLocalSyncState);
        }
        writer.println(innerPrefix + "mLastReportedMergedConfiguration="
                + mLastReportedMergedConfiguration);
        writer.println(innerPrefix + "mLastConfigurationFromResources="
                + mLastConfigurationFromResources);
        writer.println(innerPrefix + "mIsAmbientMode="  + mIsAmbientMode);
        writer.println(innerPrefix + "mUnbufferedInputSource="
                + Integer.toHexString(mUnbufferedInputSource));
+1 −1
Original line number Diff line number Diff line
@@ -3869,7 +3869,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
        // configuration update when the window has requested to be hidden. Doing so can lead to
        // the client erroneously accepting a configuration that would have otherwise caused an
        // activity restart. We instead hand back the last reported {@link MergedConfiguration}.
        if (useLatestConfig || (relayoutVisible && (shouldCheckTokenVisibleRequested()
        if (useLatestConfig || (relayoutVisible && (!shouldCheckTokenVisibleRequested()
                || mToken.isVisibleRequested()))) {
            final Configuration globalConfig = getProcessGlobalConfiguration();
            final Configuration overrideConfig = getMergedOverrideConfiguration();
+14 −2
Original line number Diff line number Diff line
@@ -43,6 +43,7 @@ import static com.android.server.wm.LetterboxConfiguration.LETTERBOX_BACKGROUND_

import static com.google.common.truth.Truth.assertThat;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNull;
import static org.mockito.ArgumentMatchers.any;
@@ -195,14 +196,25 @@ public class WindowManagerServiceTests extends WindowTestsBase {
        mWm.mWindowMap.put(win.mClient.asBinder(), win);
        final int w = 100;
        final int h = 200;
        final ClientWindowFrames outFrames = new ClientWindowFrames();
        final MergedConfiguration outConfig = new MergedConfiguration();
        final SurfaceControl outSurfaceControl = new SurfaceControl();
        final InsetsState outInsetsState = new InsetsState();
        final InsetsSourceControl[] outControls = new InsetsSourceControl[0];
        final Bundle outBundle = new Bundle();
        mWm.relayoutWindow(win.mSession, win.mClient, win.mAttrs, w, h, View.GONE, 0, 0, 0,
                new ClientWindowFrames(), new MergedConfiguration(), new SurfaceControl(),
                new InsetsState(), new InsetsSourceControl[0], new Bundle());
                outFrames, outConfig, outSurfaceControl, outInsetsState, outControls, outBundle);
        // Because the window is already invisible, it doesn't need to apply exiting animation
        // and WMS#tryStartExitingAnimation() will destroy the surface directly.
        assertFalse(win.mAnimatingExit);
        assertFalse(win.mHasSurface);
        assertNull(win.mWinAnimator.mSurfaceController);

        doReturn(mSystemServicesTestRule.mTransaction).when(SurfaceControl::getGlobalTransaction);
        // Invisible requested activity should not get the last config even if its view is visible.
        mWm.relayoutWindow(win.mSession, win.mClient, win.mAttrs, w, h, View.VISIBLE, 0, 0, 0,
                outFrames, outConfig, outSurfaceControl, outInsetsState, outControls, outBundle);
        assertEquals(0, outConfig.getMergedConfiguration().densityDpi);
    }

    @Test