Loading core/java/android/content/pm/ActivityInfo.java +20 −0 Original line number Diff line number Diff line Loading @@ -1528,6 +1528,26 @@ public class ActivityInfo extends ComponentInfo implements Parcelable { @EnabledSince(targetSdkVersion = Build.VERSION_CODES.VANILLA_ICE_CREAM) public static final long INSETS_DECOUPLED_CONFIGURATION_ENFORCED = 151861875L; /** * When enabled, the activity will receive configuration decoupled from system bar insets. * * <p>This will only apply if the activity is targeting SDK level 34 or earlier versions. * * <p>This will only in effect if the device is trying to provide a different value by default * other than the legacy value, i.e., the * {@code Flags.allowsScreenSizeDecoupledFromStatusBarAndCutout()} is set to true. * * <p>If the {@code Flags.insetsDecoupledConfiguration()} is also set to true, all apps * targeting SDK level 35 or later, and apps with this override flag will receive the insets * decoupled configuration. * * @hide */ @ChangeId @Disabled @Overridable public static final long OVERRIDE_ENABLE_INSETS_DECOUPLED_CONFIGURATION = 327313645L; /** * Optional set of a certificates identifying apps that are allowed to embed this activity. From * the "knownActivityEmbeddingCerts" attribute. Loading services/core/java/com/android/server/wm/ActivityRecord.java +20 −9 Original line number Diff line number Diff line Loading @@ -76,6 +76,7 @@ import static android.content.pm.ActivityInfo.FLAG_NO_HISTORY; import static android.content.pm.ActivityInfo.FLAG_SHOW_FOR_ALL_USERS; import static android.content.pm.ActivityInfo.FLAG_STATE_NOT_NEEDED; import static android.content.pm.ActivityInfo.FLAG_TURN_SCREEN_ON; import static android.content.pm.ActivityInfo.OVERRIDE_ENABLE_INSETS_DECOUPLED_CONFIGURATION; import static android.content.pm.ActivityInfo.INSETS_DECOUPLED_CONFIGURATION_ENFORCED; import static android.content.pm.ActivityInfo.LAUNCH_MULTIPLE; import static android.content.pm.ActivityInfo.LAUNCH_SINGLE_INSTANCE; Loading Loading @@ -2119,9 +2120,19 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A mCameraCompatControlEnabled = mWmService.mContext.getResources() .getBoolean(R.bool.config_isCameraCompatControlForStretchedIssuesEnabled); mResolveConfigHint = new TaskFragment.ConfigOverrideHint(); mResolveConfigHint.mUseLegacyInsetsForStableBounds = mWmService.mFlags.mInsetsDecoupledConfiguration && !info.isChangeEnabled(INSETS_DECOUPLED_CONFIGURATION_ENFORCED); if (mWmService.mFlags.mInsetsDecoupledConfiguration) { // When the stable configuration is the default behavior, override for the legacy apps // without forward override flag. mResolveConfigHint.mUseOverrideInsetsForStableBounds = !info.isChangeEnabled(INSETS_DECOUPLED_CONFIGURATION_ENFORCED) && !info.isChangeEnabled( OVERRIDE_ENABLE_INSETS_DECOUPLED_CONFIGURATION); } else { // When the stable configuration is not the default behavior, forward overriding the // listed apps. mResolveConfigHint.mUseOverrideInsetsForStableBounds = info.isChangeEnabled(OVERRIDE_ENABLE_INSETS_DECOUPLED_CONFIGURATION); } mTargetSdk = info.applicationInfo.targetSdkVersion; Loading Loading @@ -8425,7 +8436,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A mCompatDisplayInsets = new CompatDisplayInsets( mDisplayContent, this, letterboxedContainerBounds, mResolveConfigHint.mUseLegacyInsetsForStableBounds); mResolveConfigHint.mUseOverrideInsetsForStableBounds); } private void clearSizeCompatModeAttributes() { Loading Loading @@ -8628,7 +8639,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A if (rotation == ROTATION_UNDEFINED && !isFixedRotationTransforming()) { rotation = mDisplayContent.getRotation(); } if (!mResolveConfigHint.mUseLegacyInsetsForStableBounds if (!mResolveConfigHint.mUseOverrideInsetsForStableBounds || getCompatDisplayInsets() != null || isFloating(parentWindowingMode) || parentAppBounds == null || parentAppBounds.isEmpty() || rotation == ROTATION_UNDEFINED) { Loading Loading @@ -8945,7 +8956,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A if (mDisplayContent == null) { return true; } if (!mResolveConfigHint.mUseLegacyInsetsForStableBounds) { if (!mResolveConfigHint.mUseOverrideInsetsForStableBounds) { // No insets should be considered any more. return true; } Loading @@ -8964,7 +8975,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A final Task task = getTask(); task.calculateInsetFrames(outNonDecorBounds /* outNonDecorBounds */, outStableBounds /* outStableBounds */, parentBounds /* bounds */, di, mResolveConfigHint.mUseLegacyInsetsForStableBounds); mResolveConfigHint.mUseOverrideInsetsForStableBounds); final int orientationWithInsets = outStableBounds.height() >= outStableBounds.width() ? ORIENTATION_PORTRAIT : ORIENTATION_LANDSCAPE; // If orientation does not match the orientation with insets applied, then a Loading Loading @@ -9021,7 +9032,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A getResolvedOverrideConfiguration().windowConfiguration.getBounds(); final int stableBoundsOrientation = stableBounds.width() > stableBounds.height() ? ORIENTATION_LANDSCAPE : ORIENTATION_PORTRAIT; final int parentOrientation = mResolveConfigHint.mUseLegacyInsetsForStableBounds final int parentOrientation = mResolveConfigHint.mUseOverrideInsetsForStableBounds ? stableBoundsOrientation : newParentConfig.orientation; // If the activity requires a different orientation (either by override or activityInfo), Loading @@ -9046,7 +9057,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A return; } final Rect parentAppBounds = mResolveConfigHint.mUseLegacyInsetsForStableBounds final Rect parentAppBounds = mResolveConfigHint.mUseOverrideInsetsForStableBounds ? outNonDecorBounds : newParentConfig.windowConfiguration.getAppBounds(); // TODO(b/182268157): Explore using only one type of parentBoundsWithInsets, either app // bounds or stable bounds to unify aspect ratio logic. Loading services/core/java/com/android/server/wm/TaskFragment.java +4 −4 Original line number Diff line number Diff line Loading @@ -2213,7 +2213,7 @@ class TaskFragment extends WindowContainer<WindowContainer> { static class ConfigOverrideHint { @Nullable DisplayInfo mTmpOverrideDisplayInfo; @Nullable ActivityRecord.CompatDisplayInsets mTmpCompatInsets; boolean mUseLegacyInsetsForStableBounds; boolean mUseOverrideInsetsForStableBounds; } void computeConfigResourceOverrides(@NonNull Configuration inOutConfig, Loading Loading @@ -2246,11 +2246,11 @@ class TaskFragment extends WindowContainer<WindowContainer> { @NonNull Configuration parentConfig, @Nullable ConfigOverrideHint overrideHint) { DisplayInfo overrideDisplayInfo = null; ActivityRecord.CompatDisplayInsets compatInsets = null; boolean useLegacyInsetsForStableBounds = false; boolean useOverrideInsetsForStableBounds = false; if (overrideHint != null) { overrideDisplayInfo = overrideHint.mTmpOverrideDisplayInfo; compatInsets = overrideHint.mTmpCompatInsets; useLegacyInsetsForStableBounds = overrideHint.mUseLegacyInsetsForStableBounds; useOverrideInsetsForStableBounds = overrideHint.mUseOverrideInsetsForStableBounds; if (overrideDisplayInfo != null) { // Make sure the screen related configs can be computed by the provided // display info. Loading Loading @@ -2330,7 +2330,7 @@ class TaskFragment extends WindowContainer<WindowContainer> { // The non decor inset are areas that could never be removed in Honeycomb. See // {@link WindowManagerPolicy#getNonDecorInsetsLw}. calculateInsetFrames(mTmpNonDecorBounds, mTmpStableBounds, mTmpFullBounds, di, useLegacyInsetsForStableBounds); useOverrideInsetsForStableBounds); } else { // Apply the given non-decor and stable insets to calculate the corresponding bounds // for screen size of configuration. Loading Loading
core/java/android/content/pm/ActivityInfo.java +20 −0 Original line number Diff line number Diff line Loading @@ -1528,6 +1528,26 @@ public class ActivityInfo extends ComponentInfo implements Parcelable { @EnabledSince(targetSdkVersion = Build.VERSION_CODES.VANILLA_ICE_CREAM) public static final long INSETS_DECOUPLED_CONFIGURATION_ENFORCED = 151861875L; /** * When enabled, the activity will receive configuration decoupled from system bar insets. * * <p>This will only apply if the activity is targeting SDK level 34 or earlier versions. * * <p>This will only in effect if the device is trying to provide a different value by default * other than the legacy value, i.e., the * {@code Flags.allowsScreenSizeDecoupledFromStatusBarAndCutout()} is set to true. * * <p>If the {@code Flags.insetsDecoupledConfiguration()} is also set to true, all apps * targeting SDK level 35 or later, and apps with this override flag will receive the insets * decoupled configuration. * * @hide */ @ChangeId @Disabled @Overridable public static final long OVERRIDE_ENABLE_INSETS_DECOUPLED_CONFIGURATION = 327313645L; /** * Optional set of a certificates identifying apps that are allowed to embed this activity. From * the "knownActivityEmbeddingCerts" attribute. Loading
services/core/java/com/android/server/wm/ActivityRecord.java +20 −9 Original line number Diff line number Diff line Loading @@ -76,6 +76,7 @@ import static android.content.pm.ActivityInfo.FLAG_NO_HISTORY; import static android.content.pm.ActivityInfo.FLAG_SHOW_FOR_ALL_USERS; import static android.content.pm.ActivityInfo.FLAG_STATE_NOT_NEEDED; import static android.content.pm.ActivityInfo.FLAG_TURN_SCREEN_ON; import static android.content.pm.ActivityInfo.OVERRIDE_ENABLE_INSETS_DECOUPLED_CONFIGURATION; import static android.content.pm.ActivityInfo.INSETS_DECOUPLED_CONFIGURATION_ENFORCED; import static android.content.pm.ActivityInfo.LAUNCH_MULTIPLE; import static android.content.pm.ActivityInfo.LAUNCH_SINGLE_INSTANCE; Loading Loading @@ -2119,9 +2120,19 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A mCameraCompatControlEnabled = mWmService.mContext.getResources() .getBoolean(R.bool.config_isCameraCompatControlForStretchedIssuesEnabled); mResolveConfigHint = new TaskFragment.ConfigOverrideHint(); mResolveConfigHint.mUseLegacyInsetsForStableBounds = mWmService.mFlags.mInsetsDecoupledConfiguration && !info.isChangeEnabled(INSETS_DECOUPLED_CONFIGURATION_ENFORCED); if (mWmService.mFlags.mInsetsDecoupledConfiguration) { // When the stable configuration is the default behavior, override for the legacy apps // without forward override flag. mResolveConfigHint.mUseOverrideInsetsForStableBounds = !info.isChangeEnabled(INSETS_DECOUPLED_CONFIGURATION_ENFORCED) && !info.isChangeEnabled( OVERRIDE_ENABLE_INSETS_DECOUPLED_CONFIGURATION); } else { // When the stable configuration is not the default behavior, forward overriding the // listed apps. mResolveConfigHint.mUseOverrideInsetsForStableBounds = info.isChangeEnabled(OVERRIDE_ENABLE_INSETS_DECOUPLED_CONFIGURATION); } mTargetSdk = info.applicationInfo.targetSdkVersion; Loading Loading @@ -8425,7 +8436,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A mCompatDisplayInsets = new CompatDisplayInsets( mDisplayContent, this, letterboxedContainerBounds, mResolveConfigHint.mUseLegacyInsetsForStableBounds); mResolveConfigHint.mUseOverrideInsetsForStableBounds); } private void clearSizeCompatModeAttributes() { Loading Loading @@ -8628,7 +8639,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A if (rotation == ROTATION_UNDEFINED && !isFixedRotationTransforming()) { rotation = mDisplayContent.getRotation(); } if (!mResolveConfigHint.mUseLegacyInsetsForStableBounds if (!mResolveConfigHint.mUseOverrideInsetsForStableBounds || getCompatDisplayInsets() != null || isFloating(parentWindowingMode) || parentAppBounds == null || parentAppBounds.isEmpty() || rotation == ROTATION_UNDEFINED) { Loading Loading @@ -8945,7 +8956,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A if (mDisplayContent == null) { return true; } if (!mResolveConfigHint.mUseLegacyInsetsForStableBounds) { if (!mResolveConfigHint.mUseOverrideInsetsForStableBounds) { // No insets should be considered any more. return true; } Loading @@ -8964,7 +8975,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A final Task task = getTask(); task.calculateInsetFrames(outNonDecorBounds /* outNonDecorBounds */, outStableBounds /* outStableBounds */, parentBounds /* bounds */, di, mResolveConfigHint.mUseLegacyInsetsForStableBounds); mResolveConfigHint.mUseOverrideInsetsForStableBounds); final int orientationWithInsets = outStableBounds.height() >= outStableBounds.width() ? ORIENTATION_PORTRAIT : ORIENTATION_LANDSCAPE; // If orientation does not match the orientation with insets applied, then a Loading Loading @@ -9021,7 +9032,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A getResolvedOverrideConfiguration().windowConfiguration.getBounds(); final int stableBoundsOrientation = stableBounds.width() > stableBounds.height() ? ORIENTATION_LANDSCAPE : ORIENTATION_PORTRAIT; final int parentOrientation = mResolveConfigHint.mUseLegacyInsetsForStableBounds final int parentOrientation = mResolveConfigHint.mUseOverrideInsetsForStableBounds ? stableBoundsOrientation : newParentConfig.orientation; // If the activity requires a different orientation (either by override or activityInfo), Loading @@ -9046,7 +9057,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A return; } final Rect parentAppBounds = mResolveConfigHint.mUseLegacyInsetsForStableBounds final Rect parentAppBounds = mResolveConfigHint.mUseOverrideInsetsForStableBounds ? outNonDecorBounds : newParentConfig.windowConfiguration.getAppBounds(); // TODO(b/182268157): Explore using only one type of parentBoundsWithInsets, either app // bounds or stable bounds to unify aspect ratio logic. Loading
services/core/java/com/android/server/wm/TaskFragment.java +4 −4 Original line number Diff line number Diff line Loading @@ -2213,7 +2213,7 @@ class TaskFragment extends WindowContainer<WindowContainer> { static class ConfigOverrideHint { @Nullable DisplayInfo mTmpOverrideDisplayInfo; @Nullable ActivityRecord.CompatDisplayInsets mTmpCompatInsets; boolean mUseLegacyInsetsForStableBounds; boolean mUseOverrideInsetsForStableBounds; } void computeConfigResourceOverrides(@NonNull Configuration inOutConfig, Loading Loading @@ -2246,11 +2246,11 @@ class TaskFragment extends WindowContainer<WindowContainer> { @NonNull Configuration parentConfig, @Nullable ConfigOverrideHint overrideHint) { DisplayInfo overrideDisplayInfo = null; ActivityRecord.CompatDisplayInsets compatInsets = null; boolean useLegacyInsetsForStableBounds = false; boolean useOverrideInsetsForStableBounds = false; if (overrideHint != null) { overrideDisplayInfo = overrideHint.mTmpOverrideDisplayInfo; compatInsets = overrideHint.mTmpCompatInsets; useLegacyInsetsForStableBounds = overrideHint.mUseLegacyInsetsForStableBounds; useOverrideInsetsForStableBounds = overrideHint.mUseOverrideInsetsForStableBounds; if (overrideDisplayInfo != null) { // Make sure the screen related configs can be computed by the provided // display info. Loading Loading @@ -2330,7 +2330,7 @@ class TaskFragment extends WindowContainer<WindowContainer> { // The non decor inset are areas that could never be removed in Honeycomb. See // {@link WindowManagerPolicy#getNonDecorInsetsLw}. calculateInsetFrames(mTmpNonDecorBounds, mTmpStableBounds, mTmpFullBounds, di, useLegacyInsetsForStableBounds); useOverrideInsetsForStableBounds); } else { // Apply the given non-decor and stable insets to calculate the corresponding bounds // for screen size of configuration. Loading