Add CameraService Watchdog

This CL adds a watchdog used to detect issues in cameraservice/
Camera HAL. It uses a timer that can be customized to monitor calls
and kills the process if a fixed amount of time has elapsed without
a successful execution of the monitored call.

The following cases are included in this CL: flush(), close().
Further cases can be added with the APIs in watchdog.

Test: Manual; Tested by force triggering watchdog with custom timer
values and while(true) or sleep in monitored calls
Bug: 229145451
Merged-In: Ia7b4a3fd9395210800a391c62b4ea757efbb3b00

Change-Id: Ia7b4a3fd9395210800a391c62b4ea757efbb3b00
diff --git a/services/camera/libcameraservice/device3/Camera3Device.h b/services/camera/libcameraservice/device3/Camera3Device.h
index 749b342..748d063 100644
--- a/services/camera/libcameraservice/device3/Camera3Device.h
+++ b/services/camera/libcameraservice/device3/Camera3Device.h
@@ -32,6 +32,7 @@
 #include <camera/CaptureResult.h>
 
 #include "android/hardware/camera/metadata/3.8/types.h"
+#include "CameraServiceWatchdog.h"
 #include "common/CameraDeviceBase.h"
 #include "device3/BufferUtils.h"
 #include "device3/StatusTracker.h"
@@ -98,6 +99,9 @@
 
     metadata_vendor_id_t getVendorTagId() const override { return mVendorTagId; }
 
+    // Watchdog thread
+    sp<CameraServiceWatchdog> mCameraServiceWatchdog;
+
     // Transitions to idle state on success.
     virtual status_t initialize(sp<CameraProviderManager> /*manager*/,
             const String8& /*monitorTags*/) = 0;