Add encod/decod test for OMX hal.

Bug: 32023356
Test: make vts
      run vts -m VtsHalMediaOmxV1_0Host

Change-Id: I886cc90b8fc4d87830cdc4fd6025104fc55c3788
diff --git a/media/omx/V1_0/host/AndroidTest.xml b/media/omx/V1_0/host/AndroidTest.xml
index 3edbb0e..233a5ed 100644
--- a/media/omx/V1_0/host/AndroidTest.xml
+++ b/media/omx/V1_0/host/AndroidTest.xml
@@ -34,12 +34,26 @@
         <option name="push" value="DATA/lib64/android.hardware.media@1.0-vts.driver.so->/data/local/tmp/64/android.hardware.media@1.0-vts.driver.so"/>
         <option name="push" value="DATA/lib/android.hardware.media.omx@1.0-vts.driver.so->/data/local/tmp/32/android.hardware.media.omx@1.0-vts.driver.so"/>
         <option name="push" value="DATA/lib64/android.hardware.media.omx@1.0-vts.driver.so->/data/local/tmp/64/android.hardware.media.omx@1.0-vts.driver.so"/>
+        <option name="push" value="DATA/media/res/bbb_480x360_420p_30fps_32frames.yuv->/sdcard/media/bbb_480x360_420p_30fps_32frames.yuv"/>
+        <option name="push" value="DATA/media/res/bbb_avc_1920x1080_5000kbps_30fps.h264->/sdcard/media/bbb_avc_1920x1080_5000kbps_30fps.h264"/>
+        <option name="push" value="DATA/media/res/bbb_avc_1920x1080_5000kbps_30fps.info->/sdcard/media/bbb_avc_1920x1080_5000kbps_30fps.info"/>
+        <option name="push" value="DATA/media/res/bbb_mp3_stereo_192kbps_48000hz.info->/sdcard/media/bbb_mp3_stereo_192kbps_48000hz.info"/>
+        <option name="push" value="DATA/media/res/bbb_mp3_stereo_192kbps_48000hz.mp3->/sdcard/media/bbb_mp3_stereo_192kbps_48000hz.mp3"/>
+        <option name="push" value="DATA/media/res/bbb_raw_1ch_16khz_s16le.raw->/sdcard/media/bbb_raw_1ch_16khz_s16le.raw"/>
+        <option name="push" value="DATA/media/res/bbb_raw_1ch_8khz_s16le.raw->/sdcard/media/bbb_raw_1ch_8khz_s16le.raw"/>
+        <option name="push" value="DATA/media/res/bbb_raw_2ch_48khz_s16le.raw->/sdcard/media/bbb_raw_2ch_48khz_s16le.raw"/>
+        <option name="push" value="DATA/media/res/sine_amrnb_1ch_12kbps_8000hz.amrnb->/sdcard/media/sine_amrnb_1ch_12kbps_8000hz.amrnb"/>
+        <option name="push" value="DATA/media/res/sine_amrnb_1ch_12kbps_8000hz.info->/sdcard/media/sine_amrnb_1ch_12kbps_8000hz.info"/>
     </target_preparer>
     <target_preparer class="com.android.tradefed.targetprep.VtsPythonVirtualenvPreparer"/>
     <test class="com.android.tradefed.testtype.VtsMultiDeviceTest">
         <option name="test-module-name" value="VtsHalMediaOmxV1_0Host"/>
         <option name="test-case-path" value="vts/testcases/hal/media/omx/V1_0/host/VtsHalMediaOmxV1_0HostTest"/>
         <option name="binary-test-source" value="_64bit::DATA/nativetest64/VtsHalMediaOmxV1_0TargetComponentTest/VtsHalMediaOmxV1_0TargetComponentTest"/>
+        <option name="binary-test-source" value="_64bit::DATA/nativetest64/VtsHalMediaOmxV1_0TargetAudioEncTest/VtsHalMediaOmxV1_0TargetAudioEncTest"/>
+        <option name="binary-test-source" value="_64bit::DATA/nativetest64/VtsHalMediaOmxV1_0TargetAudioDecTest/VtsHalMediaOmxV1_0TargetAudioDecTest"/>
+        <option name="binary-test-source" value="_64bit::DATA/nativetest64/VtsHalMediaOmxV1_0TargetVideoEncTest/VtsHalMediaOmxV1_0TargetVideoEncTest"/>
+        <option name="binary-test-source" value="_64bit::DATA/nativetest64/VtsHalMediaOmxV1_0TargetVideoDecTest/VtsHalMediaOmxV1_0TargetVideoDecTest"/>
         <option name="hal-hidl-package-name" value="android.hardware.media.omx@1.0"/>
         <option name="precondition-lshal" value="android.hardware.media.omx@1.0"/>
         <option name="test-timeout" value="30m"/>
diff --git a/media/omx/V1_0/host/VtsHalMediaOmxV1_0HostTest.py b/media/omx/V1_0/host/VtsHalMediaOmxV1_0HostTest.py
index 4b3862a..3499cb2 100644
--- a/media/omx/V1_0/host/VtsHalMediaOmxV1_0HostTest.py
+++ b/media/omx/V1_0/host/VtsHalMediaOmxV1_0HostTest.py
@@ -28,6 +28,30 @@
 class VtsHalMediaOmxV1_0Host(hal_hidl_gtest.HidlHalGTest):
     """Host test class to run the Media_Omx HAL."""
 
+    AUDIO_ENC_TEST = "AudioEncHidlTest"
+    AUDIO_DEC_TEST = "AudioDecHidlTest"
+    VIDEO_ENC_TEST = "VideoEncHidlTest"
+    VIDEO_DEC_TEST = "VideoDecHidlTest"
+
+    # Components and Roles which will be skipped.
+    blacklist_components = ["OMX.google.h264.encoder",
+                            "OMX.google.h264.decoder",
+                            "OMX.qcom.video.decoder.avc",
+                            "OMX.google.amrnb.encoder",
+                            "OMX.google.flac.encoder",
+                            "OMX.google.amrwb.encoder",
+                            "OMX.google.aac.encoder",
+                            "OMX.google.mp3.decoder",
+                            "OMX.google.amrnb.decoder"]
+    blacklist_roles = ["video_encoder.avc",
+                       "video_decoder.avc",
+                       "audio_encoder.amrnb",
+                       "audio_encoder.flac",
+                       "audio_encoder.amrwb",
+                       "audio_encoder.aac",
+                       "audio_decoder.mp3",
+                       "audio_decoder.amrnb"]
+
     def CreateTestCases(self):
         """Get all registered test components and create test case objects."""
         # Init the IOmx hal.
@@ -64,21 +88,31 @@
         Returns:
             A list of VtsHalMediaOmxV1_0TestCase objects
         """
-        gtest_cases = super(VtsHalMediaOmxV1_0Host, self).CreateTestCase(
-            path, tag)
+        gtest_cases = super(VtsHalMediaOmxV1_0Host, self).CreateTestCase(path,
+                                                                         tag)
         test_cases = []
 
         for gtest_case in gtest_cases:
             test_suite = gtest_case.GetFullName()
             for component, roles in self.components.iteritems():
                 for role in roles:
+                    if component in self.blacklist_components and role in self.blacklist_roles:
+                        continue
+                    if self.AUDIO_ENC_TEST in test_suite and not "audio_encoder" in role:
+                        continue
+                    if self.AUDIO_DEC_TEST in test_suite and not "audio_decoder" in role:
+                        continue
+                    if self.VIDEO_ENC_TEST in test_suite and not "video_encoder" in role:
+                        continue
+                    if self.VIDEO_DEC_TEST in test_suite and not "video_decoder" in role:
+                        continue
                     test_name = component + '_' + role
                     # TODO (zhuoyao): get instance name using lshal.
                     instance_name = "default"
                     test_case = omx_test_case.VtsHalMediaOmxV1_0TestCase(
                         component, role, instance_name, test_suite, test_name,
                         path)
-                test_cases.append(test_case)
+                    test_cases.append(test_case)
         logging.info("num of test_testcases: %s", len(test_cases))
         return test_cases