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

Commit 555a62eb authored by Vali Calinescu's avatar Vali Calinescu Committed by Automerger Merge Worker
Browse files

Merge "Clear mInheritedCompatDisplayInsets when clearing size compat mode"...

Merge "Clear mInheritedCompatDisplayInsets when clearing size compat mode" into tm-qpr-dev am: 451856db am: 3f867c81 am: 24d6079a

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/22185523



Change-Id: I934d9678b0f3719143fdd9573b0111d79327eb26
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 202df719 24d6079a
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -8124,6 +8124,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
        mSizeCompatScale = 1f;
        mSizeCompatScale = 1f;
        mSizeCompatBounds = null;
        mSizeCompatBounds = null;
        mCompatDisplayInsets = null;
        mCompatDisplayInsets = null;
        mLetterboxUiController.clearInheritedCompatDisplayInsets();
    }
    }


    @VisibleForTesting
    @VisibleForTesting
+4 −0
Original line number Original line Diff line number Diff line
@@ -1488,6 +1488,10 @@ final class LetterboxUiController {
        return mInheritedCompatDisplayInsets;
        return mInheritedCompatDisplayInsets;
    }
    }


    void clearInheritedCompatDisplayInsets() {
        mInheritedCompatDisplayInsets = null;
    }

    /**
    /**
     * In case of translucent activities, it consumes the {@link ActivityRecord} of the first opaque
     * In case of translucent activities, it consumes the {@link ActivityRecord} of the first opaque
     * activity beneath using the given consumer and returns {@code true}.
     * activity beneath using the given consumer and returns {@code true}.
+29 −0
Original line number Original line Diff line number Diff line
@@ -64,6 +64,8 @@ import static com.google.common.truth.Truth.assertThat;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.assertTrue;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyBoolean;
import static org.mockito.ArgumentMatchers.anyBoolean;
@@ -506,6 +508,33 @@ public class SizeCompatTests extends WindowTestsBase {
        assertEquals(translucentActivity.getBounds(), mActivity.getBounds());
        assertEquals(translucentActivity.getBounds(), mActivity.getBounds());
    }
    }


    @Test
    public void testTranslucentActivity_clearSizeCompatMode_inheritedCompatDisplayInsetsCleared() {
        mWm.mLetterboxConfiguration.setTranslucentLetterboxingOverrideEnabled(true);
        setUpDisplaySizeWithApp(2800, 1400);
        mActivity.mDisplayContent.setIgnoreOrientationRequest(true /* ignoreOrientationRequest */);
        prepareUnresizable(mActivity, -1f /* maxAspect */, SCREEN_ORIENTATION_PORTRAIT);
        // Rotate to put activity in size compat mode.
        rotateDisplay(mActivity.mDisplayContent, ROTATION_90);
        assertTrue(mActivity.inSizeCompatMode());

        // We launch a transparent activity
        final ActivityRecord translucentActivity = new ActivityBuilder(mAtm)
                .setLaunchedFromUid(mActivity.getUid())
                .setScreenOrientation(SCREEN_ORIENTATION_PORTRAIT)
                .build();
        doReturn(false).when(translucentActivity).fillsParent();
        mTask.addChild(translucentActivity);

        // The transparent activity inherits the compat display insets of the opaque activity
        // beneath it
        assertNotNull(translucentActivity.getCompatDisplayInsets());

        // Clearing SCM should also clear the inherited compat display insets
        translucentActivity.clearSizeCompatMode();
        assertNull(translucentActivity.getCompatDisplayInsets());
    }

    @Test
    @Test
    public void testRestartProcessIfVisible() {
    public void testRestartProcessIfVisible() {
        setUpDisplaySizeWithApp(1000, 2500);
        setUpDisplaySizeWithApp(1000, 2500);