Pull out FrameRateCompatibility definition to avoid circular dependencies
Test: presubmit
Bug: 300701739
Change-Id: I7a1cc64a786fca5a7a273522dc4735439b44fd13
diff --git a/services/surfaceflinger/tests/unittests/LayerHistoryTest.cpp b/services/surfaceflinger/tests/unittests/LayerHistoryTest.cpp
index 7e3e61f..cc7a45c 100644
--- a/services/surfaceflinger/tests/unittests/LayerHistoryTest.cpp
+++ b/services/surfaceflinger/tests/unittests/LayerHistoryTest.cpp
@@ -152,7 +152,7 @@
EXPECT_CALL(*layer, isVisible()).WillRepeatedly(Return(true));
EXPECT_CALL(*layer, getFrameRateForLayerTree()).WillRepeatedly(Return(Layer::FrameRate()));
EXPECT_CALL(*layer, getDefaultFrameRateCompatibility())
- .WillOnce(Return(LayerInfo::FrameRateCompatibility::NoVote));
+ .WillOnce(Return(FrameRateCompatibility::NoVote));
EXPECT_EQ(1, layerCount());
EXPECT_EQ(0, activeLayerCount());
@@ -176,7 +176,7 @@
EXPECT_CALL(*layer, isVisible()).WillRepeatedly(Return(true));
EXPECT_CALL(*layer, getFrameRateForLayerTree()).WillRepeatedly(Return(Layer::FrameRate()));
EXPECT_CALL(*layer, getDefaultFrameRateCompatibility())
- .WillOnce(Return(LayerInfo::FrameRateCompatibility::Min));
+ .WillOnce(Return(FrameRateCompatibility::Min));
EXPECT_EQ(1, layerCount());
EXPECT_EQ(0, activeLayerCount());
diff --git a/services/surfaceflinger/tests/unittests/LayerSnapshotTest.cpp b/services/surfaceflinger/tests/unittests/LayerSnapshotTest.cpp
index 1a9233d..69316bf 100644
--- a/services/surfaceflinger/tests/unittests/LayerSnapshotTest.cpp
+++ b/services/surfaceflinger/tests/unittests/LayerSnapshotTest.cpp
@@ -315,14 +315,11 @@
UPDATE_AND_VERIFY(mSnapshotBuilder, STARTING_ZORDER);
EXPECT_EQ(getSnapshot(11)->frameRate.vote.rate.getIntValue(), 90);
- EXPECT_EQ(getSnapshot(11)->frameRate.vote.type,
- scheduler::LayerInfo::FrameRateCompatibility::Exact);
+ EXPECT_EQ(getSnapshot(11)->frameRate.vote.type, scheduler::FrameRateCompatibility::Exact);
EXPECT_EQ(getSnapshot(111)->frameRate.vote.rate.getIntValue(), 90);
- EXPECT_EQ(getSnapshot(111)->frameRate.vote.type,
- scheduler::LayerInfo::FrameRateCompatibility::Exact);
+ EXPECT_EQ(getSnapshot(111)->frameRate.vote.type, scheduler::FrameRateCompatibility::Exact);
EXPECT_EQ(getSnapshot(1)->frameRate.vote.rate.getIntValue(), 0);
- EXPECT_EQ(getSnapshot(1)->frameRate.vote.type,
- scheduler::LayerInfo::FrameRateCompatibility::NoVote);
+ EXPECT_EQ(getSnapshot(1)->frameRate.vote.type, scheduler::FrameRateCompatibility::NoVote);
}
TEST_F(LayerSnapshotTest, CanCropTouchableRegion) {
@@ -550,20 +547,20 @@
// verify parent is gets no vote
EXPECT_FALSE(getSnapshot({.id = 1})->frameRate.vote.rate.isValid());
EXPECT_EQ(getSnapshot({.id = 1})->frameRate.vote.type,
- scheduler::LayerInfo::FrameRateCompatibility::NoVote);
+ scheduler::FrameRateCompatibility::NoVote);
EXPECT_TRUE(getSnapshot({.id = 1})->changes.test(RequestedLayerState::Changes::FrameRate));
// verify layer and children get the requested votes
EXPECT_TRUE(getSnapshot({.id = 11})->frameRate.vote.rate.isValid());
EXPECT_EQ(getSnapshot({.id = 11})->frameRate.vote.rate.getValue(), 244.f);
EXPECT_EQ(getSnapshot({.id = 11})->frameRate.vote.type,
- scheduler::LayerInfo::FrameRateCompatibility::Default);
+ scheduler::FrameRateCompatibility::Default);
EXPECT_TRUE(getSnapshot({.id = 11})->changes.test(RequestedLayerState::Changes::FrameRate));
EXPECT_TRUE(getSnapshot({.id = 111})->frameRate.vote.rate.isValid());
EXPECT_EQ(getSnapshot({.id = 111})->frameRate.vote.rate.getValue(), 244.f);
EXPECT_EQ(getSnapshot({.id = 111})->frameRate.vote.type,
- scheduler::LayerInfo::FrameRateCompatibility::Default);
+ scheduler::FrameRateCompatibility::Default);
EXPECT_TRUE(getSnapshot({.id = 111})->changes.test(RequestedLayerState::Changes::FrameRate));
// reparent and verify the child gets the new parent's framerate
@@ -574,23 +571,23 @@
// verify parent is gets no vote
EXPECT_FALSE(getSnapshot({.id = 1})->frameRate.vote.rate.isValid());
EXPECT_EQ(getSnapshot({.id = 1})->frameRate.vote.type,
- scheduler::LayerInfo::FrameRateCompatibility::NoVote);
+ scheduler::FrameRateCompatibility::NoVote);
// verify layer and children get the requested votes
EXPECT_TRUE(getSnapshot({.id = 11})->frameRate.vote.rate.isValid());
EXPECT_EQ(getSnapshot({.id = 11})->frameRate.vote.rate.getValue(), 244.f);
EXPECT_EQ(getSnapshot({.id = 11})->frameRate.vote.type,
- scheduler::LayerInfo::FrameRateCompatibility::Default);
+ scheduler::FrameRateCompatibility::Default);
EXPECT_TRUE(getSnapshot({.id = 111})->frameRate.vote.rate.isValid());
EXPECT_EQ(getSnapshot({.id = 111})->frameRate.vote.rate.getValue(), 244.f);
EXPECT_EQ(getSnapshot({.id = 111})->frameRate.vote.type,
- scheduler::LayerInfo::FrameRateCompatibility::Default);
+ scheduler::FrameRateCompatibility::Default);
EXPECT_TRUE(getSnapshot({.id = 122})->frameRate.vote.rate.isValid());
EXPECT_EQ(getSnapshot({.id = 122})->frameRate.vote.rate.getValue(), 244.f);
EXPECT_EQ(getSnapshot({.id = 122})->frameRate.vote.type,
- scheduler::LayerInfo::FrameRateCompatibility::Default);
+ scheduler::FrameRateCompatibility::Default);
EXPECT_TRUE(getSnapshot({.id = 122})->changes.test(RequestedLayerState::Changes::FrameRate));
// reparent and verify the new parent gets no vote
@@ -601,30 +598,30 @@
// verify old parent has invalid framerate (default)
EXPECT_FALSE(getSnapshot({.id = 1})->frameRate.vote.rate.isValid());
EXPECT_EQ(getSnapshot({.id = 1})->frameRate.vote.type,
- scheduler::LayerInfo::FrameRateCompatibility::Default);
+ scheduler::FrameRateCompatibility::Default);
EXPECT_TRUE(getSnapshot({.id = 1})->changes.test(RequestedLayerState::Changes::FrameRate));
// verify new parent get no vote
EXPECT_FALSE(getSnapshot({.id = 2})->frameRate.vote.rate.isValid());
EXPECT_EQ(getSnapshot({.id = 2})->frameRate.vote.type,
- scheduler::LayerInfo::FrameRateCompatibility::NoVote);
+ scheduler::FrameRateCompatibility::NoVote);
EXPECT_TRUE(getSnapshot({.id = 2})->changes.test(RequestedLayerState::Changes::FrameRate));
// verify layer and children get the requested votes (unchanged)
EXPECT_TRUE(getSnapshot({.id = 11})->frameRate.vote.rate.isValid());
EXPECT_EQ(getSnapshot({.id = 11})->frameRate.vote.rate.getValue(), 244.f);
EXPECT_EQ(getSnapshot({.id = 11})->frameRate.vote.type,
- scheduler::LayerInfo::FrameRateCompatibility::Default);
+ scheduler::FrameRateCompatibility::Default);
EXPECT_TRUE(getSnapshot({.id = 111})->frameRate.vote.rate.isValid());
EXPECT_EQ(getSnapshot({.id = 111})->frameRate.vote.rate.getValue(), 244.f);
EXPECT_EQ(getSnapshot({.id = 111})->frameRate.vote.type,
- scheduler::LayerInfo::FrameRateCompatibility::Default);
+ scheduler::FrameRateCompatibility::Default);
EXPECT_TRUE(getSnapshot({.id = 122})->frameRate.vote.rate.isValid());
EXPECT_EQ(getSnapshot({.id = 122})->frameRate.vote.rate.getValue(), 244.f);
EXPECT_EQ(getSnapshot({.id = 122})->frameRate.vote.type,
- scheduler::LayerInfo::FrameRateCompatibility::Default);
+ scheduler::FrameRateCompatibility::Default);
}
TEST_F(LayerSnapshotTest, translateDataspace) {
@@ -653,33 +650,33 @@
// verify parent 1 gets no vote
EXPECT_FALSE(getSnapshot({.id = 1})->frameRate.vote.rate.isValid());
EXPECT_EQ(getSnapshot({.id = 1})->frameRate.vote.type,
- scheduler::LayerInfo::FrameRateCompatibility::NoVote);
+ scheduler::FrameRateCompatibility::NoVote);
EXPECT_TRUE(getSnapshot({.id = 1})->changes.test(RequestedLayerState::Changes::FrameRate));
// verify layer 11 and children 111 get the requested votes
EXPECT_TRUE(getSnapshot({.id = 11})->frameRate.vote.rate.isValid());
EXPECT_EQ(getSnapshot({.id = 11})->frameRate.vote.rate.getValue(), 244.f);
EXPECT_EQ(getSnapshot({.id = 11})->frameRate.vote.type,
- scheduler::LayerInfo::FrameRateCompatibility::Default);
+ scheduler::FrameRateCompatibility::Default);
EXPECT_TRUE(getSnapshot({.id = 11})->changes.test(RequestedLayerState::Changes::FrameRate));
EXPECT_TRUE(getSnapshot({.id = 111})->frameRate.vote.rate.isValid());
EXPECT_EQ(getSnapshot({.id = 111})->frameRate.vote.rate.getValue(), 244.f);
EXPECT_EQ(getSnapshot({.id = 111})->frameRate.vote.type,
- scheduler::LayerInfo::FrameRateCompatibility::Default);
+ scheduler::FrameRateCompatibility::Default);
EXPECT_TRUE(getSnapshot({.id = 111})->changes.test(RequestedLayerState::Changes::FrameRate));
// verify parent 12 gets no vote
EXPECT_FALSE(getSnapshot({.id = 12})->frameRate.vote.rate.isValid());
EXPECT_EQ(getSnapshot({.id = 12})->frameRate.vote.type,
- scheduler::LayerInfo::FrameRateCompatibility::NoVote);
+ scheduler::FrameRateCompatibility::NoVote);
EXPECT_TRUE(getSnapshot({.id = 12})->changes.test(RequestedLayerState::Changes::FrameRate));
// verify layer 122 and children 1221 get the requested votes
EXPECT_FALSE(getSnapshot({.id = 122})->frameRate.vote.rate.isValid());
EXPECT_TRUE(getSnapshot({.id = 122})->frameRate.isValid());
EXPECT_EQ(getSnapshot({.id = 122})->frameRate.vote.type,
- scheduler::LayerInfo::FrameRateCompatibility::Default);
+ scheduler::FrameRateCompatibility::Default);
EXPECT_EQ(getSnapshot({.id = 122})->frameRate.category, FrameRateCategory::Normal);
EXPECT_TRUE(getSnapshot({.id = 122})->changes.test(RequestedLayerState::Changes::FrameRate));
EXPECT_TRUE(
@@ -688,7 +685,7 @@
EXPECT_FALSE(getSnapshot({.id = 1221})->frameRate.vote.rate.isValid());
EXPECT_TRUE(getSnapshot({.id = 1221})->frameRate.isValid());
EXPECT_EQ(getSnapshot({.id = 1221})->frameRate.vote.type,
- scheduler::LayerInfo::FrameRateCompatibility::Default);
+ scheduler::FrameRateCompatibility::Default);
EXPECT_EQ(getSnapshot({.id = 1221})->frameRate.category, FrameRateCategory::Normal);
EXPECT_TRUE(getSnapshot({.id = 1221})->changes.test(RequestedLayerState::Changes::FrameRate));
EXPECT_TRUE(
@@ -713,32 +710,32 @@
// verify parent is gets no vote
EXPECT_FALSE(getSnapshot({.id = 1})->frameRate.vote.rate.isValid());
EXPECT_EQ(getSnapshot({.id = 1})->frameRate.vote.type,
- scheduler::LayerInfo::FrameRateCompatibility::NoVote);
+ scheduler::FrameRateCompatibility::NoVote);
// verify layer 11 and children 111 get the requested votes
EXPECT_TRUE(getSnapshot({.id = 11})->frameRate.vote.rate.isValid());
EXPECT_EQ(getSnapshot({.id = 11})->frameRate.vote.rate.getValue(), 244.f);
EXPECT_EQ(getSnapshot({.id = 11})->frameRate.vote.type,
- scheduler::LayerInfo::FrameRateCompatibility::Default);
+ scheduler::FrameRateCompatibility::Default);
EXPECT_TRUE(getSnapshot({.id = 111})->frameRate.vote.rate.isValid());
EXPECT_EQ(getSnapshot({.id = 111})->frameRate.vote.rate.getValue(), 244.f);
EXPECT_EQ(getSnapshot({.id = 111})->frameRate.vote.type,
- scheduler::LayerInfo::FrameRateCompatibility::Default);
+ scheduler::FrameRateCompatibility::Default);
// verify layer 122 and children 1221 get the requested category vote (unchanged from
// reparenting)
EXPECT_FALSE(getSnapshot({.id = 122})->frameRate.vote.rate.isValid());
EXPECT_TRUE(getSnapshot({.id = 122})->frameRate.isValid());
EXPECT_EQ(getSnapshot({.id = 122})->frameRate.vote.type,
- scheduler::LayerInfo::FrameRateCompatibility::Default);
+ scheduler::FrameRateCompatibility::Default);
EXPECT_EQ(getSnapshot({.id = 122})->frameRate.category, FrameRateCategory::Normal);
EXPECT_TRUE(getSnapshot({.id = 122})->changes.test(RequestedLayerState::Changes::FrameRate));
EXPECT_FALSE(getSnapshot({.id = 1221})->frameRate.vote.rate.isValid());
EXPECT_TRUE(getSnapshot({.id = 1221})->frameRate.isValid());
EXPECT_EQ(getSnapshot({.id = 1221})->frameRate.vote.type,
- scheduler::LayerInfo::FrameRateCompatibility::Default);
+ scheduler::FrameRateCompatibility::Default);
EXPECT_EQ(getSnapshot({.id = 1221})->frameRate.category, FrameRateCategory::Normal);
EXPECT_TRUE(getSnapshot({.id = 1221})->changes.test(RequestedLayerState::Changes::FrameRate));
}
@@ -762,7 +759,7 @@
// verify parent 1 gets no vote
EXPECT_FALSE(getSnapshot({.id = 1})->frameRate.vote.rate.isValid());
EXPECT_EQ(getSnapshot({.id = 1})->frameRate.vote.type,
- scheduler::LayerInfo::FrameRateCompatibility::NoVote);
+ scheduler::FrameRateCompatibility::NoVote);
EXPECT_TRUE(getSnapshot({.id = 1})->changes.test(RequestedLayerState::Changes::FrameRate));
// verify layer 12 and all descendants (121, 122, 1221) get the requested vote
diff --git a/services/surfaceflinger/tests/unittests/mock/MockLayer.h b/services/surfaceflinger/tests/unittests/mock/MockLayer.h
index 50e07fc..4cc78fe 100644
--- a/services/surfaceflinger/tests/unittests/mock/MockLayer.h
+++ b/services/surfaceflinger/tests/unittests/mock/MockLayer.h
@@ -25,7 +25,7 @@
MockLayer(SurfaceFlinger* flinger, std::string name)
: Layer(LayerCreationArgs(flinger, nullptr, std::move(name), 0, {})) {
EXPECT_CALL(*this, getDefaultFrameRateCompatibility())
- .WillOnce(testing::Return(scheduler::LayerInfo::FrameRateCompatibility::Default));
+ .WillOnce(testing::Return(scheduler::FrameRateCompatibility::Default));
}
explicit MockLayer(SurfaceFlinger* flinger) : MockLayer(flinger, "TestLayer") {}
@@ -34,8 +34,7 @@
MOCK_CONST_METHOD0(isVisible, bool());
MOCK_METHOD1(createClone, sp<Layer>(uint32_t));
MOCK_CONST_METHOD0(getFrameRateForLayerTree, FrameRate());
- MOCK_CONST_METHOD0(getDefaultFrameRateCompatibility,
- scheduler::LayerInfo::FrameRateCompatibility());
+ MOCK_CONST_METHOD0(getDefaultFrameRateCompatibility, scheduler::FrameRateCompatibility());
MOCK_CONST_METHOD0(getOwnerUid, uid_t());
MOCK_CONST_METHOD0(getDataSpace, ui::Dataspace());
};