Loading services/core/java/com/android/server/wm/AppCompatAspectRatioOverrides.java +39 −19 Original line number Diff line number Diff line Loading @@ -62,8 +62,8 @@ class AppCompatAspectRatioOverrides { private final ActivityRecord mActivityRecord; @NonNull private final AppCompatConfiguration mAppCompatConfiguration; @PackageManager.UserMinAspectRatio final int mUserAspectRatioType; @NonNull private final UserAspectRatioState mUserAspectRatioState; @NonNull private final OptPropFactory.OptProp mAllowMinAspectRatioOverrideOptProp; Loading @@ -86,7 +86,7 @@ class AppCompatAspectRatioOverrides { mActivityRecord = activityRecord; mAppCompatConfiguration = appCompatConfiguration; mAppCompatDeviceStateQuery = appCompatDeviceStateQuery; mUserAspectRatioType = getUserMinAspectRatioOverrideType(); mUserAspectRatioState = new UserAspectRatioState(); mAppCompatReachabilityOverrides = appCompatReachabilityOverrides; mAllowMinAspectRatioOverrideOptProp = optPropBuilder.create( PROPERTY_COMPAT_ALLOW_MIN_ASPECT_RATIO_OVERRIDE); Loading Loading @@ -122,28 +122,41 @@ class AppCompatAspectRatioOverrides { * current app. */ boolean shouldApplyUserMinAspectRatioOverride() { return shouldEnableUserAspectRatioSettings() && mUserAspectRatioType != USER_MIN_ASPECT_RATIO_UNSET && mUserAspectRatioType != USER_MIN_ASPECT_RATIO_APP_DEFAULT && mUserAspectRatioType != USER_MIN_ASPECT_RATIO_FULLSCREEN; if (!shouldEnableUserAspectRatioSettings()) { return false; } mUserAspectRatioState.mUserAspectRatio = getUserMinAspectRatioOverrideCode(); return mUserAspectRatioState.mUserAspectRatio != USER_MIN_ASPECT_RATIO_UNSET && mUserAspectRatioState.mUserAspectRatio != USER_MIN_ASPECT_RATIO_APP_DEFAULT && mUserAspectRatioState.mUserAspectRatio != USER_MIN_ASPECT_RATIO_FULLSCREEN; } boolean shouldApplyUserFullscreenOverride() { return isUserFullscreenOverrideEnabled() && mUserAspectRatioType == USER_MIN_ASPECT_RATIO_FULLSCREEN; if (isUserFullscreenOverrideEnabled()) { mUserAspectRatioState.mUserAspectRatio = getUserMinAspectRatioOverrideCode(); return mUserAspectRatioState.mUserAspectRatio == USER_MIN_ASPECT_RATIO_FULLSCREEN; } return false; } boolean isUserFullscreenOverrideEnabled() { return !mAllowUserAspectRatioOverrideOptProp.isFalse() && !mAllowUserAspectRatioFullscreenOverrideOptProp.isFalse() && mAppCompatConfiguration.isUserAppAspectRatioFullscreenEnabled(); if (mAllowUserAspectRatioOverrideOptProp.isFalse() || mAllowUserAspectRatioFullscreenOverrideOptProp.isFalse() || !mAppCompatConfiguration.isUserAppAspectRatioFullscreenEnabled()) { return false; } return true; } boolean isSystemOverrideToFullscreenEnabled() { return isChangeEnabled(mActivityRecord, OVERRIDE_ANY_ORIENTATION_TO_USER) && !mAllowOrientationOverrideOptProp.isFalse() && (mUserAspectRatioType == USER_MIN_ASPECT_RATIO_UNSET || mUserAspectRatioType == USER_MIN_ASPECT_RATIO_FULLSCREEN); && (mUserAspectRatioState.mUserAspectRatio == USER_MIN_ASPECT_RATIO_UNSET || mUserAspectRatioState.mUserAspectRatio == USER_MIN_ASPECT_RATIO_FULLSCREEN); } /** Loading @@ -160,11 +173,12 @@ class AppCompatAspectRatioOverrides { } boolean hasFullscreenOverride() { // `mUserAspectRatio` is always initialized first in `shouldApplyUserFullscreenOverride()`. return shouldApplyUserFullscreenOverride() || isSystemOverrideToFullscreenEnabled(); } float getUserMinAspectRatio() { switch (mUserAspectRatioType) { switch (mUserAspectRatioState.mUserAspectRatio) { case USER_MIN_ASPECT_RATIO_DISPLAY_SIZE: return getDisplaySizeMinAspectRatio(); case USER_MIN_ASPECT_RATIO_SPLIT_SCREEN: Loading @@ -177,7 +191,7 @@ class AppCompatAspectRatioOverrides { return 3 / 2f; default: throw new AssertionError("Unexpected user min aspect ratio override: " + mUserAspectRatioType); + mUserAspectRatioState.mUserAspectRatio); } } Loading Loading @@ -254,15 +268,14 @@ class AppCompatAspectRatioOverrides { return !mAllowUserAspectRatioOverrideOptProp.isFalse(); } // TODO(b/359217664): make this private. int getUserMinAspectRatioOverrideType() { int getUserMinAspectRatioOverrideCode() { try { return mActivityRecord.mAtmService.getPackageManager() .getUserMinAspectRatio(mActivityRecord.packageName, mActivityRecord.mUserId); } catch (RemoteException e) { Slog.w(TAG, "Exception thrown retrieving aspect ratio user override " + this, e); } return USER_MIN_ASPECT_RATIO_UNSET; return mUserAspectRatioState.mUserAspectRatio; } private float getDefaultMinAspectRatioForUnresizableApps() { Loading @@ -286,6 +299,13 @@ class AppCompatAspectRatioOverrides { return getDisplaySizeMinAspectRatio(); } private static class UserAspectRatioState { // TODO(b/315140179): Make mUserAspectRatio final // The min aspect ratio override set by user @PackageManager.UserMinAspectRatio private int mUserAspectRatio = USER_MIN_ASPECT_RATIO_UNSET; } private Resources getResources() { return mActivityRecord.mWmService.mContext.getResources(); } Loading services/core/java/com/android/server/wm/AppCompatOrientationPolicy.java +21 −3 Original line number Diff line number Diff line Loading @@ -56,11 +56,11 @@ class AppCompatOrientationPolicy { final DisplayContent displayContent = mActivityRecord.mDisplayContent; final boolean isIgnoreOrientationRequestEnabled = displayContent != null && displayContent.getIgnoreOrientationRequest(); final boolean hasFullscreenOverride = mAppCompatOverrides .getAppCompatAspectRatioOverrides().hasFullscreenOverride(); final boolean shouldApplyUserFullscreenOverride = mAppCompatOverrides .getAppCompatAspectRatioOverrides().shouldApplyUserFullscreenOverride(); final boolean shouldCameraCompatControlOrientation = AppCompatCameraPolicy.shouldCameraCompatControlOrientation(mActivityRecord); if (hasFullscreenOverride && isIgnoreOrientationRequestEnabled if (shouldApplyUserFullscreenOverride && isIgnoreOrientationRequestEnabled // Do not override orientation to fullscreen for camera activities. // Fixed-orientation activities are rarely tested in other orientations, and it // often results in sideways or stretched previews. As the camera compat treatment Loading Loading @@ -101,6 +101,24 @@ class AppCompatOrientationPolicy { return candidate; } // mUserAspectRatio is always initialized first in shouldApplyUserFullscreenOverride(), // which will always come first before this check as user override > device // manufacturer override. final boolean isSystemOverrideToFullscreenEnabled = mAppCompatOverrides .getAppCompatAspectRatioOverrides().isSystemOverrideToFullscreenEnabled(); if (isSystemOverrideToFullscreenEnabled && isIgnoreOrientationRequestEnabled // Do not override orientation to fullscreen for camera activities. // Fixed-orientation activities are rarely tested in other orientations, and it // often results in sideways or stretched previews. As the camera compat treatment // targets fixed-orientation activities, overriding the orientation disables the // treatment. && !shouldCameraCompatControlOrientation) { Slog.v(TAG, "Requested orientation " + screenOrientationToString(candidate) + " for " + mActivityRecord + " is overridden to " + screenOrientationToString(SCREEN_ORIENTATION_USER)); return SCREEN_ORIENTATION_USER; } final AppCompatOrientationOverrides.OrientationOverridesState capabilityState = mAppCompatOverrides.getAppCompatOrientationOverrides() .mOrientationOverridesState; Loading services/core/java/com/android/server/wm/DesktopAppCompatAspectRatioPolicy.java +1 −1 Original line number Diff line number Diff line Loading @@ -265,7 +265,7 @@ public class DesktopAppCompatAspectRatioPolicy { } final int userAspectRatioCode = mAppCompatOverrides.getAppCompatAspectRatioOverrides() .getUserMinAspectRatioOverrideType(); .getUserMinAspectRatioOverrideCode(); return userAspectRatioCode != USER_MIN_ASPECT_RATIO_UNSET && userAspectRatioCode != USER_MIN_ASPECT_RATIO_APP_DEFAULT Loading services/tests/wmtests/src/com/android/server/wm/AppCompatActivityRobot.java +1 −8 Original line number Diff line number Diff line Loading @@ -25,7 +25,6 @@ import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED; import static com.android.dx.mockito.inline.extended.ExtendedMockito.doReturn; import static com.android.dx.mockito.inline.extended.ExtendedMockito.spyOn; import static com.android.server.wm.BackgroundActivityStartControllerTests.setViaReflection; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyBoolean; Loading Loading @@ -228,13 +227,7 @@ class AppCompatActivityRobot { void setGetUserMinAspectRatioOverrideCode(@UserMinAspectRatio int overrideCode) { doReturn(overrideCode).when(mActivityStack.top().mAppCompatController .getAppCompatAspectRatioOverrides()).getUserMinAspectRatioOverrideType(); } void setUserAspectRatioType(@UserMinAspectRatio int aspectRatio) { final AppCompatAspectRatioOverrides aspectRatioOverrides = mActivityStack.top() .mAppCompatController.getAppCompatAspectRatioOverrides(); setViaReflection(aspectRatioOverrides, "mUserAspectRatioType", aspectRatio); .getAppCompatAspectRatioOverrides()).getUserMinAspectRatioOverrideCode(); } void setGetUserMinAspectRatioOverrideValue(float overrideValue) { Loading services/tests/wmtests/src/com/android/server/wm/AppCompatAspectRatioOverridesTest.java +10 −10 Original line number Diff line number Diff line Loading @@ -75,7 +75,7 @@ public class AppCompatAspectRatioOverridesTest extends WindowTestsBase { robot.activity().setIgnoreOrientationRequest(/* enabled */ true); robot.prop().disable(PROPERTY_COMPAT_ALLOW_USER_ASPECT_RATIO_FULLSCREEN_OVERRIDE); robot.activity().createActivityWithComponent(); robot.activity().setUserAspectRatioType(USER_MIN_ASPECT_RATIO_FULLSCREEN); robot.activity().setGetUserMinAspectRatioOverrideCode(USER_MIN_ASPECT_RATIO_FULLSCREEN); robot.checkShouldApplyUserFullscreenOverride(/* expected */ false); }); Loading @@ -88,7 +88,7 @@ public class AppCompatAspectRatioOverridesTest extends WindowTestsBase { robot.activity().setIgnoreOrientationRequest(/* enabled */ true); robot.prop().disable(PROPERTY_COMPAT_ALLOW_USER_ASPECT_RATIO_OVERRIDE); robot.activity().createActivityWithComponent(); robot.activity().setUserAspectRatioType(USER_MIN_ASPECT_RATIO_FULLSCREEN); robot.activity().setGetUserMinAspectRatioOverrideCode(USER_MIN_ASPECT_RATIO_FULLSCREEN); robot.checkShouldApplyUserFullscreenOverride(/* expected */ false); }); } Loading @@ -100,7 +100,7 @@ public class AppCompatAspectRatioOverridesTest extends WindowTestsBase { robot.conf().enableUserAppAspectRatioFullscreen(/* enabled */ true); robot.activity().setIgnoreOrientationRequest(/* enabled */ true); robot.activity().createActivityWithComponent(); robot.activity().setUserAspectRatioType(USER_MIN_ASPECT_RATIO_FULLSCREEN); robot.activity().setGetUserMinAspectRatioOverrideCode(USER_MIN_ASPECT_RATIO_FULLSCREEN); robot.checkShouldApplyUserFullscreenOverride(/* expected */ true); }); Loading @@ -113,7 +113,7 @@ public class AppCompatAspectRatioOverridesTest extends WindowTestsBase { robot.activity().setIgnoreOrientationRequest(/* enabled */ true); robot.prop().disable(PROPERTY_COMPAT_ALLOW_USER_ASPECT_RATIO_OVERRIDE); robot.activity().createActivityWithComponent(); robot.activity().setUserAspectRatioType(USER_MIN_ASPECT_RATIO_3_2); robot.activity().setGetUserMinAspectRatioOverrideCode(USER_MIN_ASPECT_RATIO_3_2); robot.checkShouldEnableUserAspectRatioSettings(/* expected */ false); }); Loading @@ -126,7 +126,7 @@ public class AppCompatAspectRatioOverridesTest extends WindowTestsBase { robot.activity().setIgnoreOrientationRequest(/* enabled */ true); robot.prop().enable(PROPERTY_COMPAT_ALLOW_USER_ASPECT_RATIO_OVERRIDE); robot.activity().createActivityWithComponent(); robot.activity().setUserAspectRatioType(USER_MIN_ASPECT_RATIO_3_2); robot.activity().setGetUserMinAspectRatioOverrideCode(USER_MIN_ASPECT_RATIO_3_2); robot.checkShouldEnableUserAspectRatioSettings(/* expected */ true); }); Loading @@ -139,7 +139,7 @@ public class AppCompatAspectRatioOverridesTest extends WindowTestsBase { robot.activity().setIgnoreOrientationRequest(/* enabled */ true); robot.prop().enable(PROPERTY_COMPAT_ALLOW_USER_ASPECT_RATIO_OVERRIDE); robot.activity().createActivityWithComponent(); robot.activity().setUserAspectRatioType(USER_MIN_ASPECT_RATIO_3_2); robot.activity().setGetUserMinAspectRatioOverrideCode(USER_MIN_ASPECT_RATIO_3_2); robot.checkShouldEnableUserAspectRatioSettings(/* expected */ false); }); Loading @@ -152,7 +152,7 @@ public class AppCompatAspectRatioOverridesTest extends WindowTestsBase { robot.activity().setIgnoreOrientationRequest(/* enabled */ true); robot.prop().disable(PROPERTY_COMPAT_ALLOW_USER_ASPECT_RATIO_OVERRIDE); robot.activity().createActivityWithComponent(); robot.activity().setUserAspectRatioType(USER_MIN_ASPECT_RATIO_3_2); robot.activity().setGetUserMinAspectRatioOverrideCode(USER_MIN_ASPECT_RATIO_3_2); robot.checkShouldEnableUserAspectRatioSettings(/* expected */ false); }); Loading @@ -175,7 +175,7 @@ public class AppCompatAspectRatioOverridesTest extends WindowTestsBase { robot.conf().enableUserAppAspectRatioSettings(/* enabled */ true); robot.activity().setIgnoreOrientationRequest(/* enabled */ false); robot.activity().createActivityWithComponent(); robot.activity().setUserAspectRatioType(USER_MIN_ASPECT_RATIO_3_2); robot.activity().setGetUserMinAspectRatioOverrideCode(USER_MIN_ASPECT_RATIO_3_2); robot.checkShouldApplyUserMinAspectRatioOverride(/* expected */ false); }); Loading @@ -187,7 +187,7 @@ public class AppCompatAspectRatioOverridesTest extends WindowTestsBase { robot.conf().enableUserAppAspectRatioSettings(/* enabled */ true); robot.activity().setIgnoreOrientationRequest(/* enabled */ true); robot.activity().createActivityWithComponent(); robot.activity().setUserAspectRatioType(USER_MIN_ASPECT_RATIO_3_2); robot.activity().setGetUserMinAspectRatioOverrideCode(USER_MIN_ASPECT_RATIO_3_2); robot.checkShouldApplyUserMinAspectRatioOverride(/* expected */ true); }); Loading @@ -199,7 +199,7 @@ public class AppCompatAspectRatioOverridesTest extends WindowTestsBase { robot.conf().enableUserAppAspectRatioSettings(/* enabled */ false); robot.activity().setIgnoreOrientationRequest(/* enabled */ true); robot.activity().createActivityWithComponent(); robot.activity().setUserAspectRatioType(USER_MIN_ASPECT_RATIO_3_2); robot.activity().setGetUserMinAspectRatioOverrideCode(USER_MIN_ASPECT_RATIO_3_2); robot.checkShouldApplyUserMinAspectRatioOverride(/* expected */ false); }); Loading Loading
services/core/java/com/android/server/wm/AppCompatAspectRatioOverrides.java +39 −19 Original line number Diff line number Diff line Loading @@ -62,8 +62,8 @@ class AppCompatAspectRatioOverrides { private final ActivityRecord mActivityRecord; @NonNull private final AppCompatConfiguration mAppCompatConfiguration; @PackageManager.UserMinAspectRatio final int mUserAspectRatioType; @NonNull private final UserAspectRatioState mUserAspectRatioState; @NonNull private final OptPropFactory.OptProp mAllowMinAspectRatioOverrideOptProp; Loading @@ -86,7 +86,7 @@ class AppCompatAspectRatioOverrides { mActivityRecord = activityRecord; mAppCompatConfiguration = appCompatConfiguration; mAppCompatDeviceStateQuery = appCompatDeviceStateQuery; mUserAspectRatioType = getUserMinAspectRatioOverrideType(); mUserAspectRatioState = new UserAspectRatioState(); mAppCompatReachabilityOverrides = appCompatReachabilityOverrides; mAllowMinAspectRatioOverrideOptProp = optPropBuilder.create( PROPERTY_COMPAT_ALLOW_MIN_ASPECT_RATIO_OVERRIDE); Loading Loading @@ -122,28 +122,41 @@ class AppCompatAspectRatioOverrides { * current app. */ boolean shouldApplyUserMinAspectRatioOverride() { return shouldEnableUserAspectRatioSettings() && mUserAspectRatioType != USER_MIN_ASPECT_RATIO_UNSET && mUserAspectRatioType != USER_MIN_ASPECT_RATIO_APP_DEFAULT && mUserAspectRatioType != USER_MIN_ASPECT_RATIO_FULLSCREEN; if (!shouldEnableUserAspectRatioSettings()) { return false; } mUserAspectRatioState.mUserAspectRatio = getUserMinAspectRatioOverrideCode(); return mUserAspectRatioState.mUserAspectRatio != USER_MIN_ASPECT_RATIO_UNSET && mUserAspectRatioState.mUserAspectRatio != USER_MIN_ASPECT_RATIO_APP_DEFAULT && mUserAspectRatioState.mUserAspectRatio != USER_MIN_ASPECT_RATIO_FULLSCREEN; } boolean shouldApplyUserFullscreenOverride() { return isUserFullscreenOverrideEnabled() && mUserAspectRatioType == USER_MIN_ASPECT_RATIO_FULLSCREEN; if (isUserFullscreenOverrideEnabled()) { mUserAspectRatioState.mUserAspectRatio = getUserMinAspectRatioOverrideCode(); return mUserAspectRatioState.mUserAspectRatio == USER_MIN_ASPECT_RATIO_FULLSCREEN; } return false; } boolean isUserFullscreenOverrideEnabled() { return !mAllowUserAspectRatioOverrideOptProp.isFalse() && !mAllowUserAspectRatioFullscreenOverrideOptProp.isFalse() && mAppCompatConfiguration.isUserAppAspectRatioFullscreenEnabled(); if (mAllowUserAspectRatioOverrideOptProp.isFalse() || mAllowUserAspectRatioFullscreenOverrideOptProp.isFalse() || !mAppCompatConfiguration.isUserAppAspectRatioFullscreenEnabled()) { return false; } return true; } boolean isSystemOverrideToFullscreenEnabled() { return isChangeEnabled(mActivityRecord, OVERRIDE_ANY_ORIENTATION_TO_USER) && !mAllowOrientationOverrideOptProp.isFalse() && (mUserAspectRatioType == USER_MIN_ASPECT_RATIO_UNSET || mUserAspectRatioType == USER_MIN_ASPECT_RATIO_FULLSCREEN); && (mUserAspectRatioState.mUserAspectRatio == USER_MIN_ASPECT_RATIO_UNSET || mUserAspectRatioState.mUserAspectRatio == USER_MIN_ASPECT_RATIO_FULLSCREEN); } /** Loading @@ -160,11 +173,12 @@ class AppCompatAspectRatioOverrides { } boolean hasFullscreenOverride() { // `mUserAspectRatio` is always initialized first in `shouldApplyUserFullscreenOverride()`. return shouldApplyUserFullscreenOverride() || isSystemOverrideToFullscreenEnabled(); } float getUserMinAspectRatio() { switch (mUserAspectRatioType) { switch (mUserAspectRatioState.mUserAspectRatio) { case USER_MIN_ASPECT_RATIO_DISPLAY_SIZE: return getDisplaySizeMinAspectRatio(); case USER_MIN_ASPECT_RATIO_SPLIT_SCREEN: Loading @@ -177,7 +191,7 @@ class AppCompatAspectRatioOverrides { return 3 / 2f; default: throw new AssertionError("Unexpected user min aspect ratio override: " + mUserAspectRatioType); + mUserAspectRatioState.mUserAspectRatio); } } Loading Loading @@ -254,15 +268,14 @@ class AppCompatAspectRatioOverrides { return !mAllowUserAspectRatioOverrideOptProp.isFalse(); } // TODO(b/359217664): make this private. int getUserMinAspectRatioOverrideType() { int getUserMinAspectRatioOverrideCode() { try { return mActivityRecord.mAtmService.getPackageManager() .getUserMinAspectRatio(mActivityRecord.packageName, mActivityRecord.mUserId); } catch (RemoteException e) { Slog.w(TAG, "Exception thrown retrieving aspect ratio user override " + this, e); } return USER_MIN_ASPECT_RATIO_UNSET; return mUserAspectRatioState.mUserAspectRatio; } private float getDefaultMinAspectRatioForUnresizableApps() { Loading @@ -286,6 +299,13 @@ class AppCompatAspectRatioOverrides { return getDisplaySizeMinAspectRatio(); } private static class UserAspectRatioState { // TODO(b/315140179): Make mUserAspectRatio final // The min aspect ratio override set by user @PackageManager.UserMinAspectRatio private int mUserAspectRatio = USER_MIN_ASPECT_RATIO_UNSET; } private Resources getResources() { return mActivityRecord.mWmService.mContext.getResources(); } Loading
services/core/java/com/android/server/wm/AppCompatOrientationPolicy.java +21 −3 Original line number Diff line number Diff line Loading @@ -56,11 +56,11 @@ class AppCompatOrientationPolicy { final DisplayContent displayContent = mActivityRecord.mDisplayContent; final boolean isIgnoreOrientationRequestEnabled = displayContent != null && displayContent.getIgnoreOrientationRequest(); final boolean hasFullscreenOverride = mAppCompatOverrides .getAppCompatAspectRatioOverrides().hasFullscreenOverride(); final boolean shouldApplyUserFullscreenOverride = mAppCompatOverrides .getAppCompatAspectRatioOverrides().shouldApplyUserFullscreenOverride(); final boolean shouldCameraCompatControlOrientation = AppCompatCameraPolicy.shouldCameraCompatControlOrientation(mActivityRecord); if (hasFullscreenOverride && isIgnoreOrientationRequestEnabled if (shouldApplyUserFullscreenOverride && isIgnoreOrientationRequestEnabled // Do not override orientation to fullscreen for camera activities. // Fixed-orientation activities are rarely tested in other orientations, and it // often results in sideways or stretched previews. As the camera compat treatment Loading Loading @@ -101,6 +101,24 @@ class AppCompatOrientationPolicy { return candidate; } // mUserAspectRatio is always initialized first in shouldApplyUserFullscreenOverride(), // which will always come first before this check as user override > device // manufacturer override. final boolean isSystemOverrideToFullscreenEnabled = mAppCompatOverrides .getAppCompatAspectRatioOverrides().isSystemOverrideToFullscreenEnabled(); if (isSystemOverrideToFullscreenEnabled && isIgnoreOrientationRequestEnabled // Do not override orientation to fullscreen for camera activities. // Fixed-orientation activities are rarely tested in other orientations, and it // often results in sideways or stretched previews. As the camera compat treatment // targets fixed-orientation activities, overriding the orientation disables the // treatment. && !shouldCameraCompatControlOrientation) { Slog.v(TAG, "Requested orientation " + screenOrientationToString(candidate) + " for " + mActivityRecord + " is overridden to " + screenOrientationToString(SCREEN_ORIENTATION_USER)); return SCREEN_ORIENTATION_USER; } final AppCompatOrientationOverrides.OrientationOverridesState capabilityState = mAppCompatOverrides.getAppCompatOrientationOverrides() .mOrientationOverridesState; Loading
services/core/java/com/android/server/wm/DesktopAppCompatAspectRatioPolicy.java +1 −1 Original line number Diff line number Diff line Loading @@ -265,7 +265,7 @@ public class DesktopAppCompatAspectRatioPolicy { } final int userAspectRatioCode = mAppCompatOverrides.getAppCompatAspectRatioOverrides() .getUserMinAspectRatioOverrideType(); .getUserMinAspectRatioOverrideCode(); return userAspectRatioCode != USER_MIN_ASPECT_RATIO_UNSET && userAspectRatioCode != USER_MIN_ASPECT_RATIO_APP_DEFAULT Loading
services/tests/wmtests/src/com/android/server/wm/AppCompatActivityRobot.java +1 −8 Original line number Diff line number Diff line Loading @@ -25,7 +25,6 @@ import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED; import static com.android.dx.mockito.inline.extended.ExtendedMockito.doReturn; import static com.android.dx.mockito.inline.extended.ExtendedMockito.spyOn; import static com.android.server.wm.BackgroundActivityStartControllerTests.setViaReflection; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyBoolean; Loading Loading @@ -228,13 +227,7 @@ class AppCompatActivityRobot { void setGetUserMinAspectRatioOverrideCode(@UserMinAspectRatio int overrideCode) { doReturn(overrideCode).when(mActivityStack.top().mAppCompatController .getAppCompatAspectRatioOverrides()).getUserMinAspectRatioOverrideType(); } void setUserAspectRatioType(@UserMinAspectRatio int aspectRatio) { final AppCompatAspectRatioOverrides aspectRatioOverrides = mActivityStack.top() .mAppCompatController.getAppCompatAspectRatioOverrides(); setViaReflection(aspectRatioOverrides, "mUserAspectRatioType", aspectRatio); .getAppCompatAspectRatioOverrides()).getUserMinAspectRatioOverrideCode(); } void setGetUserMinAspectRatioOverrideValue(float overrideValue) { Loading
services/tests/wmtests/src/com/android/server/wm/AppCompatAspectRatioOverridesTest.java +10 −10 Original line number Diff line number Diff line Loading @@ -75,7 +75,7 @@ public class AppCompatAspectRatioOverridesTest extends WindowTestsBase { robot.activity().setIgnoreOrientationRequest(/* enabled */ true); robot.prop().disable(PROPERTY_COMPAT_ALLOW_USER_ASPECT_RATIO_FULLSCREEN_OVERRIDE); robot.activity().createActivityWithComponent(); robot.activity().setUserAspectRatioType(USER_MIN_ASPECT_RATIO_FULLSCREEN); robot.activity().setGetUserMinAspectRatioOverrideCode(USER_MIN_ASPECT_RATIO_FULLSCREEN); robot.checkShouldApplyUserFullscreenOverride(/* expected */ false); }); Loading @@ -88,7 +88,7 @@ public class AppCompatAspectRatioOverridesTest extends WindowTestsBase { robot.activity().setIgnoreOrientationRequest(/* enabled */ true); robot.prop().disable(PROPERTY_COMPAT_ALLOW_USER_ASPECT_RATIO_OVERRIDE); robot.activity().createActivityWithComponent(); robot.activity().setUserAspectRatioType(USER_MIN_ASPECT_RATIO_FULLSCREEN); robot.activity().setGetUserMinAspectRatioOverrideCode(USER_MIN_ASPECT_RATIO_FULLSCREEN); robot.checkShouldApplyUserFullscreenOverride(/* expected */ false); }); } Loading @@ -100,7 +100,7 @@ public class AppCompatAspectRatioOverridesTest extends WindowTestsBase { robot.conf().enableUserAppAspectRatioFullscreen(/* enabled */ true); robot.activity().setIgnoreOrientationRequest(/* enabled */ true); robot.activity().createActivityWithComponent(); robot.activity().setUserAspectRatioType(USER_MIN_ASPECT_RATIO_FULLSCREEN); robot.activity().setGetUserMinAspectRatioOverrideCode(USER_MIN_ASPECT_RATIO_FULLSCREEN); robot.checkShouldApplyUserFullscreenOverride(/* expected */ true); }); Loading @@ -113,7 +113,7 @@ public class AppCompatAspectRatioOverridesTest extends WindowTestsBase { robot.activity().setIgnoreOrientationRequest(/* enabled */ true); robot.prop().disable(PROPERTY_COMPAT_ALLOW_USER_ASPECT_RATIO_OVERRIDE); robot.activity().createActivityWithComponent(); robot.activity().setUserAspectRatioType(USER_MIN_ASPECT_RATIO_3_2); robot.activity().setGetUserMinAspectRatioOverrideCode(USER_MIN_ASPECT_RATIO_3_2); robot.checkShouldEnableUserAspectRatioSettings(/* expected */ false); }); Loading @@ -126,7 +126,7 @@ public class AppCompatAspectRatioOverridesTest extends WindowTestsBase { robot.activity().setIgnoreOrientationRequest(/* enabled */ true); robot.prop().enable(PROPERTY_COMPAT_ALLOW_USER_ASPECT_RATIO_OVERRIDE); robot.activity().createActivityWithComponent(); robot.activity().setUserAspectRatioType(USER_MIN_ASPECT_RATIO_3_2); robot.activity().setGetUserMinAspectRatioOverrideCode(USER_MIN_ASPECT_RATIO_3_2); robot.checkShouldEnableUserAspectRatioSettings(/* expected */ true); }); Loading @@ -139,7 +139,7 @@ public class AppCompatAspectRatioOverridesTest extends WindowTestsBase { robot.activity().setIgnoreOrientationRequest(/* enabled */ true); robot.prop().enable(PROPERTY_COMPAT_ALLOW_USER_ASPECT_RATIO_OVERRIDE); robot.activity().createActivityWithComponent(); robot.activity().setUserAspectRatioType(USER_MIN_ASPECT_RATIO_3_2); robot.activity().setGetUserMinAspectRatioOverrideCode(USER_MIN_ASPECT_RATIO_3_2); robot.checkShouldEnableUserAspectRatioSettings(/* expected */ false); }); Loading @@ -152,7 +152,7 @@ public class AppCompatAspectRatioOverridesTest extends WindowTestsBase { robot.activity().setIgnoreOrientationRequest(/* enabled */ true); robot.prop().disable(PROPERTY_COMPAT_ALLOW_USER_ASPECT_RATIO_OVERRIDE); robot.activity().createActivityWithComponent(); robot.activity().setUserAspectRatioType(USER_MIN_ASPECT_RATIO_3_2); robot.activity().setGetUserMinAspectRatioOverrideCode(USER_MIN_ASPECT_RATIO_3_2); robot.checkShouldEnableUserAspectRatioSettings(/* expected */ false); }); Loading @@ -175,7 +175,7 @@ public class AppCompatAspectRatioOverridesTest extends WindowTestsBase { robot.conf().enableUserAppAspectRatioSettings(/* enabled */ true); robot.activity().setIgnoreOrientationRequest(/* enabled */ false); robot.activity().createActivityWithComponent(); robot.activity().setUserAspectRatioType(USER_MIN_ASPECT_RATIO_3_2); robot.activity().setGetUserMinAspectRatioOverrideCode(USER_MIN_ASPECT_RATIO_3_2); robot.checkShouldApplyUserMinAspectRatioOverride(/* expected */ false); }); Loading @@ -187,7 +187,7 @@ public class AppCompatAspectRatioOverridesTest extends WindowTestsBase { robot.conf().enableUserAppAspectRatioSettings(/* enabled */ true); robot.activity().setIgnoreOrientationRequest(/* enabled */ true); robot.activity().createActivityWithComponent(); robot.activity().setUserAspectRatioType(USER_MIN_ASPECT_RATIO_3_2); robot.activity().setGetUserMinAspectRatioOverrideCode(USER_MIN_ASPECT_RATIO_3_2); robot.checkShouldApplyUserMinAspectRatioOverride(/* expected */ true); }); Loading @@ -199,7 +199,7 @@ public class AppCompatAspectRatioOverridesTest extends WindowTestsBase { robot.conf().enableUserAppAspectRatioSettings(/* enabled */ false); robot.activity().setIgnoreOrientationRequest(/* enabled */ true); robot.activity().createActivityWithComponent(); robot.activity().setUserAspectRatioType(USER_MIN_ASPECT_RATIO_3_2); robot.activity().setGetUserMinAspectRatioOverrideCode(USER_MIN_ASPECT_RATIO_3_2); robot.checkShouldApplyUserMinAspectRatioOverride(/* expected */ false); }); Loading