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

Commit 6bb6836c authored by Marin Shalamanov's avatar Marin Shalamanov Committed by Android (Google) Code Review
Browse files

Merge "Add logging when refresh rate policy is invalid"

parents 65dd86ef b6674e7a
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -48,7 +48,7 @@ std::string RefreshRateConfigs::layerVoteTypeString(LayerVoteType vote) {
    }
}

std::string RefreshRateConfigs::Policy::toString() {
std::string RefreshRateConfigs::Policy::toString() const {
    return base::StringPrintf("default config ID: %d, allowGroupSwitching = %d"
                              ", primary range: [%.2f %.2f], app request range: [%.2f %.2f]",
                              defaultConfig.value(), allowGroupSwitching, primaryRange.min,
@@ -433,10 +433,12 @@ bool RefreshRateConfigs::isPolicyValid(const Policy& policy) {
    // defaultConfig must be a valid config, and within the given refresh rate range.
    auto iter = mRefreshRates.find(policy.defaultConfig);
    if (iter == mRefreshRates.end()) {
        ALOGE("Default config is not found.");
        return false;
    }
    const RefreshRate& refreshRate = *iter->second;
    if (!refreshRate.inPolicy(policy.primaryRange.min, policy.primaryRange.max)) {
        ALOGE("Default config is not in the primary range.");
        return false;
    }
    return policy.appRequestRange.min <= policy.primaryRange.min &&
@@ -446,6 +448,7 @@ bool RefreshRateConfigs::isPolicyValid(const Policy& policy) {
status_t RefreshRateConfigs::setDisplayManagerPolicy(const Policy& policy) {
    std::lock_guard lock(mLock);
    if (!isPolicyValid(policy)) {
        ALOGE("Invalid refresh rate policy: %s", policy.toString().c_str());
        return BAD_VALUE;
    }
    Policy previousPolicy = *getCurrentPolicyLocked();
+1 −1
Original line number Diff line number Diff line
@@ -166,7 +166,7 @@ public:
        }

        bool operator!=(const Policy& other) const { return !(*this == other); }
        std::string toString();
        std::string toString() const;
    };

    // Return code set*Policy() to indicate the current policy is unchanged.