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

Commit bee01125 authored by Eghosa Ewansiha-Vlachavas's avatar Eghosa Ewansiha-Vlachavas
Browse files

[1/n] Don't apply aspect ratio restrictions for resizeable activities in desktop mode

If a resizeable activity is in desktop mode, ignore all aspect ratio
constraints. Aspect ratio restrictions will still be applied on entry
into desktop mode.

Flag: com.android.window.flags.ignore_aspect_ratio_restrictions_for_resizeable_freeform_activities
Test: Manual - apply 16/9 user aspect ratio to resizeable application
and enter desktop mode. Resizing application should not cause letterbox.
Fixes: 381866902

Change-Id: I4c34111aae8180abb7f555a0395a32092e5feb32
parent a6f3b889
Loading
Loading
Loading
Loading
+11 −1
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.OVERRIDE_MIN_ASPECT_RATIO_EXCLUDE_PORTRAIT_FULLSCREEN;
import static android.content.pm.ActivityInfo.OVERRIDE_MIN_ASPECT_RATIO_LARGE;
@@ -36,6 +37,8 @@ import android.content.pm.ActivityInfo;
import android.content.res.Configuration;
import android.graphics.Rect;

import com.android.window.flags.Flags;

/**
 * Encapsulate app compat policy logic related to aspect ratio.
 */
@@ -239,7 +242,14 @@ class AppCompatAspectRatioPolicy {
                || AppCompatUtils.isInVrUiMode(mActivityRecord.getConfiguration())
                // TODO(b/232898850): Always respect aspect ratio requests.
                // Don't set aspect ratio for activity in ActivityEmbedding split.
                || (organizedTf != null && !organizedTf.fillsParent())) {
                || (organizedTf != null && !organizedTf.fillsParent())
                // Don't set aspect ratio for resizeable activities in freeform.
                // {@link ActivityRecord#shouldCreateAppCompatDisplayInsets()} will be false for
                // both activities that are naturally resizeable and activities that have been
                // forced resizeable.
                || (Flags.ignoreAspectRatioRestrictionsForResizeableFreeformActivities()
                    && task.getWindowingMode() == WINDOWING_MODE_FREEFORM
                    && !mActivityRecord.shouldCreateAppCompatDisplayInsets())) {
            return false;
        }