Loading core/java/android/content/pm/ActivityInfo.java +13 −0 Original line number Diff line number Diff line Loading @@ -1642,6 +1642,19 @@ public class ActivityInfo extends ComponentInfo implements Parcelable { @Overridable public static final long OVERRIDE_ENABLE_INSETS_DECOUPLED_CONFIGURATION = 327313645L; /** * When the override is enabled, the activity receives configuration coupled with caption bar * insets. Normally, caption bar insets are decoupled from configuration. * * <p>Override applies only if the activity targets SDK level 34 or earlier version. * * @hide */ @ChangeId @Overridable @Disabled public static final long OVERRIDE_EXCLUDE_CAPTION_INSETS_FROM_APP_BOUNDS = 388014743L; /** * Optional set of a certificates identifying apps that are allowed to embed this activity. From * the "knownActivityEmbeddingCerts" attribute. Loading libs/WindowManager/Shell/shared/src/com/android/wm/shell/shared/desktopmode/DesktopModeCompatPolicy.kt +6 −2 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ import android.content.Context import android.content.pm.ActivityInfo import android.content.pm.ActivityInfo.INSETS_DECOUPLED_CONFIGURATION_ENFORCED import android.content.pm.ActivityInfo.OVERRIDE_ENABLE_INSETS_DECOUPLED_CONFIGURATION import android.content.pm.ActivityInfo.OVERRIDE_EXCLUDE_CAPTION_INSETS_FROM_APP_BOUNDS import android.window.DesktopModeFlags import com.android.internal.R import com.android.window.flags.Flags Loading Loading @@ -59,13 +60,16 @@ class DesktopModeCompatPolicy(private val context: Context) { * The treatment is enabled when all the of the following is true: * * Any flags to forcibly consume caption insets are enabled. * * Top activity have configuration coupled with insets. * * Task is not resizeable. * * Task is not resizeable or [ActivityInfo.OVERRIDE_EXCLUDE_CAPTION_INSETS_FROM_APP_BOUNDS] * is enabled. */ fun shouldExcludeCaptionFromAppBounds(taskInfo: TaskInfo): Boolean = Flags.excludeCaptionFromAppBounds() && isAnyForceConsumptionFlagsEnabled() && taskInfo.topActivityInfo?.let { isInsetsCoupledWithConfiguration(it) && !taskInfo.isResizeable isInsetsCoupledWithConfiguration(it) && (!taskInfo.isResizeable || it.isChangeEnabled( OVERRIDE_EXCLUDE_CAPTION_INSETS_FROM_APP_BOUNDS )) } ?: false /** Loading libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/shared/desktopmode/DesktopModeCompatPolicyTest.kt +11 −0 Original line number Diff line number Diff line Loading @@ -181,6 +181,17 @@ class DesktopModeCompatPolicyTest : ShellTestCase() { ) } @Test @EnableFlags(Flags.FLAG_EXCLUDE_CAPTION_FROM_APP_BOUNDS) @DisableCompatChanges(ActivityInfo.INSETS_DECOUPLED_CONFIGURATION_ENFORCED) @EnableCompatChanges(ActivityInfo.OVERRIDE_EXCLUDE_CAPTION_INSETS_FROM_APP_BOUNDS) fun testShouldExcludeCaptionFromAppBounds_resizeable_overridden_true() { assertTrue(desktopModeCompatPolicy.shouldExcludeCaptionFromAppBounds( setUpFreeformTask().apply { isResizeable = true }) ) } fun setUpFreeformTask(): TaskInfo = createFreeformTask().apply { val componentName = Loading Loading
core/java/android/content/pm/ActivityInfo.java +13 −0 Original line number Diff line number Diff line Loading @@ -1642,6 +1642,19 @@ public class ActivityInfo extends ComponentInfo implements Parcelable { @Overridable public static final long OVERRIDE_ENABLE_INSETS_DECOUPLED_CONFIGURATION = 327313645L; /** * When the override is enabled, the activity receives configuration coupled with caption bar * insets. Normally, caption bar insets are decoupled from configuration. * * <p>Override applies only if the activity targets SDK level 34 or earlier version. * * @hide */ @ChangeId @Overridable @Disabled public static final long OVERRIDE_EXCLUDE_CAPTION_INSETS_FROM_APP_BOUNDS = 388014743L; /** * Optional set of a certificates identifying apps that are allowed to embed this activity. From * the "knownActivityEmbeddingCerts" attribute. Loading
libs/WindowManager/Shell/shared/src/com/android/wm/shell/shared/desktopmode/DesktopModeCompatPolicy.kt +6 −2 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ import android.content.Context import android.content.pm.ActivityInfo import android.content.pm.ActivityInfo.INSETS_DECOUPLED_CONFIGURATION_ENFORCED import android.content.pm.ActivityInfo.OVERRIDE_ENABLE_INSETS_DECOUPLED_CONFIGURATION import android.content.pm.ActivityInfo.OVERRIDE_EXCLUDE_CAPTION_INSETS_FROM_APP_BOUNDS import android.window.DesktopModeFlags import com.android.internal.R import com.android.window.flags.Flags Loading Loading @@ -59,13 +60,16 @@ class DesktopModeCompatPolicy(private val context: Context) { * The treatment is enabled when all the of the following is true: * * Any flags to forcibly consume caption insets are enabled. * * Top activity have configuration coupled with insets. * * Task is not resizeable. * * Task is not resizeable or [ActivityInfo.OVERRIDE_EXCLUDE_CAPTION_INSETS_FROM_APP_BOUNDS] * is enabled. */ fun shouldExcludeCaptionFromAppBounds(taskInfo: TaskInfo): Boolean = Flags.excludeCaptionFromAppBounds() && isAnyForceConsumptionFlagsEnabled() && taskInfo.topActivityInfo?.let { isInsetsCoupledWithConfiguration(it) && !taskInfo.isResizeable isInsetsCoupledWithConfiguration(it) && (!taskInfo.isResizeable || it.isChangeEnabled( OVERRIDE_EXCLUDE_CAPTION_INSETS_FROM_APP_BOUNDS )) } ?: false /** Loading
libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/shared/desktopmode/DesktopModeCompatPolicyTest.kt +11 −0 Original line number Diff line number Diff line Loading @@ -181,6 +181,17 @@ class DesktopModeCompatPolicyTest : ShellTestCase() { ) } @Test @EnableFlags(Flags.FLAG_EXCLUDE_CAPTION_FROM_APP_BOUNDS) @DisableCompatChanges(ActivityInfo.INSETS_DECOUPLED_CONFIGURATION_ENFORCED) @EnableCompatChanges(ActivityInfo.OVERRIDE_EXCLUDE_CAPTION_INSETS_FROM_APP_BOUNDS) fun testShouldExcludeCaptionFromAppBounds_resizeable_overridden_true() { assertTrue(desktopModeCompatPolicy.shouldExcludeCaptionFromAppBounds( setUpFreeformTask().apply { isResizeable = true }) ) } fun setUpFreeformTask(): TaskInfo = createFreeformTask().apply { val componentName = Loading