drm_hwcomposer: Disable flattening controller at instance creation time

Disable flattening controller at creation time. Without disabling the
flattening controller, it could result in refresh event being set to
composer clients early before the display is validated which can result
in VTS test failures as it checks for invalid refresh events at
test teardown.

Change-Id: I4a91032fdce1be0a7ee0d26b52914992a95842b5
Signed-off-by: Normunds Rieksts <normunds.rieksts@arm.com>
Signed-off-by: Drew Davenport <ddavenport@google.com>
diff --git a/compositor/FlatteningController.cpp b/compositor/FlatteningController.cpp
index 000a240..efd7ad0 100644
--- a/compositor/FlatteningController.cpp
+++ b/compositor/FlatteningController.cpp
@@ -41,6 +41,12 @@
     -> std::shared_ptr<FlatteningController> {
   auto fc = std::shared_ptr<FlatteningController>(new FlatteningController());
 
+  /* Disable the controller by default as it can cause refresh event to be
+   * issued at creation time, even when it is not required. This can fail VTS
+   * tests at teardown that check for this behaviour. See:
+   * https://cs.android.com/android/platform/superproject/main/+/cedca652b903e4f4e584e457b5a7038e0825fb94:hardware/interfaces/graphics/composer/aidl/vts/VtsComposerClient.cpp;drc=a2a6deaf5036e081f48379b6573db4465538b5ac;l=604
+   */
+  fc->Disable();
   fc->cbks_ = cbks;
 
   std::thread(&FlatteningController::ThreadFn, fc).detach();