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

Commit 2429135e authored by Piotr Wilczyński's avatar Piotr Wilczyński Committed by Android (Google) Code Review
Browse files

Merge "Keep refresh rate settings upgraded even if the flag is off" into main

parents b96025b2 cfbcf0ac
Loading
Loading
Loading
Loading
+0 −28
Original line number Diff line number Diff line
@@ -1110,20 +1110,6 @@ public class DisplayModeDirector {
            if (Float.isInfinite(minRefreshRate)) {
                // Infinity means that we want the highest possible refresh rate
                minRefreshRate = highestRefreshRate;

                if (!mIsBackUpSmoothDisplayAndForcePeakRefreshRateEnabled
                        && displayId == Display.DEFAULT_DISPLAY) {
                    // The flag has been turned off, we need to restore the original value. We'll
                    // use the peak refresh rate of the default display.
                    Settings.System.putFloatForUser(cr, Settings.System.MIN_REFRESH_RATE,
                            highestRefreshRate, cr.getUserId());
                }
            } else if (mIsBackUpSmoothDisplayAndForcePeakRefreshRateEnabled
                    && displayId == Display.DEFAULT_DISPLAY
                    && Math.round(minRefreshRate) == Math.round(highestRefreshRate)) {
                // The flag has been turned on, we need to upgrade the setting
                Settings.System.putFloatForUser(cr, Settings.System.MIN_REFRESH_RATE,
                        Float.POSITIVE_INFINITY, cr.getUserId());
            }

            float peakRefreshRate = Settings.System.getFloatForUser(cr,
@@ -1131,20 +1117,6 @@ public class DisplayModeDirector {
            if (Float.isInfinite(peakRefreshRate)) {
                // Infinity means that we want the highest possible refresh rate
                peakRefreshRate = highestRefreshRate;

                if (!mIsBackUpSmoothDisplayAndForcePeakRefreshRateEnabled
                        && displayId == Display.DEFAULT_DISPLAY) {
                    // The flag has been turned off, we need to restore the original value. We'll
                    // use the peak refresh rate of the default display.
                    Settings.System.putFloatForUser(cr, Settings.System.PEAK_REFRESH_RATE,
                            highestRefreshRate, cr.getUserId());
                }
            } else if (mIsBackUpSmoothDisplayAndForcePeakRefreshRateEnabled
                    && displayId == Display.DEFAULT_DISPLAY
                    && Math.round(peakRefreshRate) == Math.round(highestRefreshRate)) {
                // The flag has been turned on, we need to upgrade the setting
                Settings.System.putFloatForUser(cr, Settings.System.PEAK_REFRESH_RATE,
                        Float.POSITIVE_INFINITY, cr.getUserId());
            }

            updateRefreshRateSettingLocked(minRefreshRate, peakRefreshRate, mDefaultRefreshRate,