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

Commit 716fc1cd authored by Riddle Hsu's avatar Riddle Hsu Committed by Android (Google) Code Review
Browse files

Merge "Make universal resizable compat id visible to CTS" into main

parents c1eb4481 d710af44
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -1101,6 +1101,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
@@ -285,9 +285,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;
@@ -467,11 +464,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
@@ -3192,7 +3184,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);