SF: Move MessageQueue to Scheduler
...as a first step in removing the ISchedulerCallback::scheduleComposite
roundtrip, and extracting scheduling logic from SF::{commit,composite}.
Bug: 185535769
Test: libsurfaceflinger_unittest
Change-Id: I7fb38a1dd7b917e5639b9d58a0d44b32983b689e
diff --git a/services/surfaceflinger/tests/unittests/Android.bp b/services/surfaceflinger/tests/unittests/Android.bp
index 1ac5680..3dc6d8b 100644
--- a/services/surfaceflinger/tests/unittests/Android.bp
+++ b/services/surfaceflinger/tests/unittests/Android.bp
@@ -107,7 +107,6 @@
"mock/MockEventThread.cpp",
"mock/MockFrameTimeline.cpp",
"mock/MockFrameTracer.cpp",
- "mock/MockMessageQueue.cpp",
"mock/MockNativeWindowSurface.cpp",
"mock/MockSurfaceInterceptor.cpp",
"mock/MockTimeStats.cpp",
diff --git a/services/surfaceflinger/tests/unittests/CompositionTest.cpp b/services/surfaceflinger/tests/unittests/CompositionTest.cpp
index dffc6c6..0c9e6e1 100644
--- a/services/surfaceflinger/tests/unittests/CompositionTest.cpp
+++ b/services/surfaceflinger/tests/unittests/CompositionTest.cpp
@@ -45,7 +45,6 @@
#include "mock/DisplayHardware/MockComposer.h"
#include "mock/DisplayHardware/MockPowerAdvisor.h"
#include "mock/MockEventThread.h"
-#include "mock/MockMessageQueue.h"
#include "mock/MockTimeStats.h"
#include "mock/MockVsyncController.h"
#include "mock/system/window/MockNativeWindow.h"
@@ -95,7 +94,6 @@
::testing::UnitTest::GetInstance()->current_test_info();
ALOGD("**** Setting up for %s.%s\n", test_info->test_case_name(), test_info->name());
- mFlinger.mutableEventQueue().reset(mMessageQueue);
setupScheduler();
EXPECT_CALL(*mNativeWindow, query(NATIVE_WINDOW_WIDTH, _))
@@ -183,7 +181,6 @@
Hwc2::mock::Composer* mComposer = nullptr;
renderengine::mock::RenderEngine* mRenderEngine = new renderengine::mock::RenderEngine();
mock::TimeStats* mTimeStats = new mock::TimeStats();
- mock::MessageQueue* mMessageQueue = new mock::MessageQueue();
Hwc2::mock::PowerAdvisor mPowerAdvisor;
sp<Fence> mClientTargetAcquireFence = Fence::NO_FENCE;
@@ -539,9 +536,9 @@
ASSERT_EQ(NO_ERROR, err);
Mock::VerifyAndClear(test->mRenderEngine);
- EXPECT_CALL(*test->mMessageQueue, scheduleCommit()).Times(1);
+ EXPECT_CALL(*test->mFlinger.scheduler(), scheduleCommit()).Times(1);
enqueueBuffer(test, layer);
- Mock::VerifyAndClearExpectations(test->mMessageQueue);
+ Mock::VerifyAndClearExpectations(test->mFlinger.scheduler());
bool ignoredRecomputeVisibleRegions;
layer->latchBuffer(ignoredRecomputeVisibleRegions, 0, 0);
@@ -836,7 +833,7 @@
struct BaseLayerVariant {
template <typename L, typename F>
static sp<L> createLayerWithFactory(CompositionTest* test, F factory) {
- EXPECT_CALL(*test->mMessageQueue, postMessage(_)).Times(0);
+ EXPECT_CALL(*test->mFlinger.scheduler(), postMessage(_)).Times(0);
sp<L> layer = factory();
@@ -845,7 +842,7 @@
Mock::VerifyAndClear(test->mComposer);
Mock::VerifyAndClear(test->mRenderEngine);
- Mock::VerifyAndClearExpectations(test->mMessageQueue);
+ Mock::VerifyAndClearExpectations(test->mFlinger.scheduler());
initLayerDrawingStateAndComputeBounds(test, layer);
diff --git a/services/surfaceflinger/tests/unittests/DisplayTransactionTest.cpp b/services/surfaceflinger/tests/unittests/DisplayTransactionTest.cpp
index 6cb3052..b1f704a 100644
--- a/services/surfaceflinger/tests/unittests/DisplayTransactionTest.cpp
+++ b/services/surfaceflinger/tests/unittests/DisplayTransactionTest.cpp
@@ -50,7 +50,6 @@
});
injectMockScheduler();
- mFlinger.mutableEventQueue().reset(mMessageQueue);
mFlinger.setupRenderEngine(std::unique_ptr<renderengine::RenderEngine>(mRenderEngine));
mFlinger.mutableInterceptor() = mSurfaceInterceptor;
diff --git a/services/surfaceflinger/tests/unittests/DisplayTransactionTestHelpers.h b/services/surfaceflinger/tests/unittests/DisplayTransactionTestHelpers.h
index 7746e73..de5e9df 100644
--- a/services/surfaceflinger/tests/unittests/DisplayTransactionTestHelpers.h
+++ b/services/surfaceflinger/tests/unittests/DisplayTransactionTestHelpers.h
@@ -47,7 +47,6 @@
#include "mock/DisplayHardware/MockComposer.h"
#include "mock/DisplayHardware/MockPowerAdvisor.h"
#include "mock/MockEventThread.h"
-#include "mock/MockMessageQueue.h"
#include "mock/MockNativeWindowSurface.h"
#include "mock/MockSchedulerCallback.h"
#include "mock/MockSurfaceInterceptor.h"
@@ -118,7 +117,6 @@
// to keep a reference to them for use in setting up call expectations.
renderengine::mock::RenderEngine* mRenderEngine = new renderengine::mock::RenderEngine();
Hwc2::mock::Composer* mComposer = nullptr;
- mock::MessageQueue* mMessageQueue = new mock::MessageQueue();
sp<mock::SurfaceInterceptor> mSurfaceInterceptor = new mock::SurfaceInterceptor;
mock::VsyncController* mVsyncController = new mock::VsyncController;
diff --git a/services/surfaceflinger/tests/unittests/SetFrameRateTest.cpp b/services/surfaceflinger/tests/unittests/SetFrameRateTest.cpp
index 84c845d..115a44d 100644
--- a/services/surfaceflinger/tests/unittests/SetFrameRateTest.cpp
+++ b/services/surfaceflinger/tests/unittests/SetFrameRateTest.cpp
@@ -33,7 +33,6 @@
#include "TestableSurfaceFlinger.h"
#include "mock/DisplayHardware/MockComposer.h"
#include "mock/MockEventThread.h"
-#include "mock/MockMessageQueue.h"
#include "mock/MockVsyncController.h"
namespace android {
@@ -112,7 +111,6 @@
void commitTransaction();
TestableSurfaceFlinger mFlinger;
- mock::MessageQueue* mMessageQueue = new mock::MessageQueue();
std::vector<sp<Layer>> mLayers;
};
@@ -125,7 +123,6 @@
setupScheduler();
mFlinger.setupComposer(std::make_unique<Hwc2::mock::Composer>());
- mFlinger.mutableEventQueue().reset(mMessageQueue);
}
void SetFrameRateTest::addChild(sp<Layer> layer, sp<Layer> child) {
@@ -172,7 +169,7 @@
namespace {
TEST_P(SetFrameRateTest, SetAndGet) {
- EXPECT_CALL(*mMessageQueue, scheduleCommit()).Times(1);
+ EXPECT_CALL(*mFlinger.scheduler(), scheduleCommit()).Times(1);
const auto& layerFactory = GetParam();
@@ -183,7 +180,7 @@
}
TEST_P(SetFrameRateTest, SetAndGetParent) {
- EXPECT_CALL(*mMessageQueue, scheduleCommit()).Times(1);
+ EXPECT_CALL(*mFlinger.scheduler(), scheduleCommit()).Times(1);
const auto& layerFactory = GetParam();
@@ -208,7 +205,7 @@
}
TEST_P(SetFrameRateTest, SetAndGetParentAllVote) {
- EXPECT_CALL(*mMessageQueue, scheduleCommit()).Times(1);
+ EXPECT_CALL(*mFlinger.scheduler(), scheduleCommit()).Times(1);
const auto& layerFactory = GetParam();
@@ -247,7 +244,7 @@
}
TEST_P(SetFrameRateTest, SetAndGetChild) {
- EXPECT_CALL(*mMessageQueue, scheduleCommit()).Times(1);
+ EXPECT_CALL(*mFlinger.scheduler(), scheduleCommit()).Times(1);
const auto& layerFactory = GetParam();
@@ -272,7 +269,7 @@
}
TEST_P(SetFrameRateTest, SetAndGetChildAllVote) {
- EXPECT_CALL(*mMessageQueue, scheduleCommit()).Times(1);
+ EXPECT_CALL(*mFlinger.scheduler(), scheduleCommit()).Times(1);
const auto& layerFactory = GetParam();
@@ -311,7 +308,7 @@
}
TEST_P(SetFrameRateTest, SetAndGetChildAddAfterVote) {
- EXPECT_CALL(*mMessageQueue, scheduleCommit()).Times(1);
+ EXPECT_CALL(*mFlinger.scheduler(), scheduleCommit()).Times(1);
const auto& layerFactory = GetParam();
@@ -341,7 +338,7 @@
}
TEST_P(SetFrameRateTest, SetAndGetChildRemoveAfterVote) {
- EXPECT_CALL(*mMessageQueue, scheduleCommit()).Times(1);
+ EXPECT_CALL(*mFlinger.scheduler(), scheduleCommit()).Times(1);
const auto& layerFactory = GetParam();
@@ -372,7 +369,7 @@
}
TEST_P(SetFrameRateTest, SetAndGetParentNotInTree) {
- EXPECT_CALL(*mMessageQueue, scheduleCommit()).Times(1);
+ EXPECT_CALL(*mFlinger.scheduler(), scheduleCommit()).Times(1);
const auto& layerFactory = GetParam();
@@ -467,7 +464,7 @@
}
TEST_P(SetFrameRateTest, addChildForParentWithTreeVote) {
- EXPECT_CALL(*mMessageQueue, scheduleCommit()).Times(1);
+ EXPECT_CALL(*mFlinger.scheduler(), scheduleCommit()).Times(1);
const auto& layerFactory = GetParam();
diff --git a/services/surfaceflinger/tests/unittests/SurfaceFlinger_CreateDisplayTest.cpp b/services/surfaceflinger/tests/unittests/SurfaceFlinger_CreateDisplayTest.cpp
index 8c30341..2236db7 100644
--- a/services/surfaceflinger/tests/unittests/SurfaceFlinger_CreateDisplayTest.cpp
+++ b/services/surfaceflinger/tests/unittests/SurfaceFlinger_CreateDisplayTest.cpp
@@ -52,7 +52,7 @@
// Cleanup conditions
// Creating the display commits a display transaction.
- EXPECT_CALL(*mMessageQueue, scheduleCommit()).Times(1);
+ EXPECT_CALL(*mFlinger.scheduler(), scheduleCommit()).Times(1);
}
TEST_F(CreateDisplayTest, createDisplaySetsCurrentStateForSecureDisplay) {
@@ -87,7 +87,7 @@
// Cleanup conditions
// Creating the display commits a display transaction.
- EXPECT_CALL(*mMessageQueue, scheduleCommit()).Times(1);
+ EXPECT_CALL(*mFlinger.scheduler(), scheduleCommit()).Times(1);
}
} // namespace
diff --git a/services/surfaceflinger/tests/unittests/SurfaceFlinger_DestroyDisplayTest.cpp b/services/surfaceflinger/tests/unittests/SurfaceFlinger_DestroyDisplayTest.cpp
index 7087fb6..bcd3222 100644
--- a/services/surfaceflinger/tests/unittests/SurfaceFlinger_DestroyDisplayTest.cpp
+++ b/services/surfaceflinger/tests/unittests/SurfaceFlinger_DestroyDisplayTest.cpp
@@ -41,7 +41,7 @@
EXPECT_CALL(*mSurfaceInterceptor, saveDisplayDeletion(_)).Times(1);
// Destroying the display commits a display transaction.
- EXPECT_CALL(*mMessageQueue, scheduleCommit()).Times(1);
+ EXPECT_CALL(*mFlinger.scheduler(), scheduleCommit()).Times(1);
// --------------------------------------------------------------------
// Invocation
diff --git a/services/surfaceflinger/tests/unittests/SurfaceFlinger_HotplugTest.cpp b/services/surfaceflinger/tests/unittests/SurfaceFlinger_HotplugTest.cpp
index 29ff0cd..cc979c9 100644
--- a/services/surfaceflinger/tests/unittests/SurfaceFlinger_HotplugTest.cpp
+++ b/services/surfaceflinger/tests/unittests/SurfaceFlinger_HotplugTest.cpp
@@ -39,7 +39,7 @@
// Call Expectations
// We expect a scheduled commit for the display transaction.
- EXPECT_CALL(*mMessageQueue, scheduleCommit()).Times(1);
+ EXPECT_CALL(*mFlinger.scheduler(), scheduleCommit()).Times(1);
// --------------------------------------------------------------------
// Invocation
@@ -86,7 +86,7 @@
// Call Expectations
// We expect a scheduled commit for the display transaction.
- EXPECT_CALL(*mMessageQueue, scheduleCommit()).Times(1);
+ EXPECT_CALL(*mFlinger.scheduler(), scheduleCommit()).Times(1);
// --------------------------------------------------------------------
// Invocation
diff --git a/services/surfaceflinger/tests/unittests/SurfaceFlinger_OnInitializeDisplaysTest.cpp b/services/surfaceflinger/tests/unittests/SurfaceFlinger_OnInitializeDisplaysTest.cpp
index e1b44cf..83b150f 100644
--- a/services/surfaceflinger/tests/unittests/SurfaceFlinger_OnInitializeDisplaysTest.cpp
+++ b/services/surfaceflinger/tests/unittests/SurfaceFlinger_OnInitializeDisplaysTest.cpp
@@ -47,7 +47,7 @@
Case::Display::setupHwcGetActiveConfigCallExpectations(this);
// We expect a scheduled commit for the display transaction.
- EXPECT_CALL(*mMessageQueue, scheduleCommit()).Times(1);
+ EXPECT_CALL(*mFlinger.scheduler(), scheduleCommit()).Times(1);
EXPECT_CALL(*mVSyncTracker, nextAnticipatedVSyncTimeFrom(_)).WillRepeatedly(Return(0));
diff --git a/services/surfaceflinger/tests/unittests/SurfaceFlinger_SetPowerModeInternalTest.cpp b/services/surfaceflinger/tests/unittests/SurfaceFlinger_SetPowerModeInternalTest.cpp
index 6edebd4..ad696aa 100644
--- a/services/surfaceflinger/tests/unittests/SurfaceFlinger_SetPowerModeInternalTest.cpp
+++ b/services/surfaceflinger/tests/unittests/SurfaceFlinger_SetPowerModeInternalTest.cpp
@@ -273,7 +273,7 @@
}
static void setupRepaintEverythingCallExpectations(DisplayTransactionTest* test) {
- EXPECT_CALL(*test->mMessageQueue, scheduleCommit()).Times(1);
+ EXPECT_CALL(*test->mFlinger.scheduler(), scheduleCommit()).Times(1);
}
static void setupSurfaceInterceptorCallExpectations(DisplayTransactionTest* test,
diff --git a/services/surfaceflinger/tests/unittests/TestableScheduler.h b/services/surfaceflinger/tests/unittests/TestableScheduler.h
index 1b850fc..32ec848 100644
--- a/services/surfaceflinger/tests/unittests/TestableScheduler.h
+++ b/services/surfaceflinger/tests/unittests/TestableScheduler.h
@@ -30,7 +30,7 @@
namespace android {
-class TestableScheduler : public Scheduler {
+class TestableScheduler : public Scheduler, private ICompositor {
public:
TestableScheduler(std::shared_ptr<scheduler::RefreshRateConfigs> configs,
ISchedulerCallback& callback)
@@ -42,11 +42,19 @@
std::unique_ptr<scheduler::VSyncTracker> vsyncTracker,
std::shared_ptr<scheduler::RefreshRateConfigs> configs,
ISchedulerCallback& callback)
- : Scheduler(callback, {.useContentDetection = true}) {
+ : Scheduler(*this, callback, {.useContentDetection = true}) {
mVsyncSchedule = {std::move(vsyncController), std::move(vsyncTracker), nullptr};
setRefreshRateConfigs(std::move(configs));
+
+ ON_CALL(*this, postMessage).WillByDefault([](sp<MessageHandler>&& handler) {
+ // Execute task to prevent broken promise exception on destruction.
+ handler->handleMessage(Message());
+ });
}
+ MOCK_METHOD(void, scheduleCommit, (), (override));
+ MOCK_METHOD(void, postMessage, (sp<MessageHandler>&&), (override));
+
// Used to inject mock event thread.
ConnectionHandle createConnection(std::unique_ptr<EventThread> eventThread) {
return Scheduler::createConnection(std::move(eventThread));
@@ -104,6 +112,12 @@
mVsyncSchedule.controller.reset();
mConnections.clear();
}
+
+private:
+ // ICompositor overrides:
+ bool commit(nsecs_t, int64_t, nsecs_t) override { return false; }
+ void composite(nsecs_t) override {}
+ void sample() override {}
};
} // namespace android
diff --git a/services/surfaceflinger/tests/unittests/TestableSurfaceFlinger.h b/services/surfaceflinger/tests/unittests/TestableSurfaceFlinger.h
index c2c4a54..4c5789e 100644
--- a/services/surfaceflinger/tests/unittests/TestableSurfaceFlinger.h
+++ b/services/surfaceflinger/tests/unittests/TestableSurfaceFlinger.h
@@ -73,10 +73,6 @@
return nullptr;
}
- std::unique_ptr<MessageQueue> createMessageQueue(ICompositor& compositor) override {
- return std::make_unique<android::impl::MessageQueue>(compositor);
- }
-
std::unique_ptr<scheduler::VsyncConfiguration> createVsyncConfiguration(
Fps /*currentRefreshRate*/) override {
return std::make_unique<scheduler::FakePhaseOffsets>();
@@ -426,7 +422,6 @@
auto& mutableDisplayColorSetting() { return mFlinger->mDisplayColorSetting; }
auto& mutableDisplays() { return mFlinger->mDisplays; }
auto& mutableDrawingState() { return mFlinger->mDrawingState; }
- auto& mutableEventQueue() { return mFlinger->mEventQueue; }
auto& mutableGeometryDirty() { return mFlinger->mGeometryDirty; }
auto& mutableInterceptor() { return mFlinger->mInterceptor; }
auto& mutableMainThreadId() { return mFlinger->mMainThreadId; }
@@ -455,7 +450,6 @@
mutableDisplays().clear();
mutableCurrentState().displays.clear();
mutableDrawingState().displays.clear();
- mutableEventQueue().reset();
mutableInterceptor().clear();
mFlinger->mScheduler.reset();
mFlinger->mCompositionEngine->setHwComposer(std::unique_ptr<HWComposer>());
diff --git a/services/surfaceflinger/tests/unittests/TransactionApplicationTest.cpp b/services/surfaceflinger/tests/unittests/TransactionApplicationTest.cpp
index 8caadfb..b3a6a1b 100644
--- a/services/surfaceflinger/tests/unittests/TransactionApplicationTest.cpp
+++ b/services/surfaceflinger/tests/unittests/TransactionApplicationTest.cpp
@@ -29,7 +29,6 @@
#include "TestableScheduler.h"
#include "TestableSurfaceFlinger.h"
#include "mock/MockEventThread.h"
-#include "mock/MockMessageQueue.h"
#include "mock/MockVsyncController.h"
namespace android {
@@ -46,7 +45,6 @@
::testing::UnitTest::GetInstance()->current_test_info();
ALOGD("**** Setting up for %s.%s\n", test_info->test_case_name(), test_info->name());
- mFlinger.mutableEventQueue().reset(mMessageQueue);
setupScheduler();
}
@@ -92,7 +90,6 @@
std::unique_ptr<mock::EventThread> mEventThread = std::make_unique<mock::EventThread>();
- mock::MessageQueue* mMessageQueue = new mock::MessageQueue();
mock::VsyncController* mVsyncController = new mock::VsyncController();
mock::VSyncTracker* mVSyncTracker = new mock::VSyncTracker();
mock::MockFence* mFenceUnsignaled = new mock::MockFence();
@@ -146,7 +143,7 @@
void NotPlacedOnTransactionQueue(uint32_t flags, bool syncInputWindows) {
ASSERT_EQ(0u, mFlinger.getTransactionQueue().size());
- EXPECT_CALL(*mMessageQueue, scheduleCommit()).Times(1);
+ EXPECT_CALL(*mFlinger.scheduler(), scheduleCommit()).Times(1);
TransactionInfo transaction;
setupSingle(transaction, flags, syncInputWindows,
/*desiredPresentTime*/ systemTime(), /*isAutoTimestamp*/ true,
@@ -176,7 +173,7 @@
void PlaceOnTransactionQueue(uint32_t flags, bool syncInputWindows) {
ASSERT_EQ(0u, mFlinger.getTransactionQueue().size());
- EXPECT_CALL(*mMessageQueue, scheduleCommit()).Times(1);
+ EXPECT_CALL(*mFlinger.scheduler(), scheduleCommit()).Times(1);
// first check will see desired present time has not passed,
// but afterwards it will look like the desired present time has passed
@@ -207,9 +204,9 @@
ASSERT_EQ(0u, mFlinger.getTransactionQueue().size());
nsecs_t time = systemTime();
if (!syncInputWindows) {
- EXPECT_CALL(*mMessageQueue, scheduleCommit()).Times(2);
+ EXPECT_CALL(*mFlinger.scheduler(), scheduleCommit()).Times(2);
} else {
- EXPECT_CALL(*mMessageQueue, scheduleCommit()).Times(1);
+ EXPECT_CALL(*mFlinger.scheduler(), scheduleCommit()).Times(1);
}
// transaction that should go on the pending thread
TransactionInfo transactionA;
@@ -454,7 +451,7 @@
TEST_F(TransactionApplicationTest, Flush_RemovesFromQueue) {
ASSERT_EQ(0u, mFlinger.getTransactionQueue().size());
- EXPECT_CALL(*mMessageQueue, scheduleCommit()).Times(1);
+ EXPECT_CALL(*mFlinger.scheduler(), scheduleCommit()).Times(1);
TransactionInfo transactionA; // transaction to go on pending queue
setupSingle(transactionA, /*flags*/ 0, /*syncInputWindows*/ false,
diff --git a/services/surfaceflinger/tests/unittests/TunnelModeEnabledReporterTest.cpp b/services/surfaceflinger/tests/unittests/TunnelModeEnabledReporterTest.cpp
index ade4fbb..15fea9c 100644
--- a/services/surfaceflinger/tests/unittests/TunnelModeEnabledReporterTest.cpp
+++ b/services/surfaceflinger/tests/unittests/TunnelModeEnabledReporterTest.cpp
@@ -27,7 +27,6 @@
#include "TunnelModeEnabledReporter.h"
#include "mock/DisplayHardware/MockComposer.h"
#include "mock/MockEventThread.h"
-#include "mock/MockMessageQueue.h"
namespace android {
@@ -69,12 +68,12 @@
TestableSurfaceFlinger mFlinger;
Hwc2::mock::Composer* mComposer = nullptr;
- sp<TestableTunnelModeEnabledListener> mTunnelModeEnabledListener =
- new TestableTunnelModeEnabledListener();
- sp<TunnelModeEnabledReporter> mTunnelModeEnabledReporter =
- new TunnelModeEnabledReporter();
- mock::MessageQueue* mMessageQueue = new mock::MessageQueue();
+ sp<TestableTunnelModeEnabledListener> mTunnelModeEnabledListener =
+ sp<TestableTunnelModeEnabledListener>::make();
+
+ sp<TunnelModeEnabledReporter> mTunnelModeEnabledReporter =
+ sp<TunnelModeEnabledReporter>::make();
};
TunnelModeEnabledReporterTest::TunnelModeEnabledReporterTest() {
@@ -82,7 +81,6 @@
::testing::UnitTest::GetInstance()->current_test_info();
ALOGD("**** Setting up for %s.%s\n", test_info->test_case_name(), test_info->name());
- mFlinger.mutableEventQueue().reset(mMessageQueue);
setupScheduler();
mFlinger.setupComposer(std::make_unique<Hwc2::mock::Composer>());
mFlinger.flinger()->mTunnelModeEnabledReporter = mTunnelModeEnabledReporter;
diff --git a/services/surfaceflinger/tests/unittests/mock/MockMessageQueue.cpp b/services/surfaceflinger/tests/unittests/mock/MockMessageQueue.cpp
deleted file mode 100644
index 5fb06fd..0000000
--- a/services/surfaceflinger/tests/unittests/mock/MockMessageQueue.cpp
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright (C) 2018 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "mock/MockMessageQueue.h"
-
-namespace android::mock {
-
-MessageQueue::MessageQueue() {
- ON_CALL(*this, postMessage).WillByDefault([](sp<MessageHandler>&& handler) {
- // Execute task to prevent broken promise exception on destruction.
- handler->handleMessage(Message());
- });
-}
-
-MessageQueue::~MessageQueue() = default;
-
-} // namespace android::mock
diff --git a/services/surfaceflinger/tests/unittests/mock/MockMessageQueue.h b/services/surfaceflinger/tests/unittests/mock/MockMessageQueue.h
deleted file mode 100644
index d684337..0000000
--- a/services/surfaceflinger/tests/unittests/mock/MockMessageQueue.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright (C) 2018 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#pragma once
-
-#include <gmock/gmock.h>
-
-#include "FrameTimeline.h"
-#include "Scheduler/EventThread.h"
-#include "Scheduler/MessageQueue.h"
-
-namespace android::mock {
-
-class MessageQueue : public android::MessageQueue {
-public:
- MessageQueue();
- ~MessageQueue() override;
-
- MOCK_METHOD1(setInjector, void(sp<EventThreadConnection>));
- MOCK_METHOD0(waitMessage, void());
- MOCK_METHOD1(postMessage, void(sp<MessageHandler>&&));
- MOCK_METHOD3(initVsync,
- void(scheduler::VSyncDispatch&, frametimeline::TokenManager&,
- std::chrono::nanoseconds));
- MOCK_METHOD1(setDuration, void(std::chrono::nanoseconds workDuration));
-
- MOCK_METHOD(void, scheduleCommit, (), (override));
- MOCK_METHOD(void, scheduleComposite, (), (override));
-
- MOCK_METHOD(std::optional<Clock::time_point>, getScheduledFrameTime, (), (const, override));
-};
-
-} // namespace android::mock