CEC: Add support for multiple ports to default HdmiCec

Bug: 185434120
Test: manual
Change-Id: I4e1a1f2ff7cb4530e8b223169d8efd452412089b
diff --git a/tv/cec/1.0/default/HdmiCecDefault.h b/tv/cec/1.0/default/HdmiCecDefault.h
index 81229d3..6574429 100644
--- a/tv/cec/1.0/default/HdmiCecDefault.h
+++ b/tv/cec/1.0/default/HdmiCecDefault.h
@@ -13,11 +13,11 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
-#include <android/hardware/tv/cec/1.0/IHdmiCec.h>
 #include <hardware/hdmi_cec.h>
 #include <linux/cec.h>
 #include <thread>
+#include <vector>
+#include "HdmiCecPort.h"
 
 namespace android {
 namespace hardware {
@@ -26,7 +26,9 @@
 namespace V1_0 {
 namespace implementation {
 
+using std::shared_ptr;
 using std::thread;
+using std::vector;
 
 class HdmiCecDefault : public IHdmiCec, public hidl_death_recipient {
   public:
@@ -54,14 +56,16 @@
     Return<void> release();
 
   private:
-    void event_thread();
+    void event_thread(HdmiCecPort* hdmiCecPort);
     static int getOpcode(cec_msg message);
     static int getFirstParam(cec_msg message);
     static bool isWakeupMessage(cec_msg message);
     static bool isTransferableInSleep(cec_msg message);
     static bool isPowerUICommand(cec_msg message);
+    static Return<SendMessageResult> getSendMessageResult(int tx_status);
 
-    thread mEventThread;
+    vector<thread> mEventThreads;
+    vector<shared_ptr<HdmiCecPort>> mHdmiCecPorts;
 
     // When set to false, all the CEC commands are discarded. True by default after initialization.
     bool mCecEnabled;
@@ -78,9 +82,6 @@
      */
     bool mCecControlEnabled;
     sp<IHdmiCecCallback> mCallback;
-
-    int mCecFd;
-    int mExitFd;
 };
 }  // namespace implementation
 }  // namespace V1_0