FrameRateCategory::NoPreference votes Min
LayerVoteType::Min is a vote type that is ignored unless all voting
active layers also vote Min for minimum refresh rate.
Now the NoPreference category works for
infrequent animations such as a blinking cursor.
Bug: 298716564
Test: atest CtsSurfaceControlTestsStaging
Test: atest libsurfaceflinger_unittest
Change-Id: I970d59ff6499b9d64962361f3098d19b6b953d9c
diff --git a/services/surfaceflinger/tests/unittests/LayerInfoTest.cpp b/services/surfaceflinger/tests/unittests/LayerInfoTest.cpp
index e0133d6..11072bc 100644
--- a/services/surfaceflinger/tests/unittests/LayerInfoTest.cpp
+++ b/services/surfaceflinger/tests/unittests/LayerInfoTest.cpp
@@ -223,8 +223,6 @@
}
TEST_F(LayerInfoTest, getRefreshRateVote_explicitCategory) {
- // When a layer only has a category set, the LayerVoteType should be the LayerInfo's default.
- // The most common case should be Heuristic.
LayerInfo::LayerVote vote = {.type = LayerHistory::LayerVoteType::ExplicitDefault,
.category = FrameRateCategory::High};
layerInfo.setLayerVote(vote);
@@ -234,6 +232,20 @@
ASSERT_EQ(actualVotes.size(), 1u);
ASSERT_EQ(actualVotes[0].type, LayerHistory::LayerVoteType::ExplicitCategory);
ASSERT_EQ(actualVotes[0].category, vote.category);
+ ASSERT_EQ(actualVotes[0].fps, 0_Hz);
+}
+
+TEST_F(LayerInfoTest, getRefreshRateVote_categoryNoPreference) {
+ LayerInfo::LayerVote vote = {.type = LayerHistory::LayerVoteType::ExplicitDefault,
+ .category = FrameRateCategory::NoPreference};
+ layerInfo.setLayerVote(vote);
+
+ auto actualVotes =
+ layerInfo.getRefreshRateVote(*mScheduler->refreshRateSelector(), systemTime());
+ ASSERT_EQ(actualVotes.size(), 1u);
+ ASSERT_EQ(actualVotes[0].type, LayerHistory::LayerVoteType::ExplicitCategory);
+ ASSERT_EQ(actualVotes[0].category, vote.category);
+ ASSERT_EQ(actualVotes[0].fps, 0_Hz);
}
TEST_F(LayerInfoTest, getRefreshRateVote_noData) {