MH2 | Add restart logic in HalProxy::initialize method.

Bug: 136511617
Test: None yet

Change-Id: I389a7243d3612586aae4e8a802afda92af8dcc6d
diff --git a/sensors/2.0/multihal/include/HalProxy.h b/sensors/2.0/multihal/include/HalProxy.h
index 6592afe..26bc644 100644
--- a/sensors/2.0/multihal/include/HalProxy.h
+++ b/sensors/2.0/multihal/include/HalProxy.h
@@ -149,9 +149,13 @@
     std::unique_ptr<WakeLockMessageQueue> mWakeLockQueue;
 
     /**
-     * Event Flag to signal to the framework when sensor events are available to be read
+     * Event Flag to signal to the framework when sensor events are available to be read and to
+     * interrupt event queue blocking write.
      */
-    EventFlag* mEventQueueFlag;
+    EventFlag* mEventQueueFlag = nullptr;
+
+    //! Event Flag to signal internally that the wakelock queue should stop its blocking read.
+    EventFlag* mWakelockQueueFlag = nullptr;
 
     /**
      * Callback to the sensors framework to inform it that new sensors have been added or removed.
@@ -254,6 +258,16 @@
     void init();
 
     /**
+     * Stops all threads by setting the threads running flag to false and joining to them.
+     */
+    void stopThreads();
+
+    /**
+     * Disable all the sensors observed by the HalProxy.
+     */
+    void disableAllSensors();
+
+    /**
      * Starts the thread that handles pending writes to event fmq.
      *
      * @param halProxy The HalProxy object pointer.