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

Commit 10f8173b authored by Riddle Hsu's avatar Riddle Hsu
Browse files

Do not ignore locked orientation by universal resizable

The policy focuses on the orientation request that may trigger a change.
The "lock" is like to keep current orientation, so it is excluded.

Also fix some tests by using activity builder with test package
(legacy target sdk).

Bug: 357141415
Flag: com.android.window.flags.universal_resizable_by_default
Test: SizeCompatTests
Change-Id: Ibc3a4fbcab3132d00a22da4a37947d5a48f9c421
parent 8ac5a154
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -8179,7 +8179,9 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
    @ActivityInfo.ScreenOrientation
    protected int getOverrideOrientation() {
        int candidateOrientation = super.getOverrideOrientation();
        if (ActivityInfo.isFixedOrientation(candidateOrientation) && isUniversalResizeable()) {
        if (candidateOrientation != ActivityInfo.SCREEN_ORIENTATION_LOCKED
                && ActivityInfo.isFixedOrientation(candidateOrientation)
                && isUniversalResizeable()) {
            candidateOrientation = ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED;
        }
        return mAppCompatController.getOrientationPolicy()
+3 −3
Original line number Diff line number Diff line
@@ -2899,7 +2899,7 @@ public class SizeCompatTests extends WindowTestsBase {
        // Launch another portrait fixed app.
        spyOn(mTask);
        setBooted(display.mWmService.mAtmService);
        final ActivityRecord newActivity = new ActivityBuilder(display.mWmService.mAtmService)
        final ActivityRecord newActivity = getActivityBuilderWithoutTask()
                .setResizeMode(RESIZE_MODE_UNRESIZEABLE)
                .setScreenOrientation(SCREEN_ORIENTATION_PORTRAIT)
                .setTask(mTask)
@@ -2967,7 +2967,7 @@ public class SizeCompatTests extends WindowTestsBase {
        // Launch another portrait fixed app with max aspect ratio as 1.3.
        spyOn(mTask);
        setBooted(display.mWmService.mAtmService);
        final ActivityRecord newActivity = new ActivityBuilder(display.mWmService.mAtmService)
        final ActivityRecord newActivity = getActivityBuilderWithoutTask()
                .setResizeMode(RESIZE_MODE_UNRESIZEABLE)
                .setMaxAspectRatio(1.3f)
                .setScreenOrientation(SCREEN_ORIENTATION_PORTRAIT)
@@ -4791,7 +4791,7 @@ public class SizeCompatTests extends WindowTestsBase {
        final float maxAspect = 1.8f;
        final float minAspect = 1.5f;
        prepareLimitedBounds(mActivity, maxAspect, minAspect,
                ActivityInfo.SCREEN_ORIENTATION_LOCKED, true /* isUnresizable */);
                ActivityInfo.SCREEN_ORIENTATION_NOSENSOR, true /* isUnresizable */);

        assertTrue(mActivity.isUniversalResizeable());
        assertTrue(mActivity.isResizeable());