Loading core/java/android/content/pm/ActivityInfo.java +13 −0 Original line number Diff line number Diff line Loading @@ -1021,6 +1021,19 @@ public class ActivityInfo extends ComponentInfo implements Parcelable { @Retention(RetentionPolicy.SOURCE) public @interface SizeChangesSupportMode {} /** * This change id enables compat policy that ignores app requested orientation in * response to an app calling {@link android.app.Activity#setRequestedOrientation}. See * com.android.server.wm.LetterboxUiController#shouldIgnoreRequestedOrientation for * details. * @hide */ @ChangeId @Overridable @Disabled public static final long OVERRIDE_ENABLE_COMPAT_IGNORE_REQUESTED_ORIENTATION = 254631730L; // buganizer id /** * This change id forces the packages it is applied to never have Display API sandboxing * applied for a letterbox or SCM activity. The Display APIs will continue to provide Loading core/java/android/view/WindowManager.java +39 −0 Original line number Diff line number Diff line Loading @@ -813,6 +813,45 @@ public interface WindowManager extends ViewManager { int SCREENSHOT_VENDOR_GESTURE = 6; } /** * Activity level {@link android.content.pm.PackageManager.Property PackageManager * .Property} for an app to inform the system that the activity can be opted-in or opted-out * from the compatibility treatment that avoids {@link * android.app.Activity#setRequestedOrientation} loops. The loop can be trigerred by * ignoreRequestedOrientation display setting enabled on the device or by the landscape natural * orientation of the device. * * <p>The treatment is disabled by default but device manufacturers can enable the treatment * using their discretion to improve display compatibility. * * <p>With this property set to {@code true}, the system could ignore {@link * android.app.Activity#setRequestedOrientation} call from an app if one of the following * conditions are true: * <ul> * <li>Activity is relaunching due to the previous {@link * android.app.Activity#setRequestedOrientation} call. * <li>Camera compatibility force rotation treatment is active for the package. * </ul> * * <p>Setting this property to {@code false} informs the system that the activity must be * opted-out from the compatibility treatment even if the device manufacturer has opted the app * into the treatment. * * <p><b>Syntax:</b> * <pre> * <activity> * <property * android:name="android.window.PROPERTY_COMPAT_IGNORE_REQUESTED_ORIENTATION" * android:value="true|false"/> * </activity> * </pre> * * @hide */ // TODO(b/263984287): Make this public API. String PROPERTY_COMPAT_IGNORE_REQUESTED_ORIENTATION = "android.window.PROPERTY_COMPAT_IGNORE_REQUESTED_ORIENTATION"; /** * @hide */ Loading core/res/res/values/config.xml +5 −0 Original line number Diff line number Diff line Loading @@ -5328,6 +5328,11 @@ If given value is outside of this range, the option 0 (top) is assummed. --> <integer name="config_letterboxDefaultPositionForTabletopModeReachability">0</integer> <!-- Whether should ignore app requested orientation in response to an app calling Activity#setRequestedOrientation. See LetterboxUiController#shouldIgnoreRequestedOrientation for details. --> <bool name="config_letterboxIsPolicyForIgnoringRequestedOrientationEnabled">false</bool> <!-- Whether displaying letterbox education is enabled for letterboxed fullscreen apps. --> <bool name="config_letterboxIsEducationEnabled">false</bool> Loading core/res/res/values/symbols.xml +1 −0 Original line number Diff line number Diff line Loading @@ -4457,6 +4457,7 @@ <java-symbol type="integer" name="config_letterboxDefaultPositionForVerticalReachability" /> <java-symbol type="integer" name="config_letterboxDefaultPositionForBookModeReachability" /> <java-symbol type="integer" name="config_letterboxDefaultPositionForTabletopModeReachability" /> <java-symbol type="bool" name="config_letterboxIsPolicyForIgnoringRequestedOrientationEnabled" /> <java-symbol type="bool" name="config_letterboxIsEducationEnabled" /> <java-symbol type="dimen" name="config_letterboxDefaultMinAspectRatioForUnresizableApps" /> <java-symbol type="bool" name="config_letterboxIsSplitScreenAspectRatioForUnresizableAppsEnabled" /> Loading services/core/java/com/android/server/wm/ActivityRecord.java +20 −5 Original line number Diff line number Diff line Loading @@ -1456,8 +1456,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A updatePictureInPictureMode(null, false); } else { mLastReportedMultiWindowMode = inMultiWindowMode; ensureActivityConfiguration(0 /* globalChanges */, PRESERVE_WINDOWS, false /* ignoreVisibility */); ensureActivityConfiguration(0 /* globalChanges */, PRESERVE_WINDOWS); } } } Loading Loading @@ -3988,6 +3987,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A } void finishRelaunching() { mLetterboxUiController.setRelauchingAfterRequestedOrientationChanged(false); mTaskSupervisor.getActivityMetricsLogger().notifyActivityRelaunched(this); if (mPendingRelaunchCount > 0) { Loading Loading @@ -7745,13 +7745,17 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A } void setRequestedOrientation(int requestedOrientation) { if (mLetterboxUiController.shouldIgnoreRequestedOrientation(requestedOrientation)) { return; } setOrientation(requestedOrientation, this); // Push the new configuration to the requested app in case where it's not pushed, e.g. when // the request is handled at task level with letterbox. if (!getMergedOverrideConfiguration().equals( mLastReportedConfiguration.getMergedConfiguration())) { ensureActivityConfiguration(0 /* globalChanges */, false /* preserveWindow */); ensureActivityConfiguration(0 /* globalChanges */, false /* preserveWindow */, false /* ignoreVisibility */, true /* isRequestedOrientationChanged */); } mAtmService.getTaskChangeNotificationController().notifyActivityRequestedOrientationChanged( Loading Loading @@ -9052,7 +9056,13 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A boolean ensureActivityConfiguration(int globalChanges, boolean preserveWindow) { return ensureActivityConfiguration(globalChanges, preserveWindow, false /* ignoreVisibility */); false /* ignoreVisibility */, false /* isRequestedOrientationChanged */); } boolean ensureActivityConfiguration(int globalChanges, boolean preserveWindow, boolean ignoreVisibility) { return ensureActivityConfiguration(globalChanges, preserveWindow, ignoreVisibility, false /* isRequestedOrientationChanged */); } /** Loading @@ -9066,11 +9076,13 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A * (stopped state). This is useful for the case where we know the * activity will be visible soon and we want to ensure its configuration * before we make it visible. * @param isRequestedOrientationChanged whether this is triggered in response to an app calling * {@link android.app.Activity#setRequestedOrientation}. * @return False if the activity was relaunched and true if it wasn't relaunched because we * can't or the app handles the specific configuration that is changing. */ boolean ensureActivityConfiguration(int globalChanges, boolean preserveWindow, boolean ignoreVisibility) { boolean ignoreVisibility, boolean isRequestedOrientationChanged) { final Task rootTask = getRootTask(); if (rootTask.mConfigWillChange) { ProtoLog.v(WM_DEBUG_CONFIGURATION, "Skipping config check " Loading Loading @@ -9194,6 +9206,9 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A } else { mRelaunchReason = RELAUNCH_REASON_NONE; } if (isRequestedOrientationChanged) { mLetterboxUiController.setRelauchingAfterRequestedOrientationChanged(true); } if (mState == PAUSING) { // A little annoying: we are waiting for this activity to finish pausing. Let's not // do anything now, but just flag that it needs to be restarted when done pausing. Loading Loading
core/java/android/content/pm/ActivityInfo.java +13 −0 Original line number Diff line number Diff line Loading @@ -1021,6 +1021,19 @@ public class ActivityInfo extends ComponentInfo implements Parcelable { @Retention(RetentionPolicy.SOURCE) public @interface SizeChangesSupportMode {} /** * This change id enables compat policy that ignores app requested orientation in * response to an app calling {@link android.app.Activity#setRequestedOrientation}. See * com.android.server.wm.LetterboxUiController#shouldIgnoreRequestedOrientation for * details. * @hide */ @ChangeId @Overridable @Disabled public static final long OVERRIDE_ENABLE_COMPAT_IGNORE_REQUESTED_ORIENTATION = 254631730L; // buganizer id /** * This change id forces the packages it is applied to never have Display API sandboxing * applied for a letterbox or SCM activity. The Display APIs will continue to provide Loading
core/java/android/view/WindowManager.java +39 −0 Original line number Diff line number Diff line Loading @@ -813,6 +813,45 @@ public interface WindowManager extends ViewManager { int SCREENSHOT_VENDOR_GESTURE = 6; } /** * Activity level {@link android.content.pm.PackageManager.Property PackageManager * .Property} for an app to inform the system that the activity can be opted-in or opted-out * from the compatibility treatment that avoids {@link * android.app.Activity#setRequestedOrientation} loops. The loop can be trigerred by * ignoreRequestedOrientation display setting enabled on the device or by the landscape natural * orientation of the device. * * <p>The treatment is disabled by default but device manufacturers can enable the treatment * using their discretion to improve display compatibility. * * <p>With this property set to {@code true}, the system could ignore {@link * android.app.Activity#setRequestedOrientation} call from an app if one of the following * conditions are true: * <ul> * <li>Activity is relaunching due to the previous {@link * android.app.Activity#setRequestedOrientation} call. * <li>Camera compatibility force rotation treatment is active for the package. * </ul> * * <p>Setting this property to {@code false} informs the system that the activity must be * opted-out from the compatibility treatment even if the device manufacturer has opted the app * into the treatment. * * <p><b>Syntax:</b> * <pre> * <activity> * <property * android:name="android.window.PROPERTY_COMPAT_IGNORE_REQUESTED_ORIENTATION" * android:value="true|false"/> * </activity> * </pre> * * @hide */ // TODO(b/263984287): Make this public API. String PROPERTY_COMPAT_IGNORE_REQUESTED_ORIENTATION = "android.window.PROPERTY_COMPAT_IGNORE_REQUESTED_ORIENTATION"; /** * @hide */ Loading
core/res/res/values/config.xml +5 −0 Original line number Diff line number Diff line Loading @@ -5328,6 +5328,11 @@ If given value is outside of this range, the option 0 (top) is assummed. --> <integer name="config_letterboxDefaultPositionForTabletopModeReachability">0</integer> <!-- Whether should ignore app requested orientation in response to an app calling Activity#setRequestedOrientation. See LetterboxUiController#shouldIgnoreRequestedOrientation for details. --> <bool name="config_letterboxIsPolicyForIgnoringRequestedOrientationEnabled">false</bool> <!-- Whether displaying letterbox education is enabled for letterboxed fullscreen apps. --> <bool name="config_letterboxIsEducationEnabled">false</bool> Loading
core/res/res/values/symbols.xml +1 −0 Original line number Diff line number Diff line Loading @@ -4457,6 +4457,7 @@ <java-symbol type="integer" name="config_letterboxDefaultPositionForVerticalReachability" /> <java-symbol type="integer" name="config_letterboxDefaultPositionForBookModeReachability" /> <java-symbol type="integer" name="config_letterboxDefaultPositionForTabletopModeReachability" /> <java-symbol type="bool" name="config_letterboxIsPolicyForIgnoringRequestedOrientationEnabled" /> <java-symbol type="bool" name="config_letterboxIsEducationEnabled" /> <java-symbol type="dimen" name="config_letterboxDefaultMinAspectRatioForUnresizableApps" /> <java-symbol type="bool" name="config_letterboxIsSplitScreenAspectRatioForUnresizableAppsEnabled" /> Loading
services/core/java/com/android/server/wm/ActivityRecord.java +20 −5 Original line number Diff line number Diff line Loading @@ -1456,8 +1456,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A updatePictureInPictureMode(null, false); } else { mLastReportedMultiWindowMode = inMultiWindowMode; ensureActivityConfiguration(0 /* globalChanges */, PRESERVE_WINDOWS, false /* ignoreVisibility */); ensureActivityConfiguration(0 /* globalChanges */, PRESERVE_WINDOWS); } } } Loading Loading @@ -3988,6 +3987,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A } void finishRelaunching() { mLetterboxUiController.setRelauchingAfterRequestedOrientationChanged(false); mTaskSupervisor.getActivityMetricsLogger().notifyActivityRelaunched(this); if (mPendingRelaunchCount > 0) { Loading Loading @@ -7745,13 +7745,17 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A } void setRequestedOrientation(int requestedOrientation) { if (mLetterboxUiController.shouldIgnoreRequestedOrientation(requestedOrientation)) { return; } setOrientation(requestedOrientation, this); // Push the new configuration to the requested app in case where it's not pushed, e.g. when // the request is handled at task level with letterbox. if (!getMergedOverrideConfiguration().equals( mLastReportedConfiguration.getMergedConfiguration())) { ensureActivityConfiguration(0 /* globalChanges */, false /* preserveWindow */); ensureActivityConfiguration(0 /* globalChanges */, false /* preserveWindow */, false /* ignoreVisibility */, true /* isRequestedOrientationChanged */); } mAtmService.getTaskChangeNotificationController().notifyActivityRequestedOrientationChanged( Loading Loading @@ -9052,7 +9056,13 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A boolean ensureActivityConfiguration(int globalChanges, boolean preserveWindow) { return ensureActivityConfiguration(globalChanges, preserveWindow, false /* ignoreVisibility */); false /* ignoreVisibility */, false /* isRequestedOrientationChanged */); } boolean ensureActivityConfiguration(int globalChanges, boolean preserveWindow, boolean ignoreVisibility) { return ensureActivityConfiguration(globalChanges, preserveWindow, ignoreVisibility, false /* isRequestedOrientationChanged */); } /** Loading @@ -9066,11 +9076,13 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A * (stopped state). This is useful for the case where we know the * activity will be visible soon and we want to ensure its configuration * before we make it visible. * @param isRequestedOrientationChanged whether this is triggered in response to an app calling * {@link android.app.Activity#setRequestedOrientation}. * @return False if the activity was relaunched and true if it wasn't relaunched because we * can't or the app handles the specific configuration that is changing. */ boolean ensureActivityConfiguration(int globalChanges, boolean preserveWindow, boolean ignoreVisibility) { boolean ignoreVisibility, boolean isRequestedOrientationChanged) { final Task rootTask = getRootTask(); if (rootTask.mConfigWillChange) { ProtoLog.v(WM_DEBUG_CONFIGURATION, "Skipping config check " Loading Loading @@ -9194,6 +9206,9 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A } else { mRelaunchReason = RELAUNCH_REASON_NONE; } if (isRequestedOrientationChanged) { mLetterboxUiController.setRelauchingAfterRequestedOrientationChanged(true); } if (mState == PAUSING) { // A little annoying: we are waiting for this activity to finish pausing. Let's not // do anything now, but just flag that it needs to be restarted when done pausing. Loading