SF: Allow SurfaceFlinger creation to be altered
As a first step, we need to be able to build a version of the
/system/binsurfacefligner binary that can (eventually) invoke the
SurfaceFlinger constructor to pass a "factory" class to replace certain
key types.
The unittest will also be able to use it to construct mocks by default.
Bug: None
Test: marlin builds, cheets_x86_64 builds (and overrides default)
Change-Id: Id6d5cabf0dd54e85ac0e6706edf3cbe8a0288bc3
diff --git a/services/surfaceflinger/main_surfaceflinger.cpp b/services/surfaceflinger/main_surfaceflinger.cpp
index b1ff522..9c2edca 100644
--- a/services/surfaceflinger/main_surfaceflinger.cpp
+++ b/services/surfaceflinger/main_surfaceflinger.cpp
@@ -21,16 +21,16 @@
#include <android/frameworks/displayservice/1.0/IDisplayService.h>
#include <android/hardware/configstore/1.0/ISurfaceFlingerConfigs.h>
#include <android/hardware/graphics/allocator/2.0/IAllocator.h>
-#include <cutils/sched_policy.h>
-#include <binder/IServiceManager.h>
#include <binder/IPCThreadState.h>
-#include <binder/ProcessState.h>
#include <binder/IServiceManager.h>
+#include <binder/ProcessState.h>
+#include <configstore/Utils.h>
+#include <cutils/sched_policy.h>
#include <displayservice/DisplayService.h>
#include <hidl/LegacySupport.h>
-#include <configstore/Utils.h>
#include "GpuService.h"
#include "SurfaceFlinger.h"
+#include "SurfaceFlingerFactory.h"
using namespace android;
@@ -85,7 +85,7 @@
ps->startThreadPool();
// instantiate surfaceflinger
- sp<SurfaceFlinger> flinger = new SurfaceFlinger();
+ sp<SurfaceFlinger> flinger = surfaceflinger::createSurfaceFlinger();
setpriority(PRIO_PROCESS, 0, PRIORITY_URGENT_DISPLAY);