Update HAL interface

Based on the Android Native API Council's review.

Bug: 268601655
Test: make
Change-Id: I84e828ed08d6ad5dd30dd33541b0c91324b5f8fb
Merged-In: I84e828ed08d6ad5dd30dd33541b0c91324b5f8fb
diff --git a/tv/hdmi/cec/aidl/aidl_api/android.hardware.tv.hdmi.cec/current/android/hardware/tv/hdmi/cec/CecDeviceType.aidl b/tv/hdmi/cec/aidl/aidl_api/android.hardware.tv.hdmi.cec/current/android/hardware/tv/hdmi/cec/CecDeviceType.aidl
index 08dc1ee..4f7e247 100644
--- a/tv/hdmi/cec/aidl/aidl_api/android.hardware.tv.hdmi.cec/current/android/hardware/tv/hdmi/cec/CecDeviceType.aidl
+++ b/tv/hdmi/cec/aidl/aidl_api/android.hardware.tv.hdmi.cec/current/android/hardware/tv/hdmi/cec/CecDeviceType.aidl
@@ -34,7 +34,7 @@
 package android.hardware.tv.hdmi.cec;
 @Backing(type="byte") @VintfStability
 enum CecDeviceType {
-  INACTIVE = -1,
+  INACTIVE = (-1) /* -1 */,
   TV = 0,
   RECORDER = 1,
   TUNER = 3,
diff --git a/tv/hdmi/cec/aidl/aidl_api/android.hardware.tv.hdmi.cec/current/android/hardware/tv/hdmi/cec/CecMessageType.aidl b/tv/hdmi/cec/aidl/aidl_api/android.hardware.tv.hdmi.cec/current/android/hardware/tv/hdmi/cec/CecMessageType.aidl
index 31ca895..20472f0 100644
--- a/tv/hdmi/cec/aidl/aidl_api/android.hardware.tv.hdmi.cec/current/android/hardware/tv/hdmi/cec/CecMessageType.aidl
+++ b/tv/hdmi/cec/aidl/aidl_api/android.hardware.tv.hdmi.cec/current/android/hardware/tv/hdmi/cec/CecMessageType.aidl
@@ -34,78 +34,78 @@
 package android.hardware.tv.hdmi.cec;
 @Backing(type="int") @VintfStability
 enum CecMessageType {
-  FEATURE_ABORT = 0,
-  IMAGE_VIEW_ON = 4,
-  TUNER_STEP_INCREMENT = 5,
-  TUNER_STEP_DECREMENT = 6,
-  TUNER_DEVICE_STATUS = 7,
-  GIVE_TUNER_DEVICE_STATUS = 8,
-  RECORD_ON = 9,
-  RECORD_STATUS = 10,
-  RECORD_OFF = 11,
-  TEXT_VIEW_ON = 13,
-  RECORD_TV_SCREEN = 15,
-  GIVE_DECK_STATUS = 26,
-  DECK_STATUS = 27,
-  SET_MENU_LANGUAGE = 50,
-  CLEAR_ANALOG_TIMER = 51,
-  SET_ANALOG_TIMER = 52,
-  TIMER_STATUS = 53,
-  STANDBY = 54,
-  PLAY = 65,
-  DECK_CONTROL = 66,
-  TIMER_CLEARED_STATUS = 67,
-  USER_CONTROL_PRESSED = 68,
-  USER_CONTROL_RELEASED = 69,
-  GIVE_OSD_NAME = 70,
-  SET_OSD_NAME = 71,
-  SET_OSD_STRING = 100,
-  SET_TIMER_PROGRAM_TITLE = 103,
-  SYSTEM_AUDIO_MODE_REQUEST = 112,
-  GIVE_AUDIO_STATUS = 113,
-  SET_SYSTEM_AUDIO_MODE = 114,
-  REPORT_AUDIO_STATUS = 122,
-  GIVE_SYSTEM_AUDIO_MODE_STATUS = 125,
-  SYSTEM_AUDIO_MODE_STATUS = 126,
-  ROUTING_CHANGE = 128,
-  ROUTING_INFORMATION = 129,
-  ACTIVE_SOURCE = 130,
-  GIVE_PHYSICAL_ADDRESS = 131,
-  REPORT_PHYSICAL_ADDRESS = 132,
-  REQUEST_ACTIVE_SOURCE = 133,
-  SET_STREAM_PATH = 134,
-  DEVICE_VENDOR_ID = 135,
-  VENDOR_COMMAND = 137,
-  VENDOR_REMOTE_BUTTON_DOWN = 138,
-  VENDOR_REMOTE_BUTTON_UP = 139,
-  GIVE_DEVICE_VENDOR_ID = 140,
-  MENU_REQUEST = 141,
-  MENU_STATUS = 142,
-  GIVE_DEVICE_POWER_STATUS = 143,
-  REPORT_POWER_STATUS = 144,
-  GET_MENU_LANGUAGE = 145,
-  SELECT_ANALOG_SERVICE = 146,
-  SELECT_DIGITAL_SERVICE = 147,
-  SET_DIGITAL_TIMER = 151,
-  CLEAR_DIGITAL_TIMER = 153,
-  SET_AUDIO_RATE = 154,
-  INACTIVE_SOURCE = 157,
-  CEC_VERSION = 158,
-  GET_CEC_VERSION = 159,
-  VENDOR_COMMAND_WITH_ID = 160,
-  CLEAR_EXTERNAL_TIMER = 161,
-  SET_EXTERNAL_TIMER = 162,
-  REPORT_SHORT_AUDIO_DESCRIPTOR = 163,
-  REQUEST_SHORT_AUDIO_DESCRIPTOR = 164,
-  INITIATE_ARC = 192,
-  REPORT_ARC_INITIATED = 193,
-  REPORT_ARC_TERMINATED = 194,
-  REQUEST_ARC_INITIATION = 195,
-  REQUEST_ARC_TERMINATION = 196,
-  TERMINATE_ARC = 197,
-  ABORT = 255,
-  GIVE_FEATURES = 165,
-  REPORT_FEATURES = 166,
-  REQUEST_CURRENT_LATENCY = 167,
-  REPORT_CURRENT_LATENCY = 168,
+  FEATURE_ABORT = 0x00,
+  IMAGE_VIEW_ON = 0x04,
+  TUNER_STEP_INCREMENT = 0x05,
+  TUNER_STEP_DECREMENT = 0x06,
+  TUNER_DEVICE_STATUS = 0x07,
+  GIVE_TUNER_DEVICE_STATUS = 0x08,
+  RECORD_ON = 0x09,
+  RECORD_STATUS = 0x0A,
+  RECORD_OFF = 0x0B,
+  TEXT_VIEW_ON = 0x0D,
+  RECORD_TV_SCREEN = 0x0F,
+  GIVE_DECK_STATUS = 0x1A,
+  DECK_STATUS = 0x1B,
+  SET_MENU_LANGUAGE = 0x32,
+  CLEAR_ANALOG_TIMER = 0x33,
+  SET_ANALOG_TIMER = 0x34,
+  TIMER_STATUS = 0x35,
+  STANDBY = 0x36,
+  PLAY = 0x41,
+  DECK_CONTROL = 0x42,
+  TIMER_CLEARED_STATUS = 0x43,
+  USER_CONTROL_PRESSED = 0x44,
+  USER_CONTROL_RELEASED = 0x45,
+  GIVE_OSD_NAME = 0x46,
+  SET_OSD_NAME = 0x47,
+  SET_OSD_STRING = 0x64,
+  SET_TIMER_PROGRAM_TITLE = 0x67,
+  SYSTEM_AUDIO_MODE_REQUEST = 0x70,
+  GIVE_AUDIO_STATUS = 0x71,
+  SET_SYSTEM_AUDIO_MODE = 0x72,
+  REPORT_AUDIO_STATUS = 0x7A,
+  GIVE_SYSTEM_AUDIO_MODE_STATUS = 0x7D,
+  SYSTEM_AUDIO_MODE_STATUS = 0x7E,
+  ROUTING_CHANGE = 0x80,
+  ROUTING_INFORMATION = 0x81,
+  ACTIVE_SOURCE = 0x82,
+  GIVE_PHYSICAL_ADDRESS = 0x83,
+  REPORT_PHYSICAL_ADDRESS = 0x84,
+  REQUEST_ACTIVE_SOURCE = 0x85,
+  SET_STREAM_PATH = 0x86,
+  DEVICE_VENDOR_ID = 0x87,
+  VENDOR_COMMAND = 0x89,
+  VENDOR_REMOTE_BUTTON_DOWN = 0x8A,
+  VENDOR_REMOTE_BUTTON_UP = 0x8B,
+  GIVE_DEVICE_VENDOR_ID = 0x8C,
+  MENU_REQUEST = 0x8D,
+  MENU_STATUS = 0x8E,
+  GIVE_DEVICE_POWER_STATUS = 0x8F,
+  REPORT_POWER_STATUS = 0x90,
+  GET_MENU_LANGUAGE = 0x91,
+  SELECT_ANALOG_SERVICE = 0x92,
+  SELECT_DIGITAL_SERVICE = 0x93,
+  SET_DIGITAL_TIMER = 0x97,
+  CLEAR_DIGITAL_TIMER = 0x99,
+  SET_AUDIO_RATE = 0x9A,
+  INACTIVE_SOURCE = 0x9D,
+  CEC_VERSION = 0x9E,
+  GET_CEC_VERSION = 0x9F,
+  VENDOR_COMMAND_WITH_ID = 0xA0,
+  CLEAR_EXTERNAL_TIMER = 0xA1,
+  SET_EXTERNAL_TIMER = 0xA2,
+  REPORT_SHORT_AUDIO_DESCRIPTOR = 0xA3,
+  REQUEST_SHORT_AUDIO_DESCRIPTOR = 0xA4,
+  INITIATE_ARC = 0xC0,
+  REPORT_ARC_INITIATED = 0xC1,
+  REPORT_ARC_TERMINATED = 0xC2,
+  REQUEST_ARC_INITIATION = 0xC3,
+  REQUEST_ARC_TERMINATION = 0xC4,
+  TERMINATE_ARC = 0xC5,
+  ABORT = 0xFF,
+  GIVE_FEATURES = 0xA5,
+  REPORT_FEATURES = 0xA6,
+  REQUEST_CURRENT_LATENCY = 0xA7,
+  REPORT_CURRENT_LATENCY = 0xA8,
 }
diff --git a/tv/hdmi/cec/aidl/aidl_api/android.hardware.tv.hdmi.cec/current/android/hardware/tv/hdmi/cec/IHdmiCec.aidl b/tv/hdmi/cec/aidl/aidl_api/android.hardware.tv.hdmi.cec/current/android/hardware/tv/hdmi/cec/IHdmiCec.aidl
index 0881489..c6060d1 100644
--- a/tv/hdmi/cec/aidl/aidl_api/android.hardware.tv.hdmi.cec/current/android/hardware/tv/hdmi/cec/IHdmiCec.aidl
+++ b/tv/hdmi/cec/aidl/aidl_api/android.hardware.tv.hdmi.cec/current/android/hardware/tv/hdmi/cec/IHdmiCec.aidl
@@ -41,7 +41,7 @@
   int getPhysicalAddress();
   int getVendorId();
   android.hardware.tv.hdmi.cec.SendMessageResult sendMessage(in android.hardware.tv.hdmi.cec.CecMessage message);
-  void setCallback(in android.hardware.tv.hdmi.cec.IHdmiCecCallback callback);
+  void setCallback(in @nullable android.hardware.tv.hdmi.cec.IHdmiCecCallback callback);
   void setLanguage(in String language);
   void enableWakeupByOtp(in boolean value);
   void enableCec(in boolean value);
diff --git a/tv/hdmi/cec/aidl/android/hardware/tv/hdmi/cec/IHdmiCec.aidl b/tv/hdmi/cec/aidl/android/hardware/tv/hdmi/cec/IHdmiCec.aidl
index 577c377..578d924 100644
--- a/tv/hdmi/cec/aidl/android/hardware/tv/hdmi/cec/IHdmiCec.aidl
+++ b/tv/hdmi/cec/aidl/android/hardware/tv/hdmi/cec/IHdmiCec.aidl
@@ -77,7 +77,7 @@
      * plugged off and on again. It is advised to call getPhysicalAddress to get
      * the updated address when hot plug event takes place.
      *
-     * @param out addr Physical address of this device.
+     * @return Physical address of this device.
      */
     int getPhysicalAddress();
 
@@ -116,7 +116,7 @@
      *        previously registered callback must be replaced with this one.
      *        setCallback(null) should deregister the callback.
      */
-    void setCallback(in IHdmiCecCallback callback);
+    void setCallback(in @nullable IHdmiCecCallback callback);
 
     /**
      * Passes the updated language information of Android system. Contains
diff --git a/tv/hdmi/connection/aidl/android/hardware/tv/hdmi/connection/HdmiPortInfo.aidl b/tv/hdmi/connection/aidl/android/hardware/tv/hdmi/connection/HdmiPortInfo.aidl
index 1d2ef4a..875c9da 100644
--- a/tv/hdmi/connection/aidl/android/hardware/tv/hdmi/connection/HdmiPortInfo.aidl
+++ b/tv/hdmi/connection/aidl/android/hardware/tv/hdmi/connection/HdmiPortInfo.aidl
@@ -24,9 +24,10 @@
 @VintfStability
 parcelable HdmiPortInfo {
     HdmiPortType type;
-    int portId; // Output ports should start from 1 which corresponds to HDMI "port 1".
+    int portId; // Input ports should start from 1 which corresponds to HDMI "port 1".
     boolean cecSupported;
-    boolean arcSupported;
+    boolean arcSupported; // If true, cecSupported has to be true as well. ARC cannot be supported
+                          // without CEC support.
     boolean eArcSupported;
     // The physical address of the device connected to this port, valid range is 0x0000 to 0xFFFF
     // (ref Sec 8.7.2 of HDMI 1.4b).
diff --git a/tv/hdmi/earc/aidl/aidl_api/android.hardware.tv.hdmi.earc/current/android/hardware/tv/hdmi/earc/IEArcStatus.aidl b/tv/hdmi/earc/aidl/aidl_api/android.hardware.tv.hdmi.earc/current/android/hardware/tv/hdmi/earc/IEArcStatus.aidl
index 29d4ea9..6dcbd8d 100644
--- a/tv/hdmi/earc/aidl/aidl_api/android.hardware.tv.hdmi.earc/current/android/hardware/tv/hdmi/earc/IEArcStatus.aidl
+++ b/tv/hdmi/earc/aidl/aidl_api/android.hardware.tv.hdmi.earc/current/android/hardware/tv/hdmi/earc/IEArcStatus.aidl
@@ -34,8 +34,8 @@
 package android.hardware.tv.hdmi.earc;
 @Backing(type="byte") @VintfStability
 enum IEArcStatus {
-  STATUS_IDLE = 0,
-  STATUS_EARC_PENDING = 1,
-  STATUS_ARC_PENDING = 2,
-  STATUS_EARC_CONNECTED = 3,
+  IDLE = 0,
+  EARC_PENDING = 1,
+  ARC_PENDING = 2,
+  EARC_CONNECTED = 3,
 }
diff --git a/tv/hdmi/earc/aidl/android/hardware/tv/hdmi/earc/IEArc.aidl b/tv/hdmi/earc/aidl/android/hardware/tv/hdmi/earc/IEArc.aidl
index a2dde6a..e5a6458 100644
--- a/tv/hdmi/earc/aidl/android/hardware/tv/hdmi/earc/IEArc.aidl
+++ b/tv/hdmi/earc/aidl/android/hardware/tv/hdmi/earc/IEArc.aidl
@@ -64,10 +64,11 @@
     IEArcStatus getState(in int portId);
 
     /**
-     * Getter for the most recent capabilities reported by the device connected to port.
+     * Getter for the most recent audio capabilities reported by the device connected to port.
      *
      * @param portId The port ID on which the device is connected.
-     * @return The raw, unparsed audio capabilities
+     * @return a byte array containing the raw, unparsed audio capabilities (Ref "Section 9.5.3.6 -
+     * eARC RX Capabilities Data Structure" in HDMI 2.1 specification).
      */
     byte[] getLastReportedAudioCapabilities(in int portId);
 }
diff --git a/tv/hdmi/earc/aidl/android/hardware/tv/hdmi/earc/IEArcCallback.aidl b/tv/hdmi/earc/aidl/android/hardware/tv/hdmi/earc/IEArcCallback.aidl
index a11924b..ea77c54 100644
--- a/tv/hdmi/earc/aidl/android/hardware/tv/hdmi/earc/IEArcCallback.aidl
+++ b/tv/hdmi/earc/aidl/android/hardware/tv/hdmi/earc/IEArcCallback.aidl
@@ -34,9 +34,9 @@
     /**
      * The callback function that must be called by the eARC driver and HAL implementation to
      * notify the Android framework of the audio capabilities reported by the connected device. On
-     * every state change to {@code STATUS_EARC_CONNECTED}, the driver shall read the capabilities
-     * reported by the eARC RX. The onStateChange callback shall always be invoked first and the
-     * onCapabilitiesReported callback shall be invoked second.
+     * every state change to {@code IEArcStatus::EARC_CONNECTED}, the driver shall read the
+     * capabilities reported by the eARC RX. The onStateChange callback shall always be invoked
+     * first and the onCapabilitiesReported callback shall be invoked second.
      * @param rawCapabilities The raw unparsed audio capabilities (Ref "Section 9.5.3.6 - eARC RX
      *         Capabilities Data Structure" in HDMI 2.1 specification).
      * @param portId The port ID for which the audio capabilities are being reported
diff --git a/tv/hdmi/earc/aidl/android/hardware/tv/hdmi/earc/IEArcStatus.aidl b/tv/hdmi/earc/aidl/android/hardware/tv/hdmi/earc/IEArcStatus.aidl
index de1aaf1..5407434 100644
--- a/tv/hdmi/earc/aidl/android/hardware/tv/hdmi/earc/IEArcStatus.aidl
+++ b/tv/hdmi/earc/aidl/android/hardware/tv/hdmi/earc/IEArcStatus.aidl
@@ -22,8 +22,8 @@
 @VintfStability
 @Backing(type="byte")
 enum IEArcStatus {
-    STATUS_IDLE = 0,
-    STATUS_EARC_PENDING = 1,
-    STATUS_ARC_PENDING = 2,
-    STATUS_EARC_CONNECTED = 3,
+    IDLE = 0,
+    EARC_PENDING = 1,
+    ARC_PENDING = 2,
+    EARC_CONNECTED = 3,
 }
diff --git a/tv/hdmi/earc/aidl/default/EArcMock.cpp b/tv/hdmi/earc/aidl/default/EArcMock.cpp
index 99a845e..93395fc 100644
--- a/tv/hdmi/earc/aidl/default/EArcMock.cpp
+++ b/tv/hdmi/earc/aidl/default/EArcMock.cpp
@@ -109,7 +109,7 @@
     mCallback = nullptr;
     mCapabilities.resize(mTotalPorts);
     mPortStatus.resize(mTotalPorts);
-    mPortStatus[0] = IEArcStatus::STATUS_IDLE;
+    mPortStatus[0] = IEArcStatus::IDLE;
     mDeathRecipient = ndk::ScopedAIBinder_DeathRecipient(AIBinder_DeathRecipient_new(serviceDied));
 }