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

Commit d710af44 authored by Riddle Hsu's avatar Riddle Hsu
Browse files

Make universal resizable compat id visible to CTS

So tests can run enabled/disabled cases easier.

Bug: 357141415
Flag: com.android.window.flags.universal_resizable_by_default
Test: atest CtsWindowManagerDeviceDisplay:CompatChangeTests
Change-Id: If592ef730b67f73cf4b1eb9be0538f8d6baba14c
parent d8aa9a2a
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -1098,6 +1098,7 @@ package android.content.pm {
    field public static final long OVERRIDE_UNDEFINED_ORIENTATION_TO_PORTRAIT = 265452344L; // 0xfd27b38L
    field public static final long OVERRIDE_USE_DISPLAY_LANDSCAPE_NATURAL_ORIENTATION = 255940284L; // 0xf4156bcL
    field public static final int RESIZE_MODE_RESIZEABLE = 2; // 0x2
    field public static final long UNIVERSAL_RESIZABLE_BY_DEFAULT = 357141415L; // 0x15498ba7L
  }

  public class ApplicationInfo extends android.content.pm.PackageItemInfo implements android.os.Parcelable {
+14 −0
Original line number Diff line number Diff line
@@ -21,10 +21,12 @@ import android.annotation.FloatRange;
import android.annotation.IntDef;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.SuppressLint;
import android.annotation.TestApi;
import android.app.Activity;
import android.compat.annotation.ChangeId;
import android.compat.annotation.Disabled;
import android.compat.annotation.EnabledAfter;
import android.compat.annotation.EnabledSince;
import android.compat.annotation.Overridable;
import android.compat.annotation.UnsupportedAppUsage;
@@ -1203,6 +1205,18 @@ public class ActivityInfo extends ComponentInfo implements Parcelable {
    @Retention(RetentionPolicy.SOURCE)
    public @interface SizeChangesSupportMode {}

    /**
     * This change id makes the restriction of fixed orientation, aspect ratio, and resizability
     * of the app to be ignored, which means making the app fill the given available area.
     * @hide
     */
    @ChangeId
    @Overridable
    @TestApi
    @SuppressLint("UnflaggedApi") // @TestApi without associated public API.
    @EnabledAfter(targetSdkVersion = Build.VERSION_CODES.VANILLA_ICE_CREAM)
    public static final long UNIVERSAL_RESIZABLE_BY_DEFAULT = 357141415L; // buganizer id

    /**
     * This change id enables compat policy that ignores app requested orientation in
     * response to an app calling {@link android.app.Activity#setRequestedOrientation}. See
+1 −9
Original line number Diff line number Diff line
@@ -287,9 +287,6 @@ import android.app.servertransaction.StopActivityItem;
import android.app.servertransaction.TopResumedActivityChangeItem;
import android.app.servertransaction.TransferSplashScreenViewStateItem;
import android.app.usage.UsageEvents.Event;
import android.compat.annotation.ChangeId;
import android.compat.annotation.EnabledAfter;
import android.compat.annotation.Overridable;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
@@ -469,11 +466,6 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
    // finished destroying itself.
    private static final int DESTROY_TIMEOUT = 10 * 1000;

    @ChangeId
    @Overridable
    @EnabledAfter(targetSdkVersion = Build.VERSION_CODES.VANILLA_ICE_CREAM)
    static final long UNIVERSAL_RESIZABLE_BY_DEFAULT = 357141415;

    final ActivityTaskManagerService mAtmService;
    final ActivityCallerState mCallerState;
    @NonNull
@@ -3197,7 +3189,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
                && mDisplayContent != null && mDisplayContent.getConfiguration()
                    .smallestScreenWidthDp >= WindowManager.LARGE_SCREEN_SMALLEST_SCREEN_WIDTH_DP
                && mDisplayContent.getIgnoreOrientationRequest()
                && info.isChangeEnabled(UNIVERSAL_RESIZABLE_BY_DEFAULT);
                && info.isChangeEnabled(ActivityInfo.UNIVERSAL_RESIZABLE_BY_DEFAULT);
        if (!compatEnabled && !mWmService.mConstants.mIgnoreActivityOrientationRequest) {
            return false;
        }
+1 −1
Original line number Diff line number Diff line
@@ -4883,7 +4883,7 @@ public class SizeCompatTests extends WindowTestsBase {


    @Test
    @EnableCompatChanges({ActivityRecord.UNIVERSAL_RESIZABLE_BY_DEFAULT})
    @EnableCompatChanges({ActivityInfo.UNIVERSAL_RESIZABLE_BY_DEFAULT})
    public void testUniversalResizeableByDefault() {
        mSetFlagsRule.enableFlags(Flags.FLAG_UNIVERSAL_RESIZABLE_BY_DEFAULT);
        mDisplayContent.setIgnoreOrientationRequest(false);