SF: Separate EventThread into interface and impl
This allows the normal EventThread to be substituted by a GMock for unit
tests.
The EventThread is now the abstract interface. impl::EventThread is the
normal implementation.
Test: Builds
Bug: None
Change-Id: I2c6234a10849f7d34a215d53e5f601895738a5ae
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index 7ad13e3..03f6bdc 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -574,15 +574,16 @@
Mutex::Autolock _l(mStateLock);
// start the EventThread
-
- mEventThreadSource = std::make_unique<DispSyncSource>(
- &mPrimaryDispSync, SurfaceFlinger::vsyncPhaseOffsetNs, true, "app");
- mEventThread = std::make_unique<EventThread>(
- mEventThreadSource.get(), *this, false, "sfEventThread");
- mSfEventThreadSource = std::make_unique<DispSyncSource>(
- &mPrimaryDispSync, SurfaceFlinger::sfVsyncPhaseOffsetNs, true, "sf");
- mSFEventThread = std::make_unique<EventThread>(
- mSfEventThreadSource.get(), *this, true, "appEventThread");
+ mEventThreadSource =
+ std::make_unique<DispSyncSource>(&mPrimaryDispSync, SurfaceFlinger::vsyncPhaseOffsetNs,
+ true, "app");
+ mEventThread = std::make_unique<impl::EventThread>(mEventThreadSource.get(), *this, false,
+ "appEventThread");
+ mSfEventThreadSource =
+ std::make_unique<DispSyncSource>(&mPrimaryDispSync,
+ SurfaceFlinger::sfVsyncPhaseOffsetNs, true, "sf");
+ mSFEventThread = std::make_unique<impl::EventThread>(mSfEventThreadSource.get(), *this, true,
+ "sfEventThread");
mEventQueue.setEventThread(mSFEventThread.get());
// Get a RenderEngine for the given display / config (can't fail)
@@ -1068,8 +1069,9 @@
ALOGV("VSync Injections enabled");
if (mVSyncInjector.get() == nullptr) {
mVSyncInjector = std::make_unique<InjectVSyncSource>();
- mInjectorEventThread = std::make_unique<EventThread>(
- mVSyncInjector.get(), *this, false, "injEvThread");
+ mInjectorEventThread =
+ std::make_unique<impl::EventThread>(mVSyncInjector.get(), *this, false,
+ "injEventThread");
}
mEventQueue.setEventThread(mInjectorEventThread.get());
} else {