diff options
8 files changed, 7 insertions, 67 deletions
diff --git a/services/surfaceflinger/Scheduler/Scheduler.cpp b/services/surfaceflinger/Scheduler/Scheduler.cpp index be00079b9c..5e131548aa 100644 --- a/services/surfaceflinger/Scheduler/Scheduler.cpp +++ b/services/surfaceflinger/Scheduler/Scheduler.cpp @@ -38,7 +38,6 @@ #include <FrameTimeline/FrameTimeline.h> #include <scheduler/interface/ICompositor.h> -#include <algorithm> #include <cinttypes> #include <cstdint> #include <functional> @@ -46,16 +45,15 @@ #include <numeric> #include <common/FlagManager.h> -#include "../Layer.h" #include "EventThread.h" #include "FrameRateOverrideMappings.h" #include "FrontEnd/LayerHandle.h" +#include "Layer.h" #include "OneShotTimer.h" #include "RefreshRateStats.h" #include "SurfaceFlingerFactory.h" #include "SurfaceFlingerProperties.h" #include "TimeStats/TimeStats.h" -#include "VSyncTracker.h" #include "VsyncConfiguration.h" #include "VsyncController.h" #include "VsyncSchedule.h" @@ -361,10 +359,8 @@ void Scheduler::createEventThread(Cycle cycle, frametimeline::TokenManager* toke if (cycle == Cycle::Render) { mRenderEventThread = std::move(eventThread); - mRenderEventConnection = mRenderEventThread->createEventConnection(); } else { mLastCompositeEventThread = std::move(eventThread); - mLastCompositeEventConnection = mLastCompositeEventThread->createEventConnection(); } } diff --git a/services/surfaceflinger/Scheduler/Scheduler.h b/services/surfaceflinger/Scheduler/Scheduler.h index 1367ec385e..c88b563805 100644 --- a/services/surfaceflinger/Scheduler/Scheduler.h +++ b/services/surfaceflinger/Scheduler/Scheduler.h @@ -145,10 +145,6 @@ public: Cycle, EventRegistrationFlags eventRegistration = {}, const sp<IBinder>& layerHandle = nullptr) EXCLUDES(mChoreographerLock); - const sp<EventThreadConnection>& getEventConnection(Cycle cycle) const { - return cycle == Cycle::Render ? mRenderEventConnection : mLastCompositeEventConnection; - } - enum class Hotplug { Connected, Disconnected }; void dispatchHotplug(PhysicalDisplayId, Hotplug); @@ -467,10 +463,7 @@ private: void onExpectedPresentTimePosted(TimePoint expectedPresentTime) override EXCLUDES(mDisplayLock); std::unique_ptr<EventThread> mRenderEventThread; - sp<EventThreadConnection> mRenderEventConnection; - std::unique_ptr<EventThread> mLastCompositeEventThread; - sp<EventThreadConnection> mLastCompositeEventConnection; std::atomic<nsecs_t> mLastResyncTime = 0; diff --git a/services/surfaceflinger/tests/unittests/DisplayTransactionTest.cpp b/services/surfaceflinger/tests/unittests/DisplayTransactionTest.cpp index fa31643df1..9b10c94bcd 100644 --- a/services/surfaceflinger/tests/unittests/DisplayTransactionTest.cpp +++ b/services/surfaceflinger/tests/unittests/DisplayTransactionTest.cpp @@ -64,17 +64,6 @@ DisplayTransactionTest::~DisplayTransactionTest() { void DisplayTransactionTest::injectMockScheduler(PhysicalDisplayId displayId) { LOG_ALWAYS_FATAL_IF(mFlinger.scheduler()); - - EXPECT_CALL(*mEventThread, registerDisplayEventConnection(_)); - EXPECT_CALL(*mEventThread, createEventConnection(_, _)) - .WillOnce(Return( - sp<EventThreadConnection>::make(mEventThread, mock::EventThread::kCallingUid))); - - EXPECT_CALL(*mSFEventThread, registerDisplayEventConnection(_)); - EXPECT_CALL(*mSFEventThread, createEventConnection(_, _)) - .WillOnce(Return(sp<EventThreadConnection>::make(mSFEventThread, - mock::EventThread::kCallingUid))); - mFlinger.setupScheduler(std::make_unique<mock::VsyncController>(), std::make_shared<mock::VSyncTracker>(), std::unique_ptr<EventThread>(mEventThread), diff --git a/services/surfaceflinger/tests/unittests/SchedulerTest.cpp b/services/surfaceflinger/tests/unittests/SchedulerTest.cpp index 45ca7e2f59..ac09cbcea6 100644 --- a/services/surfaceflinger/tests/unittests/SchedulerTest.cpp +++ b/services/surfaceflinger/tests/unittests/SchedulerTest.cpp @@ -124,7 +124,7 @@ SchedulerTest::SchedulerTest() { // createConnection call to scheduler makes a createEventConnection call to EventThread. Make // sure that call gets executed and returns an EventThread::Connection object. - EXPECT_CALL(*mEventThread, createEventConnection(_, _)) + EXPECT_CALL(*mEventThread, createEventConnection(_)) .WillRepeatedly(Return(mEventThreadConnection)); mScheduler->setEventThread(Cycle::Render, std::move(eventThread)); @@ -797,7 +797,7 @@ TEST_F(AttachedChoreographerTest, registerMultipleOnSameLayer) { const auto mockConnection1 = sp<MockEventThreadConnection>::make(mEventThread); const auto mockConnection2 = sp<MockEventThreadConnection>::make(mEventThread); - EXPECT_CALL(*mEventThread, createEventConnection(_, _)) + EXPECT_CALL(*mEventThread, createEventConnection(_)) .WillOnce(Return(mockConnection1)) .WillOnce(Return(mockConnection2)); diff --git a/services/surfaceflinger/tests/unittests/SurfaceFlinger_DisplayModeSwitching.cpp b/services/surfaceflinger/tests/unittests/SurfaceFlinger_DisplayModeSwitching.cpp index 4b0a7c3a04..86996214b5 100644 --- a/services/surfaceflinger/tests/unittests/SurfaceFlinger_DisplayModeSwitching.cpp +++ b/services/surfaceflinger/tests/unittests/SurfaceFlinger_DisplayModeSwitching.cpp @@ -187,16 +187,6 @@ void DisplayModeSwitchingTest::setupScheduler( mAppEventThread = eventThread.get(); auto sfEventThread = std::make_unique<mock::EventThread>(); - EXPECT_CALL(*eventThread, registerDisplayEventConnection(_)); - EXPECT_CALL(*eventThread, createEventConnection(_, _)) - .WillOnce(Return(sp<EventThreadConnection>::make(eventThread.get(), - mock::EventThread::kCallingUid))); - - EXPECT_CALL(*sfEventThread, registerDisplayEventConnection(_)); - EXPECT_CALL(*sfEventThread, createEventConnection(_, _)) - .WillOnce(Return(sp<EventThreadConnection>::make(sfEventThread.get(), - mock::EventThread::kCallingUid))); - auto vsyncController = std::make_unique<mock::VsyncController>(); auto vsyncTracker = std::make_shared<mock::VSyncTracker>(); diff --git a/services/surfaceflinger/tests/unittests/TestableScheduler.h b/services/surfaceflinger/tests/unittests/TestableScheduler.h index df16b2e058..d92f891148 100644 --- a/services/surfaceflinger/tests/unittests/TestableScheduler.h +++ b/services/surfaceflinger/tests/unittests/TestableScheduler.h @@ -74,10 +74,8 @@ public: void setEventThread(Cycle cycle, std::unique_ptr<EventThread> eventThreadPtr) { if (cycle == Cycle::Render) { mRenderEventThread = std::move(eventThreadPtr); - mRenderEventConnection = mRenderEventThread->createEventConnection(); } else { mLastCompositeEventThread = std::move(eventThreadPtr); - mLastCompositeEventConnection = mLastCompositeEventThread->createEventConnection(); } } diff --git a/services/surfaceflinger/tests/unittests/TestableSurfaceFlinger.h b/services/surfaceflinger/tests/unittests/TestableSurfaceFlinger.h index 725354b845..347a396e74 100644 --- a/services/surfaceflinger/tests/unittests/TestableSurfaceFlinger.h +++ b/services/surfaceflinger/tests/unittests/TestableSurfaceFlinger.h @@ -16,7 +16,6 @@ #pragma once -#include <algorithm> #include <chrono> #include <memory> #include <variant> @@ -44,7 +43,6 @@ #include "Layer.h" #include "NativeWindowSurface.h" #include "RenderArea.h" -#include "Scheduler/MessageQueue.h" #include "Scheduler/RefreshRateSelector.h" #include "SurfaceFlinger.h" #include "TestableScheduler.h" @@ -60,7 +58,6 @@ #include "Scheduler/VSyncTracker.h" #include "Scheduler/VsyncController.h" -#include "mock/MockVSyncDispatch.h" #include "mock/MockVSyncTracker.h" #include "mock/MockVsyncController.h" @@ -88,9 +85,7 @@ class Factory final : public surfaceflinger::Factory { public: ~Factory() = default; - std::unique_ptr<HWComposer> createHWComposer(const std::string&) override { - return nullptr; - } + std::unique_ptr<HWComposer> createHWComposer(const std::string&) override { return nullptr; } std::unique_ptr<scheduler::VsyncConfiguration> createVsyncConfiguration( Fps /*currentRefreshRate*/) override { @@ -276,17 +271,6 @@ public: auto eventThread = makeMock<mock::EventThread>(options.useNiceMock); auto sfEventThread = makeMock<mock::EventThread>(options.useNiceMock); - - EXPECT_CALL(*eventThread, registerDisplayEventConnection(_)); - EXPECT_CALL(*eventThread, createEventConnection(_, _)) - .WillOnce(Return(sp<EventThreadConnection>::make(eventThread.get(), - mock::EventThread::kCallingUid))); - - EXPECT_CALL(*sfEventThread, registerDisplayEventConnection(_)); - EXPECT_CALL(*sfEventThread, createEventConnection(_, _)) - .WillOnce(Return(sp<EventThreadConnection>::make(sfEventThread.get(), - mock::EventThread::kCallingUid))); - auto vsyncController = makeMock<mock::VsyncController>(options.useNiceMock); auto vsyncTracker = makeSharedMock<mock::VSyncTracker>(options.useNiceMock); @@ -502,7 +486,7 @@ public: } auto getDisplayNativePrimaries(const sp<IBinder>& displayToken, - ui::DisplayPrimaries &primaries) { + ui::DisplayPrimaries& primaries) { return mFlinger->SurfaceFlinger::getDisplayNativePrimaries(displayToken, primaries); } diff --git a/services/surfaceflinger/tests/unittests/mock/MockEventThread.h b/services/surfaceflinger/tests/unittests/mock/MockEventThread.h index 8dd1a34ec4..7398cbebe3 100644 --- a/services/surfaceflinger/tests/unittests/mock/MockEventThread.h +++ b/services/surfaceflinger/tests/unittests/mock/MockEventThread.h @@ -24,21 +24,11 @@ namespace android::mock { class EventThread : public android::EventThread { public: - static constexpr auto kCallingUid = static_cast<uid_t>(0); - EventThread(); ~EventThread() override; - // TODO(b/302035909): workaround otherwise gtest complains about - // error: no viable conversion from - // 'tuple<android::ftl::Flags<android::gui::ISurfaceComposer::EventRegistration> &&>' to 'const - // tuple<android::ftl::Flags<android::gui::ISurfaceComposer::EventRegistration>>' - sp<EventThreadConnection> createEventConnection(EventRegistrationFlags flags) const override { - return createEventConnection(false, flags); - } - MOCK_METHOD(sp<EventThreadConnection>, createEventConnection, (bool, EventRegistrationFlags), - (const)); - + MOCK_METHOD(sp<EventThreadConnection>, createEventConnection, (EventRegistrationFlags), + (const, override)); MOCK_METHOD(void, enableSyntheticVsync, (bool), (override)); MOCK_METHOD(void, onHotplugReceived, (PhysicalDisplayId, bool), (override)); MOCK_METHOD(void, onHotplugConnectionError, (int32_t), (override)); |