diff options
| author | 2021-04-08 17:30:52 -0700 | |
|---|---|---|
| committer | 2021-04-08 17:32:19 -0700 | |
| commit | 257fdaecb53fdec10dbe187ec523641da21b55cb (patch) | |
| tree | d8b2ebe397742d8ea8f32a728dba57fa6bfc71ec | |
| parent | 9432a357af0f0ff4a83d1f9db646450cf162d616 (diff) | |
SurfaceFlinger: Remove reparentChildren
No callers left outside of tests.
Bug: 161937501
Test: Existing tests pass
Change-Id: Id5c2b68d1be05fce9f698813d83044b02bb2764d
| -rw-r--r-- | cmds/surfacereplayer/proto/src/trace.proto | 5 | ||||
| -rw-r--r-- | cmds/surfacereplayer/replayer/Replayer.cpp | 12 | ||||
| -rw-r--r-- | cmds/surfacereplayer/replayer/Replayer.h | 2 | ||||
| -rw-r--r-- | libs/gui/LayerState.cpp | 4 | ||||
| -rw-r--r-- | libs/gui/SurfaceComposerClient.cpp | 14 | ||||
| -rw-r--r-- | libs/gui/include/gui/LayerState.h | 1 | ||||
| -rw-r--r-- | libs/gui/include/gui/SurfaceComposerClient.h | 6 | ||||
| -rw-r--r-- | services/surfaceflinger/Layer.cpp | 26 | ||||
| -rw-r--r-- | services/surfaceflinger/Layer.h | 2 | ||||
| -rw-r--r-- | services/surfaceflinger/SurfaceFlinger.cpp | 5 | ||||
| -rw-r--r-- | services/surfaceflinger/SurfaceInterceptor.cpp | 11 | ||||
| -rw-r--r-- | services/surfaceflinger/SurfaceInterceptor.h | 1 | ||||
| -rw-r--r-- | services/surfaceflinger/tests/LayerUpdate_test.cpp | 34 | ||||
| -rw-r--r-- | services/surfaceflinger/tests/SurfaceInterceptor_test.cpp | 26 | ||||
| -rw-r--r-- | services/surfaceflinger/tests/fakehwc/SFFakeHwc_test.cpp | 28 | ||||
| -rw-r--r-- | services/surfaceflinger/tests/unittests/SetFrameRateTest.cpp | 40 |
16 files changed, 1 insertions, 216 deletions
diff --git a/cmds/surfacereplayer/proto/src/trace.proto b/cmds/surfacereplayer/proto/src/trace.proto index 79aab822e4..06afefd3c8 100644 --- a/cmds/surfacereplayer/proto/src/trace.proto +++ b/cmds/surfacereplayer/proto/src/trace.proto @@ -50,7 +50,6 @@ message SurfaceChange { CornerRadiusChange corner_radius = 16; ReparentChange reparent = 17; RelativeParentChange relative_parent = 18; - ReparentChildrenChange reparent_children = 19; BackgroundBlurRadiusChange background_blur_radius = 20; ShadowRadiusChange shadow_radius = 21; BlurRegionsChange blur_regions = 22; @@ -190,10 +189,6 @@ message ReparentChange { required int32 parent_id = 1; } -message ReparentChildrenChange { - required int32 parent_id = 1; -} - message RelativeParentChange { required int32 relative_parent_id = 1; required int32 z = 2; diff --git a/cmds/surfacereplayer/replayer/Replayer.cpp b/cmds/surfacereplayer/replayer/Replayer.cpp index bbbe6f7ec4..a6d9a3feb6 100644 --- a/cmds/surfacereplayer/replayer/Replayer.cpp +++ b/cmds/surfacereplayer/replayer/Replayer.cpp @@ -410,9 +410,6 @@ status_t Replayer::doSurfaceTransaction( case SurfaceChange::SurfaceChangeCase::kReparent: setReparentChange(transaction, change.id(), change.reparent()); break; - case SurfaceChange::SurfaceChangeCase::kReparentChildren: - setReparentChildrenChange(transaction, change.id(), change.reparent_children()); - break; case SurfaceChange::SurfaceChangeCase::kRelativeParent: setRelativeParentChange(transaction, change.id(), change.relative_parent()); break; @@ -709,15 +706,6 @@ void Replayer::setRelativeParentChange(SurfaceComposerClient::Transaction& t, t.setRelativeLayer(mLayers[id], mLayers[c.relative_parent_id()], c.z()); } -void Replayer::setReparentChildrenChange(SurfaceComposerClient::Transaction& t, - layer_id id, const ReparentChildrenChange& c) { - if (mLayers.count(c.parent_id()) == 0 || mLayers[c.parent_id()] == nullptr) { - ALOGE("Layer %d not found in reparent children transaction", c.parent_id()); - return; - } - t.reparentChildren(mLayers[id], mLayers[c.parent_id()]); -} - void Replayer::setShadowRadiusChange(SurfaceComposerClient::Transaction& t, layer_id id, const ShadowRadiusChange& c) { t.setShadowRadius(mLayers[id], c.radius()); diff --git a/cmds/surfacereplayer/replayer/Replayer.h b/cmds/surfacereplayer/replayer/Replayer.h index 324d591eaa..252db2bfbb 100644 --- a/cmds/surfacereplayer/replayer/Replayer.h +++ b/cmds/surfacereplayer/replayer/Replayer.h @@ -116,8 +116,6 @@ class Replayer { layer_id id, const ReparentChange& c); void setRelativeParentChange(SurfaceComposerClient::Transaction& t, layer_id id, const RelativeParentChange& c); - void setReparentChildrenChange(SurfaceComposerClient::Transaction& t, - layer_id id, const ReparentChildrenChange& c); void setShadowRadiusChange(SurfaceComposerClient::Transaction& t, layer_id id, const ShadowRadiusChange& c); void setBlurRegionsChange(SurfaceComposerClient::Transaction& t, diff --git a/libs/gui/LayerState.cpp b/libs/gui/LayerState.cpp index 0ca497795b..809438534c 100644 --- a/libs/gui/LayerState.cpp +++ b/libs/gui/LayerState.cpp @@ -430,10 +430,6 @@ void layer_state_t::merge(const layer_state_t& other) { barrierSurfaceControl_legacy = other.barrierSurfaceControl_legacy; barrierFrameNumber = other.barrierFrameNumber; } - if (other.what & eReparentChildren) { - what |= eReparentChildren; - reparentSurfaceControl = other.reparentSurfaceControl; - } if (other.what & eRelativeLayerChanged) { what |= eRelativeLayerChanged; what &= ~eLayerChanged; diff --git a/libs/gui/SurfaceComposerClient.cpp b/libs/gui/SurfaceComposerClient.cpp index c888312184..9ce094aa77 100644 --- a/libs/gui/SurfaceComposerClient.cpp +++ b/libs/gui/SurfaceComposerClient.cpp @@ -1157,20 +1157,6 @@ SurfaceComposerClient::Transaction::deferTransactionUntil_legacy( return *this; } -SurfaceComposerClient::Transaction& SurfaceComposerClient::Transaction::reparentChildren( - const sp<SurfaceControl>& sc, const sp<SurfaceControl>& newParent) { - layer_state_t* s = getLayerState(sc); - if (!s) { - mStatus = BAD_INDEX; - return *this; - } - s->what |= layer_state_t::eReparentChildren; - s->reparentSurfaceControl = newParent; - - registerSurfaceControlForCallback(sc); - return *this; -} - SurfaceComposerClient::Transaction& SurfaceComposerClient::Transaction::reparent( const sp<SurfaceControl>& sc, const sp<SurfaceControl>& newParent) { layer_state_t* s = getLayerState(sc); diff --git a/libs/gui/include/gui/LayerState.h b/libs/gui/include/gui/LayerState.h index 706a09c3c7..41a022f90e 100644 --- a/libs/gui/include/gui/LayerState.h +++ b/libs/gui/include/gui/LayerState.h @@ -86,7 +86,6 @@ struct layer_state_t { eDeferTransaction_legacy = 0x00000200, eReleaseBufferListenerChanged = 0x00000400, eShadowRadiusChanged = 0x00000800, - eReparentChildren = 0x00001000, /* was eDetachChildren, now available 0x00002000, */ eRelativeLayerChanged = 0x00004000, eReparent = 0x00008000, diff --git a/libs/gui/include/gui/SurfaceComposerClient.h b/libs/gui/include/gui/SurfaceComposerClient.h index 731af58e85..1590b10a00 100644 --- a/libs/gui/include/gui/SurfaceComposerClient.h +++ b/libs/gui/include/gui/SurfaceComposerClient.h @@ -461,13 +461,7 @@ public: Transaction& deferTransactionUntil_legacy(const sp<SurfaceControl>& sc, const sp<SurfaceControl>& barrierSurfaceControl, uint64_t frameNumber); - // Reparents all children of this layer to the new parent handle. - Transaction& reparentChildren(const sp<SurfaceControl>& sc, - const sp<SurfaceControl>& newParent); - /// Reparents the current layer to the new parent handle. The new parent must not be null. - // This can be used instead of reparentChildren if the caller wants to - // only re-parent a specific child. Transaction& reparent(const sp<SurfaceControl>& sc, const sp<SurfaceControl>& newParent); Transaction& setColor(const sp<SurfaceControl>& sc, const half3& color); diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp index 2fcd8215eb..c7e798b74b 100644 --- a/services/surfaceflinger/Layer.cpp +++ b/services/surfaceflinger/Layer.cpp @@ -1949,32 +1949,6 @@ ssize_t Layer::removeChild(const sp<Layer>& layer) { return removeResult; } -void Layer::reparentChildren(const sp<Layer>& newParent) { - for (const sp<Layer>& child : mCurrentChildren) { - newParent->addChild(child); - } - mCurrentChildren.clear(); - updateTreeHasFrameRateVote(); -} - -bool Layer::reparentChildren(const sp<IBinder>& newParentHandle) { - sp<Handle> handle = nullptr; - sp<Layer> newParent = nullptr; - if (newParentHandle == nullptr) { - return false; - } - handle = static_cast<Handle*>(newParentHandle.get()); - newParent = handle->owner.promote(); - if (newParent == nullptr) { - ALOGE("Unable to promote Layer handle"); - return false; - } - - reparentChildren(newParent); - - return true; -} - void Layer::setChildrenDrawingParent(const sp<Layer>& newParent) { for (const sp<Layer>& child : mDrawingChildren) { child->mDrawingParent = newParent; diff --git a/services/surfaceflinger/Layer.h b/services/surfaceflinger/Layer.h index 4a105ebeda..e993b7b9e1 100644 --- a/services/surfaceflinger/Layer.h +++ b/services/surfaceflinger/Layer.h @@ -637,8 +637,6 @@ public: void onLayerDisplayed(const sp<Fence>& releaseFence) override; const char* getDebugName() const override; - bool reparentChildren(const sp<IBinder>& newParentHandle); - void reparentChildren(const sp<Layer>& newParent); bool setShadowRadius(float shadowRadius); // Before color management is introduced, contents on Android have to be diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp index 1b7158b825..57349124dd 100644 --- a/services/surfaceflinger/SurfaceFlinger.cpp +++ b/services/surfaceflinger/SurfaceFlinger.cpp @@ -4019,11 +4019,6 @@ uint32_t SurfaceFlinger::setClientStateLocked( // We don't trigger a traversal here because if no other state is // changed, we don't want this to cause any more work } - if (what & layer_state_t::eReparentChildren) { - if (layer->reparentChildren(s.reparentSurfaceControl->getHandle())) { - flags |= eTransactionNeeded|eTraversalNeeded; - } - } if (what & layer_state_t::eTransformChanged) { if (layer->setTransform(s.transform)) flags |= eTraversalNeeded; } diff --git a/services/surfaceflinger/SurfaceInterceptor.cpp b/services/surfaceflinger/SurfaceInterceptor.cpp index 8a3be9f4ed..b49562a0a5 100644 --- a/services/surfaceflinger/SurfaceInterceptor.cpp +++ b/services/surfaceflinger/SurfaceInterceptor.cpp @@ -401,13 +401,6 @@ void SurfaceInterceptor::addReparentLocked(Transaction* transaction, int32_t lay overrideChange->set_parent_id(parentId); } -void SurfaceInterceptor::addReparentChildrenLocked(Transaction* transaction, int32_t layerId, - int32_t parentId) { - SurfaceChange* change(createSurfaceChangeLocked(transaction, layerId)); - ReparentChildrenChange* overrideChange(change->mutable_reparent_children()); - overrideChange->set_parent_id(parentId); -} - void SurfaceInterceptor::addRelativeParentLocked(Transaction* transaction, int32_t layerId, int32_t parentId, int z) { SurfaceChange* change(createSurfaceChangeLocked(transaction, layerId)); @@ -486,10 +479,6 @@ void SurfaceInterceptor::addSurfaceChangesLocked(Transaction* transaction, : nullptr; addReparentLocked(transaction, layerId, getLayerIdFromHandle(parentHandle)); } - if (state.what & layer_state_t::eReparentChildren) { - addReparentChildrenLocked(transaction, layerId, - getLayerIdFromHandle(state.reparentSurfaceControl->getHandle())); - } if (state.what & layer_state_t::eRelativeLayerChanged) { addRelativeParentLocked(transaction, layerId, getLayerIdFromHandle( diff --git a/services/surfaceflinger/SurfaceInterceptor.h b/services/surfaceflinger/SurfaceInterceptor.h index 3e27e83b02..d2cbf40426 100644 --- a/services/surfaceflinger/SurfaceInterceptor.h +++ b/services/surfaceflinger/SurfaceInterceptor.h @@ -176,7 +176,6 @@ private: uint32_t transactionFlags, int originPid, int originUid, uint64_t transactionId); void addReparentLocked(Transaction* transaction, int32_t layerId, int32_t parentId); - void addReparentChildrenLocked(Transaction* transaction, int32_t layerId, int32_t parentId); void addRelativeParentLocked(Transaction* transaction, int32_t layerId, int32_t parentId, int z); void addShadowRadiusLocked(Transaction* transaction, int32_t layerId, float shadowRadius); diff --git a/services/surfaceflinger/tests/LayerUpdate_test.cpp b/services/surfaceflinger/tests/LayerUpdate_test.cpp index e5c2ec8bfb..39d9206e1a 100644 --- a/services/surfaceflinger/tests/LayerUpdate_test.cpp +++ b/services/surfaceflinger/tests/LayerUpdate_test.cpp @@ -462,38 +462,6 @@ TEST_F(ChildLayerTest, ChildLayerAlpha) { } } -TEST_F(ChildLayerTest, ReparentChildren) { - asTransaction([&](Transaction& t) { - t.show(mChild); - t.setPosition(mChild, 10, 10); - t.setPosition(mFGSurfaceControl, 64, 64); - }); - - { - mCapture = screenshot(); - // Top left of foreground must now be visible - mCapture->expectFGColor(64, 64); - // But 10 pixels in we should see the child surface - mCapture->expectChildColor(74, 74); - // And 10 more pixels we should be back to the foreground surface - mCapture->expectFGColor(84, 84); - } - - asTransaction( - [&](Transaction& t) { t.reparentChildren(mFGSurfaceControl, mBGSurfaceControl); }); - - { - mCapture = screenshot(); - mCapture->expectFGColor(64, 64); - // In reparenting we should have exposed the entire foreground surface. - mCapture->expectFGColor(74, 74); - // And the child layer should now begin at 10, 10 (since the BG - // layer is at (0, 0)). - mCapture->expectBGColor(9, 9); - mCapture->expectChildColor(10, 10); - } -} - TEST_F(ChildLayerTest, ChildrenSurviveParentDestruction) { sp<SurfaceControl> mGrandChild = createSurface(mClient, "Grand Child", 10, 10, PIXEL_FORMAT_RGBA_8888, 0, mChild.get()); @@ -539,7 +507,7 @@ TEST_F(ChildLayerTest, ChildrenRelativeZSurvivesParentDestruction) { asTransaction([&](Transaction& t) { t.reparent(mChild, nullptr); - t.reparentChildren(mChild, mFGSurfaceControl); + t.reparent(mGrandChild, mFGSurfaceControl); }); { diff --git a/services/surfaceflinger/tests/SurfaceInterceptor_test.cpp b/services/surfaceflinger/tests/SurfaceInterceptor_test.cpp index d9cab42aae..09bd775872 100644 --- a/services/surfaceflinger/tests/SurfaceInterceptor_test.cpp +++ b/services/surfaceflinger/tests/SurfaceInterceptor_test.cpp @@ -194,7 +194,6 @@ public: bool deferredTransactionUpdateFound(const SurfaceChange& change, bool foundDeferred); bool reparentUpdateFound(const SurfaceChange& change, bool found); bool relativeParentUpdateFound(const SurfaceChange& change, bool found); - bool reparentChildrenUpdateFound(const SurfaceChange& change, bool found); bool shadowRadiusUpdateFound(const SurfaceChange& change, bool found); bool surfaceUpdateFound(const Trace& trace, SurfaceChange::SurfaceChangeCase changeCase); @@ -231,7 +230,6 @@ public: void deferredTransactionUpdate(Transaction&); void reparentUpdate(Transaction&); void relativeParentUpdate(Transaction&); - void reparentChildrenUpdate(Transaction&); void shadowRadiusUpdate(Transaction&); void surfaceCreation(Transaction&); void displayCreation(Transaction&); @@ -410,10 +408,6 @@ void SurfaceInterceptorTest::relativeParentUpdate(Transaction& t) { t.setRelativeLayer(mBGSurfaceControl, mFGSurfaceControl, RELATIVE_Z); } -void SurfaceInterceptorTest::reparentChildrenUpdate(Transaction& t) { - t.reparentChildren(mBGSurfaceControl, mFGSurfaceControl); -} - void SurfaceInterceptorTest::shadowRadiusUpdate(Transaction& t) { t.setShadowRadius(mBGSurfaceControl, SHADOW_RADIUS_UPDATE); } @@ -445,7 +439,6 @@ void SurfaceInterceptorTest::runAllUpdates() { runInTransaction(&SurfaceInterceptorTest::secureFlagUpdate); runInTransaction(&SurfaceInterceptorTest::deferredTransactionUpdate); runInTransaction(&SurfaceInterceptorTest::reparentUpdate); - runInTransaction(&SurfaceInterceptorTest::reparentChildrenUpdate); runInTransaction(&SurfaceInterceptorTest::relativeParentUpdate); runInTransaction(&SurfaceInterceptorTest::shadowRadiusUpdate); } @@ -660,16 +653,6 @@ bool SurfaceInterceptorTest::relativeParentUpdateFound(const SurfaceChange& chan return found; } -bool SurfaceInterceptorTest::reparentChildrenUpdateFound(const SurfaceChange& change, bool found) { - bool hasId(change.reparent_children().parent_id() == mFGLayerId); - if (hasId && !found) { - found = true; - } else if (hasId && found) { - []() { FAIL(); }(); - } - return found; -} - bool SurfaceInterceptorTest::shadowRadiusUpdateFound(const SurfaceChange& change, bool foundShadowRadius) { bool hasShadowRadius(change.shadow_radius().radius() == SHADOW_RADIUS_UPDATE); @@ -738,9 +721,6 @@ bool SurfaceInterceptorTest::surfaceUpdateFound(const Trace& trace, case SurfaceChange::SurfaceChangeCase::kReparent: foundUpdate = reparentUpdateFound(change, foundUpdate); break; - case SurfaceChange::SurfaceChangeCase::kReparentChildren: - foundUpdate = reparentChildrenUpdateFound(change, foundUpdate); - break; case SurfaceChange::SurfaceChangeCase::kRelativeParent: foundUpdate = relativeParentUpdateFound(change, foundUpdate); break; @@ -771,7 +751,6 @@ void SurfaceInterceptorTest::assertAllUpdatesFound(const Trace& trace) { ASSERT_TRUE(surfaceUpdateFound(trace, SurfaceChange::SurfaceChangeCase::kSecureFlag)); ASSERT_TRUE(surfaceUpdateFound(trace, SurfaceChange::SurfaceChangeCase::kDeferredTransaction)); ASSERT_TRUE(surfaceUpdateFound(trace, SurfaceChange::SurfaceChangeCase::kReparent)); - ASSERT_TRUE(surfaceUpdateFound(trace, SurfaceChange::SurfaceChangeCase::kReparentChildren)); ASSERT_TRUE(surfaceUpdateFound(trace, SurfaceChange::SurfaceChangeCase::kRelativeParent)); } @@ -937,11 +916,6 @@ TEST_F(SurfaceInterceptorTest, InterceptReparentUpdateWorks) { SurfaceChange::SurfaceChangeCase::kReparent); } -TEST_F(SurfaceInterceptorTest, InterceptReparentChildrenUpdateWorks) { - captureTest(&SurfaceInterceptorTest::reparentChildrenUpdate, - SurfaceChange::SurfaceChangeCase::kReparentChildren); -} - TEST_F(SurfaceInterceptorTest, InterceptRelativeParentUpdateWorks) { captureTest(&SurfaceInterceptorTest::relativeParentUpdate, SurfaceChange::SurfaceChangeCase::kRelativeParent); diff --git a/services/surfaceflinger/tests/fakehwc/SFFakeHwc_test.cpp b/services/surfaceflinger/tests/fakehwc/SFFakeHwc_test.cpp index 820f248dbb..c081f9b642 100644 --- a/services/surfaceflinger/tests/fakehwc/SFFakeHwc_test.cpp +++ b/services/surfaceflinger/tests/fakehwc/SFFakeHwc_test.cpp @@ -1766,30 +1766,6 @@ protected: EXPECT_TRUE(framesAreSame(referenceFrame2, Base::sFakeComposer->getLatestFrame())); } - void Test_ReparentChildren() { - { - TransactionScope ts(*Base::sFakeComposer); - ts.show(mChild); - ts.setPosition(mChild, 10, 10); - ts.setPosition(Base::mFGSurfaceControl, 64, 64); - } - auto referenceFrame = Base::mBaseFrame; - referenceFrame[Base::FG_LAYER].mDisplayFrame = hwc_rect_t{64, 64, 64 + 64, 64 + 64}; - referenceFrame[CHILD_LAYER].mDisplayFrame = - hwc_rect_t{64 + 10, 64 + 10, 64 + 10 + 10, 64 + 10 + 10}; - EXPECT_TRUE(framesAreSame(referenceFrame, Base::sFakeComposer->getLatestFrame())); - - { - TransactionScope ts(*Base::sFakeComposer); - ts.reparentChildren(Base::mFGSurfaceControl, Base::mBGSurfaceControl); - } - - auto referenceFrame2 = referenceFrame; - referenceFrame2[Base::FG_LAYER].mDisplayFrame = hwc_rect_t{64, 64, 64 + 64, 64 + 64}; - referenceFrame2[CHILD_LAYER].mDisplayFrame = hwc_rect_t{10, 10, 10 + 10, 10 + 10}; - EXPECT_TRUE(framesAreSame(referenceFrame2, Base::sFakeComposer->getLatestFrame())); - } - // Regression test for b/37673612 void Test_ChildrenWithParentBufferTransform() { { @@ -1886,10 +1862,6 @@ TEST_F(ChildLayerTest_2_1, DISABLED_LayerAlpha) { Test_LayerAlpha(); } -TEST_F(ChildLayerTest_2_1, DISABLED_ReparentChildren) { - Test_ReparentChildren(); -} - // Regression test for b/37673612 TEST_F(ChildLayerTest_2_1, DISABLED_ChildrenWithParentBufferTransform) { Test_ChildrenWithParentBufferTransform(); diff --git a/services/surfaceflinger/tests/unittests/SetFrameRateTest.cpp b/services/surfaceflinger/tests/unittests/SetFrameRateTest.cpp index 7e602a29a0..0bb7e31194 100644 --- a/services/surfaceflinger/tests/unittests/SetFrameRateTest.cpp +++ b/services/surfaceflinger/tests/unittests/SetFrameRateTest.cpp @@ -122,7 +122,6 @@ protected: void addChild(sp<Layer> layer, sp<Layer> child); void removeChild(sp<Layer> layer, sp<Layer> child); - void reparentChildren(sp<Layer> layer, sp<Layer> child); void commitTransaction(); TestableSurfaceFlinger mFlinger; @@ -152,10 +151,6 @@ void SetFrameRateTest::removeChild(sp<Layer> layer, sp<Layer> child) { layer.get()->removeChild(child.get()); } -void SetFrameRateTest::reparentChildren(sp<Layer> parent, sp<Layer> newParent) { - parent.get()->reparentChildren(newParent); -} - void SetFrameRateTest::commitTransaction() { for (auto layer : mLayers) { layer->pushPendingState(); @@ -433,41 +428,6 @@ TEST_P(SetFrameRateTest, SetAndGetParentNotInTree) { EXPECT_EQ(FRAME_RATE_NO_VOTE, child2_1->getFrameRateForLayerTree()); } -TEST_P(SetFrameRateTest, SetAndGetReparentChildren) { - EXPECT_CALL(*mMessageQueue, invalidate()).Times(1); - - const auto& layerFactory = GetParam(); - - auto parent = mLayers.emplace_back(layerFactory->createLayer(mFlinger)); - auto parent2 = mLayers.emplace_back(layerFactory->createLayer(mFlinger)); - auto child1 = mLayers.emplace_back(layerFactory->createLayer(mFlinger)); - auto child2 = mLayers.emplace_back(layerFactory->createLayer(mFlinger)); - - addChild(parent, child1); - addChild(child1, child2); - - child2->setFrameRate(FRAME_RATE_VOTE1); - commitTransaction(); - EXPECT_EQ(FRAME_RATE_TREE, parent->getFrameRateForLayerTree()); - EXPECT_EQ(FRAME_RATE_NO_VOTE, parent2->getFrameRateForLayerTree()); - EXPECT_EQ(FRAME_RATE_TREE, child1->getFrameRateForLayerTree()); - EXPECT_EQ(FRAME_RATE_VOTE1, child2->getFrameRateForLayerTree()); - - reparentChildren(parent, parent2); - commitTransaction(); - EXPECT_EQ(FRAME_RATE_NO_VOTE, parent->getFrameRateForLayerTree()); - EXPECT_EQ(FRAME_RATE_TREE, parent2->getFrameRateForLayerTree()); - EXPECT_EQ(FRAME_RATE_TREE, child1->getFrameRateForLayerTree()); - EXPECT_EQ(FRAME_RATE_VOTE1, child2->getFrameRateForLayerTree()); - - child2->setFrameRate(FRAME_RATE_NO_VOTE); - commitTransaction(); - EXPECT_EQ(FRAME_RATE_NO_VOTE, parent->getFrameRateForLayerTree()); - EXPECT_EQ(FRAME_RATE_NO_VOTE, parent2->getFrameRateForLayerTree()); - EXPECT_EQ(FRAME_RATE_NO_VOTE, child1->getFrameRateForLayerTree()); - EXPECT_EQ(FRAME_RATE_NO_VOTE, child2->getFrameRateForLayerTree()); -} - INSTANTIATE_TEST_SUITE_P(PerLayerType, SetFrameRateTest, testing::Values(std::make_shared<BufferQueueLayerFactory>(), std::make_shared<BufferStateLayerFactory>(), |