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

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

Make user aspect ratio settings override public and introduce proto for CTS

Bug: 294227289
Test: atest CtsWindowManagerDeviceDisplay:CompatChangeTests
Change-Id: Iae5706ddb799794f952aa285989f518aac551784
parent 0bad00b4
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -53959,6 +53959,7 @@ package android.view {
    field public static final String PROPERTY_COMPAT_ALLOW_ORIENTATION_OVERRIDE = "android.window.PROPERTY_COMPAT_ALLOW_ORIENTATION_OVERRIDE";
    field @FlaggedApi("com.android.window.flags.app_compat_properties_api") public static final String PROPERTY_COMPAT_ALLOW_RESIZEABLE_ACTIVITY_OVERRIDES = "android.window.PROPERTY_COMPAT_ALLOW_RESIZEABLE_ACTIVITY_OVERRIDES";
    field public static final String PROPERTY_COMPAT_ALLOW_SANDBOXING_VIEW_BOUNDS_APIS = "android.window.PROPERTY_COMPAT_ALLOW_SANDBOXING_VIEW_BOUNDS_APIS";
    field @FlaggedApi("com.android.window.flags.app_compat_properties_api") public static final String PROPERTY_COMPAT_ALLOW_USER_ASPECT_RATIO_OVERRIDE = "android.window.PROPERTY_COMPAT_ALLOW_USER_ASPECT_RATIO_OVERRIDE";
    field public static final String PROPERTY_COMPAT_ENABLE_FAKE_FOCUS = "android.window.PROPERTY_COMPAT_ENABLE_FAKE_FOCUS";
    field public static final String PROPERTY_COMPAT_IGNORE_REQUESTED_ORIENTATION = "android.window.PROPERTY_COMPAT_IGNORE_REQUESTED_ORIENTATION";
  }
+2 −5
Original line number Diff line number Diff line
@@ -1331,9 +1331,7 @@ public interface WindowManager extends ViewManager {
     * <p>When users apply the aspect ratio override, the minimum aspect ratio
     * specified in the app manifest is overridden. If users choose a
     * full-screen aspect ratio, the orientation of the activity is forced to
     * {@link android.content.pm.ActivityInfo#SCREEN_ORIENTATION_USER};
     * see {@link #PROPERTY_COMPAT_ALLOW_USER_ASPECT_RATIO_FULLSCREEN_OVERRIDE} to
     * disable the full-screen option only.
     * {@link android.content.pm.ActivityInfo#SCREEN_ORIENTATION_USER}.
     *
     * <p>The user override is intended to improve the app experience on devices
     * that have the ignore orientation request display setting enabled by OEMs
@@ -1358,9 +1356,8 @@ public interface WindowManager extends ViewManager {
     *     android:value="false"/&gt;
     * &lt;/application&gt;
     * </pre>
     * @hide
     */
    // TODO(b/294227289): Make this public API
    @FlaggedApi(Flags.FLAG_APP_COMPAT_PROPERTIES_API)
    String PROPERTY_COMPAT_ALLOW_USER_ASPECT_RATIO_OVERRIDE =
            "android.window.PROPERTY_COMPAT_ALLOW_USER_ASPECT_RATIO_OVERRIDE";

+1 −0
Original line number Diff line number Diff line
@@ -397,6 +397,7 @@ message ActivityRecordProto {
    optional bool should_override_min_aspect_ratio = 42;
    optional bool should_ignore_orientation_request_loop = 43;
    optional bool should_override_force_resize_app = 44;
    optional bool should_enable_user_aspect_ratio_settings = 45;
}

/* represents WindowToken */
+3 −0
Original line number Diff line number Diff line
@@ -182,6 +182,7 @@ import static com.android.server.wm.ActivityRecordProto.PROC_ID;
import static com.android.server.wm.ActivityRecordProto.PROVIDES_MAX_BOUNDS;
import static com.android.server.wm.ActivityRecordProto.REPORTED_DRAWN;
import static com.android.server.wm.ActivityRecordProto.REPORTED_VISIBLE;
import static com.android.server.wm.ActivityRecordProto.SHOULD_ENABLE_USER_ASPECT_RATIO_SETTINGS;
import static com.android.server.wm.ActivityRecordProto.SHOULD_FORCE_ROTATE_FOR_CAMERA_COMPAT;
import static com.android.server.wm.ActivityRecordProto.SHOULD_IGNORE_ORIENTATION_REQUEST_LOOP;
import static com.android.server.wm.ActivityRecordProto.SHOULD_OVERRIDE_FORCE_RESIZE_APP;
@@ -10363,6 +10364,8 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
                mLetterboxUiController.shouldIgnoreOrientationRequestLoop());
        proto.write(SHOULD_OVERRIDE_FORCE_RESIZE_APP,
                mLetterboxUiController.shouldOverrideForceResizeApp());
        proto.write(SHOULD_ENABLE_USER_ASPECT_RATIO_SETTINGS,
                mLetterboxUiController.shouldEnableUserAspectRatioSettings());
    }

    @Override