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

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

Merge "SF Crash Bug fix"

parents 584b9e6e 5d47791e
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -229,6 +229,15 @@ const RefreshRate& RefreshRateConfigs::getCurrentRefreshRate() const {
    return *mCurrentRefreshRate;
}

const RefreshRate& RefreshRateConfigs::getCurrentRefreshRateByPolicy() const {
    std::lock_guard lock(mLock);
    if (std::find(mAvailableRefreshRates.begin(), mAvailableRefreshRates.end(),
                  mCurrentRefreshRate) != mAvailableRefreshRates.end()) {
        return *mCurrentRefreshRate;
    }
    return mRefreshRates.at(mDefaultConfig);
}

void RefreshRateConfigs::setCurrentConfigId(HwcConfigIndexType configId) {
    std::lock_guard lock(mLock);
    mCurrentRefreshRate = &mRefreshRates.at(configId);
+4 −0
Original line number Diff line number Diff line
@@ -149,6 +149,10 @@ public:
    // Returns the current refresh rate
    const RefreshRate& getCurrentRefreshRate() const EXCLUDES(mLock);

    // Returns the current refresh rate, if allowed. Otherwise the default that is allowed by
    // the policy.
    const RefreshRate& getCurrentRefreshRateByPolicy() const;

    // Returns the refresh rate that corresponds to a HwcConfigIndexType. This won't change at
    // runtime.
    const RefreshRate& getRefreshRateFromConfigId(HwcConfigIndexType configId) const {
+2 −2
Original line number Diff line number Diff line
@@ -625,8 +625,8 @@ HwcConfigIndexType Scheduler::calculateRefreshRateType() {
                .configId;
    }

    // There are no signals for refresh rate, just leave it as is
    return mRefreshRateConfigs.getCurrentRefreshRate().configId;
    // There are no signals for refresh rate, just leave it as is.
    return mRefreshRateConfigs.getCurrentRefreshRateByPolicy().configId;
}

std::optional<HwcConfigIndexType> Scheduler::getPreferredConfigId() {