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

Commit af54782a authored by Ying Wei's avatar Ying Wei
Browse files

Improve log message.

Add more information to the failure message: now it looks something like `Failed to get a callback for Display 0 switching from {Config 38: vsyncPeriod 4166666, minFrameIntervalNs 16666667} to {Config 37: vsyncPeriod 8333333, minFrameIntervalNs 8333333}` instead of `failed to get a callback for the display 0 with config 37`

Test: atest VtsHalGraphicsComposer3_TargetTest:PerInstance/GraphicsComposerAidlCommandV2Test#SetRefreshRateChangedCallbackDebugEnabled_SetActiveConfigWithConstraints/0_android_hardware_graphics_composer3_IComposer_default

Bug: 340971724
Change-Id: Id2a1030a9b12e86bda8f6031e79a8374227f4061
parent 6c4bc494
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -288,6 +288,20 @@ class VtsDisplay {
        return false;
    }

    std::string printConfig(int config) {
        const auto displayConfig = getDisplayConfig(config);
        const auto vrrConfigOpt = displayConfig.vrrConfigOpt;
        std::stringstream ss;
        if (displayConfig.vrrConfigOpt) {
            ss << "{Config " << config << ": vsyncPeriod " << displayConfig.vsyncPeriod
                << ", minFrameIntervalNs " << vrrConfigOpt->minFrameIntervalNs << "}";
        }
        else {
            ss << "{Config " << config << ": vsyncPeriod " << displayConfig.vsyncPeriod << "}";
        }
        return ss.str();
    }

    std::unordered_map<int32_t, DisplayConfig> getDisplayConfigs() { return mDisplayConfigs; }

  private:
+3 −2
Original line number Diff line number Diff line
@@ -2877,8 +2877,9 @@ TEST_P(GraphicsComposerAidlCommandV2Test,
            } while (--retryCount > 0);

            if (retryCount == 0) {
                GTEST_FAIL() << "failed to get a callback for the display " << displayId
                             << " with config " << config2;
                GTEST_FAIL() << "Failed to get a callback for Display " << displayId
                             << " switching from " << display.printConfig(config1)
                             << " to " << display.printConfig(config2);
            }
        });