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

This commit is contained in:
TreeHugger Robot
2022-10-05 10:17:58 +00:00
committed by Android (Google) Code Review
3 changed files with 19 additions and 3 deletions

View File

@@ -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));

View File

@@ -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();

View File

@@ -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