drm_hwcomposer: CI: Increase coverage

Add the following files to the build:
backend/BackendClient.cpp
backend/Backend.cpp
backend/BackendManager.cpp
backend/BackendRCarDu.cpp
bufferinfo/legacy/BufferInfoImagination.cpp
bufferinfo/legacy/BufferInfoLibdrm.cpp
bufferinfo/legacy/BufferInfoMaliHisi.cpp
bufferinfo/legacy/BufferInfoMaliMediatek.cpp
bufferinfo/legacy/BufferInfoMaliMeson.cpp
bufferinfo/legacy/BufferInfoMinigbm.cpp
compositor/DrmDisplayComposition.cpp
compositor/DrmDisplayCompositor.cpp
compositor/Planner.cpp
drm/DrmGenericImporter.cpp
DrmHwcTwo.cpp
drm/ResourceManager.cpp
drm/VSyncWorker.cpp
tests/worker_test.cpp
utils/autolock.cpp

Files 'bufferinfo/BufferInfoMapperMetadata.cpp' and 'utils/hwcutils.cpp' require
a lot of additional headers, therefore move them out of the scope of this commit.

'utils/gralloc.h' isn't planned to use in pure-linux builds, therefore remove
it from 'utils' and put it into '.ci/android_headers/hardware/'

Fix minor tidy fails.

Fix linux build fails (missing includes) due to differences between libc and
bionic.

Comment-out some sections in 'tests/test_include' which aren't used by drm_hwc
but causing build failures for CI due to missing dependencies.

Signed-off-by: Roman Stratiienko <r.stratiienko@gmail.com>
Reviewed-by: Matvii Zorin <matvii.zorin@globallogic.com>
diff --git a/tests/test_include/cros_gralloc_handle.h b/tests/test_include/cros_gralloc_handle.h
new file mode 100644
index 0000000..d77d777
--- /dev/null
+++ b/tests/test_include/cros_gralloc_handle.h
@@ -0,0 +1,53 @@
+// clang-format off
+/*
+ * Copyright 2016 The Chromium OS Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef CROS_GRALLOC_HANDLE_H
+#define CROS_GRALLOC_HANDLE_H
+
+#include <cstdint>
+#include <cutils/native_handle.h>
+
+#define DRV_MAX_PLANES 4
+#define DRV_MAX_FDS (DRV_MAX_PLANES + 1)
+
+struct cros_gralloc_handle : public native_handle_t {
+	/*
+	 * File descriptors must immediately follow the native_handle_t base and used file
+	 * descriptors must be packed at the beginning of this array to work with
+	 * native_handle_clone().
+	 *
+	 * This field contains 'num_planes' plane file descriptors followed by an optional metadata
+	 * reserved region file descriptor if 'reserved_region_size' is greater than zero.
+	 */
+	int32_t fds[DRV_MAX_FDS];
+	uint32_t strides[DRV_MAX_PLANES];
+	uint32_t offsets[DRV_MAX_PLANES];
+	uint32_t sizes[DRV_MAX_PLANES];
+	uint32_t id;
+	uint32_t width;
+	uint32_t height;
+	uint32_t format; /* DRM format */
+	uint32_t tiling;
+	uint64_t format_modifier;
+	uint64_t use_flags; /* Buffer creation flags */
+	uint32_t magic;
+	uint32_t pixel_stride;
+	int32_t droid_format;
+	int32_t usage; /* Android usage. */
+	uint32_t num_planes;
+	uint64_t reserved_region_size;
+	uint64_t total_size; /* Total allocation size */
+	/*
+	 * Name is a null terminated char array located at handle->base.data[handle->name_offset].
+	 */
+	uint32_t name_offset;
+} __attribute__((packed));
+
+typedef const struct cros_gralloc_handle *cros_gralloc_handle_t;
+
+#endif
+// clang-format on
diff --git a/tests/test_include/gralloc_helper.h b/tests/test_include/gralloc_helper.h
index e65fc1c..b6cd24d 100644
--- a/tests/test_include/gralloc_helper.h
+++ b/tests/test_include/gralloc_helper.h
@@ -21,7 +21,8 @@
 #define GRALLOC_HELPER_H_
 
 #include <sys/mman.h>
-#include <android/log.h>
+#include <sys/user.h>
+#include "utils/log.h"
 
 #ifndef AWAR
 #define AWAR(fmt, args...) \
diff --git a/tests/test_include/gralloc_priv.h b/tests/test_include/gralloc_priv.h
index 2cfae7f..e771a69 100644
--- a/tests/test_include/gralloc_priv.h
+++ b/tests/test_include/gralloc_priv.h
@@ -28,7 +28,7 @@
 #include <unistd.h>
 #include <sys/mman.h>
 #include <cutils/native_handle.h>
-#include <utils/Log.h>
+#include "utils/log.h"
 
 #if GRALLOC_USE_GRALLOC1_API
 #include <hardware/gralloc1.h>
diff --git a/tests/test_include/img_gralloc1_public.h b/tests/test_include/img_gralloc1_public.h
index 5305845..aef435f 100644
--- a/tests/test_include/img_gralloc1_public.h
+++ b/tests/test_include/img_gralloc1_public.h
@@ -30,7 +30,9 @@
  */
 
 #include <hardware/gralloc.h>
+#if 0 /* Header below is not used by drm_hwcomposer */
 #include <hardware/memtrack.h>
+#endif
 
 #define ALIGN(x,a)	(((x) + (a) - 1L) & ~((a) - 1L))
 #define HW_ALIGN	16
@@ -161,6 +163,8 @@
 }
 IMG_buffer_format_public_t;
 
+#if 0 /* Not used by drm_hwcomposer but require additional dependencies */
+
 typedef struct
 {
 	/* Base memtrack record, copied to caller */
@@ -207,6 +211,8 @@
 }
 IMG_gralloc_module_public_t;
 
+#endif
+
 /**
  * pixel format definitions
  */
diff --git a/tests/worker_test.cpp b/tests/worker_test.cpp
index cb6275e..d1eb2b3 100644
--- a/tests/worker_test.cpp
+++ b/tests/worker_test.cpp
@@ -8,17 +8,13 @@
 using android::Worker;
 
 struct TestWorker : public Worker {
-  TestWorker()
-      : Worker("test-worker", HAL_PRIORITY_URGENT_DISPLAY),
-        value(0),
-        enabled_(false) {
-  }
+  TestWorker() : Worker("test-worker", HAL_PRIORITY_URGENT_DISPLAY){};
 
   int Init() {
     return InitWorker();
   }
 
-  void Routine() {
+  void Routine() override {
     Lock();
     if (!enabled_) {
       int ret = WaitForSignalOrExitLocked();
@@ -47,16 +43,17 @@
       Signal();
   }
 
-  int value;
+  // NOLINTNEXTLINE: should not be public
+  int value{};
 
  private:
-  bool enabled_;
+  bool enabled_{};
 };
 
 struct WorkerTest : public testing::Test {
   TestWorker worker;
 
-  virtual void SetUp() {
+  void SetUp() override {
     worker.Init();
   }
 
@@ -65,7 +62,8 @@
   }
 };
 
-TEST_F(WorkerTest, test_worker) {
+// NOLINTNEXTLINE: required by gtest macros
+TEST_F(WorkerTest, TestWorker) {
   // already isInitialized so should succeed
   ASSERT_TRUE(worker.initialized());
 
@@ -102,7 +100,8 @@
   ASSERT_FALSE(worker.initialized());
 }
 
-TEST_F(WorkerTest, exit_while_running) {
+// NOLINTNEXTLINE: required by gtest macros
+TEST_F(WorkerTest, ExitWhileRunning) {
   worker.Control(true);
 
   std::this_thread::sleep_for(std::chrono::milliseconds(50));