Loading services/core/java/com/android/server/wm/ActivityRecord.java +5 −3 Original line number Diff line number Diff line Loading @@ -8403,7 +8403,8 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A */ @ActivityInfo.SizeChangesSupportMode private int supportsSizeChanges() { if (mLetterboxUiController.shouldOverrideForceNonResizeApp()) { if (mAppCompatController.getAppCompatResizeOverrides() .shouldOverrideForceNonResizeApp()) { return SIZE_CHANGES_UNSUPPORTED_OVERRIDE; } Loading @@ -8411,7 +8412,8 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A return SIZE_CHANGES_SUPPORTED_METADATA; } if (mLetterboxUiController.shouldOverrideForceResizeApp()) { if (mAppCompatController.getAppCompatResizeOverrides() .shouldOverrideForceResizeApp()) { return SIZE_CHANGES_SUPPORTED_OVERRIDE; } Loading Loading @@ -10494,7 +10496,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A mAppCompatController.getAppCompatOrientationOverrides() .shouldIgnoreOrientationRequestLoop()); proto.write(SHOULD_OVERRIDE_FORCE_RESIZE_APP, mLetterboxUiController.shouldOverrideForceResizeApp()); mAppCompatController.getAppCompatResizeOverrides().shouldOverrideForceResizeApp()); proto.write(SHOULD_ENABLE_USER_ASPECT_RATIO_SETTINGS, mAppCompatController.getAppCompatAspectRatioOverrides() .shouldEnableUserAspectRatioSettings()); Loading services/core/java/com/android/server/wm/AppCompatController.java +5 −0 Original line number Diff line number Diff line Loading @@ -87,6 +87,11 @@ class AppCompatController { return mAppCompatOverrides.getAppCompatAspectRatioOverrides(); } @NonNull AppCompatResizeOverrides getAppCompatResizeOverrides() { return mAppCompatOverrides.getAppCompatResizeOverrides(); } @Nullable AppCompatCameraPolicy getAppCompatCameraPolicy() { if (mActivityRecord.mDisplayContent != null) { Loading services/core/java/com/android/server/wm/AppCompatOverrides.java +9 −48 Original line number Diff line number Diff line Loading @@ -16,12 +16,6 @@ package com.android.server.wm; import static android.content.pm.ActivityInfo.FORCE_NON_RESIZE_APP; import static android.content.pm.ActivityInfo.FORCE_RESIZE_APP; import static android.view.WindowManager.PROPERTY_COMPAT_ALLOW_RESIZEABLE_ACTIVITY_OVERRIDES; import static com.android.server.wm.AppCompatUtils.isChangeEnabled; import android.annotation.NonNull; import com.android.server.wm.utils.OptPropFactory; Loading @@ -31,10 +25,6 @@ import com.android.server.wm.utils.OptPropFactory; */ public class AppCompatOverrides { @NonNull private final ActivityRecord mActivityRecord; @NonNull private final OptPropFactory.OptProp mAllowForceResizeOverrideOptProp; @NonNull private final AppCompatOrientationOverrides mAppCompatOrientationOverrides; @NonNull Loading @@ -43,26 +33,24 @@ public class AppCompatOverrides { private final AppCompatAspectRatioOverrides mAppCompatAspectRatioOverrides; @NonNull private final AppCompatFocusOverrides mAppCompatFocusOverrides; @NonNull private final AppCompatResizeOverrides mAppCompatResizeOverrides; AppCompatOverrides(@NonNull ActivityRecord activityRecord, @NonNull AppCompatConfiguration appCompatConfiguration, @NonNull OptPropFactory optPropBuilder) { mActivityRecord = activityRecord; mAppCompatCameraOverrides = new AppCompatCameraOverrides(mActivityRecord, mAppCompatCameraOverrides = new AppCompatCameraOverrides(activityRecord, appCompatConfiguration, optPropBuilder); mAppCompatOrientationOverrides = new AppCompatOrientationOverrides(mActivityRecord, mAppCompatOrientationOverrides = new AppCompatOrientationOverrides(activityRecord, appCompatConfiguration, optPropBuilder, mAppCompatCameraOverrides); // TODO(b/341903757) Remove BooleanSuppliers after fixing dependency with reachability. mAppCompatAspectRatioOverrides = new AppCompatAspectRatioOverrides(activityRecord, appCompatConfiguration, optPropBuilder, activityRecord.mLetterboxUiController::isDisplayFullScreenAndInPosture, activityRecord.mLetterboxUiController::getHorizontalPositionMultiplier); mAppCompatFocusOverrides = new AppCompatFocusOverrides(mActivityRecord, mAppCompatFocusOverrides = new AppCompatFocusOverrides(activityRecord, appCompatConfiguration, optPropBuilder); mAllowForceResizeOverrideOptProp = optPropBuilder.create( PROPERTY_COMPAT_ALLOW_RESIZEABLE_ACTIVITY_OVERRIDES); mAppCompatResizeOverrides = new AppCompatResizeOverrides(activityRecord, optPropBuilder); } @NonNull Loading @@ -85,35 +73,8 @@ public class AppCompatOverrides { return mAppCompatFocusOverrides; } /** * Whether we should apply the force resize per-app override. When this override is applied it * forces the packages it is applied to to be resizable. It won't change whether the app can be * put into multi-windowing mode, but allow the app to resize without going into size-compat * mode when the window container resizes, such as display size change or screen rotation. * * <p>This method returns {@code true} when the following conditions are met: * <ul> * <li>Opt-out component property isn't enabled * <li>Per-app override is enabled * </ul> */ boolean shouldOverrideForceResizeApp() { return mAllowForceResizeOverrideOptProp.shouldEnableWithOptInOverrideAndOptOutProperty( isChangeEnabled(mActivityRecord, FORCE_RESIZE_APP)); } /** * Whether we should apply the force non resize per-app override. When this override is applied * it forces the packages it is applied to to be non-resizable. * * <p>This method returns {@code true} when the following conditions are met: * <ul> * <li>Opt-out component property isn't enabled * <li>Per-app override is enabled * </ul> */ boolean shouldOverrideForceNonResizeApp() { return mAllowForceResizeOverrideOptProp.shouldEnableWithOptInOverrideAndOptOutProperty( isChangeEnabled(mActivityRecord, FORCE_NON_RESIZE_APP)); @NonNull AppCompatResizeOverrides getAppCompatResizeOverrides() { return mAppCompatResizeOverrides; } } services/core/java/com/android/server/wm/AppCompatResizeOverrides.java 0 → 100644 +78 −0 Original line number Diff line number Diff line /* * Copyright (C) 2024 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.server.wm; import static android.content.pm.ActivityInfo.FORCE_NON_RESIZE_APP; import static android.content.pm.ActivityInfo.FORCE_RESIZE_APP; import static android.view.WindowManager.PROPERTY_COMPAT_ALLOW_RESIZEABLE_ACTIVITY_OVERRIDES; import static com.android.server.wm.AppCompatUtils.isChangeEnabled; import android.annotation.NonNull; import com.android.server.wm.utils.OptPropFactory; /** * Encapsulate app compat logic about resizability. */ class AppCompatResizeOverrides { @NonNull private final ActivityRecord mActivityRecord; @NonNull private final OptPropFactory.OptProp mAllowForceResizeOverrideOptProp; AppCompatResizeOverrides(@NonNull ActivityRecord activityRecord, @NonNull OptPropFactory optPropBuilder) { mActivityRecord = activityRecord; mAllowForceResizeOverrideOptProp = optPropBuilder.create( PROPERTY_COMPAT_ALLOW_RESIZEABLE_ACTIVITY_OVERRIDES); } /** * Whether we should apply the force resize per-app override. When this override is applied it * forces the packages it is applied to to be resizable. It won't change whether the app can be * put into multi-windowing mode, but allow the app to resize without going into size-compat * mode when the window container resizes, such as display size change or screen rotation. * * <p>This method returns {@code true} when the following conditions are met: * <ul> * <li>Opt-out component property isn't enabled * <li>Per-app override is enabled * </ul> */ boolean shouldOverrideForceResizeApp() { return mAllowForceResizeOverrideOptProp.shouldEnableWithOptInOverrideAndOptOutProperty( isChangeEnabled(mActivityRecord, FORCE_RESIZE_APP)); } /** * Whether we should apply the force non resize per-app override. When this override is applied * it forces the packages it is applied to to be non-resizable. * * <p>This method returns {@code true} when the following conditions are met: * <ul> * <li>Opt-out component property isn't enabled * <li>Per-app override is enabled * </ul> */ boolean shouldOverrideForceNonResizeApp() { return mAllowForceResizeOverrideOptProp.shouldEnableWithOptInOverrideAndOptOutProperty( isChangeEnabled(mActivityRecord, FORCE_NON_RESIZE_APP)); } } services/core/java/com/android/server/wm/LetterboxUiController.java +0 −48 Original line number Diff line number Diff line Loading @@ -116,54 +116,6 @@ final class LetterboxUiController { } } /** * Whether we should apply the force resize per-app override. When this override is applied it * forces the packages it is applied to to be resizable. It won't change whether the app can be * put into multi-windowing mode, but allow the app to resize without going into size-compat * mode when the window container resizes, such as display size change or screen rotation. * * <p>This method returns {@code true} when the following conditions are met: * <ul> * <li>Opt-out component property isn't enabled * <li>Per-app override is enabled * </ul> */ boolean shouldOverrideForceResizeApp() { return getAppCompatOverrides().shouldOverrideForceResizeApp(); } /** * Whether we should apply the force non resize per-app override. When this override is applied * it forces the packages it is applied to to be non-resizable. * * <p>This method returns {@code true} when the following conditions are met: * <ul> * <li>Opt-out component property isn't enabled * <li>Per-app override is enabled * </ul> */ boolean shouldOverrideForceNonResizeApp() { return getAppCompatOverrides().shouldOverrideForceNonResizeApp(); } /** * Whether should fix display orientation to landscape natural orientation when a task is * fullscreen and the display is ignoring orientation requests. * * <p>This treatment is enabled when the following conditions are met: * <ul> * <li>Opt-out component property isn't enabled * <li>Opt-in per-app override is enabled * <li>Task is in fullscreen. * <li>{@link DisplayContent#getIgnoreOrientationRequest} is enabled * <li>Natural orientation of the display is landscape. * </ul> */ boolean shouldUseDisplayLandscapeNaturalOrientation() { return getAppCompatOverrides().getAppCompatOrientationOverrides() .shouldUseDisplayLandscapeNaturalOrientation(); } boolean hasWallpaperBackgroundForLetterbox() { return mShowWallpaperForLetterboxBackground; } Loading Loading
services/core/java/com/android/server/wm/ActivityRecord.java +5 −3 Original line number Diff line number Diff line Loading @@ -8403,7 +8403,8 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A */ @ActivityInfo.SizeChangesSupportMode private int supportsSizeChanges() { if (mLetterboxUiController.shouldOverrideForceNonResizeApp()) { if (mAppCompatController.getAppCompatResizeOverrides() .shouldOverrideForceNonResizeApp()) { return SIZE_CHANGES_UNSUPPORTED_OVERRIDE; } Loading @@ -8411,7 +8412,8 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A return SIZE_CHANGES_SUPPORTED_METADATA; } if (mLetterboxUiController.shouldOverrideForceResizeApp()) { if (mAppCompatController.getAppCompatResizeOverrides() .shouldOverrideForceResizeApp()) { return SIZE_CHANGES_SUPPORTED_OVERRIDE; } Loading Loading @@ -10494,7 +10496,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A mAppCompatController.getAppCompatOrientationOverrides() .shouldIgnoreOrientationRequestLoop()); proto.write(SHOULD_OVERRIDE_FORCE_RESIZE_APP, mLetterboxUiController.shouldOverrideForceResizeApp()); mAppCompatController.getAppCompatResizeOverrides().shouldOverrideForceResizeApp()); proto.write(SHOULD_ENABLE_USER_ASPECT_RATIO_SETTINGS, mAppCompatController.getAppCompatAspectRatioOverrides() .shouldEnableUserAspectRatioSettings()); Loading
services/core/java/com/android/server/wm/AppCompatController.java +5 −0 Original line number Diff line number Diff line Loading @@ -87,6 +87,11 @@ class AppCompatController { return mAppCompatOverrides.getAppCompatAspectRatioOverrides(); } @NonNull AppCompatResizeOverrides getAppCompatResizeOverrides() { return mAppCompatOverrides.getAppCompatResizeOverrides(); } @Nullable AppCompatCameraPolicy getAppCompatCameraPolicy() { if (mActivityRecord.mDisplayContent != null) { Loading
services/core/java/com/android/server/wm/AppCompatOverrides.java +9 −48 Original line number Diff line number Diff line Loading @@ -16,12 +16,6 @@ package com.android.server.wm; import static android.content.pm.ActivityInfo.FORCE_NON_RESIZE_APP; import static android.content.pm.ActivityInfo.FORCE_RESIZE_APP; import static android.view.WindowManager.PROPERTY_COMPAT_ALLOW_RESIZEABLE_ACTIVITY_OVERRIDES; import static com.android.server.wm.AppCompatUtils.isChangeEnabled; import android.annotation.NonNull; import com.android.server.wm.utils.OptPropFactory; Loading @@ -31,10 +25,6 @@ import com.android.server.wm.utils.OptPropFactory; */ public class AppCompatOverrides { @NonNull private final ActivityRecord mActivityRecord; @NonNull private final OptPropFactory.OptProp mAllowForceResizeOverrideOptProp; @NonNull private final AppCompatOrientationOverrides mAppCompatOrientationOverrides; @NonNull Loading @@ -43,26 +33,24 @@ public class AppCompatOverrides { private final AppCompatAspectRatioOverrides mAppCompatAspectRatioOverrides; @NonNull private final AppCompatFocusOverrides mAppCompatFocusOverrides; @NonNull private final AppCompatResizeOverrides mAppCompatResizeOverrides; AppCompatOverrides(@NonNull ActivityRecord activityRecord, @NonNull AppCompatConfiguration appCompatConfiguration, @NonNull OptPropFactory optPropBuilder) { mActivityRecord = activityRecord; mAppCompatCameraOverrides = new AppCompatCameraOverrides(mActivityRecord, mAppCompatCameraOverrides = new AppCompatCameraOverrides(activityRecord, appCompatConfiguration, optPropBuilder); mAppCompatOrientationOverrides = new AppCompatOrientationOverrides(mActivityRecord, mAppCompatOrientationOverrides = new AppCompatOrientationOverrides(activityRecord, appCompatConfiguration, optPropBuilder, mAppCompatCameraOverrides); // TODO(b/341903757) Remove BooleanSuppliers after fixing dependency with reachability. mAppCompatAspectRatioOverrides = new AppCompatAspectRatioOverrides(activityRecord, appCompatConfiguration, optPropBuilder, activityRecord.mLetterboxUiController::isDisplayFullScreenAndInPosture, activityRecord.mLetterboxUiController::getHorizontalPositionMultiplier); mAppCompatFocusOverrides = new AppCompatFocusOverrides(mActivityRecord, mAppCompatFocusOverrides = new AppCompatFocusOverrides(activityRecord, appCompatConfiguration, optPropBuilder); mAllowForceResizeOverrideOptProp = optPropBuilder.create( PROPERTY_COMPAT_ALLOW_RESIZEABLE_ACTIVITY_OVERRIDES); mAppCompatResizeOverrides = new AppCompatResizeOverrides(activityRecord, optPropBuilder); } @NonNull Loading @@ -85,35 +73,8 @@ public class AppCompatOverrides { return mAppCompatFocusOverrides; } /** * Whether we should apply the force resize per-app override. When this override is applied it * forces the packages it is applied to to be resizable. It won't change whether the app can be * put into multi-windowing mode, but allow the app to resize without going into size-compat * mode when the window container resizes, such as display size change or screen rotation. * * <p>This method returns {@code true} when the following conditions are met: * <ul> * <li>Opt-out component property isn't enabled * <li>Per-app override is enabled * </ul> */ boolean shouldOverrideForceResizeApp() { return mAllowForceResizeOverrideOptProp.shouldEnableWithOptInOverrideAndOptOutProperty( isChangeEnabled(mActivityRecord, FORCE_RESIZE_APP)); } /** * Whether we should apply the force non resize per-app override. When this override is applied * it forces the packages it is applied to to be non-resizable. * * <p>This method returns {@code true} when the following conditions are met: * <ul> * <li>Opt-out component property isn't enabled * <li>Per-app override is enabled * </ul> */ boolean shouldOverrideForceNonResizeApp() { return mAllowForceResizeOverrideOptProp.shouldEnableWithOptInOverrideAndOptOutProperty( isChangeEnabled(mActivityRecord, FORCE_NON_RESIZE_APP)); @NonNull AppCompatResizeOverrides getAppCompatResizeOverrides() { return mAppCompatResizeOverrides; } }
services/core/java/com/android/server/wm/AppCompatResizeOverrides.java 0 → 100644 +78 −0 Original line number Diff line number Diff line /* * Copyright (C) 2024 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.server.wm; import static android.content.pm.ActivityInfo.FORCE_NON_RESIZE_APP; import static android.content.pm.ActivityInfo.FORCE_RESIZE_APP; import static android.view.WindowManager.PROPERTY_COMPAT_ALLOW_RESIZEABLE_ACTIVITY_OVERRIDES; import static com.android.server.wm.AppCompatUtils.isChangeEnabled; import android.annotation.NonNull; import com.android.server.wm.utils.OptPropFactory; /** * Encapsulate app compat logic about resizability. */ class AppCompatResizeOverrides { @NonNull private final ActivityRecord mActivityRecord; @NonNull private final OptPropFactory.OptProp mAllowForceResizeOverrideOptProp; AppCompatResizeOverrides(@NonNull ActivityRecord activityRecord, @NonNull OptPropFactory optPropBuilder) { mActivityRecord = activityRecord; mAllowForceResizeOverrideOptProp = optPropBuilder.create( PROPERTY_COMPAT_ALLOW_RESIZEABLE_ACTIVITY_OVERRIDES); } /** * Whether we should apply the force resize per-app override. When this override is applied it * forces the packages it is applied to to be resizable. It won't change whether the app can be * put into multi-windowing mode, but allow the app to resize without going into size-compat * mode when the window container resizes, such as display size change or screen rotation. * * <p>This method returns {@code true} when the following conditions are met: * <ul> * <li>Opt-out component property isn't enabled * <li>Per-app override is enabled * </ul> */ boolean shouldOverrideForceResizeApp() { return mAllowForceResizeOverrideOptProp.shouldEnableWithOptInOverrideAndOptOutProperty( isChangeEnabled(mActivityRecord, FORCE_RESIZE_APP)); } /** * Whether we should apply the force non resize per-app override. When this override is applied * it forces the packages it is applied to to be non-resizable. * * <p>This method returns {@code true} when the following conditions are met: * <ul> * <li>Opt-out component property isn't enabled * <li>Per-app override is enabled * </ul> */ boolean shouldOverrideForceNonResizeApp() { return mAllowForceResizeOverrideOptProp.shouldEnableWithOptInOverrideAndOptOutProperty( isChangeEnabled(mActivityRecord, FORCE_NON_RESIZE_APP)); } }
services/core/java/com/android/server/wm/LetterboxUiController.java +0 −48 Original line number Diff line number Diff line Loading @@ -116,54 +116,6 @@ final class LetterboxUiController { } } /** * Whether we should apply the force resize per-app override. When this override is applied it * forces the packages it is applied to to be resizable. It won't change whether the app can be * put into multi-windowing mode, but allow the app to resize without going into size-compat * mode when the window container resizes, such as display size change or screen rotation. * * <p>This method returns {@code true} when the following conditions are met: * <ul> * <li>Opt-out component property isn't enabled * <li>Per-app override is enabled * </ul> */ boolean shouldOverrideForceResizeApp() { return getAppCompatOverrides().shouldOverrideForceResizeApp(); } /** * Whether we should apply the force non resize per-app override. When this override is applied * it forces the packages it is applied to to be non-resizable. * * <p>This method returns {@code true} when the following conditions are met: * <ul> * <li>Opt-out component property isn't enabled * <li>Per-app override is enabled * </ul> */ boolean shouldOverrideForceNonResizeApp() { return getAppCompatOverrides().shouldOverrideForceNonResizeApp(); } /** * Whether should fix display orientation to landscape natural orientation when a task is * fullscreen and the display is ignoring orientation requests. * * <p>This treatment is enabled when the following conditions are met: * <ul> * <li>Opt-out component property isn't enabled * <li>Opt-in per-app override is enabled * <li>Task is in fullscreen. * <li>{@link DisplayContent#getIgnoreOrientationRequest} is enabled * <li>Natural orientation of the display is landscape. * </ul> */ boolean shouldUseDisplayLandscapeNaturalOrientation() { return getAppCompatOverrides().getAppCompatOrientationOverrides() .shouldUseDisplayLandscapeNaturalOrientation(); } boolean hasWallpaperBackgroundForLetterbox() { return mShowWallpaperForLetterboxBackground; } Loading