Add constraints to window duration scale

Ensure that all uses of WINDOW_DURATION_SCALE are bounded between 0
and 20.

Bug: 238178261
Test: adb shell dumpsys window windows | grep "Animation setting"
Change-Id: I36ea0ffce662fea7b3e02e9f13caaea9e5ecf54b
This commit is contained in:
Fiona Campbell
2022-08-16 14:56:01 +00:00
parent f73a728509
commit ed28faef53

View File

@@ -1324,8 +1324,7 @@ public class WindowManagerService extends IWindowManager.Stub
}, UserHandle.ALL, suspendPackagesFilter, null, null);
// Get persisted window scale setting
mWindowAnimationScaleSetting = Settings.Global.getFloat(resolver,
Settings.Global.WINDOW_ANIMATION_SCALE, mWindowAnimationScaleSetting);
mWindowAnimationScaleSetting = getWindowAnimationScaleSetting();
mTransitionAnimationScaleSetting = getTransitionAnimationScaleSetting();
setAnimatorDurationScale(getAnimatorDurationScaleSetting());
@@ -1413,6 +1412,11 @@ public class WindowManagerService extends IWindowManager.Stub
Settings.Global.ANIMATOR_DURATION_SCALE, mAnimatorDurationScaleSetting));
}
private float getWindowAnimationScaleSetting() {
return fixScale(Settings.Global.getFloat(mContext.getContentResolver(),
Settings.Global.WINDOW_ANIMATION_SCALE, mWindowAnimationScaleSetting));
}
/**
* Called after all entities (such as the {@link ActivityManagerService}) have been set up and
* associated with the {@link WindowManagerService}.
@@ -5327,10 +5331,7 @@ public class WindowManagerService extends IWindowManager.Stub
final int mode = msg.arg1;
switch (mode) {
case WINDOW_ANIMATION_SCALE: {
mWindowAnimationScaleSetting = Settings.Global.getFloat(
mContext.getContentResolver(),
Settings.Global.WINDOW_ANIMATION_SCALE,
mWindowAnimationScaleSetting);
mWindowAnimationScaleSetting = getWindowAnimationScaleSetting();
break;
}
case TRANSITION_ANIMATION_SCALE: {