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

Commit 237093c0 authored by Graciela Wissen Putri's avatar Graciela Wissen Putri
Browse files

Disable transparent policy for freeform activities

Non-resizeable activities in freeform have parent bounds constrained to
size compat scaled bounds. Disable transparent policy to inherit from
parent bounds instead of top opaque activity.

Flag: EXEMPT bug fix
Fix: 361813238
Test: atest TransparentPolicyTest
Change-Id: I961b9f86ed594cbd156ddd20354c4680bee9e46d
parent 004d702c
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package com.android.server.wm;

import static android.app.WindowConfiguration.WINDOWING_MODE_FREEFORM;
import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED;
import static android.content.res.Configuration.ORIENTATION_UNDEFINED;
import static android.content.res.Configuration.SCREEN_HEIGHT_DP_UNDEFINED;
@@ -331,6 +332,11 @@ class TransparentPolicy {
        }

        private boolean isPolicyEnabled() {
            // Disable transparent policy if task is null or in freeform.
            final Task task = mActivityRecord.getTask();
            if (task == null || task.getWindowingMode() == WINDOWING_MODE_FREEFORM) {
                return false;
            }
            if (!mActivityRecord.mWmService.mFlags.mRespectNonTopVisibleFixedOrientation) {
                return true;
            }
+16 −0
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package com.android.server.wm;

import static android.app.WindowConfiguration.WINDOWING_MODE_FREEFORM;
import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN;
import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE;
import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_PORTRAIT;
@@ -235,6 +236,21 @@ public class TransparentPolicyTest extends WindowTestsBase {
        })), /* displayWidth */ 500,  /* displayHeight */ 1000);
    }

    @Test
    public void testNotRunStrategyToTranslucentActivitiesIfTaskIsFreeform() {
        runTestScenario((robot) -> {
            robot.transparentActivity((ta) -> {
                ta.applyOnActivity((a) -> {
                    a.setIgnoreOrientationRequest(true);
                    ta.launchTransparentActivityInTask();
                    a.setTaskWindowingMode(WINDOWING_MODE_FREEFORM);

                    ta.checkTopActivityTransparentPolicyStateIsRunning(/* running */ false);
                });
            });
        }, /* displayWidth */ 2800,  /* displayHeight */ 1400);
    }

    @Test
    public void testTranslucentActivitiesDontGoInSizeCompatMode() {
        runTestScenario((robot) -> {