Loading AconfigFlags.bp +7 −0 Original line number Diff line number Diff line Loading @@ -478,6 +478,13 @@ java_aconfig_library { defaults: ["framework-minus-apex-aconfig-java-defaults"], } cc_aconfig_library { name: "android.os.vibrator.flags-aconfig-cc", aconfig_declarations: "android.os.vibrator.flags-aconfig", host_supported: true, vendor_available: true, } // View aconfig_declarations { name: "android.view.flags-aconfig", Loading Ravenwood.bp +2 −1 Original line number Diff line number Diff line Loading @@ -159,7 +159,8 @@ java_library { "framework-minus-apex.ravenwood", ], sdk_version: "core_platform", jarjar_rules: ":ravenwood-framework-jarjar-rules", // See b/313930116. Jarjar is too slow on this jar. We use HostStubGen to do the rename. // jarjar_rules: ":ravenwood-framework-jarjar-rules", } java_genrule { Loading config/preloaded-classes-denylist +15 −5 Original line number Diff line number Diff line android.content.AsyncTaskLoader$LoadTask android.media.MediaCodecInfo$CodecCapabilities$FeatureList android.media.MediaCodecInfo$LazyHolder android.net.ConnectivityThread$Singleton android.net.rtp.AudioGroup android.net.rtp.AudioStream android.net.rtp.RtpStream android.os.FileObserver android.os.NullVibrator android.permission.PermissionManager android.provider.MediaStore android.speech.tts.TextToSpeech$Connection$SetupConnectionAsyncTask android.view.HdrRenderState android.text.TextFlags android.widget.Magnifier com.android.internal.jank.InteractionJankMonitor$InstanceHolder com.android.internal.os.BinderCallsStats$SettingsObserver com.android.internal.util.LatencyTracker$SLatencyTrackerHolder com.android.server.BootReceiver$2 gov.nist.core.net.DefaultNetworkLayer android.net.rtp.AudioGroup android.net.rtp.AudioStream android.net.rtp.RtpStream java.util.concurrent.ThreadLocalRandom java.util.ImmutableCollections com.android.internal.jank.InteractionJankMonitor$InstanceHolder java.util.concurrent.ThreadLocalRandom sun.nio.fs.UnixChannelFactory core/api/system-current.txt +1 −1 Original line number Diff line number Diff line Loading @@ -3448,7 +3448,7 @@ package android.companion.virtual { } public static interface VirtualDeviceManager.ActivityListener { method @FlaggedApi("android.companion.virtualdevice.flags.activity_control_api") public default void onActivityLaunchBlocked(int, @NonNull android.content.ComponentName, int); method @FlaggedApi("android.companion.virtualdevice.flags.activity_control_api") public default void onActivityLaunchBlocked(int, @NonNull android.content.ComponentName, int, @Nullable android.content.IntentSender); method public void onDisplayEmpty(int); method @Deprecated public void onTopActivityChanged(int, @NonNull android.content.ComponentName); method public default void onTopActivityChanged(int, @NonNull android.content.ComponentName, int); core/java/android/app/AppCompatTaskInfo.java +216 −92 Original line number Diff line number Diff line Loading @@ -18,62 +18,20 @@ package android.app; import static android.app.TaskInfo.PROPERTY_VALUE_UNSET; import android.annotation.IntDef; import android.annotation.NonNull; import android.annotation.Nullable; import android.os.Parcel; import android.os.Parcelable; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; /** * Stores App Compat information about a particular Task. * @hide */ public class AppCompatTaskInfo implements Parcelable { /** * Whether the direct top activity is eligible for letterbox education. */ public boolean topActivityEligibleForLetterboxEducation; /** * Whether the letterbox education is enabled. */ public boolean isLetterboxEducationEnabled; /** * Whether the direct top activity is in size compat mode on foreground. */ public boolean topActivityInSizeCompat; /** * Whether the double tap is enabled. */ public boolean isLetterboxDoubleTapEnabled; /** * Whether the user aspect ratio settings button is enabled. */ public boolean topActivityEligibleForUserAspectRatioButton; /** * Whether the user has forced the activity to be fullscreen through the user aspect ratio * settings. */ public boolean isUserFullscreenOverrideEnabled; /** * Whether the system has forced the activity to be fullscreen */ public boolean isSystemFullscreenOverrideEnabled; /** * Hint about the letterbox state of the top activity. */ public boolean topActivityBoundsLetterboxed; /** * Whether the update comes from a letterbox double-tap action from the user or not. */ public boolean isFromLetterboxDoubleTap; /** * If {@link #isLetterboxDoubleTapEnabled} it contains the current letterbox vertical position * or {@link TaskInfo#PROPERTY_VALUE_UNSET} otherwise. Loading Loading @@ -115,6 +73,57 @@ public class AppCompatTaskInfo implements Parcelable { */ public CameraCompatTaskInfo cameraCompatTaskInfo = CameraCompatTaskInfo.create(); /** Constant indicating no top activity flag has been set. */ private static final int FLAG_UNDEFINED = 0x0; /** Constant base value for top activity flag. */ private static final int FLAG_BASE = 0x1; /** Top activity flag for whether letterbox education is enabled. */ private static final int FLAG_LETTERBOX_EDU_ENABLED = FLAG_BASE; /** Top activity flag for whether activity is eligible for letterbox education. */ private static final int FLAG_ELIGIBLE_FOR_LETTERBOX_EDU = FLAG_BASE << 1; /** Top activity flag for whether activity bounds are letterboxed. */ private static final int FLAG_LETTERBOXED = FLAG_BASE << 2; /** Top activity flag for whether activity is in size compat mode. */ private static final int FLAG_IN_SIZE_COMPAT = FLAG_BASE << 3; /** Top activity flag for whether letterbox double tap is enabled. */ private static final int FLAG_LETTERBOX_DOUBLE_TAP_ENABLED = FLAG_BASE << 4; /** Top activity flag for whether the update comes from a letterbox double tap action. */ private static final int FLAG_IS_FROM_LETTERBOX_DOUBLE_TAP = FLAG_BASE << 5; /** Top activity flag for whether activity is eligible for user aspect ratio button. */ private static final int FLAG_ELIGIBLE_FOR_USER_ASPECT_RATIO_BUTTON = FLAG_BASE << 6; /** Top activity flag for whether has activity has been overridden to fullscreen by system. */ private static final int FLAG_FULLSCREEN_OVERRIDE_SYSTEM = FLAG_BASE << 7; /** Top activity flag for whether has activity has been overridden to fullscreen by user. */ private static final int FLAG_FULLSCREEN_OVERRIDE_USER = FLAG_BASE << 8; @Retention(RetentionPolicy.SOURCE) @IntDef(flag = true, value = { FLAG_UNDEFINED, FLAG_BASE, FLAG_LETTERBOX_EDU_ENABLED, FLAG_ELIGIBLE_FOR_LETTERBOX_EDU, FLAG_LETTERBOXED, FLAG_IN_SIZE_COMPAT, FLAG_LETTERBOX_DOUBLE_TAP_ENABLED, FLAG_IS_FROM_LETTERBOX_DOUBLE_TAP, FLAG_ELIGIBLE_FOR_USER_ASPECT_RATIO_BUTTON, FLAG_FULLSCREEN_OVERRIDE_SYSTEM, FLAG_FULLSCREEN_OVERRIDE_USER }) public @interface TopActivityFlag {} @TopActivityFlag private int mTopActivityFlags; @TopActivityFlag private static final int FLAGS_ORGANIZER_INTERESTED = FLAG_IS_FROM_LETTERBOX_DOUBLE_TAP | FLAG_ELIGIBLE_FOR_USER_ASPECT_RATIO_BUTTON | FLAG_FULLSCREEN_OVERRIDE_SYSTEM | FLAG_FULLSCREEN_OVERRIDE_USER; @TopActivityFlag private static final int FLAGS_COMPAT_UI_INTERESTED = FLAGS_ORGANIZER_INTERESTED | FLAG_IN_SIZE_COMPAT | FLAG_ELIGIBLE_FOR_LETTERBOX_EDU | FLAG_LETTERBOX_EDU_ENABLED; private AppCompatTaskInfo() { // Do nothing } Loading Loading @@ -150,9 +159,8 @@ public class AppCompatTaskInfo implements Parcelable { * @return {@code true} if the task has some compat ui. */ public boolean hasCompatUI() { return topActivityInSizeCompat || topActivityEligibleForLetterboxEducation || isLetterboxDoubleTapEnabled || topActivityEligibleForUserAspectRatioButton; return isTopActivityInSizeCompat() || eligibleForLetterboxEducation() || isLetterboxDoubleTapEnabled() || eligibleForUserAspectRatioButton(); } /** Loading @@ -162,6 +170,142 @@ public class AppCompatTaskInfo implements Parcelable { return topActivityLetterboxWidth < topActivityLetterboxHeight; } /** * @return {@code true} if the letterbox education is enabled. */ public boolean isLetterboxEducationEnabled() { return isTopActivityFlagEnabled(FLAG_LETTERBOX_EDU_ENABLED); } /** * Sets the top activity flag for whether letterbox education is enabled. */ public void setLetterboxEducationEnabled(boolean enable) { setTopActivityFlag(FLAG_LETTERBOX_EDU_ENABLED, enable); } /** * @return {@code true} if the direct top activity is eligible for letterbox education. */ public boolean eligibleForLetterboxEducation() { return isTopActivityFlagEnabled(FLAG_ELIGIBLE_FOR_LETTERBOX_EDU); } /** * Sets the top activity flag to be eligible for letterbox education. */ public void setEligibleForLetterboxEducation(boolean enable) { setTopActivityFlag(FLAG_ELIGIBLE_FOR_LETTERBOX_EDU, enable); } /** * @return {@code true} if the direct top activity is eligible for the user aspect ratio * settings button. */ public boolean eligibleForUserAspectRatioButton() { return isTopActivityFlagEnabled(FLAG_ELIGIBLE_FOR_USER_ASPECT_RATIO_BUTTON); } /** * Sets the top activity flag to be eligible for the user aspect ratio settings button. */ public void setEligibleForUserAspectRatioButton(boolean enable) { setTopActivityFlag(FLAG_ELIGIBLE_FOR_USER_ASPECT_RATIO_BUTTON, enable); } /** * @return {@code true} if double tap to reposition letterboxed app is enabled. */ public boolean isLetterboxDoubleTapEnabled() { return isTopActivityFlagEnabled(FLAG_LETTERBOX_DOUBLE_TAP_ENABLED); } /** * Sets the top activity flag to enable double tap to reposition letterboxed app. */ public void setLetterboxDoubleTapEnabled(boolean enable) { setTopActivityFlag(FLAG_LETTERBOX_DOUBLE_TAP_ENABLED, enable); } /** * @return {@code true} if the update comes from a letterbox double-tap action from the user. */ public boolean isFromLetterboxDoubleTap() { return isTopActivityFlagEnabled(FLAG_IS_FROM_LETTERBOX_DOUBLE_TAP); } /** * Sets the top activity flag for whether the update comes from a letterbox double-tap action * from the user. */ public void setIsFromLetterboxDoubleTap(boolean enable) { setTopActivityFlag(FLAG_IS_FROM_LETTERBOX_DOUBLE_TAP, enable); } /** * @return {@code true} if the user has forced the activity to be fullscreen through the * user aspect ratio settings. */ public boolean isUserFullscreenOverrideEnabled() { return isTopActivityFlagEnabled(FLAG_FULLSCREEN_OVERRIDE_USER); } /** * Sets the top activity flag for whether the user has forced the activity to be fullscreen * through the user aspect ratio settings. */ public void setUserFullscreenOverrideEnabled(boolean enable) { setTopActivityFlag(FLAG_FULLSCREEN_OVERRIDE_USER, enable); } /** * @return {@code true} if the system has forced the activity to be fullscreen. */ public boolean isSystemFullscreenOverrideEnabled() { return isTopActivityFlagEnabled(FLAG_FULLSCREEN_OVERRIDE_SYSTEM); } /** * Sets the top activity flag for whether the system has forced the activity to be fullscreen. */ public void setSystemFullscreenOverrideEnabled(boolean enable) { setTopActivityFlag(FLAG_FULLSCREEN_OVERRIDE_SYSTEM, enable); } /** * @return {@code true} if the direct top activity is in size compat mode on foreground. */ public boolean isTopActivityInSizeCompat() { return isTopActivityFlagEnabled(FLAG_IN_SIZE_COMPAT); } /** * Sets the top activity flag for whether the direct top activity is in size compat mode * on foreground. */ public void setTopActivityInSizeCompat(boolean enable) { setTopActivityFlag(FLAG_IN_SIZE_COMPAT, enable); } /** * @return {@code true} if the top activity bounds are letterboxed. */ public boolean isTopActivityLetterboxed() { return isTopActivityFlagEnabled(FLAG_LETTERBOXED); } /** * Sets the top activity flag for whether the top activity bounds are letterboxed. */ public void setTopActivityLetterboxed(boolean enable) { setTopActivityFlag(FLAG_LETTERBOXED, enable); } /** Clear all top activity flags and set to false. */ public void clearTopActivityFlags() { mTopActivityFlags = FLAG_UNDEFINED; } /** * @return {@code true} if the app compat parameters that are important for task organizers * are equal. Loading @@ -170,9 +314,8 @@ public class AppCompatTaskInfo implements Parcelable { if (that == null) { return false; } return isFromLetterboxDoubleTap == that.isFromLetterboxDoubleTap && topActivityEligibleForUserAspectRatioButton == that.topActivityEligibleForUserAspectRatioButton return (mTopActivityFlags & FLAGS_ORGANIZER_INTERESTED) == (that.mTopActivityFlags & FLAGS_ORGANIZER_INTERESTED) && topActivityLetterboxVerticalPosition == that.topActivityLetterboxVerticalPosition && topActivityLetterboxWidth == that.topActivityLetterboxWidth && topActivityLetterboxHeight == that.topActivityLetterboxHeight Loading @@ -180,8 +323,6 @@ public class AppCompatTaskInfo implements Parcelable { && topActivityLetterboxAppHeight == that.topActivityLetterboxAppHeight && topActivityLetterboxHorizontalPosition == that.topActivityLetterboxHorizontalPosition && isUserFullscreenOverrideEnabled == that.isUserFullscreenOverrideEnabled && isSystemFullscreenOverrideEnabled == that.isSystemFullscreenOverrideEnabled && cameraCompatTaskInfo.equalsForTaskOrganizer(that.cameraCompatTaskInfo); } Loading @@ -192,13 +333,8 @@ public class AppCompatTaskInfo implements Parcelable { if (that == null) { return false; } return topActivityInSizeCompat == that.topActivityInSizeCompat && isFromLetterboxDoubleTap == that.isFromLetterboxDoubleTap && topActivityEligibleForUserAspectRatioButton == that.topActivityEligibleForUserAspectRatioButton && topActivityEligibleForLetterboxEducation == that.topActivityEligibleForLetterboxEducation && isLetterboxEducationEnabled == that.isLetterboxEducationEnabled return (mTopActivityFlags & FLAGS_COMPAT_UI_INTERESTED) == (that.mTopActivityFlags & FLAGS_COMPAT_UI_INTERESTED) && topActivityLetterboxVerticalPosition == that.topActivityLetterboxVerticalPosition && topActivityLetterboxHorizontalPosition == that.topActivityLetterboxHorizontalPosition Loading @@ -206,8 +342,6 @@ public class AppCompatTaskInfo implements Parcelable { && topActivityLetterboxHeight == that.topActivityLetterboxHeight && topActivityLetterboxAppWidth == that.topActivityLetterboxAppWidth && topActivityLetterboxAppHeight == that.topActivityLetterboxAppHeight && isUserFullscreenOverrideEnabled == that.isUserFullscreenOverrideEnabled && isSystemFullscreenOverrideEnabled == that.isSystemFullscreenOverrideEnabled && cameraCompatTaskInfo.equalsForCompatUi(that.cameraCompatTaskInfo); } Loading @@ -215,21 +349,13 @@ public class AppCompatTaskInfo implements Parcelable { * Reads the AppCompatTaskInfo from a parcel. */ void readFromParcel(Parcel source) { isLetterboxEducationEnabled = source.readBoolean(); topActivityInSizeCompat = source.readBoolean(); topActivityEligibleForLetterboxEducation = source.readBoolean(); isLetterboxDoubleTapEnabled = source.readBoolean(); topActivityEligibleForUserAspectRatioButton = source.readBoolean(); topActivityBoundsLetterboxed = source.readBoolean(); isFromLetterboxDoubleTap = source.readBoolean(); mTopActivityFlags = source.readInt(); topActivityLetterboxVerticalPosition = source.readInt(); topActivityLetterboxHorizontalPosition = source.readInt(); topActivityLetterboxWidth = source.readInt(); topActivityLetterboxHeight = source.readInt(); topActivityLetterboxAppWidth = source.readInt(); topActivityLetterboxAppHeight = source.readInt(); isUserFullscreenOverrideEnabled = source.readBoolean(); isSystemFullscreenOverrideEnabled = source.readBoolean(); cameraCompatTaskInfo = source.readTypedObject(CameraCompatTaskInfo.CREATOR); } Loading @@ -238,35 +364,25 @@ public class AppCompatTaskInfo implements Parcelable { */ @Override public void writeToParcel(Parcel dest, int flags) { dest.writeBoolean(isLetterboxEducationEnabled); dest.writeBoolean(topActivityInSizeCompat); dest.writeBoolean(topActivityEligibleForLetterboxEducation); dest.writeBoolean(isLetterboxDoubleTapEnabled); dest.writeBoolean(topActivityEligibleForUserAspectRatioButton); dest.writeBoolean(topActivityBoundsLetterboxed); dest.writeBoolean(isFromLetterboxDoubleTap); dest.writeInt(mTopActivityFlags); dest.writeInt(topActivityLetterboxVerticalPosition); dest.writeInt(topActivityLetterboxHorizontalPosition); dest.writeInt(topActivityLetterboxWidth); dest.writeInt(topActivityLetterboxHeight); dest.writeInt(topActivityLetterboxAppWidth); dest.writeInt(topActivityLetterboxAppHeight); dest.writeBoolean(isUserFullscreenOverrideEnabled); dest.writeBoolean(isSystemFullscreenOverrideEnabled); dest.writeTypedObject(cameraCompatTaskInfo, flags); } @Override public String toString() { return "AppCompatTaskInfo { topActivityInSizeCompat=" + topActivityInSizeCompat + " topActivityEligibleForLetterboxEducation= " + topActivityEligibleForLetterboxEducation + "isLetterboxEducationEnabled= " + isLetterboxEducationEnabled + " isLetterboxDoubleTapEnabled= " + isLetterboxDoubleTapEnabled + " topActivityEligibleForUserAspectRatioButton= " + topActivityEligibleForUserAspectRatioButton + " topActivityBoundsLetterboxed= " + topActivityBoundsLetterboxed + " isFromLetterboxDoubleTap= " + isFromLetterboxDoubleTap return "AppCompatTaskInfo { topActivityInSizeCompat=" + isTopActivityInSizeCompat() + " eligibleForLetterboxEducation= " + eligibleForLetterboxEducation() + " isLetterboxEducationEnabled= " + isLetterboxEducationEnabled() + " isLetterboxDoubleTapEnabled= " + isLetterboxDoubleTapEnabled() + " eligibleForUserAspectRatioButton= " + eligibleForUserAspectRatioButton() + " topActivityBoundsLetterboxed= " + isTopActivityLetterboxed() + " isFromLetterboxDoubleTap= " + isFromLetterboxDoubleTap() + " topActivityLetterboxVerticalPosition= " + topActivityLetterboxVerticalPosition + " topActivityLetterboxHorizontalPosition= " + topActivityLetterboxHorizontalPosition Loading @@ -274,9 +390,17 @@ public class AppCompatTaskInfo implements Parcelable { + " topActivityLetterboxHeight=" + topActivityLetterboxHeight + " topActivityLetterboxAppWidth=" + topActivityLetterboxAppWidth + " topActivityLetterboxAppHeight=" + topActivityLetterboxAppHeight + " isUserFullscreenOverrideEnabled=" + isUserFullscreenOverrideEnabled + " isSystemFullscreenOverrideEnabled=" + isSystemFullscreenOverrideEnabled + " isUserFullscreenOverrideEnabled=" + isUserFullscreenOverrideEnabled() + " isSystemFullscreenOverrideEnabled=" + isSystemFullscreenOverrideEnabled() + " cameraCompatTaskInfo=" + cameraCompatTaskInfo.toString() + "}"; } private void setTopActivityFlag(@TopActivityFlag int flag, boolean enable) { mTopActivityFlags = enable ? (mTopActivityFlags | flag) : (mTopActivityFlags & ~flag); } private boolean isTopActivityFlagEnabled(@TopActivityFlag int flag) { return (mTopActivityFlags & flag) == flag; } } Loading
AconfigFlags.bp +7 −0 Original line number Diff line number Diff line Loading @@ -478,6 +478,13 @@ java_aconfig_library { defaults: ["framework-minus-apex-aconfig-java-defaults"], } cc_aconfig_library { name: "android.os.vibrator.flags-aconfig-cc", aconfig_declarations: "android.os.vibrator.flags-aconfig", host_supported: true, vendor_available: true, } // View aconfig_declarations { name: "android.view.flags-aconfig", Loading
Ravenwood.bp +2 −1 Original line number Diff line number Diff line Loading @@ -159,7 +159,8 @@ java_library { "framework-minus-apex.ravenwood", ], sdk_version: "core_platform", jarjar_rules: ":ravenwood-framework-jarjar-rules", // See b/313930116. Jarjar is too slow on this jar. We use HostStubGen to do the rename. // jarjar_rules: ":ravenwood-framework-jarjar-rules", } java_genrule { Loading
config/preloaded-classes-denylist +15 −5 Original line number Diff line number Diff line android.content.AsyncTaskLoader$LoadTask android.media.MediaCodecInfo$CodecCapabilities$FeatureList android.media.MediaCodecInfo$LazyHolder android.net.ConnectivityThread$Singleton android.net.rtp.AudioGroup android.net.rtp.AudioStream android.net.rtp.RtpStream android.os.FileObserver android.os.NullVibrator android.permission.PermissionManager android.provider.MediaStore android.speech.tts.TextToSpeech$Connection$SetupConnectionAsyncTask android.view.HdrRenderState android.text.TextFlags android.widget.Magnifier com.android.internal.jank.InteractionJankMonitor$InstanceHolder com.android.internal.os.BinderCallsStats$SettingsObserver com.android.internal.util.LatencyTracker$SLatencyTrackerHolder com.android.server.BootReceiver$2 gov.nist.core.net.DefaultNetworkLayer android.net.rtp.AudioGroup android.net.rtp.AudioStream android.net.rtp.RtpStream java.util.concurrent.ThreadLocalRandom java.util.ImmutableCollections com.android.internal.jank.InteractionJankMonitor$InstanceHolder java.util.concurrent.ThreadLocalRandom sun.nio.fs.UnixChannelFactory
core/api/system-current.txt +1 −1 Original line number Diff line number Diff line Loading @@ -3448,7 +3448,7 @@ package android.companion.virtual { } public static interface VirtualDeviceManager.ActivityListener { method @FlaggedApi("android.companion.virtualdevice.flags.activity_control_api") public default void onActivityLaunchBlocked(int, @NonNull android.content.ComponentName, int); method @FlaggedApi("android.companion.virtualdevice.flags.activity_control_api") public default void onActivityLaunchBlocked(int, @NonNull android.content.ComponentName, int, @Nullable android.content.IntentSender); method public void onDisplayEmpty(int); method @Deprecated public void onTopActivityChanged(int, @NonNull android.content.ComponentName); method public default void onTopActivityChanged(int, @NonNull android.content.ComponentName, int);
core/java/android/app/AppCompatTaskInfo.java +216 −92 Original line number Diff line number Diff line Loading @@ -18,62 +18,20 @@ package android.app; import static android.app.TaskInfo.PROPERTY_VALUE_UNSET; import android.annotation.IntDef; import android.annotation.NonNull; import android.annotation.Nullable; import android.os.Parcel; import android.os.Parcelable; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; /** * Stores App Compat information about a particular Task. * @hide */ public class AppCompatTaskInfo implements Parcelable { /** * Whether the direct top activity is eligible for letterbox education. */ public boolean topActivityEligibleForLetterboxEducation; /** * Whether the letterbox education is enabled. */ public boolean isLetterboxEducationEnabled; /** * Whether the direct top activity is in size compat mode on foreground. */ public boolean topActivityInSizeCompat; /** * Whether the double tap is enabled. */ public boolean isLetterboxDoubleTapEnabled; /** * Whether the user aspect ratio settings button is enabled. */ public boolean topActivityEligibleForUserAspectRatioButton; /** * Whether the user has forced the activity to be fullscreen through the user aspect ratio * settings. */ public boolean isUserFullscreenOverrideEnabled; /** * Whether the system has forced the activity to be fullscreen */ public boolean isSystemFullscreenOverrideEnabled; /** * Hint about the letterbox state of the top activity. */ public boolean topActivityBoundsLetterboxed; /** * Whether the update comes from a letterbox double-tap action from the user or not. */ public boolean isFromLetterboxDoubleTap; /** * If {@link #isLetterboxDoubleTapEnabled} it contains the current letterbox vertical position * or {@link TaskInfo#PROPERTY_VALUE_UNSET} otherwise. Loading Loading @@ -115,6 +73,57 @@ public class AppCompatTaskInfo implements Parcelable { */ public CameraCompatTaskInfo cameraCompatTaskInfo = CameraCompatTaskInfo.create(); /** Constant indicating no top activity flag has been set. */ private static final int FLAG_UNDEFINED = 0x0; /** Constant base value for top activity flag. */ private static final int FLAG_BASE = 0x1; /** Top activity flag for whether letterbox education is enabled. */ private static final int FLAG_LETTERBOX_EDU_ENABLED = FLAG_BASE; /** Top activity flag for whether activity is eligible for letterbox education. */ private static final int FLAG_ELIGIBLE_FOR_LETTERBOX_EDU = FLAG_BASE << 1; /** Top activity flag for whether activity bounds are letterboxed. */ private static final int FLAG_LETTERBOXED = FLAG_BASE << 2; /** Top activity flag for whether activity is in size compat mode. */ private static final int FLAG_IN_SIZE_COMPAT = FLAG_BASE << 3; /** Top activity flag for whether letterbox double tap is enabled. */ private static final int FLAG_LETTERBOX_DOUBLE_TAP_ENABLED = FLAG_BASE << 4; /** Top activity flag for whether the update comes from a letterbox double tap action. */ private static final int FLAG_IS_FROM_LETTERBOX_DOUBLE_TAP = FLAG_BASE << 5; /** Top activity flag for whether activity is eligible for user aspect ratio button. */ private static final int FLAG_ELIGIBLE_FOR_USER_ASPECT_RATIO_BUTTON = FLAG_BASE << 6; /** Top activity flag for whether has activity has been overridden to fullscreen by system. */ private static final int FLAG_FULLSCREEN_OVERRIDE_SYSTEM = FLAG_BASE << 7; /** Top activity flag for whether has activity has been overridden to fullscreen by user. */ private static final int FLAG_FULLSCREEN_OVERRIDE_USER = FLAG_BASE << 8; @Retention(RetentionPolicy.SOURCE) @IntDef(flag = true, value = { FLAG_UNDEFINED, FLAG_BASE, FLAG_LETTERBOX_EDU_ENABLED, FLAG_ELIGIBLE_FOR_LETTERBOX_EDU, FLAG_LETTERBOXED, FLAG_IN_SIZE_COMPAT, FLAG_LETTERBOX_DOUBLE_TAP_ENABLED, FLAG_IS_FROM_LETTERBOX_DOUBLE_TAP, FLAG_ELIGIBLE_FOR_USER_ASPECT_RATIO_BUTTON, FLAG_FULLSCREEN_OVERRIDE_SYSTEM, FLAG_FULLSCREEN_OVERRIDE_USER }) public @interface TopActivityFlag {} @TopActivityFlag private int mTopActivityFlags; @TopActivityFlag private static final int FLAGS_ORGANIZER_INTERESTED = FLAG_IS_FROM_LETTERBOX_DOUBLE_TAP | FLAG_ELIGIBLE_FOR_USER_ASPECT_RATIO_BUTTON | FLAG_FULLSCREEN_OVERRIDE_SYSTEM | FLAG_FULLSCREEN_OVERRIDE_USER; @TopActivityFlag private static final int FLAGS_COMPAT_UI_INTERESTED = FLAGS_ORGANIZER_INTERESTED | FLAG_IN_SIZE_COMPAT | FLAG_ELIGIBLE_FOR_LETTERBOX_EDU | FLAG_LETTERBOX_EDU_ENABLED; private AppCompatTaskInfo() { // Do nothing } Loading Loading @@ -150,9 +159,8 @@ public class AppCompatTaskInfo implements Parcelable { * @return {@code true} if the task has some compat ui. */ public boolean hasCompatUI() { return topActivityInSizeCompat || topActivityEligibleForLetterboxEducation || isLetterboxDoubleTapEnabled || topActivityEligibleForUserAspectRatioButton; return isTopActivityInSizeCompat() || eligibleForLetterboxEducation() || isLetterboxDoubleTapEnabled() || eligibleForUserAspectRatioButton(); } /** Loading @@ -162,6 +170,142 @@ public class AppCompatTaskInfo implements Parcelable { return topActivityLetterboxWidth < topActivityLetterboxHeight; } /** * @return {@code true} if the letterbox education is enabled. */ public boolean isLetterboxEducationEnabled() { return isTopActivityFlagEnabled(FLAG_LETTERBOX_EDU_ENABLED); } /** * Sets the top activity flag for whether letterbox education is enabled. */ public void setLetterboxEducationEnabled(boolean enable) { setTopActivityFlag(FLAG_LETTERBOX_EDU_ENABLED, enable); } /** * @return {@code true} if the direct top activity is eligible for letterbox education. */ public boolean eligibleForLetterboxEducation() { return isTopActivityFlagEnabled(FLAG_ELIGIBLE_FOR_LETTERBOX_EDU); } /** * Sets the top activity flag to be eligible for letterbox education. */ public void setEligibleForLetterboxEducation(boolean enable) { setTopActivityFlag(FLAG_ELIGIBLE_FOR_LETTERBOX_EDU, enable); } /** * @return {@code true} if the direct top activity is eligible for the user aspect ratio * settings button. */ public boolean eligibleForUserAspectRatioButton() { return isTopActivityFlagEnabled(FLAG_ELIGIBLE_FOR_USER_ASPECT_RATIO_BUTTON); } /** * Sets the top activity flag to be eligible for the user aspect ratio settings button. */ public void setEligibleForUserAspectRatioButton(boolean enable) { setTopActivityFlag(FLAG_ELIGIBLE_FOR_USER_ASPECT_RATIO_BUTTON, enable); } /** * @return {@code true} if double tap to reposition letterboxed app is enabled. */ public boolean isLetterboxDoubleTapEnabled() { return isTopActivityFlagEnabled(FLAG_LETTERBOX_DOUBLE_TAP_ENABLED); } /** * Sets the top activity flag to enable double tap to reposition letterboxed app. */ public void setLetterboxDoubleTapEnabled(boolean enable) { setTopActivityFlag(FLAG_LETTERBOX_DOUBLE_TAP_ENABLED, enable); } /** * @return {@code true} if the update comes from a letterbox double-tap action from the user. */ public boolean isFromLetterboxDoubleTap() { return isTopActivityFlagEnabled(FLAG_IS_FROM_LETTERBOX_DOUBLE_TAP); } /** * Sets the top activity flag for whether the update comes from a letterbox double-tap action * from the user. */ public void setIsFromLetterboxDoubleTap(boolean enable) { setTopActivityFlag(FLAG_IS_FROM_LETTERBOX_DOUBLE_TAP, enable); } /** * @return {@code true} if the user has forced the activity to be fullscreen through the * user aspect ratio settings. */ public boolean isUserFullscreenOverrideEnabled() { return isTopActivityFlagEnabled(FLAG_FULLSCREEN_OVERRIDE_USER); } /** * Sets the top activity flag for whether the user has forced the activity to be fullscreen * through the user aspect ratio settings. */ public void setUserFullscreenOverrideEnabled(boolean enable) { setTopActivityFlag(FLAG_FULLSCREEN_OVERRIDE_USER, enable); } /** * @return {@code true} if the system has forced the activity to be fullscreen. */ public boolean isSystemFullscreenOverrideEnabled() { return isTopActivityFlagEnabled(FLAG_FULLSCREEN_OVERRIDE_SYSTEM); } /** * Sets the top activity flag for whether the system has forced the activity to be fullscreen. */ public void setSystemFullscreenOverrideEnabled(boolean enable) { setTopActivityFlag(FLAG_FULLSCREEN_OVERRIDE_SYSTEM, enable); } /** * @return {@code true} if the direct top activity is in size compat mode on foreground. */ public boolean isTopActivityInSizeCompat() { return isTopActivityFlagEnabled(FLAG_IN_SIZE_COMPAT); } /** * Sets the top activity flag for whether the direct top activity is in size compat mode * on foreground. */ public void setTopActivityInSizeCompat(boolean enable) { setTopActivityFlag(FLAG_IN_SIZE_COMPAT, enable); } /** * @return {@code true} if the top activity bounds are letterboxed. */ public boolean isTopActivityLetterboxed() { return isTopActivityFlagEnabled(FLAG_LETTERBOXED); } /** * Sets the top activity flag for whether the top activity bounds are letterboxed. */ public void setTopActivityLetterboxed(boolean enable) { setTopActivityFlag(FLAG_LETTERBOXED, enable); } /** Clear all top activity flags and set to false. */ public void clearTopActivityFlags() { mTopActivityFlags = FLAG_UNDEFINED; } /** * @return {@code true} if the app compat parameters that are important for task organizers * are equal. Loading @@ -170,9 +314,8 @@ public class AppCompatTaskInfo implements Parcelable { if (that == null) { return false; } return isFromLetterboxDoubleTap == that.isFromLetterboxDoubleTap && topActivityEligibleForUserAspectRatioButton == that.topActivityEligibleForUserAspectRatioButton return (mTopActivityFlags & FLAGS_ORGANIZER_INTERESTED) == (that.mTopActivityFlags & FLAGS_ORGANIZER_INTERESTED) && topActivityLetterboxVerticalPosition == that.topActivityLetterboxVerticalPosition && topActivityLetterboxWidth == that.topActivityLetterboxWidth && topActivityLetterboxHeight == that.topActivityLetterboxHeight Loading @@ -180,8 +323,6 @@ public class AppCompatTaskInfo implements Parcelable { && topActivityLetterboxAppHeight == that.topActivityLetterboxAppHeight && topActivityLetterboxHorizontalPosition == that.topActivityLetterboxHorizontalPosition && isUserFullscreenOverrideEnabled == that.isUserFullscreenOverrideEnabled && isSystemFullscreenOverrideEnabled == that.isSystemFullscreenOverrideEnabled && cameraCompatTaskInfo.equalsForTaskOrganizer(that.cameraCompatTaskInfo); } Loading @@ -192,13 +333,8 @@ public class AppCompatTaskInfo implements Parcelable { if (that == null) { return false; } return topActivityInSizeCompat == that.topActivityInSizeCompat && isFromLetterboxDoubleTap == that.isFromLetterboxDoubleTap && topActivityEligibleForUserAspectRatioButton == that.topActivityEligibleForUserAspectRatioButton && topActivityEligibleForLetterboxEducation == that.topActivityEligibleForLetterboxEducation && isLetterboxEducationEnabled == that.isLetterboxEducationEnabled return (mTopActivityFlags & FLAGS_COMPAT_UI_INTERESTED) == (that.mTopActivityFlags & FLAGS_COMPAT_UI_INTERESTED) && topActivityLetterboxVerticalPosition == that.topActivityLetterboxVerticalPosition && topActivityLetterboxHorizontalPosition == that.topActivityLetterboxHorizontalPosition Loading @@ -206,8 +342,6 @@ public class AppCompatTaskInfo implements Parcelable { && topActivityLetterboxHeight == that.topActivityLetterboxHeight && topActivityLetterboxAppWidth == that.topActivityLetterboxAppWidth && topActivityLetterboxAppHeight == that.topActivityLetterboxAppHeight && isUserFullscreenOverrideEnabled == that.isUserFullscreenOverrideEnabled && isSystemFullscreenOverrideEnabled == that.isSystemFullscreenOverrideEnabled && cameraCompatTaskInfo.equalsForCompatUi(that.cameraCompatTaskInfo); } Loading @@ -215,21 +349,13 @@ public class AppCompatTaskInfo implements Parcelable { * Reads the AppCompatTaskInfo from a parcel. */ void readFromParcel(Parcel source) { isLetterboxEducationEnabled = source.readBoolean(); topActivityInSizeCompat = source.readBoolean(); topActivityEligibleForLetterboxEducation = source.readBoolean(); isLetterboxDoubleTapEnabled = source.readBoolean(); topActivityEligibleForUserAspectRatioButton = source.readBoolean(); topActivityBoundsLetterboxed = source.readBoolean(); isFromLetterboxDoubleTap = source.readBoolean(); mTopActivityFlags = source.readInt(); topActivityLetterboxVerticalPosition = source.readInt(); topActivityLetterboxHorizontalPosition = source.readInt(); topActivityLetterboxWidth = source.readInt(); topActivityLetterboxHeight = source.readInt(); topActivityLetterboxAppWidth = source.readInt(); topActivityLetterboxAppHeight = source.readInt(); isUserFullscreenOverrideEnabled = source.readBoolean(); isSystemFullscreenOverrideEnabled = source.readBoolean(); cameraCompatTaskInfo = source.readTypedObject(CameraCompatTaskInfo.CREATOR); } Loading @@ -238,35 +364,25 @@ public class AppCompatTaskInfo implements Parcelable { */ @Override public void writeToParcel(Parcel dest, int flags) { dest.writeBoolean(isLetterboxEducationEnabled); dest.writeBoolean(topActivityInSizeCompat); dest.writeBoolean(topActivityEligibleForLetterboxEducation); dest.writeBoolean(isLetterboxDoubleTapEnabled); dest.writeBoolean(topActivityEligibleForUserAspectRatioButton); dest.writeBoolean(topActivityBoundsLetterboxed); dest.writeBoolean(isFromLetterboxDoubleTap); dest.writeInt(mTopActivityFlags); dest.writeInt(topActivityLetterboxVerticalPosition); dest.writeInt(topActivityLetterboxHorizontalPosition); dest.writeInt(topActivityLetterboxWidth); dest.writeInt(topActivityLetterboxHeight); dest.writeInt(topActivityLetterboxAppWidth); dest.writeInt(topActivityLetterboxAppHeight); dest.writeBoolean(isUserFullscreenOverrideEnabled); dest.writeBoolean(isSystemFullscreenOverrideEnabled); dest.writeTypedObject(cameraCompatTaskInfo, flags); } @Override public String toString() { return "AppCompatTaskInfo { topActivityInSizeCompat=" + topActivityInSizeCompat + " topActivityEligibleForLetterboxEducation= " + topActivityEligibleForLetterboxEducation + "isLetterboxEducationEnabled= " + isLetterboxEducationEnabled + " isLetterboxDoubleTapEnabled= " + isLetterboxDoubleTapEnabled + " topActivityEligibleForUserAspectRatioButton= " + topActivityEligibleForUserAspectRatioButton + " topActivityBoundsLetterboxed= " + topActivityBoundsLetterboxed + " isFromLetterboxDoubleTap= " + isFromLetterboxDoubleTap return "AppCompatTaskInfo { topActivityInSizeCompat=" + isTopActivityInSizeCompat() + " eligibleForLetterboxEducation= " + eligibleForLetterboxEducation() + " isLetterboxEducationEnabled= " + isLetterboxEducationEnabled() + " isLetterboxDoubleTapEnabled= " + isLetterboxDoubleTapEnabled() + " eligibleForUserAspectRatioButton= " + eligibleForUserAspectRatioButton() + " topActivityBoundsLetterboxed= " + isTopActivityLetterboxed() + " isFromLetterboxDoubleTap= " + isFromLetterboxDoubleTap() + " topActivityLetterboxVerticalPosition= " + topActivityLetterboxVerticalPosition + " topActivityLetterboxHorizontalPosition= " + topActivityLetterboxHorizontalPosition Loading @@ -274,9 +390,17 @@ public class AppCompatTaskInfo implements Parcelable { + " topActivityLetterboxHeight=" + topActivityLetterboxHeight + " topActivityLetterboxAppWidth=" + topActivityLetterboxAppWidth + " topActivityLetterboxAppHeight=" + topActivityLetterboxAppHeight + " isUserFullscreenOverrideEnabled=" + isUserFullscreenOverrideEnabled + " isSystemFullscreenOverrideEnabled=" + isSystemFullscreenOverrideEnabled + " isUserFullscreenOverrideEnabled=" + isUserFullscreenOverrideEnabled() + " isSystemFullscreenOverrideEnabled=" + isSystemFullscreenOverrideEnabled() + " cameraCompatTaskInfo=" + cameraCompatTaskInfo.toString() + "}"; } private void setTopActivityFlag(@TopActivityFlag int flag, boolean enable) { mTopActivityFlags = enable ? (mTopActivityFlags | flag) : (mTopActivityFlags & ~flag); } private boolean isTopActivityFlagEnabled(@TopActivityFlag int flag) { return (mTopActivityFlags & flag) == flag; } }