Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ed28faef authored by Fiona Campbell's avatar Fiona Campbell
Browse files

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
parent f73a7285
Loading
Loading
Loading
Loading
+7 −6
Original line number Diff line number Diff line
@@ -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: {