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

Commit 08708fd4 authored by Massimo Carli's avatar Massimo Carli Committed by Automerger Merge Worker
Browse files

Merge "Fix NullPointerException in aspect ratio restrictions" into tm-qpr-dev...

Merge "Fix NullPointerException in aspect ratio restrictions" into tm-qpr-dev am: 7522d056 am: 3e344b92 am: 33b0b3af am: cb7bf98b

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



Change-Id: I82e8a44f26eefdfc389e583c829b07bd428ff5ee
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 7076c044 cb7bf98b
Loading
Loading
Loading
Loading
+4 −0
Original line number Original line Diff line number Diff line
@@ -319,6 +319,10 @@ final class LetterboxUiController {
            mLetterbox.destroy();
            mLetterbox.destroy();
            mLetterbox = null;
            mLetterbox = null;
        }
        }
        if (mLetterboxConfigListener != null) {
            mLetterboxConfigListener.onRemoved();
            mLetterboxConfigListener = null;
        }
    }
    }


    void onMovedToDisplay(int displayId) {
    void onMovedToDisplay(int displayId) {
+21 −0
Original line number Original line Diff line number Diff line
@@ -52,6 +52,7 @@ import static com.android.internal.util.FrameworkStatsLog.APP_COMPAT_STATE_CHANG
import static com.android.internal.util.FrameworkStatsLog.APP_COMPAT_STATE_CHANGED__STATE__LETTERBOXED_FOR_SIZE_COMPAT_MODE;
import static com.android.internal.util.FrameworkStatsLog.APP_COMPAT_STATE_CHANGED__STATE__LETTERBOXED_FOR_SIZE_COMPAT_MODE;
import static com.android.internal.util.FrameworkStatsLog.APP_COMPAT_STATE_CHANGED__STATE__NOT_LETTERBOXED;
import static com.android.internal.util.FrameworkStatsLog.APP_COMPAT_STATE_CHANGED__STATE__NOT_LETTERBOXED;
import static com.android.internal.util.FrameworkStatsLog.APP_COMPAT_STATE_CHANGED__STATE__NOT_VISIBLE;
import static com.android.internal.util.FrameworkStatsLog.APP_COMPAT_STATE_CHANGED__STATE__NOT_VISIBLE;
import static com.android.server.wm.ActivityRecord.State.DESTROYED;
import static com.android.server.wm.ActivityRecord.State.PAUSED;
import static com.android.server.wm.ActivityRecord.State.PAUSED;
import static com.android.server.wm.ActivityRecord.State.RESTARTING_PROCESS;
import static com.android.server.wm.ActivityRecord.State.RESTARTING_PROCESS;
import static com.android.server.wm.ActivityRecord.State.RESUMED;
import static com.android.server.wm.ActivityRecord.State.RESUMED;
@@ -175,6 +176,26 @@ public class SizeCompatTests extends WindowTestsBase {
        setUpApp(builder.build());
        setUpApp(builder.build());
    }
    }


    @Test
    public void testCleanLetterboxConfigListenerWhenTranslucentIsDestroyed() {
        mWm.mLetterboxConfiguration.setTranslucentLetterboxingOverrideEnabled(true);
        setUpDisplaySizeWithApp(2000, 1000);
        prepareUnresizable(mActivity, SCREEN_ORIENTATION_PORTRAIT);
        mActivity.mDisplayContent.setIgnoreOrientationRequest(true /* ignoreOrientationRequest */);
        // Translucent Activity
        final ActivityRecord translucentActivity = new ActivityBuilder(mAtm)
                .setLaunchedFromUid(mActivity.getUid())
                .setScreenOrientation(SCREEN_ORIENTATION_PORTRAIT)
                .build();
        doReturn(false).when(translucentActivity).fillsParent();
        mTask.addChild(translucentActivity);

        translucentActivity.setState(DESTROYED, "testing");
        translucentActivity.removeImmediately();

        assertFalse(translucentActivity.mLetterboxUiController.hasInheritedLetterboxBehavior());
    }

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