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

Commit 7baf6d7c authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "DM: use the right terminology for divisor" into tm-dev

parents 8084c8c0 baf73d1d
Loading
Loading
Loading
Loading
+7 −7
Original line number Diff line number Diff line
@@ -204,8 +204,8 @@ public final class DisplayManagerService extends SystemService {
    private static final String PROP_DEFAULT_DISPLAY_TOP_INSET = "persist.sys.displayinset.top";
    private static final long WAIT_FOR_DEFAULT_DISPLAY_TIMEOUT = 10000;
    // This value needs to be in sync with the threshold
    // in RefreshRateConfigs::getFrameRateDivider.
    private static final float THRESHOLD_FOR_REFRESH_RATES_DIVIDERS = 0.0009f;
    // in RefreshRateConfigs::getFrameRateDivisor.
    private static final float THRESHOLD_FOR_REFRESH_RATES_DIVISORS = 0.0009f;

    private static final int MSG_REGISTER_DEFAULT_DISPLAY_ADAPTERS = 1;
    private static final int MSG_REGISTER_ADDITIONAL_DISPLAY_ADAPTERS = 2;
@@ -895,13 +895,13 @@ public final class DisplayManagerService extends SystemService {
            return info;
        }

        // Override the refresh rate only if it is a divider of the current
        // Override the refresh rate only if it is a divisor of the current
        // refresh rate. This calculation needs to be in sync with the native code
        // in RefreshRateConfigs::getFrameRateDivider
        // in RefreshRateConfigs::getFrameRateDivisor
        Display.Mode currentMode = info.getMode();
        float numPeriods = currentMode.getRefreshRate() / frameRateHz;
        float numPeriodsRound = Math.round(numPeriods);
        if (Math.abs(numPeriods - numPeriodsRound) > THRESHOLD_FOR_REFRESH_RATES_DIVIDERS) {
        if (Math.abs(numPeriods - numPeriodsRound) > THRESHOLD_FOR_REFRESH_RATES_DIVISORS) {
            return info;
        }
        frameRateHz = currentMode.getRefreshRate() / numPeriodsRound;
@@ -913,9 +913,9 @@ public final class DisplayManagerService extends SystemService {
                continue;
            }

            if (mode.getRefreshRate() >= frameRateHz - THRESHOLD_FOR_REFRESH_RATES_DIVIDERS
            if (mode.getRefreshRate() >= frameRateHz - THRESHOLD_FOR_REFRESH_RATES_DIVISORS
                    && mode.getRefreshRate()
                    <= frameRateHz + THRESHOLD_FOR_REFRESH_RATES_DIVIDERS) {
                    <= frameRateHz + THRESHOLD_FOR_REFRESH_RATES_DIVISORS) {
                if (DEBUG) {
                    Slog.d(TAG, "found matching modeId " + mode.getModeId());
                }