Merge "audio.common@2.0-util: vendor_available + in Soong" into oc-dev
diff --git a/audio/2.0/Android.bp b/audio/2.0/Android.bp
index f7975ec..9aa9e2c 100644
--- a/audio/2.0/Android.bp
+++ b/audio/2.0/Android.bp
@@ -86,6 +86,7 @@
generated_sources: ["android.hardware.audio@2.0_genc++"],
generated_headers: ["android.hardware.audio@2.0_genc++_headers"],
export_generated_headers: ["android.hardware.audio@2.0_genc++_headers"],
+ vendor_available: true,
shared_libs: [
"libhidlbase",
"libhidltransport",
diff --git a/audio/2.0/Android.mk b/audio/2.0/Android.mk
index e989364..d5e840f 100644
--- a/audio/2.0/Android.mk
+++ b/audio/2.0/Android.mk
@@ -5,7 +5,7 @@
################################################################################
include $(CLEAR_VARS)
-LOCAL_MODULE := android.hardware.audio@2.0-java-constants
+LOCAL_MODULE := android.hardware.audio-V2.0-java-constants
LOCAL_MODULE_CLASS := JAVA_LIBRARIES
intermediates := $(call local-generated-sources-dir, COMMON)
diff --git a/audio/common/2.0/Android.bp b/audio/common/2.0/Android.bp
index ad599ed..fa80d20 100644
--- a/audio/common/2.0/Android.bp
+++ b/audio/common/2.0/Android.bp
@@ -37,6 +37,7 @@
generated_sources: ["android.hardware.audio.common@2.0_genc++"],
generated_headers: ["android.hardware.audio.common@2.0_genc++_headers"],
export_generated_headers: ["android.hardware.audio.common@2.0_genc++_headers"],
+ vendor_available: true,
shared_libs: [
"libhidlbase",
"libhidltransport",
diff --git a/audio/common/2.0/Android.mk b/audio/common/2.0/Android.mk
index 7d62779..a78a395 100644
--- a/audio/common/2.0/Android.mk
+++ b/audio/common/2.0/Android.mk
@@ -5,7 +5,7 @@
################################################################################
include $(CLEAR_VARS)
-LOCAL_MODULE := android.hardware.audio.common@2.0-java-constants
+LOCAL_MODULE := android.hardware.audio.common-V2.0-java-constants
LOCAL_MODULE_CLASS := JAVA_LIBRARIES
intermediates := $(call local-generated-sources-dir, COMMON)
diff --git a/audio/effect/2.0/Android.bp b/audio/effect/2.0/Android.bp
index 937a4e6..fea2a33 100644
--- a/audio/effect/2.0/Android.bp
+++ b/audio/effect/2.0/Android.bp
@@ -135,6 +135,7 @@
generated_sources: ["android.hardware.audio.effect@2.0_genc++"],
generated_headers: ["android.hardware.audio.effect@2.0_genc++_headers"],
export_generated_headers: ["android.hardware.audio.effect@2.0_genc++_headers"],
+ vendor_available: true,
shared_libs: [
"libhidlbase",
"libhidltransport",
diff --git a/audio/effect/2.0/Android.mk b/audio/effect/2.0/Android.mk
index d71255e..a426763 100644
--- a/audio/effect/2.0/Android.mk
+++ b/audio/effect/2.0/Android.mk
@@ -5,7 +5,7 @@
################################################################################
include $(CLEAR_VARS)
-LOCAL_MODULE := android.hardware.audio.effect@2.0-java-constants
+LOCAL_MODULE := android.hardware.audio.effect-V2.0-java-constants
LOCAL_MODULE_CLASS := JAVA_LIBRARIES
intermediates := $(call local-generated-sources-dir, COMMON)
diff --git a/automotive/evs/1.0/Android.bp b/automotive/evs/1.0/Android.bp
index ec56c8f..a9f094f 100644
--- a/automotive/evs/1.0/Android.bp
+++ b/automotive/evs/1.0/Android.bp
@@ -65,6 +65,7 @@
generated_sources: ["android.hardware.automotive.evs@1.0_genc++"],
generated_headers: ["android.hardware.automotive.evs@1.0_genc++_headers"],
export_generated_headers: ["android.hardware.automotive.evs@1.0_genc++_headers"],
+ vendor_available: true,
shared_libs: [
"libhidlbase",
"libhidltransport",
diff --git a/automotive/vehicle/2.0/Android.bp b/automotive/vehicle/2.0/Android.bp
index 6957bf8..b6fde6e 100644
--- a/automotive/vehicle/2.0/Android.bp
+++ b/automotive/vehicle/2.0/Android.bp
@@ -51,6 +51,7 @@
generated_sources: ["android.hardware.automotive.vehicle@2.0_genc++"],
generated_headers: ["android.hardware.automotive.vehicle@2.0_genc++_headers"],
export_generated_headers: ["android.hardware.automotive.vehicle@2.0_genc++_headers"],
+ vendor_available: true,
shared_libs: [
"libhidlbase",
"libhidltransport",
diff --git a/automotive/vehicle/2.0/Android.mk b/automotive/vehicle/2.0/Android.mk
index d093017..eb05f35 100644
--- a/automotive/vehicle/2.0/Android.mk
+++ b/automotive/vehicle/2.0/Android.mk
@@ -5,7 +5,7 @@
################################################################################
include $(CLEAR_VARS)
-LOCAL_MODULE := android.hardware.automotive.vehicle@2.0-java
+LOCAL_MODULE := android.hardware.automotive.vehicle-V2.0-java
LOCAL_MODULE_CLASS := JAVA_LIBRARIES
intermediates := $(call local-generated-sources-dir, COMMON)
@@ -13,7 +13,7 @@
HIDL := $(HOST_OUT_EXECUTABLES)/hidl-gen$(HOST_EXECUTABLE_SUFFIX)
LOCAL_JAVA_LIBRARIES := \
- android.hidl.base@1.0-java \
+ android.hidl.base-V1.0-java \
#
@@ -977,7 +977,7 @@
################################################################################
include $(CLEAR_VARS)
-LOCAL_MODULE := android.hardware.automotive.vehicle@2.0-java-static
+LOCAL_MODULE := android.hardware.automotive.vehicle-V2.0-java-static
LOCAL_MODULE_CLASS := JAVA_LIBRARIES
intermediates := $(call local-generated-sources-dir, COMMON)
@@ -985,7 +985,7 @@
HIDL := $(HOST_OUT_EXECUTABLES)/hidl-gen$(HOST_EXECUTABLE_SUFFIX)
LOCAL_STATIC_JAVA_LIBRARIES := \
- android.hidl.base@1.0-java-static \
+ android.hidl.base-V1.0-java-static \
#
diff --git a/automotive/vehicle/2.1/Android.bp b/automotive/vehicle/2.1/Android.bp
index 825ec1f..536950a 100644
--- a/automotive/vehicle/2.1/Android.bp
+++ b/automotive/vehicle/2.1/Android.bp
@@ -44,6 +44,7 @@
generated_sources: ["android.hardware.automotive.vehicle@2.1_genc++"],
generated_headers: ["android.hardware.automotive.vehicle@2.1_genc++_headers"],
export_generated_headers: ["android.hardware.automotive.vehicle@2.1_genc++_headers"],
+ vendor_available: true,
shared_libs: [
"libhidlbase",
"libhidltransport",
diff --git a/automotive/vehicle/2.1/Android.mk b/automotive/vehicle/2.1/Android.mk
index f030af08..693fe2d 100644
--- a/automotive/vehicle/2.1/Android.mk
+++ b/automotive/vehicle/2.1/Android.mk
@@ -5,7 +5,7 @@
################################################################################
include $(CLEAR_VARS)
-LOCAL_MODULE := android.hardware.automotive.vehicle@2.1-java
+LOCAL_MODULE := android.hardware.automotive.vehicle-V2.1-java
LOCAL_MODULE_CLASS := JAVA_LIBRARIES
intermediates := $(call local-generated-sources-dir, COMMON)
@@ -13,8 +13,8 @@
HIDL := $(HOST_OUT_EXECUTABLES)/hidl-gen$(HOST_EXECUTABLE_SUFFIX)
LOCAL_JAVA_LIBRARIES := \
- android.hardware.automotive.vehicle@2.0-java \
- android.hidl.base@1.0-java \
+ android.hardware.automotive.vehicle-V2.0-java \
+ android.hidl.base-V1.0-java \
#
@@ -269,7 +269,7 @@
################################################################################
include $(CLEAR_VARS)
-LOCAL_MODULE := android.hardware.automotive.vehicle@2.1-java-static
+LOCAL_MODULE := android.hardware.automotive.vehicle-V2.1-java-static
LOCAL_MODULE_CLASS := JAVA_LIBRARIES
intermediates := $(call local-generated-sources-dir, COMMON)
@@ -277,8 +277,8 @@
HIDL := $(HOST_OUT_EXECUTABLES)/hidl-gen$(HOST_EXECUTABLE_SUFFIX)
LOCAL_STATIC_JAVA_LIBRARIES := \
- android.hardware.automotive.vehicle@2.0-java-static \
- android.hidl.base@1.0-java-static \
+ android.hardware.automotive.vehicle-V2.0-java-static \
+ android.hidl.base-V1.0-java-static \
#
diff --git a/biometrics/fingerprint/2.1/Android.bp b/biometrics/fingerprint/2.1/Android.bp
index e928f9b..9a6e9d8 100644
--- a/biometrics/fingerprint/2.1/Android.bp
+++ b/biometrics/fingerprint/2.1/Android.bp
@@ -51,6 +51,7 @@
generated_sources: ["android.hardware.biometrics.fingerprint@2.1_genc++"],
generated_headers: ["android.hardware.biometrics.fingerprint@2.1_genc++_headers"],
export_generated_headers: ["android.hardware.biometrics.fingerprint@2.1_genc++_headers"],
+ vendor_available: true,
shared_libs: [
"libhidlbase",
"libhidltransport",
diff --git a/biometrics/fingerprint/2.1/Android.mk b/biometrics/fingerprint/2.1/Android.mk
index 567b38a..2f32371 100644
--- a/biometrics/fingerprint/2.1/Android.mk
+++ b/biometrics/fingerprint/2.1/Android.mk
@@ -5,7 +5,7 @@
################################################################################
include $(CLEAR_VARS)
-LOCAL_MODULE := android.hardware.biometrics.fingerprint@2.1-java
+LOCAL_MODULE := android.hardware.biometrics.fingerprint-V2.1-java
LOCAL_MODULE_CLASS := JAVA_LIBRARIES
intermediates := $(call local-generated-sources-dir, COMMON)
@@ -13,7 +13,7 @@
HIDL := $(HOST_OUT_EXECUTABLES)/hidl-gen$(HOST_EXECUTABLE_SUFFIX)
LOCAL_JAVA_LIBRARIES := \
- android.hidl.base@1.0-java \
+ android.hidl.base-V1.0-java \
#
@@ -236,7 +236,7 @@
################################################################################
include $(CLEAR_VARS)
-LOCAL_MODULE := android.hardware.biometrics.fingerprint@2.1-java-static
+LOCAL_MODULE := android.hardware.biometrics.fingerprint-V2.1-java-static
LOCAL_MODULE_CLASS := JAVA_LIBRARIES
intermediates := $(call local-generated-sources-dir, COMMON)
@@ -244,7 +244,7 @@
HIDL := $(HOST_OUT_EXECUTABLES)/hidl-gen$(HOST_EXECUTABLE_SUFFIX)
LOCAL_STATIC_JAVA_LIBRARIES := \
- android.hidl.base@1.0-java-static \
+ android.hidl.base-V1.0-java-static \
#
diff --git a/biometrics/fingerprint/2.1/default/Android.mk b/biometrics/fingerprint/2.1/default/Android.mk
index 3d06397..f02db94 100644
--- a/biometrics/fingerprint/2.1/default/Android.mk
+++ b/biometrics/fingerprint/2.1/default/Android.mk
@@ -10,12 +10,11 @@
service.cpp \
LOCAL_SHARED_LIBRARIES := \
- libbinder \
+ libcutils \
liblog \
libhidlbase \
libhidltransport \
libhardware \
- libkeystore_binder \
libutils \
android.hardware.biometrics.fingerprint@2.1 \
diff --git a/biometrics/fingerprint/2.1/default/BiometricsFingerprint.cpp b/biometrics/fingerprint/2.1/default/BiometricsFingerprint.cpp
index 4f5aaf9..7ba84bd 100644
--- a/biometrics/fingerprint/2.1/default/BiometricsFingerprint.cpp
+++ b/biometrics/fingerprint/2.1/default/BiometricsFingerprint.cpp
@@ -16,8 +16,6 @@
#define LOG_TAG "android.hardware.biometrics.fingerprint@2.1-service"
#define LOG_VERBOSE "android.hardware.biometrics.fingerprint@2.1-service"
-// For communication with Keystore binder interface
-#include <keystore/keystore.h> // for error codes
#include <hardware/hw_auth_token.h>
#include <hardware/hardware.h>
diff --git a/bluetooth/1.0/Android.bp b/bluetooth/1.0/Android.bp
index 75cdcfc..e831069 100644
--- a/bluetooth/1.0/Android.bp
+++ b/bluetooth/1.0/Android.bp
@@ -51,6 +51,7 @@
generated_sources: ["android.hardware.bluetooth@1.0_genc++"],
generated_headers: ["android.hardware.bluetooth@1.0_genc++_headers"],
export_generated_headers: ["android.hardware.bluetooth@1.0_genc++_headers"],
+ vendor_available: true,
shared_libs: [
"libhidlbase",
"libhidltransport",
diff --git a/bluetooth/1.0/Android.mk b/bluetooth/1.0/Android.mk
index d824d5d..f8cd96e 100644
--- a/bluetooth/1.0/Android.mk
+++ b/bluetooth/1.0/Android.mk
@@ -5,7 +5,7 @@
################################################################################
include $(CLEAR_VARS)
-LOCAL_MODULE := android.hardware.bluetooth@1.0-java
+LOCAL_MODULE := android.hardware.bluetooth-V1.0-java
LOCAL_MODULE_CLASS := JAVA_LIBRARIES
intermediates := $(call local-generated-sources-dir, COMMON)
@@ -13,7 +13,7 @@
HIDL := $(HOST_OUT_EXECUTABLES)/hidl-gen$(HOST_EXECUTABLE_SUFFIX)
LOCAL_JAVA_LIBRARIES := \
- android.hidl.base@1.0-java \
+ android.hidl.base-V1.0-java \
#
@@ -84,7 +84,7 @@
################################################################################
include $(CLEAR_VARS)
-LOCAL_MODULE := android.hardware.bluetooth@1.0-java-static
+LOCAL_MODULE := android.hardware.bluetooth-V1.0-java-static
LOCAL_MODULE_CLASS := JAVA_LIBRARIES
intermediates := $(call local-generated-sources-dir, COMMON)
@@ -92,7 +92,7 @@
HIDL := $(HOST_OUT_EXECUTABLES)/hidl-gen$(HOST_EXECUTABLE_SUFFIX)
LOCAL_STATIC_JAVA_LIBRARIES := \
- android.hidl.base@1.0-java-static \
+ android.hidl.base-V1.0-java-static \
#
diff --git a/bluetooth/1.0/default/Android.bp b/bluetooth/1.0/default/Android.bp
index 292f97c..fec2264 100644
--- a/bluetooth/1.0/default/Android.bp
+++ b/bluetooth/1.0/default/Android.bp
@@ -16,7 +16,7 @@
cc_library_shared {
name: "android.hardware.bluetooth@1.0-impl",
defaults: ["hidl_defaults"],
- proprietary: true,
+ vendor: true,
relative_install_path: "hw",
srcs: [
"bluetooth_hci.cc",
@@ -41,21 +41,20 @@
cc_library_static {
name: "android.hardware.bluetooth-async",
+ vendor: true,
defaults: ["hidl_defaults"],
srcs: [
"async_fd_watcher.cc",
],
export_include_dirs: ["."],
shared_libs: [
- "libbase",
- "libcutils",
"liblog",
- "libutils",
],
}
cc_library_static {
name: "android.hardware.bluetooth-hci",
+ vendor: true,
defaults: ["hidl_defaults"],
srcs: [
"hci_packetizer.cc",
@@ -66,7 +65,6 @@
export_include_dirs: ["."],
shared_libs: [
"libbase",
- "libcutils",
"libhidlbase",
"liblog",
"libutils",
@@ -75,6 +73,7 @@
cc_test {
name: "bluetooth-vendor-interface-unit-tests",
+ vendor: true,
defaults: ["hidl_defaults"],
srcs: [
"test/async_fd_watcher_unittest.cc",
diff --git a/bluetooth/1.0/default/bluetooth_hci.cc b/bluetooth/1.0/default/bluetooth_hci.cc
index 8eccfc7..e14e3d7 100644
--- a/bluetooth/1.0/default/bluetooth_hci.cc
+++ b/bluetooth/1.0/default/bluetooth_hci.cc
@@ -17,7 +17,7 @@
#define LOG_TAG "android.hardware.bluetooth@1.0-impl"
#include "bluetooth_hci.h"
-#include <utils/Log.h>
+#include <log/log.h>
#include "vendor_interface.h"
diff --git a/bluetooth/1.0/default/hci_protocol.cc b/bluetooth/1.0/default/hci_protocol.cc
index bb1e36b..a208da1 100644
--- a/bluetooth/1.0/default/hci_protocol.cc
+++ b/bluetooth/1.0/default/hci_protocol.cc
@@ -17,10 +17,9 @@
#include "hci_protocol.h"
#define LOG_TAG "android.hardware.bluetooth-hci-hci_protocol"
-#include <android-base/logging.h>
#include <assert.h>
#include <fcntl.h>
-#include <utils/Log.h>
+#include <log/log.h>
namespace android {
namespace hardware {
diff --git a/bluetooth/1.0/default/test/async_fd_watcher_unittest.cc b/bluetooth/1.0/default/test/async_fd_watcher_unittest.cc
index b0c533c..dfc50a3 100644
--- a/bluetooth/1.0/default/test/async_fd_watcher_unittest.cc
+++ b/bluetooth/1.0/default/test/async_fd_watcher_unittest.cc
@@ -22,12 +22,12 @@
#include <cstring>
#include <vector>
+#include <log/log.h>
#include <netdb.h>
#include <netinet/in.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <unistd.h>
-#include <utils/Log.h>
namespace android {
namespace hardware {
diff --git a/bluetooth/1.0/default/test/h4_protocol_unittest.cc b/bluetooth/1.0/default/test/h4_protocol_unittest.cc
index d53aaa9..ad08086 100644
--- a/bluetooth/1.0/default/test/h4_protocol_unittest.cc
+++ b/bluetooth/1.0/default/test/h4_protocol_unittest.cc
@@ -25,10 +25,10 @@
#include <mutex>
#include <vector>
+#include <log/log.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <unistd.h>
-#include <utils/Log.h>
namespace android {
namespace hardware {
diff --git a/bluetooth/1.0/default/test/mct_protocol_unittest.cc b/bluetooth/1.0/default/test/mct_protocol_unittest.cc
index 0a6e9eb..d45058e 100644
--- a/bluetooth/1.0/default/test/mct_protocol_unittest.cc
+++ b/bluetooth/1.0/default/test/mct_protocol_unittest.cc
@@ -25,10 +25,10 @@
#include <mutex>
#include <vector>
+#include <log/log.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <unistd.h>
-#include <utils/Log.h>
namespace android {
namespace hardware {
diff --git a/bluetooth/1.0/default/test/properties.cc b/bluetooth/1.0/default/test/properties.cc
index ad5c194..6ac4fb4 100644
--- a/bluetooth/1.0/default/test/properties.cc
+++ b/bluetooth/1.0/default/test/properties.cc
@@ -23,7 +23,7 @@
#include <unistd.h>
#include <cutils/properties.h>
-#include <utils/Log.h>
+#include <log/log.h>
static const int MAX_PROPERTIES = 5;
diff --git a/boot/1.0/Android.bp b/boot/1.0/Android.bp
index 498c940..c56499a 100644
--- a/boot/1.0/Android.bp
+++ b/boot/1.0/Android.bp
@@ -44,6 +44,7 @@
generated_sources: ["android.hardware.boot@1.0_genc++"],
generated_headers: ["android.hardware.boot@1.0_genc++_headers"],
export_generated_headers: ["android.hardware.boot@1.0_genc++_headers"],
+ vendor_available: true,
shared_libs: [
"libhidlbase",
"libhidltransport",
diff --git a/boot/1.0/Android.mk b/boot/1.0/Android.mk
index b188acb..efd5759 100644
--- a/boot/1.0/Android.mk
+++ b/boot/1.0/Android.mk
@@ -5,7 +5,7 @@
################################################################################
include $(CLEAR_VARS)
-LOCAL_MODULE := android.hardware.boot@1.0-java
+LOCAL_MODULE := android.hardware.boot-V1.0-java
LOCAL_MODULE_CLASS := JAVA_LIBRARIES
intermediates := $(call local-generated-sources-dir, COMMON)
@@ -13,7 +13,7 @@
HIDL := $(HOST_OUT_EXECUTABLES)/hidl-gen$(HOST_EXECUTABLE_SUFFIX)
LOCAL_JAVA_LIBRARIES := \
- android.hidl.base@1.0-java \
+ android.hidl.base-V1.0-java \
#
@@ -80,7 +80,7 @@
################################################################################
include $(CLEAR_VARS)
-LOCAL_MODULE := android.hardware.boot@1.0-java-static
+LOCAL_MODULE := android.hardware.boot-V1.0-java-static
LOCAL_MODULE_CLASS := JAVA_LIBRARIES
intermediates := $(call local-generated-sources-dir, COMMON)
@@ -88,7 +88,7 @@
HIDL := $(HOST_OUT_EXECUTABLES)/hidl-gen$(HOST_EXECUTABLE_SUFFIX)
LOCAL_STATIC_JAVA_LIBRARIES := \
- android.hidl.base@1.0-java-static \
+ android.hidl.base-V1.0-java-static \
#
diff --git a/broadcastradio/1.0/Android.bp b/broadcastradio/1.0/Android.bp
index 5f50748..cbed9f7 100644
--- a/broadcastradio/1.0/Android.bp
+++ b/broadcastradio/1.0/Android.bp
@@ -65,6 +65,7 @@
generated_sources: ["android.hardware.broadcastradio@1.0_genc++"],
generated_headers: ["android.hardware.broadcastradio@1.0_genc++_headers"],
export_generated_headers: ["android.hardware.broadcastradio@1.0_genc++_headers"],
+ vendor_available: true,
shared_libs: [
"libhidlbase",
"libhidltransport",
diff --git a/broadcastradio/1.1/Android.bp b/broadcastradio/1.1/Android.bp
index cc0747a..2c51ca5 100644
--- a/broadcastradio/1.1/Android.bp
+++ b/broadcastradio/1.1/Android.bp
@@ -65,6 +65,7 @@
generated_sources: ["android.hardware.broadcastradio@1.1_genc++"],
generated_headers: ["android.hardware.broadcastradio@1.1_genc++_headers"],
export_generated_headers: ["android.hardware.broadcastradio@1.1_genc++_headers"],
+ vendor_available: true,
shared_libs: [
"libhidlbase",
"libhidltransport",
diff --git a/camera/common/1.0/Android.bp b/camera/common/1.0/Android.bp
index 80b5e54..76f1cf3 100644
--- a/camera/common/1.0/Android.bp
+++ b/camera/common/1.0/Android.bp
@@ -37,6 +37,7 @@
generated_sources: ["android.hardware.camera.common@1.0_genc++"],
generated_headers: ["android.hardware.camera.common@1.0_genc++_headers"],
export_generated_headers: ["android.hardware.camera.common@1.0_genc++_headers"],
+ vendor_available: true,
shared_libs: [
"libhidlbase",
"libhidltransport",
diff --git a/camera/common/1.0/Android.mk b/camera/common/1.0/Android.mk
index 9e05172..47bfb31 100644
--- a/camera/common/1.0/Android.mk
+++ b/camera/common/1.0/Android.mk
@@ -5,7 +5,7 @@
################################################################################
include $(CLEAR_VARS)
-LOCAL_MODULE := android.hardware.camera.common@1.0-java
+LOCAL_MODULE := android.hardware.camera.common-V1.0-java
LOCAL_MODULE_CLASS := JAVA_LIBRARIES
intermediates := $(call local-generated-sources-dir, COMMON)
@@ -188,7 +188,7 @@
################################################################################
include $(CLEAR_VARS)
-LOCAL_MODULE := android.hardware.camera.common@1.0-java-static
+LOCAL_MODULE := android.hardware.camera.common-V1.0-java-static
LOCAL_MODULE_CLASS := JAVA_LIBRARIES
intermediates := $(call local-generated-sources-dir, COMMON)
diff --git a/camera/common/1.0/default/Android.bp b/camera/common/1.0/default/Android.bp
index 6437480..10f9fdb 100644
--- a/camera/common/1.0/default/Android.bp
+++ b/camera/common/1.0/default/Android.bp
@@ -1,5 +1,6 @@
cc_library_static {
name: "android.hardware.camera.common@1.0-helper",
+ vendor: true,
defaults: ["hidl_defaults"],
srcs: [
"CameraModule.cpp",
diff --git a/camera/device/1.0/Android.bp b/camera/device/1.0/Android.bp
index 81e41aa..0b65892 100644
--- a/camera/device/1.0/Android.bp
+++ b/camera/device/1.0/Android.bp
@@ -58,6 +58,7 @@
generated_sources: ["android.hardware.camera.device@1.0_genc++"],
generated_headers: ["android.hardware.camera.device@1.0_genc++_headers"],
export_generated_headers: ["android.hardware.camera.device@1.0_genc++_headers"],
+ vendor_available: true,
shared_libs: [
"libhidlbase",
"libhidltransport",
diff --git a/camera/device/3.2/Android.bp b/camera/device/3.2/Android.bp
index 7807a85..cbfdcff 100644
--- a/camera/device/3.2/Android.bp
+++ b/camera/device/3.2/Android.bp
@@ -58,6 +58,7 @@
generated_sources: ["android.hardware.camera.device@3.2_genc++"],
generated_headers: ["android.hardware.camera.device@3.2_genc++_headers"],
export_generated_headers: ["android.hardware.camera.device@3.2_genc++_headers"],
+ vendor_available: true,
shared_libs: [
"libhidlbase",
"libhidltransport",
diff --git a/camera/device/3.2/ICameraDevice.hal b/camera/device/3.2/ICameraDevice.hal
index 6e66bf3..1f523e4 100644
--- a/camera/device/3.2/ICameraDevice.hal
+++ b/camera/device/3.2/ICameraDevice.hal
@@ -167,7 +167,7 @@
* longer available. This interface is now stale, and a new instance
* must be acquired if the device is reconnected. All subsequent
* calls on this interface must return CAMERA_DISCONNECTED.
- * @return cameraDevice The interface to the newly-opened camera session,
+ * @return session The interface to the newly-opened camera session,
* or null if status is not OK.
*/
open(ICameraDeviceCallback callback) generates
diff --git a/camera/device/3.2/ICameraDeviceSession.hal b/camera/device/3.2/ICameraDeviceSession.hal
index 731fc76..bf56881 100644
--- a/camera/device/3.2/ICameraDeviceSession.hal
+++ b/camera/device/3.2/ICameraDeviceSession.hal
@@ -248,6 +248,21 @@
generates (Status status, uint32_t numRequestProcessed);
/**
+ * getCaptureRequestMetadataQueue:
+ *
+ * Retrieves the queue used along with processCaptureRequest. If
+ * client decides to use fast message queue to pass request metadata,
+ * it must:
+ * - Call getCaptureRequestMetadataQueue to retrieve the fast message queue;
+ * - In each of the requests sent in processCaptureRequest, set
+ * fmqSettingsSize field of CaptureRequest to be the size to read from the
+ * fast message queue; leave settings field of CaptureRequest empty.
+ *
+ * @return queue the queue that client writes request metadata to.
+ */
+ getCaptureRequestMetadataQueue() generates (fmq_sync<uint8_t> queue);
+
+ /**
* flush:
*
* Flush all currently in-process captures and all buffers in the pipeline
diff --git a/camera/device/3.2/default/Android.bp b/camera/device/3.2/default/Android.bp
index e0dc5ff..d95f8f4 100644
--- a/camera/device/3.2/default/Android.bp
+++ b/camera/device/3.2/default/Android.bp
@@ -14,10 +14,14 @@
"android.hardware.camera.provider@2.4",
"liblog",
"libhardware",
- "libcamera_metadata"
+ "libcamera_metadata",
+ "libfmq"
],
static_libs: [
"android.hardware.camera.common@1.0-helper"
],
- export_include_dirs: ["."]
+ export_include_dirs: ["."],
+ export_shared_lib_headers: [
+ "libfmq",
+ ]
}
diff --git a/camera/device/3.2/default/CameraDeviceSession.cpp b/camera/device/3.2/default/CameraDeviceSession.cpp
index 5bb53c7..ebb8fcb 100644
--- a/camera/device/3.2/default/CameraDeviceSession.cpp
+++ b/camera/device/3.2/default/CameraDeviceSession.cpp
@@ -30,6 +30,9 @@
namespace V3_2 {
namespace implementation {
+// Size of request metadata fast message queue. Change to 0 to always use hwbinder buffer.
+static constexpr size_t CAMERA_REQUEST_METADATA_QUEUE_SIZE = 1 << 20 /* 1MB */;
+
HandleImporter& CameraDeviceSession::sHandleImporter = HandleImporter::getInstance();
const int CameraDeviceSession::ResultBatcher::NOT_BATCHED;
@@ -66,6 +69,14 @@
mClosed = true;
return true;
}
+
+ mRequestMetadataQueue = std::make_unique<RequestMetadataQueue>(
+ CAMERA_REQUEST_METADATA_QUEUE_SIZE, false /* non blocking */);
+ if (!mRequestMetadataQueue->isValid()) {
+ ALOGE("%s: invalid fmq", __FUNCTION__);
+ return true;
+ }
+
return false;
}
@@ -699,6 +710,12 @@
}
}
+Return<void> CameraDeviceSession::getCaptureRequestMetadataQueue(
+ getCaptureRequestMetadataQueue_cb _hidl_cb) {
+ _hidl_cb(*mRequestMetadataQueue->getDesc());
+ return Void();
+}
+
Return<void> CameraDeviceSession::processCaptureRequest(
const hidl_vec<CaptureRequest>& requests,
const hidl_vec<BufferCache>& cachesToRemove,
@@ -731,7 +748,24 @@
camera3_capture_request_t halRequest;
halRequest.frame_number = request.frameNumber;
- bool converted = convertFromHidl(request.settings, &halRequest.settings);
+
+ bool converted = true;
+ CameraMetadata settingsFmq; // settings from FMQ
+ if (request.fmqSettingsSize > 0) {
+ // non-blocking read; client must write metadata before calling
+ // processOneCaptureRequest
+ settingsFmq.resize(request.fmqSettingsSize);
+ bool read = mRequestMetadataQueue->read(settingsFmq.data(), request.fmqSettingsSize);
+ if (read) {
+ converted = convertFromHidl(settingsFmq, &halRequest.settings);
+ } else {
+ ALOGE("%s: capture request settings metadata couldn't be read from fmq!", __FUNCTION__);
+ converted = false;
+ }
+ } else {
+ converted = convertFromHidl(request.settings, &halRequest.settings);
+ }
+
if (!converted) {
ALOGE("%s: capture request settings metadata is corrupt!", __FUNCTION__);
return Status::INTERNAL_ERROR;
diff --git a/camera/device/3.2/default/CameraDeviceSession.h b/camera/device/3.2/default/CameraDeviceSession.h
index 781056e..f59f503 100644
--- a/camera/device/3.2/default/CameraDeviceSession.h
+++ b/camera/device/3.2/default/CameraDeviceSession.h
@@ -17,19 +17,20 @@
#ifndef ANDROID_HARDWARE_CAMERA_DEVICE_V3_2_CAMERADEVICE3SESSION_H
#define ANDROID_HARDWARE_CAMERA_DEVICE_V3_2_CAMERADEVICE3SESSION_H
+#include <android/hardware/camera/device/3.2/ICameraDevice.h>
+#include <android/hardware/camera/device/3.2/ICameraDeviceSession.h>
+#include <fmq/MessageQueue.h>
+#include <hidl/MQDescriptor.h>
+#include <hidl/Status.h>
+#include <include/convert.h>
#include <deque>
#include <map>
#include <unordered_map>
-#include "hardware/camera_common.h"
-#include "hardware/camera3.h"
-#include "utils/Mutex.h"
-#include <android/hardware/camera/device/3.2/ICameraDevice.h>
-#include <android/hardware/camera/device/3.2/ICameraDeviceSession.h>
-#include <hidl/Status.h>
-#include <hidl/MQDescriptor.h>
-#include <include/convert.h>
-#include "HandleImporter.h"
#include "CameraMetadata.h"
+#include "HandleImporter.h"
+#include "hardware/camera3.h"
+#include "hardware/camera_common.h"
+#include "utils/Mutex.h"
namespace android {
namespace hardware {
@@ -44,6 +45,9 @@
using ::android::hardware::camera::device::V3_2::ICameraDeviceSession;
using ::android::hardware::camera::common::V1_0::Status;
using ::android::hardware::camera::common::V1_0::helper::HandleImporter;
+using ::android::hardware::kSynchronizedReadWrite;
+using ::android::hardware::MessageQueue;
+using ::android::hardware::MQDescriptorSync;
using ::android::hardware::Return;
using ::android::hardware::Void;
using ::android::hardware::hidl_vec;
@@ -84,6 +88,8 @@
RequestTemplate type, constructDefaultRequestSettings_cb _hidl_cb) override;
Return<void> configureStreams(
const StreamConfiguration& requestedConfiguration, configureStreams_cb _hidl_cb) override;
+ Return<void> getCaptureRequestMetadataQueue(
+ getCaptureRequestMetadataQueue_cb _hidl_cb) override;
Return<void> processCaptureRequest(
const hidl_vec<CaptureRequest>& requests,
const hidl_vec<BufferCache>& cachesToRemove,
@@ -126,6 +132,9 @@
common::V1_0::helper::CameraMetadata mDeviceInfo;
+ using RequestMetadataQueue = MessageQueue<uint8_t, kSynchronizedReadWrite>;
+ std::unique_ptr<RequestMetadataQueue> mRequestMetadataQueue;
+
class ResultBatcher {
public:
ResultBatcher(const sp<ICameraDeviceCallback>& callback);
diff --git a/camera/device/3.2/types.hal b/camera/device/3.2/types.hal
index 1632570..8e433f6 100644
--- a/camera/device/3.2/types.hal
+++ b/camera/device/3.2/types.hal
@@ -753,11 +753,22 @@
uint32_t frameNumber;
/**
- * The settings buffer contains the capture and processing parameters for
+ * If non-zero, read settings from request queue instead
+ * (see ICameraDeviceSession.getCaptureRequestMetadataQueue).
+ * If zero, read settings from .settings field.
+ */
+ uint64_t fmqSettingsSize;
+
+ /**
+ * If fmqSettingsSize is zero,
+ * the settings buffer contains the capture and processing parameters for
* the request. As a special case, an empty settings buffer indicates that
* the settings are identical to the most-recently submitted capture
* request. A empty buffer cannot be used as the first submitted request
* after a configureStreams() call.
+ *
+ * This field must be used if fmqSettingsSize is zero. It must not be used
+ * if fmqSettingsSize is non-zero.
*/
CameraMetadata settings;
diff --git a/camera/metadata/3.2/Android.bp b/camera/metadata/3.2/Android.bp
index d6bb9a3..0534b9c 100644
--- a/camera/metadata/3.2/Android.bp
+++ b/camera/metadata/3.2/Android.bp
@@ -37,6 +37,7 @@
generated_sources: ["android.hardware.camera.metadata@3.2_genc++"],
generated_headers: ["android.hardware.camera.metadata@3.2_genc++_headers"],
export_generated_headers: ["android.hardware.camera.metadata@3.2_genc++_headers"],
+ vendor_available: true,
shared_libs: [
"libhidlbase",
"libhidltransport",
diff --git a/camera/metadata/3.2/Android.mk b/camera/metadata/3.2/Android.mk
index 86cee91..935c37c 100644
--- a/camera/metadata/3.2/Android.mk
+++ b/camera/metadata/3.2/Android.mk
@@ -5,7 +5,7 @@
################################################################################
include $(CLEAR_VARS)
-LOCAL_MODULE := android.hardware.camera.metadata@3.2-java
+LOCAL_MODULE := android.hardware.camera.metadata-V3.2-java
LOCAL_MODULE_CLASS := JAVA_LIBRARIES
intermediates := $(call local-generated-sources-dir, COMMON)
@@ -1233,7 +1233,7 @@
################################################################################
include $(CLEAR_VARS)
-LOCAL_MODULE := android.hardware.camera.metadata@3.2-java-static
+LOCAL_MODULE := android.hardware.camera.metadata-V3.2-java-static
LOCAL_MODULE_CLASS := JAVA_LIBRARIES
intermediates := $(call local-generated-sources-dir, COMMON)
diff --git a/camera/provider/2.4/Android.bp b/camera/provider/2.4/Android.bp
index d295f3e..02e02eb 100644
--- a/camera/provider/2.4/Android.bp
+++ b/camera/provider/2.4/Android.bp
@@ -47,6 +47,7 @@
generated_sources: ["android.hardware.camera.provider@2.4_genc++"],
generated_headers: ["android.hardware.camera.provider@2.4_genc++_headers"],
export_generated_headers: ["android.hardware.camera.provider@2.4_genc++_headers"],
+ vendor_available: true,
shared_libs: [
"libhidlbase",
"libhidltransport",
diff --git a/camera/provider/2.4/default/Android.bp b/camera/provider/2.4/default/Android.bp
index 9506827..8e8df62 100644
--- a/camera/provider/2.4/default/Android.bp
+++ b/camera/provider/2.4/default/Android.bp
@@ -37,6 +37,7 @@
shared_libs: [
"libhidlbase",
"libhidltransport",
+ "libbinder",
"liblog",
"libutils",
"android.hardware.camera.device@1.0",
diff --git a/camera/provider/2.4/default/service.cpp b/camera/provider/2.4/default/service.cpp
index df2602e..7eeb637 100644
--- a/camera/provider/2.4/default/service.cpp
+++ b/camera/provider/2.4/default/service.cpp
@@ -19,11 +19,16 @@
#include <android/hardware/camera/provider/2.4/ICameraProvider.h>
#include <hidl/LegacySupport.h>
+#include <binder/ProcessState.h>
+
using android::hardware::camera::provider::V2_4::ICameraProvider;
using android::hardware::defaultPassthroughServiceImplementation;
int main()
{
ALOGI("Camera provider Service is starting.");
+ // The camera HAL may communicate to other vendor components via
+ // /dev/vndbinder
+ android::ProcessState::initWithDriver("/dev/vndbinder");
return defaultPassthroughServiceImplementation<ICameraProvider>("legacy/0", /*maxThreads*/ 6);
}
diff --git a/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp b/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp
index e37f989..b7ce858 100644
--- a/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp
+++ b/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp
@@ -2493,7 +2493,7 @@
outputBuffer};
StreamBuffer emptyInputBuffer = {-1, 0, nullptr,
BufferStatus::ERROR, nullptr, nullptr};
- CaptureRequest request = {frameNumber, settings,
+ CaptureRequest request = {frameNumber, 0 /* fmqSettingsSize */, settings,
emptyInputBuffer, outputBuffers};
{
@@ -2599,7 +2599,7 @@
outputBuffer};
StreamBuffer emptyInputBuffer = {-1, 0, nullptr,
BufferStatus::ERROR, nullptr, nullptr};
- CaptureRequest request = {frameNumber, settings,
+ CaptureRequest request = {frameNumber, 0 /* fmqSettingsSize */, settings,
emptyInputBuffer, outputBuffers};
//Settings were not correctly initialized, we should fail here
@@ -2654,7 +2654,7 @@
::android::hardware::hidl_vec<StreamBuffer> emptyOutputBuffers;
StreamBuffer emptyInputBuffer = {-1, 0, nullptr,
BufferStatus::ERROR, nullptr, nullptr};
- CaptureRequest request = {frameNumber, settings,
+ CaptureRequest request = {frameNumber, 0/* fmqSettingsSize */, settings,
emptyInputBuffer, emptyOutputBuffers};
//Output buffers are missing, we should fail here
@@ -2719,7 +2719,7 @@
outputBuffer};
const StreamBuffer emptyInputBuffer = {-1, 0, nullptr,
BufferStatus::ERROR, nullptr, nullptr};
- CaptureRequest request = {frameNumber, settings,
+ CaptureRequest request = {frameNumber, 0 /* fmqSettingsSize */, settings,
emptyInputBuffer, outputBuffers};
{
diff --git a/configstore/1.0/Android.bp b/configstore/1.0/Android.bp
index 712e9a7..bd203cc 100644
--- a/configstore/1.0/Android.bp
+++ b/configstore/1.0/Android.bp
@@ -44,6 +44,7 @@
generated_sources: ["android.hardware.configstore@1.0_genc++"],
generated_headers: ["android.hardware.configstore@1.0_genc++_headers"],
export_generated_headers: ["android.hardware.configstore@1.0_genc++_headers"],
+ vendor_available: true,
shared_libs: [
"libhidlbase",
"libhidltransport",
diff --git a/configstore/1.0/Android.mk b/configstore/1.0/Android.mk
index 010d509..6be99db 100644
--- a/configstore/1.0/Android.mk
+++ b/configstore/1.0/Android.mk
@@ -5,7 +5,7 @@
################################################################################
include $(CLEAR_VARS)
-LOCAL_MODULE := android.hardware.configstore@1.0-java
+LOCAL_MODULE := android.hardware.configstore-V1.0-java
LOCAL_MODULE_CLASS := JAVA_LIBRARIES
intermediates := $(call local-generated-sources-dir, COMMON)
@@ -13,7 +13,7 @@
HIDL := $(HOST_OUT_EXECUTABLES)/hidl-gen$(HOST_EXECUTABLE_SUFFIX)
LOCAL_JAVA_LIBRARIES := \
- android.hidl.base@1.0-java \
+ android.hidl.base-V1.0-java \
#
@@ -156,7 +156,7 @@
################################################################################
include $(CLEAR_VARS)
-LOCAL_MODULE := android.hardware.configstore@1.0-java-static
+LOCAL_MODULE := android.hardware.configstore-V1.0-java-static
LOCAL_MODULE_CLASS := JAVA_LIBRARIES
intermediates := $(call local-generated-sources-dir, COMMON)
@@ -164,7 +164,7 @@
HIDL := $(HOST_OUT_EXECUTABLES)/hidl-gen$(HOST_EXECUTABLE_SUFFIX)
LOCAL_STATIC_JAVA_LIBRARIES := \
- android.hidl.base@1.0-java-static \
+ android.hidl.base-V1.0-java-static \
#
diff --git a/configstore/1.0/ISurfaceFlingerConfigs.hal b/configstore/1.0/ISurfaceFlingerConfigs.hal
index dcc9bbb..5f975bd 100644
--- a/configstore/1.0/ISurfaceFlingerConfigs.hal
+++ b/configstore/1.0/ISurfaceFlingerConfigs.hal
@@ -108,4 +108,10 @@
* FramebufferSurface.
*/
maxFrameBufferAcquiredBuffers() generates(OptionalInt64 value);
+
+ /**
+ * Returns true if surface flinger should start
+ * hardware.graphics.allocator@2.0::IAllocator service.
+ */
+ startGraphicsAllocatorService() generates(OptionalBool value);
};
diff --git a/configstore/1.0/default/SurfaceFlingerConfigs.cpp b/configstore/1.0/default/SurfaceFlingerConfigs.cpp
index 70bd803..9c134ef 100644
--- a/configstore/1.0/default/SurfaceFlingerConfigs.cpp
+++ b/configstore/1.0/default/SurfaceFlingerConfigs.cpp
@@ -112,6 +112,16 @@
return Void();
}
+Return<void> SurfaceFlingerConfigs::startGraphicsAllocatorService(
+ startGraphicsAllocatorService_cb _hidl_cb) {
+ bool value = false;
+#ifdef START_GRAPHICS_ALLOCATOR_SERVICE
+ value = true;
+#endif
+ _hidl_cb({true, value});
+ return Void();
+}
+
} // namespace implementation
} // namespace V1_0
} // namespace configstore
diff --git a/configstore/1.0/default/SurfaceFlingerConfigs.h b/configstore/1.0/default/SurfaceFlingerConfigs.h
index 9300511..17a424e 100644
--- a/configstore/1.0/default/SurfaceFlingerConfigs.h
+++ b/configstore/1.0/default/SurfaceFlingerConfigs.h
@@ -35,6 +35,8 @@
Return<void> hasSyncFramework(hasSyncFramework_cb _hidl_cb) override;
Return<void> useVrFlinger(useVrFlinger_cb _hidl_cb) override;
Return<void> maxFrameBufferAcquiredBuffers(maxFrameBufferAcquiredBuffers_cb _hidl_cb) override;
+ Return<void> startGraphicsAllocatorService(
+ startGraphicsAllocatorService_cb _hidl_cb) override;
// Methods from ::android::hidl::base::V1_0::IBase follow.
diff --git a/configstore/1.0/default/surfaceflinger.mk b/configstore/1.0/default/surfaceflinger.mk
index 9e3d4d4..3ce768a 100644
--- a/configstore/1.0/default/surfaceflinger.mk
+++ b/configstore/1.0/default/surfaceflinger.mk
@@ -50,3 +50,7 @@
ifneq ($(NUM_FRAMEBUFFER_SURFACE_BUFFERS),)
LOCAL_CFLAGS += -DNUM_FRAMEBUFFER_SURFACE_BUFFERS=$(NUM_FRAMEBUFFER_SURFACE_BUFFERS)
endif
+
+ifneq ($(SF_START_GRAPHICS_ALLOCATOR_SERVICE),)
+ LOCAL_CFLAGS += -DSTART_GRAPHICS_ALLOCATOR_SERVICE
+endif
diff --git a/contexthub/1.0/Android.bp b/contexthub/1.0/Android.bp
index 2bf951a..a4c7175 100644
--- a/contexthub/1.0/Android.bp
+++ b/contexthub/1.0/Android.bp
@@ -51,6 +51,7 @@
generated_sources: ["android.hardware.contexthub@1.0_genc++"],
generated_headers: ["android.hardware.contexthub@1.0_genc++_headers"],
export_generated_headers: ["android.hardware.contexthub@1.0_genc++_headers"],
+ vendor_available: true,
shared_libs: [
"libhidlbase",
"libhidltransport",
diff --git a/contexthub/1.0/Android.mk b/contexthub/1.0/Android.mk
index a053986..d161e3b 100644
--- a/contexthub/1.0/Android.mk
+++ b/contexthub/1.0/Android.mk
@@ -5,7 +5,7 @@
################################################################################
include $(CLEAR_VARS)
-LOCAL_MODULE := android.hardware.contexthub@1.0-java
+LOCAL_MODULE := android.hardware.contexthub-V1.0-java
LOCAL_MODULE_CLASS := JAVA_LIBRARIES
intermediates := $(call local-generated-sources-dir, COMMON)
@@ -13,7 +13,7 @@
HIDL := $(HOST_OUT_EXECUTABLES)/hidl-gen$(HOST_EXECUTABLE_SUFFIX)
LOCAL_JAVA_LIBRARIES := \
- android.hidl.base@1.0-java \
+ android.hidl.base-V1.0-java \
#
@@ -331,7 +331,7 @@
################################################################################
include $(CLEAR_VARS)
-LOCAL_MODULE := android.hardware.contexthub@1.0-java-static
+LOCAL_MODULE := android.hardware.contexthub-V1.0-java-static
LOCAL_MODULE_CLASS := JAVA_LIBRARIES
intermediates := $(call local-generated-sources-dir, COMMON)
@@ -339,7 +339,7 @@
HIDL := $(HOST_OUT_EXECUTABLES)/hidl-gen$(HOST_EXECUTABLE_SUFFIX)
LOCAL_STATIC_JAVA_LIBRARIES := \
- android.hidl.base@1.0-java-static \
+ android.hidl.base-V1.0-java-static \
#
diff --git a/drm/1.0/Android.bp b/drm/1.0/Android.bp
index 9fddaa8..0ca4766 100644
--- a/drm/1.0/Android.bp
+++ b/drm/1.0/Android.bp
@@ -72,6 +72,7 @@
generated_sources: ["android.hardware.drm@1.0_genc++"],
generated_headers: ["android.hardware.drm@1.0_genc++_headers"],
export_generated_headers: ["android.hardware.drm@1.0_genc++_headers"],
+ vendor_available: true,
shared_libs: [
"libhidlbase",
"libhidltransport",
diff --git a/drm/1.0/default/service.cpp b/drm/1.0/default/service.cpp
index a112aaf..823f39e 100644
--- a/drm/1.0/default/service.cpp
+++ b/drm/1.0/default/service.cpp
@@ -32,11 +32,11 @@
ALOGD("android.hardware.drm@1.0-service starting...");
configureRpcThreadpool(8, true /* callerWillJoin */);
android::status_t status =
- registerPassthroughServiceImplementation<IDrmFactory>("drm");
+ registerPassthroughServiceImplementation<IDrmFactory>();
LOG_ALWAYS_FATAL_IF(
status != android::OK,
"Error while registering drm service: %d", status);
- status = registerPassthroughServiceImplementation<ICryptoFactory>("crypto");
+ status = registerPassthroughServiceImplementation<ICryptoFactory>();
LOG_ALWAYS_FATAL_IF(
status != android::OK,
"Error while registering crypto service: %d", status);
diff --git a/drm/1.0/vts/functional/drm_hal_clearkey_test.cpp b/drm/1.0/vts/functional/drm_hal_clearkey_test.cpp
index e97ac10..4dd98ce 100644
--- a/drm/1.0/vts/functional/drm_hal_clearkey_test.cpp
+++ b/drm/1.0/vts/functional/drm_hal_clearkey_test.cpp
@@ -94,12 +94,10 @@
test_info->name());
drmFactory =
- ::testing::VtsHalHidlTargetTestBase::getService<IDrmFactory>(
- "drm");
+ ::testing::VtsHalHidlTargetTestBase::getService<IDrmFactory>();
ASSERT_NE(drmFactory, nullptr);
cryptoFactory =
- ::testing::VtsHalHidlTargetTestBase::getService<ICryptoFactory>(
- "crypto");
+ ::testing::VtsHalHidlTargetTestBase::getService<ICryptoFactory>();
ASSERT_NE(cryptoFactory, nullptr);
}
diff --git a/drm/1.0/vts/functional/drm_hal_vendor_test.cpp b/drm/1.0/vts/functional/drm_hal_vendor_test.cpp
index 5945c05..fec43cf 100644
--- a/drm/1.0/vts/functional/drm_hal_vendor_test.cpp
+++ b/drm/1.0/vts/functional/drm_hal_vendor_test.cpp
@@ -114,14 +114,14 @@
string name = vendorModule->getServiceName();
drmFactory = VtsTestBase::getService<IDrmFactory>(name);
if (drmFactory == nullptr) {
- drmFactory = VtsTestBase::getService<IDrmFactory>("drm");
+ drmFactory = VtsTestBase::getService<IDrmFactory>();
}
ASSERT_NE(drmFactory, nullptr);
- // Dot the same for the crypto factory
+ // Do the same for the crypto factory
cryptoFactory = VtsTestBase::getService<ICryptoFactory>(name);
if (cryptoFactory == nullptr) {
- VtsTestBase::getService<ICryptoFactory>("crypto");
+ VtsTestBase::getService<ICryptoFactory>();
}
ASSERT_NE(cryptoFactory, nullptr);
}
@@ -953,6 +953,7 @@
EXPECT_TRUE(result.args);
EXPECT_EQ(sessionId, result.args->sessionId);
EXPECT_EQ(keyStatusList, result.args->keyStatusList);
+ closeSession(sessionId);
}
/**
@@ -1429,7 +1430,7 @@
uint32_t byteCount = decrypt(Mode::AES_CTR, key.isSecure,
toHidlArray(key.keyId), &iv[0], subSamples, noPattern,
- key.clearContentKey, Status::ERROR_DRM_DECRYPT);
+ key.clearContentKey, Status::ERROR_DRM_NO_LICENSE);
EXPECT_EQ(0u, byteCount);
closeSession(sessionId);
diff --git a/dumpstate/1.0/Android.bp b/dumpstate/1.0/Android.bp
index 1b473bc..df028b49 100644
--- a/dumpstate/1.0/Android.bp
+++ b/dumpstate/1.0/Android.bp
@@ -40,6 +40,7 @@
generated_sources: ["android.hardware.dumpstate@1.0_genc++"],
generated_headers: ["android.hardware.dumpstate@1.0_genc++_headers"],
export_generated_headers: ["android.hardware.dumpstate@1.0_genc++_headers"],
+ vendor_available: true,
shared_libs: [
"libhidlbase",
"libhidltransport",
diff --git a/gatekeeper/1.0/Android.bp b/gatekeeper/1.0/Android.bp
index 56e19db..eddf0e5 100644
--- a/gatekeeper/1.0/Android.bp
+++ b/gatekeeper/1.0/Android.bp
@@ -44,6 +44,7 @@
generated_sources: ["android.hardware.gatekeeper@1.0_genc++"],
generated_headers: ["android.hardware.gatekeeper@1.0_genc++_headers"],
export_generated_headers: ["android.hardware.gatekeeper@1.0_genc++_headers"],
+ vendor_available: true,
shared_libs: [
"libhidlbase",
"libhidltransport",
diff --git a/gatekeeper/1.0/Android.mk b/gatekeeper/1.0/Android.mk
index 70206ff..576f729 100644
--- a/gatekeeper/1.0/Android.mk
+++ b/gatekeeper/1.0/Android.mk
@@ -5,7 +5,7 @@
################################################################################
include $(CLEAR_VARS)
-LOCAL_MODULE := android.hardware.gatekeeper@1.0-java
+LOCAL_MODULE := android.hardware.gatekeeper-V1.0-java
LOCAL_MODULE_CLASS := JAVA_LIBRARIES
intermediates := $(call local-generated-sources-dir, COMMON)
@@ -13,7 +13,7 @@
HIDL := $(HOST_OUT_EXECUTABLES)/hidl-gen$(HOST_EXECUTABLE_SUFFIX)
LOCAL_JAVA_LIBRARIES := \
- android.hidl.base@1.0-java \
+ android.hidl.base-V1.0-java \
#
@@ -80,7 +80,7 @@
################################################################################
include $(CLEAR_VARS)
-LOCAL_MODULE := android.hardware.gatekeeper@1.0-java-static
+LOCAL_MODULE := android.hardware.gatekeeper-V1.0-java-static
LOCAL_MODULE_CLASS := JAVA_LIBRARIES
intermediates := $(call local-generated-sources-dir, COMMON)
@@ -88,7 +88,7 @@
HIDL := $(HOST_OUT_EXECUTABLES)/hidl-gen$(HOST_EXECUTABLE_SUFFIX)
LOCAL_STATIC_JAVA_LIBRARIES := \
- android.hidl.base@1.0-java-static \
+ android.hidl.base-V1.0-java-static \
#
diff --git a/gnss/1.0/Android.bp b/gnss/1.0/Android.bp
index ed6659d..42f35b8 100644
--- a/gnss/1.0/Android.bp
+++ b/gnss/1.0/Android.bp
@@ -177,6 +177,7 @@
generated_sources: ["android.hardware.gnss@1.0_genc++"],
generated_headers: ["android.hardware.gnss@1.0_genc++_headers"],
export_generated_headers: ["android.hardware.gnss@1.0_genc++_headers"],
+ vendor_available: true,
shared_libs: [
"libhidlbase",
"libhidltransport",
diff --git a/gnss/1.0/Android.mk b/gnss/1.0/Android.mk
index 5985c87..bb1b765 100644
--- a/gnss/1.0/Android.mk
+++ b/gnss/1.0/Android.mk
@@ -5,7 +5,7 @@
################################################################################
include $(CLEAR_VARS)
-LOCAL_MODULE := android.hardware.gnss@1.0-java
+LOCAL_MODULE := android.hardware.gnss-V1.0-java
LOCAL_MODULE_CLASS := JAVA_LIBRARIES
intermediates := $(call local-generated-sources-dir, COMMON)
@@ -13,7 +13,7 @@
HIDL := $(HOST_OUT_EXECUTABLES)/hidl-gen$(HOST_EXECUTABLE_SUFFIX)
LOCAL_JAVA_LIBRARIES := \
- android.hidl.base@1.0-java \
+ android.hidl.base-V1.0-java \
#
@@ -527,7 +527,7 @@
################################################################################
include $(CLEAR_VARS)
-LOCAL_MODULE := android.hardware.gnss@1.0-java-static
+LOCAL_MODULE := android.hardware.gnss-V1.0-java-static
LOCAL_MODULE_CLASS := JAVA_LIBRARIES
intermediates := $(call local-generated-sources-dir, COMMON)
@@ -535,7 +535,7 @@
HIDL := $(HOST_OUT_EXECUTABLES)/hidl-gen$(HOST_EXECUTABLE_SUFFIX)
LOCAL_STATIC_JAVA_LIBRARIES := \
- android.hidl.base@1.0-java-static \
+ android.hidl.base-V1.0-java-static \
#
@@ -1049,7 +1049,7 @@
################################################################################
include $(CLEAR_VARS)
-LOCAL_MODULE := android.hardware.gnss@1.0-java-constants
+LOCAL_MODULE := android.hardware.gnss-V1.0-java-constants
LOCAL_MODULE_CLASS := JAVA_LIBRARIES
intermediates := $(call local-generated-sources-dir, COMMON)
diff --git a/graphics/allocator/2.0/Android.bp b/graphics/allocator/2.0/Android.bp
index f707468..77a3f70 100644
--- a/graphics/allocator/2.0/Android.bp
+++ b/graphics/allocator/2.0/Android.bp
@@ -40,6 +40,7 @@
generated_sources: ["android.hardware.graphics.allocator@2.0_genc++"],
generated_headers: ["android.hardware.graphics.allocator@2.0_genc++_headers"],
export_generated_headers: ["android.hardware.graphics.allocator@2.0_genc++_headers"],
+ vendor_available: true,
shared_libs: [
"libhidlbase",
"libhidltransport",
diff --git a/graphics/allocator/2.0/default/Android.bp b/graphics/allocator/2.0/default/Android.bp
index 6adfa71..4a7cfe0 100644
--- a/graphics/allocator/2.0/default/Android.bp
+++ b/graphics/allocator/2.0/default/Android.bp
@@ -15,7 +15,9 @@
"liblog",
"libutils",
],
- static_libs: ["libgrallocmapperincludes"],
+ header_libs: [
+ "libgrallocmapperincludes",
+ ],
}
cc_binary {
diff --git a/graphics/bufferqueue/1.0/Android.bp b/graphics/bufferqueue/1.0/Android.bp
index 4ba764f..e7adee6 100644
--- a/graphics/bufferqueue/1.0/Android.bp
+++ b/graphics/bufferqueue/1.0/Android.bp
@@ -47,6 +47,7 @@
generated_sources: ["android.hardware.graphics.bufferqueue@1.0_genc++"],
generated_headers: ["android.hardware.graphics.bufferqueue@1.0_genc++_headers"],
export_generated_headers: ["android.hardware.graphics.bufferqueue@1.0_genc++_headers"],
+ vendor_available: true,
shared_libs: [
"libhidlbase",
"libhidltransport",
diff --git a/graphics/common/1.0/Android.bp b/graphics/common/1.0/Android.bp
index 25995cd..69c8844 100644
--- a/graphics/common/1.0/Android.bp
+++ b/graphics/common/1.0/Android.bp
@@ -37,6 +37,7 @@
generated_sources: ["android.hardware.graphics.common@1.0_genc++"],
generated_headers: ["android.hardware.graphics.common@1.0_genc++_headers"],
export_generated_headers: ["android.hardware.graphics.common@1.0_genc++_headers"],
+ vendor_available: true,
shared_libs: [
"libhidlbase",
"libhidltransport",
diff --git a/graphics/common/1.0/Android.mk b/graphics/common/1.0/Android.mk
index ae80c6a..569a5f4 100644
--- a/graphics/common/1.0/Android.mk
+++ b/graphics/common/1.0/Android.mk
@@ -5,7 +5,7 @@
################################################################################
include $(CLEAR_VARS)
-LOCAL_MODULE := android.hardware.graphics.common@1.0-java
+LOCAL_MODULE := android.hardware.graphics.common-V1.0-java
LOCAL_MODULE_CLASS := JAVA_LIBRARIES
intermediates := $(call local-generated-sources-dir, COMMON)
@@ -150,7 +150,7 @@
################################################################################
include $(CLEAR_VARS)
-LOCAL_MODULE := android.hardware.graphics.common@1.0-java-static
+LOCAL_MODULE := android.hardware.graphics.common-V1.0-java-static
LOCAL_MODULE_CLASS := JAVA_LIBRARIES
intermediates := $(call local-generated-sources-dir, COMMON)
@@ -295,7 +295,7 @@
################################################################################
include $(CLEAR_VARS)
-LOCAL_MODULE := android.hardware.graphics.common@1.0-java-constants
+LOCAL_MODULE := android.hardware.graphics.common-V1.0-java-constants
LOCAL_MODULE_CLASS := JAVA_LIBRARIES
intermediates := $(call local-generated-sources-dir, COMMON)
diff --git a/graphics/composer/2.1/Android.bp b/graphics/composer/2.1/Android.bp
index f5ab965..a3d76d5 100644
--- a/graphics/composer/2.1/Android.bp
+++ b/graphics/composer/2.1/Android.bp
@@ -58,6 +58,7 @@
generated_sources: ["android.hardware.graphics.composer@2.1_genc++"],
generated_headers: ["android.hardware.graphics.composer@2.1_genc++_headers"],
export_generated_headers: ["android.hardware.graphics.composer@2.1_genc++_headers"],
+ vendor_available: true,
shared_libs: [
"libhidlbase",
"libhidltransport",
diff --git a/graphics/composer/2.1/IComposer.hal b/graphics/composer/2.1/IComposer.hal
index b3ac761..e2aa5cd 100644
--- a/graphics/composer/2.1/IComposer.hal
+++ b/graphics/composer/2.1/IComposer.hal
@@ -44,6 +44,12 @@
* applying the color transform during its composition step.
*/
SKIP_CLIENT_COLOR_TRANSFORM = 2,
+
+ /**
+ * Specifies that the present fence must not be used as an accurate
+ * representation of the actual present time of a frame.
+ */
+ PRESENT_FENCE_IS_NOT_RELIABLE = 3,
};
/**
diff --git a/graphics/composer/2.1/default/Android.bp b/graphics/composer/2.1/default/Android.bp
index 0367fcd..fb75beb 100644
--- a/graphics/composer/2.1/default/Android.bp
+++ b/graphics/composer/2.1/default/Android.bp
@@ -1,5 +1,6 @@
cc_library_static {
name: "libhwcomposer-client",
+ vendor_available: true,
defaults: ["hidl_defaults"],
export_include_dirs: ["."],
srcs: ["ComposerClient.cpp"],
diff --git a/graphics/composer/2.1/default/Hwc.cpp b/graphics/composer/2.1/default/Hwc.cpp
index 1497065..8ca0eb3 100644
--- a/graphics/composer/2.1/default/Hwc.cpp
+++ b/graphics/composer/2.1/default/Hwc.cpp
@@ -65,6 +65,12 @@
}
initCapabilities();
+ if (majorVersion >= 2 &&
+ hasCapability(Capability::PRESENT_FENCE_IS_NOT_RELIABLE)) {
+ ALOGE("Present fence must be reliable from HWC2 on.");
+ abort();
+ }
+
initDispatch();
}
diff --git a/graphics/composer/2.1/default/service.cpp b/graphics/composer/2.1/default/service.cpp
index 712dac1..aa0604a 100644
--- a/graphics/composer/2.1/default/service.cpp
+++ b/graphics/composer/2.1/default/service.cpp
@@ -28,6 +28,7 @@
int main() {
// the conventional HAL might start binder services
+ android::ProcessState::initWithDriver("/dev/vndbinder");
android::ProcessState::self()->setThreadPoolMaxThreadCount(4);
android::ProcessState::self()->startThreadPool();
diff --git a/graphics/mapper/2.0/Android.bp b/graphics/mapper/2.0/Android.bp
index cc2bd73..b95c54d 100644
--- a/graphics/mapper/2.0/Android.bp
+++ b/graphics/mapper/2.0/Android.bp
@@ -44,6 +44,7 @@
generated_sources: ["android.hardware.graphics.mapper@2.0_genc++"],
generated_headers: ["android.hardware.graphics.mapper@2.0_genc++_headers"],
export_generated_headers: ["android.hardware.graphics.mapper@2.0_genc++_headers"],
+ vendor_available: true,
shared_libs: [
"libhidlbase",
"libhidltransport",
diff --git a/graphics/mapper/2.0/default/Android.bp b/graphics/mapper/2.0/default/Android.bp
index 090c61f..677d966 100644
--- a/graphics/mapper/2.0/default/Android.bp
+++ b/graphics/mapper/2.0/default/Android.bp
@@ -16,7 +16,7 @@
cc_library_shared {
name: "android.hardware.graphics.mapper@2.0-impl",
defaults: ["hidl_defaults"],
- proprietary: true,
+ vendor: true,
relative_install_path: "hw",
srcs: ["GrallocMapper.cpp", "Gralloc0Mapper.cpp", "Gralloc1Mapper.cpp"],
cppflags: ["-Wall", "-Wextra"],
@@ -33,7 +33,8 @@
],
}
-cc_library_static {
+cc_library_headers {
name: "libgrallocmapperincludes",
+ vendor: true,
export_include_dirs: ["."],
}
diff --git a/health/1.0/Android.bp b/health/1.0/Android.bp
index 61f464d..16ee7e9 100644
--- a/health/1.0/Android.bp
+++ b/health/1.0/Android.bp
@@ -44,6 +44,7 @@
generated_sources: ["android.hardware.health@1.0_genc++"],
generated_headers: ["android.hardware.health@1.0_genc++_headers"],
export_generated_headers: ["android.hardware.health@1.0_genc++_headers"],
+ vendor_available: true,
shared_libs: [
"libhidlbase",
"libhidltransport",
diff --git a/health/1.0/Android.mk b/health/1.0/Android.mk
index ebb89a7..b03b868 100644
--- a/health/1.0/Android.mk
+++ b/health/1.0/Android.mk
@@ -5,7 +5,7 @@
################################################################################
include $(CLEAR_VARS)
-LOCAL_MODULE := android.hardware.health@1.0-java
+LOCAL_MODULE := android.hardware.health-V1.0-java
LOCAL_MODULE_CLASS := JAVA_LIBRARIES
intermediates := $(call local-generated-sources-dir, COMMON)
@@ -13,7 +13,7 @@
HIDL := $(HOST_OUT_EXECUTABLES)/hidl-gen$(HOST_EXECUTABLE_SUFFIX)
LOCAL_JAVA_LIBRARIES := \
- android.hidl.base@1.0-java \
+ android.hidl.base-V1.0-java \
#
@@ -137,7 +137,7 @@
################################################################################
include $(CLEAR_VARS)
-LOCAL_MODULE := android.hardware.health@1.0-java-static
+LOCAL_MODULE := android.hardware.health-V1.0-java-static
LOCAL_MODULE_CLASS := JAVA_LIBRARIES
intermediates := $(call local-generated-sources-dir, COMMON)
@@ -145,7 +145,7 @@
HIDL := $(HOST_OUT_EXECUTABLES)/hidl-gen$(HOST_EXECUTABLE_SUFFIX)
LOCAL_STATIC_JAVA_LIBRARIES := \
- android.hidl.base@1.0-java-static \
+ android.hidl.base-V1.0-java-static \
#
@@ -269,7 +269,7 @@
################################################################################
include $(CLEAR_VARS)
-LOCAL_MODULE := android.hardware.health@1.0-java-constants
+LOCAL_MODULE := android.hardware.health-V1.0-java-constants
LOCAL_MODULE_CLASS := JAVA_LIBRARIES
intermediates := $(call local-generated-sources-dir, COMMON)
diff --git a/ir/1.0/Android.bp b/ir/1.0/Android.bp
index 5bff1d3..6f52736 100644
--- a/ir/1.0/Android.bp
+++ b/ir/1.0/Android.bp
@@ -44,6 +44,7 @@
generated_sources: ["android.hardware.ir@1.0_genc++"],
generated_headers: ["android.hardware.ir@1.0_genc++_headers"],
export_generated_headers: ["android.hardware.ir@1.0_genc++_headers"],
+ vendor_available: true,
shared_libs: [
"libhidlbase",
"libhidltransport",
diff --git a/ir/1.0/Android.mk b/ir/1.0/Android.mk
index d43286c..bdb3b29 100644
--- a/ir/1.0/Android.mk
+++ b/ir/1.0/Android.mk
@@ -5,7 +5,7 @@
################################################################################
include $(CLEAR_VARS)
-LOCAL_MODULE := android.hardware.ir@1.0-java
+LOCAL_MODULE := android.hardware.ir-V1.0-java
LOCAL_MODULE_CLASS := JAVA_LIBRARIES
intermediates := $(call local-generated-sources-dir, COMMON)
@@ -13,7 +13,7 @@
HIDL := $(HOST_OUT_EXECUTABLES)/hidl-gen$(HOST_EXECUTABLE_SUFFIX)
LOCAL_JAVA_LIBRARIES := \
- android.hidl.base@1.0-java \
+ android.hidl.base-V1.0-java \
#
@@ -61,7 +61,7 @@
################################################################################
include $(CLEAR_VARS)
-LOCAL_MODULE := android.hardware.ir@1.0-java-static
+LOCAL_MODULE := android.hardware.ir-V1.0-java-static
LOCAL_MODULE_CLASS := JAVA_LIBRARIES
intermediates := $(call local-generated-sources-dir, COMMON)
@@ -69,7 +69,7 @@
HIDL := $(HOST_OUT_EXECUTABLES)/hidl-gen$(HOST_EXECUTABLE_SUFFIX)
LOCAL_STATIC_JAVA_LIBRARIES := \
- android.hidl.base@1.0-java-static \
+ android.hidl.base-V1.0-java-static \
#
diff --git a/keymaster/3.0/Android.bp b/keymaster/3.0/Android.bp
index 2b0899d..0afee99 100644
--- a/keymaster/3.0/Android.bp
+++ b/keymaster/3.0/Android.bp
@@ -44,6 +44,7 @@
generated_sources: ["android.hardware.keymaster@3.0_genc++"],
generated_headers: ["android.hardware.keymaster@3.0_genc++_headers"],
export_generated_headers: ["android.hardware.keymaster@3.0_genc++_headers"],
+ vendor_available: true,
shared_libs: [
"libhidlbase",
"libhidltransport",
diff --git a/light/2.0/Android.bp b/light/2.0/Android.bp
index b43b7b3..b830ef0 100644
--- a/light/2.0/Android.bp
+++ b/light/2.0/Android.bp
@@ -44,6 +44,7 @@
generated_sources: ["android.hardware.light@2.0_genc++"],
generated_headers: ["android.hardware.light@2.0_genc++_headers"],
export_generated_headers: ["android.hardware.light@2.0_genc++_headers"],
+ vendor_available: true,
shared_libs: [
"libhidlbase",
"libhidltransport",
diff --git a/light/2.0/Android.mk b/light/2.0/Android.mk
index 7bb4293..24d7ab1 100644
--- a/light/2.0/Android.mk
+++ b/light/2.0/Android.mk
@@ -5,7 +5,7 @@
################################################################################
include $(CLEAR_VARS)
-LOCAL_MODULE := android.hardware.light@2.0-java
+LOCAL_MODULE := android.hardware.light-V2.0-java
LOCAL_MODULE_CLASS := JAVA_LIBRARIES
intermediates := $(call local-generated-sources-dir, COMMON)
@@ -13,7 +13,7 @@
HIDL := $(HOST_OUT_EXECUTABLES)/hidl-gen$(HOST_EXECUTABLE_SUFFIX)
LOCAL_JAVA_LIBRARIES := \
- android.hidl.base@1.0-java \
+ android.hidl.base-V1.0-java \
#
@@ -137,7 +137,7 @@
################################################################################
include $(CLEAR_VARS)
-LOCAL_MODULE := android.hardware.light@2.0-java-static
+LOCAL_MODULE := android.hardware.light-V2.0-java-static
LOCAL_MODULE_CLASS := JAVA_LIBRARIES
intermediates := $(call local-generated-sources-dir, COMMON)
@@ -145,7 +145,7 @@
HIDL := $(HOST_OUT_EXECUTABLES)/hidl-gen$(HOST_EXECUTABLE_SUFFIX)
LOCAL_STATIC_JAVA_LIBRARIES := \
- android.hidl.base@1.0-java-static \
+ android.hidl.base-V1.0-java-static \
#
diff --git a/media/1.0/Android.bp b/media/1.0/Android.bp
index 21185db..04a3683 100644
--- a/media/1.0/Android.bp
+++ b/media/1.0/Android.bp
@@ -37,6 +37,7 @@
generated_sources: ["android.hardware.media@1.0_genc++"],
generated_headers: ["android.hardware.media@1.0_genc++_headers"],
export_generated_headers: ["android.hardware.media@1.0_genc++_headers"],
+ vendor_available: true,
shared_libs: [
"libhidlbase",
"libhidltransport",
diff --git a/media/1.0/types.hal b/media/1.0/types.hal
index 1f9c4dc..bb1a73b 100644
--- a/media/1.0/types.hal
+++ b/media/1.0/types.hal
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2016 The Android Open Source Project
+ * Copyright (C) 2017 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/media/Android.bp b/media/Android.bp
old mode 100644
new mode 100755
index f2abc67..2c12fb8
--- a/media/Android.bp
+++ b/media/Android.bp
@@ -2,4 +2,7 @@
subdirs = [
"1.0",
"omx/1.0",
+ "omx/1.0/vts/functional/audio",
+ "omx/1.0/vts/functional/component",
+ "omx/1.0/vts/functional/master",
]
diff --git a/media/omx/1.0/Android.bp b/media/omx/1.0/Android.bp
index c6e0389..0ecf085 100644
--- a/media/omx/1.0/Android.bp
+++ b/media/omx/1.0/Android.bp
@@ -9,6 +9,7 @@
"IOmxBufferSource.hal",
"IOmxNode.hal",
"IOmxObserver.hal",
+ "IOmxStore.hal",
],
}
@@ -26,6 +27,7 @@
"android/hardware/media/omx/1.0/OmxBufferSourceAll.cpp",
"android/hardware/media/omx/1.0/OmxNodeAll.cpp",
"android/hardware/media/omx/1.0/OmxObserverAll.cpp",
+ "android/hardware/media/omx/1.0/OmxStoreAll.cpp",
],
}
@@ -64,6 +66,11 @@
"android/hardware/media/omx/1.0/BnHwOmxObserver.h",
"android/hardware/media/omx/1.0/BpHwOmxObserver.h",
"android/hardware/media/omx/1.0/BsOmxObserver.h",
+ "android/hardware/media/omx/1.0/IOmxStore.h",
+ "android/hardware/media/omx/1.0/IHwOmxStore.h",
+ "android/hardware/media/omx/1.0/BnHwOmxStore.h",
+ "android/hardware/media/omx/1.0/BpHwOmxStore.h",
+ "android/hardware/media/omx/1.0/BsOmxStore.h",
],
}
@@ -72,6 +79,7 @@
generated_sources: ["android.hardware.media.omx@1.0_genc++"],
generated_headers: ["android.hardware.media.omx@1.0_genc++_headers"],
export_generated_headers: ["android.hardware.media.omx@1.0_genc++_headers"],
+ vendor_available: true,
shared_libs: [
"libhidlbase",
"libhidltransport",
diff --git a/media/omx/1.0/IOmx.hal b/media/omx/1.0/IOmx.hal
index 78d4b32..f5fc449 100644
--- a/media/omx/1.0/IOmx.hal
+++ b/media/omx/1.0/IOmx.hal
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2016 The Android Open Source Project
+ * Copyright (C) 2017 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -26,7 +26,7 @@
/**
* Ref: frameworks/av/include/media/IOMX.h: IOMX
*
- * IOmx is the main entry point for communicating with OMX components.
+ * IOmx has the ability to create OMX nodes.
*/
interface IOmx {
@@ -41,8 +41,8 @@
/**
* List available components.
*
- * @param[out] status The status of the call.
- * @param[out] nodeList The list of ComponentInfo.
+ * @return status The status of the call.
+ * @return nodeList The list of ComponentInfo.
*/
listNodes(
) generates (
@@ -50,14 +50,15 @@
vec<ComponentInfo> nodeList
);
+
/**
- * Allocate an IOmxNode instance with the specified component name.
+ * Allocate an IOmxNode instance with the specified node name.
*
- * @param[in] name The name of the component to create.
- * @param[in] observer An observer object that will receive messages from
+ * @param name The name of the node to create.
+ * @param observer An observer object that will receive messages from
* the created instance.
- * @param[out] status The status of the call.
- * @param[out] omxNode The allocated instance of IOmxNode.
+ * @return status The status of the call.
+ * @return omxNode The allocated instance of `IOmxNode`.
*/
allocateNode(
string name,
@@ -70,8 +71,9 @@
/**
* Create an input surface for recording.
*
- * @param[out] producer The associated producer end of the buffer queue.
- * @param[out] source The associated `IGraphicBufferSource`.
+ * @return status The status of the call.
+ * @return producer The associated producer end of the buffer queue.
+ * @return source The associated `IGraphicBufferSource`.
*/
createInputSurface(
) generates (
diff --git a/media/omx/1.0/IOmxNode.hal b/media/omx/1.0/IOmxNode.hal
index 8729637..71c0da3 100644
--- a/media/omx/1.0/IOmxNode.hal
+++ b/media/omx/1.0/IOmxNode.hal
@@ -35,7 +35,7 @@
/**
* Free the node.
*
- * @param[out] status Status of the call.
+ * @return status Status of the call.
*/
freeNode(
) generates (
@@ -45,9 +45,9 @@
/**
* Invoke a command on the node.
*
- * @param[in] cmd Type of the command.
- * @param[in] param Parameter for the command.
- * @param[out] status Status of the call.
+ * @param cmd Type of the command.
+ * @param param Parameter for the command.
+ * @return status Status of the call.
*
* @see OMX_SendCommand() in the OpenMax IL standard.
*/
@@ -61,10 +61,10 @@
/**
* Retrieve a parameter setting from the node.
*
- * @param[in] index Type of the parameter to retrieve.
- * @param[in] inParams Information about the retrieval.
- * @param[out] status Status of the call.
- * @param[out] outParams Current parameter setting.
+ * @param index Type of the parameter to retrieve.
+ * @param inParams Information about the retrieval.
+ * @return status Status of the call.
+ * @return outParams Current parameter setting.
*
* @see OMX_GetParameter() in the OpenMax IL standard.
*/
@@ -79,9 +79,9 @@
/**
* Change a parameter setting of the node.
*
- * @param[in] index Type of the parameter to change.
- * @param[in] params New parameter setting.
- * @param[out] status Status of the call.
+ * @param index Type of the parameter to change.
+ * @param params New parameter setting.
+ * @return status Status of the call.
*
* @see OMX_SetParameter() in the OpenMax IL standard.
*/
@@ -95,10 +95,10 @@
/**
* Retrieve a configuration from the node.
*
- * @param[in] index Type of the configuration to retrieve.
- * @param[in] inConfig Information about the retrieval.
- * @param[out] status Status of the call.
- * @param[out] outConfig Current configuration.
+ * @param index Type of the configuration to retrieve.
+ * @param inConfig Information about the retrieval.
+ * @return status Status of the call.
+ * @return outConfig Current configuration.
*
* @see OMX_GetConfig() in the OpenMax IL standard.
*/
@@ -113,9 +113,9 @@
/**
* Change a configuration of the node.
*
- * @param[in] index Type of the configuration to change.
- * @param[in] config New configuration.
- * @param[out] status Status of the call.
+ * @param index Type of the configuration to change.
+ * @param config New configuration.
+ * @return status Status of the call.
*
* @see OMX_SetConfig() in the OpenMax IL standard.
*/
@@ -129,9 +129,9 @@
/**
* Set the mode of a port on the node.
*
- * @param[in] portIndex Index of the port.
- * @param[in] mode Target mode on the specified port.
- * @param[out] status Status of the call.
+ * @param portIndex Index of the port.
+ * @param mode Target mode on the specified port.
+ * @return status Status of the call.
*/
setPortMode(
uint32_t portIndex,
@@ -144,11 +144,11 @@
* Prepare a port for adaptive playback. This is based on the extension
* "OMX.google.android.index.prepareForAdaptivePlayback".
*
- * @param[in] portIndex Index of the port.
- * @param[in] enable Whether the adaptive playback is enabled or not.
- * @param[in] maxFrameWidth Maximum frame width.
- * @param[in] maxFrameHeight Maximum frame height.
- * @param[out] status Status of the call.
+ * @param portIndex Index of the port.
+ * @param enable Whether the adaptive playback is enabled or not.
+ * @param maxFrameWidth Maximum frame width.
+ * @param maxFrameHeight Maximum frame height.
+ * @return status Status of the call.
*/
prepareForAdaptivePlayback(
uint32_t portIndex,
@@ -163,12 +163,12 @@
* Configure a port for a tunneled playback mode. This is based on the
* extension "OMX.google.android.index.configureVideoTunnelMode".
*
- * @param[in] portIndex Index of the port.
- * @param[in] tunneled Whether the tunneled mode is used or not.
- * @param[in] audioHwSync HW SYNC ID of the audio HAL output stream to sync
+ * @param portIndex Index of the port.
+ * @param tunneled Whether the tunneled mode is used or not.
+ * @param audioHwSync HW SYNC ID of the audio HAL output stream to sync
* the video with.
- * @param[out] status Status of the call.
- * @param[out] sidebandHandle Codec-allocated sideband window handle.
+ * @return status Status of the call.
+ * @return sidebandHandle Codec-allocated sideband window handle.
*/
configureVideoTunnelMode(
uint32_t portIndex,
@@ -183,9 +183,9 @@
* Retrieve the buffer usage on a port. This is based on the extension
* "OMX.google.android.index.getAndroidNativeBufferUsage".
*
- * @param[in] portIndex Index of the port.
- * @param[out] status Status of the call.
- * @param[out] usage Current graphic buffer usage.
+ * @param portIndex Index of the port.
+ * @return status Status of the call.
+ * @return usage Current graphic buffer usage.
*/
getGraphicBufferUsage(
uint32_t portIndex
@@ -197,9 +197,9 @@
/**
* Set up a listener to events related to the input surface.
*
- * @param[in] bufferSource Listener object that implements
+ * @param bufferSource Listener object that implements
* IOmxBufferSource.
- * @param[out] status Status of the call.
+ * @return status Status of the call.
*
* @see IOmxBufferSource.
*/
@@ -212,12 +212,12 @@
/**
* Allocate an opaque buffer on a port as a native handle.
*
- * @param[in] portIndex Index of the port.
- * @param[in] size Desired size of the buffer.
- * @param[out] status Status of the call.
- * @param[out] buffer Id of the allocated buffer, which will be needed in
+ * @param portIndex Index of the port.
+ * @param size Desired size of the buffer.
+ * @return status Status of the call.
+ * @return buffer Id of the allocated buffer, which will be needed in
* other buffer-related functions.
- * @param[out] nativeHandle Native handle of the allocated buffer.
+ * @return nativeHandle Native handle of the allocated buffer.
*
* @see OMX_AllocateBuffer() in the OpenMax IL standard.
*/
@@ -233,10 +233,10 @@
/**
* Assign a buffer to a port.
*
- * @param[in] portIndex Index of the port.
- * @param[in] omxBuffer Buffer to be assigned to the port.
- * @param[out] status Status of the call.
- * @param[out] buffer Id of the assigned buffer, which will be needed in
+ * @param portIndex Index of the port.
+ * @param omxBuffer Buffer to be assigned to the port.
+ * @return status Status of the call.
+ * @return buffer Id of the assigned buffer, which will be needed in
* other buffer-related functions.
*
* @see OMX_UseBuffer() in the OpenMax IL standard.
@@ -253,9 +253,9 @@
* Free a buffer previously assigned to a port by allocateSecureBuffer() or
* useBuffer().
*
- * @param[in] portIndex Index of the port.
- * @param[in] buffer Id of the buffer to be freed.
- * @param[out] status Status of the call.
+ * @param portIndex Index of the port.
+ * @param buffer Id of the buffer to be freed.
+ * @return status Status of the call.
*
* @see OMX_FreeBuffer() in the OpenMax IL standard.
*/
@@ -275,10 +275,10 @@
* the new buffer passed in via \p omxBuffer before OMX_FillThisBuffer() is
* called. Otherwise, \p omxBuffer is not used.
*
- * @param[in] buffer Id of the buffer to fill.
- * @param[in] omxBuffer New buffer information (in metadata mode).
- * @param[in] fence Fence to wait for (if not null).
- * @param[out] status Status of the call.
+ * @param buffer Id of the buffer to fill.
+ * @param omxBuffer New buffer information (in metadata mode).
+ * @param fence Fence to wait for (if not null).
+ * @return status Status of the call.
*
* @see OMX_FillThisBuffer() in the OpenMax IL standard.
*/
@@ -299,12 +299,12 @@
* the new buffer passed in via \p omxBuffer before OMX_EmptyThisBuffer() is
* called. Otherwise, \p omxBuffer is not used.
*
- * @param[in] buffer Id of the buffer to fill.
- * @param[in] omxBuffer New buffer information (in metadata mode).
- * @param[in] flags Flags to be passed to OMX_EmptyBuffer().
- * @param[in] timestampUs Timestamp OMX_EmptyBuffer().
- * @param[in] fence Fence to wait for (if not null).
- * @param[out] status Status of the call.
+ * @param buffer Id of the buffer to fill.
+ * @param omxBuffer New buffer information (in metadata mode).
+ * @param flags Flags to be passed to OMX_EmptyBuffer().
+ * @param timestampUs Timestamp OMX_EmptyBuffer().
+ * @param fence Fence to wait for (if not null).
+ * @return status Status of the call.
*
* @see OMX_EmptyThisBuffer() in the OpenMax IL standard.
*/
@@ -321,9 +321,9 @@
/**
* Request the node to translate an extension string to an index.
*
- * @param[in] parameterName Requested extension string.
- * @param[out] status Status of the call.
- * @param[out] index Translated index.
+ * @param parameterName Requested extension string.
+ * @return status Status of the call.
+ * @return index Translated index.
*
* @see OMX_GetExtensionIndex() in the OpenMax IL standard.
*/
@@ -340,8 +340,8 @@
* receive the message in batches by the callback
* IOmxObserver::onMessages().
*
- * @param[in] msg Message to send.
- * @param[out] status Status of the call.
+ * @param msg Message to send.
+ * @return status Status of the call.
*
* @see IOmxObserver::onMessages().
*/
@@ -350,16 +350,5 @@
) generates (
Status status
);
-
- /**
- * Set quirks.
- *
- * @param[in] quirks Quirks for the component, generally obtained from
- * MediaCodecList::getQuirksFor().
- */
- oneway setQuirks(
- uint32_t quirks
- );
-
};
diff --git a/media/omx/1.0/IOmxStore.hal b/media/omx/1.0/IOmxStore.hal
new file mode 100644
index 0000000..a224b0e
--- /dev/null
+++ b/media/omx/1.0/IOmxStore.hal
@@ -0,0 +1,215 @@
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.media.omx@1.0;
+
+import IOmx;
+
+/**
+ * Ref: frameworks/av/include/media/IOMX.h: IOMX
+ *
+ * There will be two instances of IOmxStore: "platform" and "vendor".
+ *
+ * The IOmxStore service provided by the platform must present "platform" as the
+ * interface name.
+ *
+ * The IOmxStore service provided by the vendor must present "vendor" as the
+ * instance name.
+ */
+interface IOmxStore {
+
+ /**
+ * Attribute is a key-value pair of strings. The `value` member is generally
+ * a stringified value of the following:
+ * enum<v1,v2,...,vn>: v1 | v2 | ... | vn
+ * num: 0 | [1-9][0-9]*
+ * string: arbitrary string
+ * size: <num>x<num>
+ * ratio: <num>:<num>
+ * range<type>: <type>-<type>
+ * list<type>: <type> | <type>,<list<type>>
+ */
+ struct Attribute {
+ string key;
+ string value;
+ };
+
+ /**
+ * Service attribute
+ *
+ * Optional service attributes:
+ * key: 'max-video-encoder-input-buffers', value-type: num
+ * key: 'supports-multiple-secure-codecs', value-type: enum<0,1>
+ * key: 'supports-secure-with-non-secure-codec', value-type: enum<0,1>
+ *
+ * For keys with prefix 'supports-', the value of 0 means "no" (not
+ * supported) while the value of 1 means "yes" (supported).
+ */
+ typedef Attribute ServiceAttribute;
+
+ /**
+ * List attributes that are service-specific (not node-specific).
+ *
+ * @return attributes The list of `Attribute`s that are specific to this
+ * service.
+ */
+ listServiceAttributes(
+ ) generates (
+ Status status,
+ vec<ServiceAttribute> attributes
+ );
+
+ /**
+ * Node attribute
+ *
+ * Optional node attributes to describe supported values:
+ * key: 'bitrate-range', value-type: range<num>
+ * key: 'max-concurrent-instances', value-type: num
+ * key: 'max-supported-instances', value-type: num
+ *
+ * Optional node attributes for audio nodes to describe supported values:
+ * key: 'max-channel-count', value-type: num
+ * key: 'sample-rate-ranges', value-type: list<range<num>>
+ *
+ * Optional node attributes for video nodes to describe supported values:
+ * key: 'alignment', value-type: size
+ * key: 'block-aspect-ratio-range', value-type: range<ratio>
+ * key: 'block-count-range', value-type: range<num>
+ * key: 'block-size', value-type: size
+ * key: 'blocks-per-second-range', value-type: range<num>
+ * key: 'feature-can-swap-width-height', value-type: enum<0,1>
+ * key: 'frame-rate-range', value-type: range<num>
+ * key: 'pixel-aspect-ratio-range', value-type: range<ratio>
+ * key: 'size-range', value-type: range<size>
+ *
+ * Required node attributes for video nodes that are required by Android to
+ * describe measured values for this device:
+ * key: 'measured-frame-rate-<width>-<height>-range',
+ * value-type: range<num>; where width: num, height: num
+ *
+ * Optional node attributes for decoders to describe supported values:
+ * key: 'feature-adaptive-playback', value: enum<0,1>
+ * key: 'feature-secure-playback', value: enum<0,1>
+ * key: 'feature-tunneled-playback', value: enum<0,1>
+ *
+ * Optional node attributes for video decoders to describe supported values:
+ * key: 'feature-partial-frame', value: enum<0,1>
+ *
+ * Optional node attributes for encoders to describe supported values:
+ * key: 'complexity-default', value-type: num
+ * key: 'complexity-range', value-type: range<num>
+ * key: 'feature-bitrate-control', value-type: list<enum<VBR,CBR,CQ>>
+ * key: 'feature-intra-refresh', value-type: enum<0,1>
+ * key: 'quality-default', value-type: num
+ * key: 'quality-range', value-type: range<num>
+ * key: 'quality-scale', value-type: string
+ *
+ * For keys with prefix 'feature-' and value type enum<0,1>, the value of 0
+ * means "optional", while the value of 1 means "required".
+ */
+ typedef Attribute NodeAttribute;
+
+ /**
+ * Information for an IOmxNode node.
+ */
+ struct NodeInfo {
+ /**
+ * Name of this node.
+ *
+ * `name` can be supplied to `IOmx::allocateNode` of a
+ * corresponding `IOmx` instance to create the node.
+ */
+ string name;
+ /**
+ * Name of the `IOmx` instance that can create this node.
+ *
+ * To obtain the `IOmx` instance, call `getOmx(owner)`.
+ */
+ string owner;
+ /**
+ * List of node attributes.
+ */
+ vec<NodeAttribute> attributes;
+ };
+
+ /**
+ * Information about nodes provided for a supported node role
+ */
+ struct RoleInfo {
+ /**
+ * Standard OMX node role.
+ */
+ string role;
+ /**
+ * Corresponding media type (as defined in MediaFormat.MIMETYPE_*
+ * constants for types required by Android).
+ */
+ string type;
+ /**
+ * Whether this role is for an encoder or a decoder.
+ */
+ bool isEncoder;
+ /**
+ * Whether to prefer platform nodes for this role.
+ */
+ bool preferPlatformNodes;
+ /**
+ * List of nodes that support this role, ordered by preference.
+ */
+ vec<NodeInfo> nodes;
+ };
+
+ /**
+ * Return the prefix of names of supported nodes.
+ *
+ * @return prefix The prefix of the names of all nodes supported by this
+ * service.
+ */
+ getNodePrefix(
+ ) generates (
+ string prefix
+ );
+
+ /**
+ * List roles of supported nodes.
+ *
+ * The name of each node inside `NodeInfo` must start with the prefix
+ * returned by `getNodePrefix()`.
+ *
+ * @return roleList The list of `RoleInfo`s.
+ *
+ * @see RoleInfo
+ */
+ listRoles(
+ ) generates (
+ vec<RoleInfo> roleList
+ );
+
+ /**
+ * Obtain an `IOmx` instance with a specified name.
+ *
+ * @param name The name of the instance.
+ * @return omx The `IOmx` interface associated with `name`. This must be
+ * null if the name is not found.
+ */
+ getOmx(
+ string name
+ ) generates (
+ IOmx omx
+ );
+
+};
+
diff --git a/media/omx/1.0/types.hal b/media/omx/1.0/types.hal
index 5413344..76a6007 100644
--- a/media/omx/1.0/types.hal
+++ b/media/omx/1.0/types.hal
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2016 The Android Open Source Project
+ * Copyright (C) 2017 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -35,6 +35,7 @@
NAME_NOT_FOUND = -2,
WOULD_BLOCK = -11,
NO_MEMORY = -12,
+ ALREADY_EXISTS = -17,
NO_INIT = -19,
BAD_VALUE = -22,
DEAD_OBJECT = -32,
diff --git a/media/omx/1.0/vts/functional/audio/Android.bp b/media/omx/1.0/vts/functional/audio/Android.bp
new file mode 100644
index 0000000..d6c73ce
--- /dev/null
+++ b/media/omx/1.0/vts/functional/audio/Android.bp
@@ -0,0 +1,79 @@
+//
+// Copyright (C) 2017 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+cc_test {
+ name: "VtsHalMediaOmxV1_0TargetAudioEncTest",
+ defaults: ["hidl_defaults"],
+ srcs: ["VtsHalMediaOmxV1_0TargetAudioEncTest.cpp",
+ "media_audio_hidl_test_common.cpp"],
+ shared_libs: [
+ "libbase",
+ "liblog",
+ "libcutils",
+ "libhidlbase",
+ "libhidlmemory",
+ "libhidltransport",
+ "libhwbinder",
+ "libnativehelper",
+ "libutils",
+ "libstagefright_foundation",
+ "android.hidl.allocator@1.0",
+ "android.hidl.memory@1.0",
+ "android.hardware.media.omx@1.0",
+ ],
+ static_libs: ["VtsHalHidlTargetTestBase"],
+ cflags: [
+ "-O0",
+ "-g",
+ ],
+ include_dirs: [
+ "frameworks/native/include/media/openmax/",
+ "hardware/interfaces/media/omx/1.0/vts/functional/common",
+ ],
+}
+
+cc_test {
+ name: "VtsHalMediaOmxV1_0TargetAudioDecTest",
+ defaults: ["hidl_defaults"],
+ srcs: ["VtsHalMediaOmxV1_0TargetAudioDecTest.cpp",
+ "media_audio_hidl_test_common.cpp"],
+ shared_libs: [
+ "libbase",
+ "liblog",
+ "libcutils",
+ "libhidlbase",
+ "libhidlmemory",
+ "libhidltransport",
+ "libhwbinder",
+ "libnativehelper",
+ "libutils",
+ "libstagefright_foundation",
+ "android.hidl.allocator@1.0",
+ "android.hidl.memory@1.0",
+ "android.hardware.media.omx@1.0",
+ ],
+ static_libs: ["VtsHalHidlTargetTestBase"],
+ cflags: [
+ "-O0",
+ "-g",
+ ],
+ include_dirs: [
+ "frameworks/native/include/media/openmax/",
+ "hardware/interfaces/media/omx/1.0/vts/functional/common",
+ ],
+}
+
+
diff --git a/media/omx/1.0/vts/functional/audio/VtsHalMediaOmxV1_0TargetAudioDecTest.cpp b/media/omx/1.0/vts/functional/audio/VtsHalMediaOmxV1_0TargetAudioDecTest.cpp
new file mode 100644
index 0000000..7c21753
--- /dev/null
+++ b/media/omx/1.0/vts/functional/audio/VtsHalMediaOmxV1_0TargetAudioDecTest.cpp
@@ -0,0 +1,687 @@
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#define LOG_TAG "media_omx_hidl_audio_dec_test"
+#include <android-base/logging.h>
+
+#include <android/hardware/media/omx/1.0/IOmx.h>
+#include <android/hardware/media/omx/1.0/IOmxNode.h>
+#include <android/hardware/media/omx/1.0/IOmxObserver.h>
+#include <android/hardware/media/omx/1.0/types.h>
+#include <android/hidl/allocator/1.0/IAllocator.h>
+#include <android/hidl/memory/1.0/IMapper.h>
+#include <android/hidl/memory/1.0/IMemory.h>
+
+using ::android::hardware::media::omx::V1_0::IOmx;
+using ::android::hardware::media::omx::V1_0::IOmxObserver;
+using ::android::hardware::media::omx::V1_0::IOmxNode;
+using ::android::hardware::media::omx::V1_0::Message;
+using ::android::hardware::media::omx::V1_0::CodecBuffer;
+using ::android::hidl::allocator::V1_0::IAllocator;
+using ::android::hidl::memory::V1_0::IMemory;
+using ::android::hidl::memory::V1_0::IMapper;
+using ::android::hardware::Return;
+using ::android::hardware::Void;
+using ::android::hardware::hidl_vec;
+using ::android::hardware::hidl_string;
+using ::android::sp;
+
+#include <VtsHalHidlTargetTestBase.h>
+#include <getopt.h>
+#include <media_audio_hidl_test_common.h>
+#include <media_hidl_test_common.h>
+#include <fstream>
+
+// A class for test environment setup
+class ComponentTestEnvironment : public ::testing::Environment {
+ public:
+ virtual void SetUp() {}
+ virtual void TearDown() {}
+
+ ComponentTestEnvironment() : instance("default") {}
+
+ void setInstance(const char* _instance) { instance = _instance; }
+
+ void setComponent(const char* _component) { component = _component; }
+
+ void setRole(const char* _role) { role = _role; }
+
+ void setQuirks(int _quirks) { quirks = _quirks; }
+
+ const hidl_string getInstance() const { return instance; }
+
+ const hidl_string getComponent() const { return component; }
+
+ const hidl_string getRole() const { return role; }
+
+ int getQuirks() const { return quirks; }
+
+ int initFromOptions(int argc, char** argv) {
+ static struct option options[] = {
+ {"instance", required_argument, 0, 'I'},
+ {"component", required_argument, 0, 'C'},
+ {"role", required_argument, 0, 'R'},
+ {"quirks", required_argument, 0, 'Q'},
+ {0, 0, 0, 0}};
+
+ while (true) {
+ int index = 0;
+ int c = getopt_long(argc, argv, "I:C:Q:R:", options, &index);
+ if (c == -1) {
+ break;
+ }
+
+ switch (c) {
+ case 'I':
+ setInstance(optarg);
+ break;
+ case 'C':
+ setComponent(optarg);
+ break;
+ case 'Q':
+ setQuirks(atoi(optarg));
+ break;
+ case 'R':
+ setRole(optarg);
+ break;
+ case '?':
+ break;
+ }
+ }
+
+ if (optind < argc) {
+ fprintf(stderr,
+ "unrecognized option: %s\n\n"
+ "usage: %s <gtest options> <test options>\n\n"
+ "test options are:\n\n"
+ "-I, --instance: HAL instance to test\n"
+ "-C, --component: OMX component to test\n"
+ "-R, --Role: OMX component Role\n"
+ "-Q, --quirks: Component quirks\n",
+ argv[optind ?: 1], argv[0]);
+ return 2;
+ }
+ return 0;
+ }
+
+ private:
+ hidl_string instance;
+ hidl_string component;
+ hidl_string role;
+ // to be removed when IOmxNode::setQuirks is removed
+ int quirks;
+};
+
+static ComponentTestEnvironment* gEnv = nullptr;
+
+class AudioDecHidlTest : public ::testing::VtsHalHidlTargetTestBase {
+ public:
+ virtual void SetUp() override {
+ android::hardware::media::omx::V1_0::Status status;
+ omx = ::testing::VtsHalHidlTargetTestBase::getService<IOmx>(
+ gEnv->getInstance());
+ ASSERT_NE(omx, nullptr);
+ observer = new CodecObserver();
+ ASSERT_NE(observer, nullptr);
+ ASSERT_EQ(strncmp(gEnv->getComponent().c_str(), "OMX.", 4), 0)
+ << "Invalid Component Name";
+ EXPECT_TRUE(omx->allocateNode(
+ gEnv->getComponent(), observer,
+ [&](android::hardware::media::omx::V1_0::Status _s,
+ sp<IOmxNode> const& _nl) {
+ status = _s;
+ this->omxNode = _nl;
+ })
+ .isOk());
+ ASSERT_NE(omxNode, nullptr);
+ ASSERT_NE(gEnv->getRole().empty(), true) << "Invalid Component Role";
+ struct StringToName {
+ const char* Name;
+ standardComp CompName;
+ };
+ const StringToName kStringToName[] = {
+ {"mp3", mp3}, {"amrnb", amrnb}, {"amrwb", amrwb},
+ {"aac", aac}, {"vorbis", vorbis}, {"opus", opus},
+ {"pcm", pcm}, {"flac", flac},
+ };
+ const size_t kNumStringToName =
+ sizeof(kStringToName) / sizeof(kStringToName[0]);
+ const char* pch;
+ char substring[OMX_MAX_STRINGNAME_SIZE];
+ strcpy(substring, gEnv->getRole().c_str());
+ pch = strchr(substring, '.');
+ ASSERT_NE(pch, nullptr);
+ compName = unknown_comp;
+ for (size_t i = 0; i < kNumStringToName; ++i) {
+ if (!strcasecmp(pch + 1, kStringToName[i].Name)) {
+ compName = kStringToName[i].CompName;
+ break;
+ }
+ }
+ ASSERT_NE(compName, unknown_comp);
+ struct CompToCoding {
+ standardComp CompName;
+ OMX_AUDIO_CODINGTYPE eEncoding;
+ };
+ static const CompToCoding kCompToCoding[] = {
+ {mp3, OMX_AUDIO_CodingMP3},
+ {amrnb, OMX_AUDIO_CodingAMR},
+ {amrwb, OMX_AUDIO_CodingAMR},
+ {aac, OMX_AUDIO_CodingAAC},
+ {vorbis, OMX_AUDIO_CodingVORBIS},
+ {pcm, OMX_AUDIO_CodingPCM},
+ {opus, (OMX_AUDIO_CODINGTYPE)OMX_AUDIO_CodingAndroidOPUS},
+ {flac, OMX_AUDIO_CodingFLAC},
+ };
+ static const size_t kNumCompToCoding =
+ sizeof(kCompToCoding) / sizeof(kCompToCoding[0]);
+ size_t i;
+ for (i = 0; i < kNumCompToCoding; ++i) {
+ if (kCompToCoding[i].CompName == compName) {
+ eEncoding = kCompToCoding[i].eEncoding;
+ break;
+ }
+ }
+ ASSERT_NE(i, kNumCompToCoding);
+ }
+
+ virtual void TearDown() override {
+ if (omxNode != nullptr) {
+ EXPECT_TRUE((omxNode->freeNode()).isOk());
+ omxNode = nullptr;
+ }
+ }
+
+ enum standardComp {
+ mp3,
+ amrnb,
+ amrwb,
+ aac,
+ vorbis,
+ opus,
+ pcm,
+ flac,
+ unknown_comp,
+ };
+
+ sp<IOmx> omx;
+ sp<CodecObserver> observer;
+ sp<IOmxNode> omxNode;
+ standardComp compName;
+ OMX_AUDIO_CODINGTYPE eEncoding;
+};
+
+void setDefaultPortParam(
+ sp<IOmxNode> omxNode, OMX_U32 portIndex, OMX_AUDIO_CODINGTYPE eEncoding,
+ int32_t nChannels = 2, int32_t nSampleRate = 44100,
+ OMX_NUMERICALDATATYPE eNumData = OMX_NumericalDataSigned,
+ int32_t nBitPerSample = 16) {
+ android::hardware::media::omx::V1_0::Status status;
+ OMX_PARAM_PORTDEFINITIONTYPE portDef;
+ status = getPortParam(omxNode, OMX_IndexParamPortDefinition, portIndex,
+ &portDef);
+ EXPECT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
+
+ portDef.format.audio.bFlagErrorConcealment = OMX_TRUE;
+ portDef.format.audio.eEncoding = eEncoding;
+ status = setPortParam(omxNode, OMX_IndexParamPortDefinition, portIndex,
+ &portDef);
+ EXPECT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
+
+ switch ((int)eEncoding) {
+ case OMX_AUDIO_CodingPCM:
+ setupPCMPort(omxNode, portIndex, nChannels, eNumData, nBitPerSample,
+ nSampleRate);
+ break;
+ default:
+ ASSERT_TRUE(false);
+ break;
+ }
+}
+
+void getInputChannelInfo(sp<IOmxNode> omxNode, OMX_U32 kPortIndexInput,
+ OMX_AUDIO_CODINGTYPE eEncoding, int32_t* nChannels,
+ int32_t* nSampleRate) {
+ *nChannels = 0;
+ *nSampleRate = 0;
+ android::hardware::media::omx::V1_0::Status status;
+
+ switch ((int)eEncoding) {
+ case OMX_AUDIO_CodingPCM: {
+ OMX_AUDIO_PARAM_PCMMODETYPE param;
+ status = getPortParam(omxNode, OMX_IndexParamAudioPcm,
+ kPortIndexInput, ¶m);
+ ASSERT_EQ(status,
+ ::android::hardware::media::omx::V1_0::Status::OK);
+ *nChannels = param.nChannels;
+ *nSampleRate = param.nSamplingRate;
+ break;
+ }
+ case OMX_AUDIO_CodingMP3: {
+ OMX_AUDIO_PARAM_MP3TYPE param;
+ status = getPortParam(omxNode, OMX_IndexParamAudioMp3,
+ kPortIndexInput, ¶m);
+ ASSERT_EQ(status,
+ ::android::hardware::media::omx::V1_0::Status::OK);
+ *nChannels = param.nChannels;
+ *nSampleRate = param.nSampleRate;
+ break;
+ }
+ case OMX_AUDIO_CodingFLAC: {
+ OMX_AUDIO_PARAM_FLACTYPE param;
+ status = getPortParam(omxNode, OMX_IndexParamAudioFlac,
+ kPortIndexInput, ¶m);
+ ASSERT_EQ(status,
+ ::android::hardware::media::omx::V1_0::Status::OK);
+ *nChannels = param.nChannels;
+ *nSampleRate = param.nSampleRate;
+ break;
+ }
+ case OMX_AUDIO_CodingAndroidOPUS: {
+ OMX_AUDIO_PARAM_ANDROID_OPUSTYPE param;
+ status = getPortParam(omxNode,
+ (OMX_INDEXTYPE)OMX_IndexParamAudioAndroidOpus,
+ kPortIndexInput, ¶m);
+ ASSERT_EQ(status,
+ ::android::hardware::media::omx::V1_0::Status::OK);
+ *nChannels = param.nChannels;
+ *nSampleRate = param.nSampleRate;
+ break;
+ }
+ case OMX_AUDIO_CodingVORBIS: {
+ OMX_AUDIO_PARAM_VORBISTYPE param;
+ status = getPortParam(omxNode, OMX_IndexParamAudioVorbis,
+ kPortIndexInput, ¶m);
+ ASSERT_EQ(status,
+ ::android::hardware::media::omx::V1_0::Status::OK);
+ *nChannels = param.nChannels;
+ *nSampleRate = param.nSampleRate;
+ break;
+ }
+ case OMX_AUDIO_CodingAMR: {
+ OMX_AUDIO_PARAM_AMRTYPE param;
+ status = getPortParam(omxNode, OMX_IndexParamAudioAmr,
+ kPortIndexInput, ¶m);
+ ASSERT_EQ(status,
+ ::android::hardware::media::omx::V1_0::Status::OK);
+ *nChannels = param.nChannels;
+ *nSampleRate = 8000;
+ break;
+ }
+ case OMX_AUDIO_CodingAAC: {
+ OMX_AUDIO_PARAM_AACPROFILETYPE param;
+ status = getPortParam(omxNode, OMX_IndexParamAudioAac,
+ kPortIndexInput, ¶m);
+ ASSERT_EQ(status,
+ ::android::hardware::media::omx::V1_0::Status::OK);
+ *nChannels = param.nChannels;
+ *nSampleRate = param.nSampleRate;
+ break;
+ }
+ default:
+ ASSERT_TRUE(false);
+ break;
+ }
+}
+
+void GetURLForComponent(AudioDecHidlTest::standardComp comp, const char** mURL,
+ const char** info) {
+ struct CompToURL {
+ AudioDecHidlTest::standardComp comp;
+ const char* mURL;
+ const char* info;
+ };
+ static const CompToURL kCompToURL[] = {
+ {AudioDecHidlTest::standardComp::mp3,
+ "/sdcard/raw/MP3_48KHz_128kbps_s_1_17_CBR.audio.mp3",
+ "/sdcard/raw/MP3_48KHz_128kbps_s_1_17_CBR.audio.info"},
+ {AudioDecHidlTest::standardComp::aac,
+ "/sdcard/raw/H264_500_AAC_128.audio.aac",
+ "/sdcard/raw/H264_500_AAC_128.audio.info"},
+ {AudioDecHidlTest::standardComp::amrnb,
+ "/sdcard/raw/H264_320_AMRNB_6.audio.amr",
+ "/sdcard/raw/H264_320_AMRNB_6.audio.info"},
+ {AudioDecHidlTest::standardComp::amrwb, "", ""},
+ {AudioDecHidlTest::standardComp::vorbis, "", ""},
+ {AudioDecHidlTest::standardComp::opus, "", ""},
+ {AudioDecHidlTest::standardComp::flac, "", ""},
+ };
+
+ for (size_t i = 0; i < sizeof(kCompToURL) / sizeof(kCompToURL[0]); ++i) {
+ if (kCompToURL[i].comp == comp) {
+ *mURL = kCompToURL[i].mURL;
+ *info = kCompToURL[i].info;
+ return;
+ }
+ }
+}
+
+void flushAllPorts(sp<IOmxNode> omxNode, sp<CodecObserver> observer,
+ android::Vector<BufferInfo>* iBuffer,
+ android::Vector<BufferInfo>* oBuffer,
+ OMX_U32 kPortIndexInput, OMX_U32 kPortIndexOutput) {
+ android::hardware::media::omx::V1_0::Status status;
+ Message msg;
+ // Flush
+ status = omxNode->sendCommand(toRawCommandType(OMX_CommandFlush),
+ kPortIndexInput);
+ ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
+ status = observer->dequeueMessage(&msg, DEFAULT_TIMEOUT, iBuffer, oBuffer);
+ ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
+ ASSERT_EQ(msg.type, Message::Type::EVENT);
+ ASSERT_EQ(msg.data.eventData.event, OMX_EventCmdComplete);
+ ASSERT_EQ(msg.data.eventData.data1, OMX_CommandFlush);
+ ASSERT_EQ(msg.data.eventData.data2, kPortIndexInput);
+ // test if client got all its buffers back
+ for (size_t i = 0; i < iBuffer->size(); ++i) {
+ EXPECT_EQ((*iBuffer)[i].owner, client);
+ }
+
+ status = omxNode->sendCommand(toRawCommandType(OMX_CommandFlush),
+ kPortIndexOutput);
+ ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
+ status = observer->dequeueMessage(&msg, DEFAULT_TIMEOUT, iBuffer, oBuffer);
+ ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
+ ASSERT_EQ(msg.type, Message::Type::EVENT);
+ ASSERT_EQ(msg.data.eventData.event, OMX_EventCmdComplete);
+ ASSERT_EQ(msg.data.eventData.data1, OMX_CommandFlush);
+ ASSERT_EQ(msg.data.eventData.data2, kPortIndexOutput);
+ // test if client got all its buffers back
+ for (size_t i = 0; i < oBuffer->size(); ++i) {
+ EXPECT_EQ((*oBuffer)[i].owner, client);
+ }
+}
+
+void decodeNFrames(sp<IOmxNode> omxNode, sp<CodecObserver> observer,
+ android::Vector<BufferInfo>* iBuffer,
+ android::Vector<BufferInfo>* oBuffer,
+ OMX_AUDIO_CODINGTYPE eEncoding, OMX_U32 kPortIndexInput,
+ OMX_U32 kPortIndexOutput, uint32_t nFrames,
+ std::ifstream& eleStream, std::ifstream& eleInfo) {
+ android::hardware::media::omx::V1_0::Status status;
+ Message msg;
+
+ // dispatch output buffers
+ for (size_t i = 0; i < oBuffer->size(); i++) {
+ dispatchOutputBuffer(omxNode, oBuffer, i);
+ }
+ // dispatch input buffers
+ int bytesCount = 0;
+ for (size_t i = 0; i < iBuffer->size(); i++) {
+ char* ipBuffer = static_cast<char*>(
+ static_cast<void*>((*iBuffer)[i].mMemory->getPointer()));
+ if (!(eleInfo >> bytesCount)) break;
+ eleStream.read(ipBuffer, bytesCount);
+ ASSERT_EQ(eleStream.gcount(), bytesCount);
+ dispatchInputBuffer(omxNode, iBuffer, i, bytesCount, 0, 0);
+ }
+
+ while (nFrames != 0) {
+ status =
+ observer->dequeueMessage(&msg, DEFAULT_TIMEOUT, iBuffer, oBuffer);
+ if (status == android::hardware::media::omx::V1_0::Status::OK &&
+ msg.type == Message::Type::EVENT &&
+ msg.data.eventData.event == OMX_EventPortSettingsChanged) {
+ ASSERT_EQ(msg.data.eventData.data1, kPortIndexOutput);
+
+ status = omxNode->sendCommand(
+ toRawCommandType(OMX_CommandPortDisable), kPortIndexOutput);
+ ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
+
+ status = observer->dequeueMessage(&msg, DEFAULT_TIMEOUT, iBuffer,
+ oBuffer);
+ if (status ==
+ android::hardware::media::omx::V1_0::Status::TIMED_OUT) {
+ for (size_t i = 0; i < oBuffer->size(); ++i) {
+ // test if client got all its buffers back
+ EXPECT_EQ((*oBuffer)[i].owner, client);
+ // free the buffers
+ status =
+ omxNode->freeBuffer(kPortIndexOutput, (*oBuffer)[i].id);
+ ASSERT_EQ(status,
+ android::hardware::media::omx::V1_0::Status::OK);
+ }
+ status = observer->dequeueMessage(&msg, DEFAULT_TIMEOUT,
+ iBuffer, oBuffer);
+ ASSERT_EQ(status,
+ android::hardware::media::omx::V1_0::Status::OK);
+ ASSERT_EQ(msg.type, Message::Type::EVENT);
+ ASSERT_EQ(msg.data.eventData.event, OMX_EventCmdComplete);
+ ASSERT_EQ(msg.data.eventData.data1, OMX_CommandPortDisable);
+ ASSERT_EQ(msg.data.eventData.data2, kPortIndexOutput);
+
+ // Port Reconfigurations
+ int32_t nChannels;
+ int32_t nSampleRate;
+ getInputChannelInfo(omxNode, kPortIndexInput, eEncoding,
+ &nChannels, &nSampleRate);
+ setDefaultPortParam(omxNode, kPortIndexOutput,
+ OMX_AUDIO_CodingPCM, nChannels,
+ nSampleRate);
+
+ // If you can disable a port, then you should be able to enable
+ // it as well
+ status = omxNode->sendCommand(
+ toRawCommandType(OMX_CommandPortEnable), kPortIndexOutput);
+ ASSERT_EQ(status,
+ android::hardware::media::omx::V1_0::Status::OK);
+
+ // do not enable the port until all the buffers are supplied
+ status = observer->dequeueMessage(&msg, DEFAULT_TIMEOUT,
+ iBuffer, oBuffer);
+ ASSERT_EQ(
+ status,
+ android::hardware::media::omx::V1_0::Status::TIMED_OUT);
+
+ allocatePortBuffers(omxNode, oBuffer, kPortIndexOutput);
+ status = observer->dequeueMessage(&msg, DEFAULT_TIMEOUT,
+ iBuffer, oBuffer);
+ ASSERT_EQ(status,
+ android::hardware::media::omx::V1_0::Status::OK);
+ ASSERT_EQ(msg.type, Message::Type::EVENT);
+ ASSERT_EQ(msg.data.eventData.data1, OMX_CommandPortEnable);
+ ASSERT_EQ(msg.data.eventData.data2, kPortIndexOutput);
+
+ // dispatch output buffers
+ for (size_t i = 0; i < oBuffer->size(); i++) {
+ dispatchOutputBuffer(omxNode, oBuffer, i);
+ }
+ } else {
+ ASSERT_TRUE(false);
+ }
+ continue;
+ }
+ size_t index = 0;
+ if ((index = getEmptyBufferID(iBuffer)) < iBuffer->size()) {
+ char* ipBuffer = static_cast<char*>(
+ static_cast<void*>((*iBuffer)[index].mMemory->getPointer()));
+ if (!(eleInfo >> bytesCount)) break;
+ eleStream.read(ipBuffer, bytesCount);
+ ASSERT_EQ(eleStream.gcount(), bytesCount);
+ dispatchInputBuffer(omxNode, iBuffer, index, bytesCount, 0, 0);
+ }
+ if ((index = getEmptyBufferID(oBuffer)) < oBuffer->size()) {
+ dispatchOutputBuffer(omxNode, oBuffer, index);
+ }
+ nFrames--;
+ }
+}
+
+// Set Component Role
+TEST_F(AudioDecHidlTest, SetRole) {
+ android::hardware::media::omx::V1_0::Status status;
+ status = setRole(omxNode, gEnv->getRole().c_str());
+ ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
+}
+
+// Enumerate Port Format
+TEST_F(AudioDecHidlTest, EnumeratePortFormat) {
+ android::hardware::media::omx::V1_0::Status status;
+ uint32_t kPortIndexInput = 0, kPortIndexOutput = 1;
+ status = setRole(omxNode, gEnv->getRole().c_str());
+ ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
+ OMX_PORT_PARAM_TYPE params;
+ status = getParam(omxNode, OMX_IndexParamAudioInit, ¶ms);
+ if (status == ::android::hardware::media::omx::V1_0::Status::OK) {
+ ASSERT_EQ(params.nPorts, 2U);
+ kPortIndexInput = params.nStartPortNumber;
+ kPortIndexOutput = kPortIndexInput + 1;
+ }
+ status = setAudioPortFormat(omxNode, kPortIndexInput, eEncoding);
+ EXPECT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
+ status = setAudioPortFormat(omxNode, kPortIndexOutput, OMX_AUDIO_CodingPCM);
+ EXPECT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
+}
+
+// Decode Test
+TEST_F(AudioDecHidlTest, DecodeTest) {
+ android::hardware::media::omx::V1_0::Status status;
+ uint32_t kPortIndexInput = 0, kPortIndexOutput = 1;
+ status = setRole(omxNode, gEnv->getRole().c_str());
+ ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
+ OMX_PORT_PARAM_TYPE params;
+ status = getParam(omxNode, OMX_IndexParamAudioInit, ¶ms);
+ if (status == ::android::hardware::media::omx::V1_0::Status::OK) {
+ ASSERT_EQ(params.nPorts, 2U);
+ kPortIndexInput = params.nStartPortNumber;
+ kPortIndexOutput = kPortIndexInput + 1;
+ }
+ const char *mURL = nullptr, *info = nullptr;
+ GetURLForComponent(compName, &mURL, &info);
+ EXPECT_NE(mURL, nullptr);
+ EXPECT_NE(info, nullptr);
+
+ std::ifstream eleStream, eleInfo;
+ eleStream.open(mURL, std::ifstream::binary);
+ ASSERT_EQ(eleStream.is_open(), true);
+ eleInfo.open(info);
+ ASSERT_EQ(eleInfo.is_open(), true);
+
+ if (eEncoding == OMX_AUDIO_CodingPCM)
+ setDefaultPortParam(omxNode, kPortIndexInput, eEncoding);
+ int32_t nChannels;
+ int32_t nSampleRate;
+ getInputChannelInfo(omxNode, kPortIndexInput, eEncoding, &nChannels,
+ &nSampleRate);
+ setDefaultPortParam(omxNode, kPortIndexOutput, OMX_AUDIO_CodingPCM,
+ nChannels, nSampleRate);
+
+ Message msg;
+ android::Vector<BufferInfo> iBuffer, oBuffer;
+
+ status = omxNode->sendCommand(toRawCommandType(OMX_CommandStateSet),
+ OMX_StateIdle);
+ ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
+
+ status =
+ observer->dequeueMessage(&msg, DEFAULT_TIMEOUT, &iBuffer, &oBuffer);
+ ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::TIMED_OUT);
+
+ allocatePortBuffers(omxNode, &iBuffer, kPortIndexInput);
+ status =
+ observer->dequeueMessage(&msg, DEFAULT_TIMEOUT, &iBuffer, &oBuffer);
+
+ ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::TIMED_OUT);
+ allocatePortBuffers(omxNode, &oBuffer, kPortIndexOutput);
+
+ status =
+ observer->dequeueMessage(&msg, DEFAULT_TIMEOUT, &iBuffer, &oBuffer);
+ ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
+ ASSERT_EQ(msg.type, Message::Type::EVENT);
+ ASSERT_EQ(msg.data.eventData.event, OMX_EventCmdComplete);
+ ASSERT_EQ(msg.data.eventData.data1, OMX_CommandStateSet);
+ ASSERT_EQ(msg.data.eventData.data2, OMX_StateIdle);
+
+ status = omxNode->sendCommand(toRawCommandType(OMX_CommandStateSet),
+ OMX_StateExecuting);
+ ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
+ status =
+ observer->dequeueMessage(&msg, DEFAULT_TIMEOUT, &iBuffer, &oBuffer);
+ ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
+ ASSERT_EQ(msg.type, Message::Type::EVENT);
+ ASSERT_EQ(msg.data.eventData.event, OMX_EventCmdComplete);
+ ASSERT_EQ(msg.data.eventData.data1, OMX_CommandStateSet);
+ ASSERT_EQ(msg.data.eventData.data2, OMX_StateExecuting);
+
+ // Port Reconfiguration
+ decodeNFrames(omxNode, observer, &iBuffer, &oBuffer, eEncoding,
+ kPortIndexInput, kPortIndexOutput, (1 << 12), eleStream,
+ eleInfo);
+
+ // flush
+ flushAllPorts(omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput,
+ kPortIndexOutput);
+
+ // set state to Idle
+ status = omxNode->sendCommand(toRawCommandType(OMX_CommandStateSet),
+ OMX_StateIdle);
+ ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
+ status =
+ observer->dequeueMessage(&msg, DEFAULT_TIMEOUT, &iBuffer, &oBuffer);
+ ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
+ ASSERT_EQ(msg.type, Message::Type::EVENT);
+ ASSERT_EQ(msg.data.eventData.event, OMX_EventCmdComplete);
+ ASSERT_EQ(msg.data.eventData.data1, OMX_CommandStateSet);
+ ASSERT_EQ(msg.data.eventData.data2, OMX_StateIdle);
+
+ // set state to Loaded
+ status = omxNode->sendCommand(toRawCommandType(OMX_CommandStateSet),
+ OMX_StateLoaded);
+ ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
+
+ // dont change state until all buffers are freed
+ status =
+ observer->dequeueMessage(&msg, DEFAULT_TIMEOUT, &iBuffer, &oBuffer);
+ ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::TIMED_OUT);
+
+ for (size_t i = 0; i < iBuffer.size(); ++i) {
+ status = omxNode->freeBuffer(kPortIndexInput, iBuffer[i].id);
+ ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
+ }
+
+ // dont change state until all buffers are freed
+ status =
+ observer->dequeueMessage(&msg, DEFAULT_TIMEOUT, &iBuffer, &oBuffer);
+ ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::TIMED_OUT);
+
+ for (size_t i = 0; i < oBuffer.size(); ++i) {
+ status = omxNode->freeBuffer(kPortIndexOutput, oBuffer[i].id);
+ ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
+ }
+
+ status =
+ observer->dequeueMessage(&msg, DEFAULT_TIMEOUT, &iBuffer, &oBuffer);
+ ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
+ ASSERT_EQ(msg.type, Message::Type::EVENT);
+ ASSERT_EQ(msg.data.eventData.event, OMX_EventCmdComplete);
+ ASSERT_EQ(msg.data.eventData.data1, OMX_CommandStateSet);
+ ASSERT_EQ(msg.data.eventData.data2, OMX_StateLoaded);
+
+ eleInfo.close();
+ eleStream.close();
+}
+
+int main(int argc, char** argv) {
+ gEnv = new ComponentTestEnvironment();
+ ::testing::AddGlobalTestEnvironment(gEnv);
+ ::testing::InitGoogleTest(&argc, argv);
+ int status = gEnv->initFromOptions(argc, argv);
+ if (status == 0) {
+ status = RUN_ALL_TESTS();
+ ALOGI("Test result = %d", status);
+ }
+ return status;
+}
diff --git a/media/omx/1.0/vts/functional/audio/VtsHalMediaOmxV1_0TargetAudioEncTest.cpp b/media/omx/1.0/vts/functional/audio/VtsHalMediaOmxV1_0TargetAudioEncTest.cpp
new file mode 100644
index 0000000..6a88b1a
--- /dev/null
+++ b/media/omx/1.0/vts/functional/audio/VtsHalMediaOmxV1_0TargetAudioEncTest.cpp
@@ -0,0 +1,263 @@
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#define LOG_TAG "media_omx_hidl_audio_enc_test"
+#include <android-base/logging.h>
+
+#include <android/hardware/media/omx/1.0/IOmx.h>
+#include <android/hardware/media/omx/1.0/IOmxNode.h>
+#include <android/hardware/media/omx/1.0/IOmxObserver.h>
+#include <android/hardware/media/omx/1.0/types.h>
+#include <android/hidl/allocator/1.0/IAllocator.h>
+#include <android/hidl/memory/1.0/IMapper.h>
+#include <android/hidl/memory/1.0/IMemory.h>
+
+using ::android::hardware::media::omx::V1_0::IOmx;
+using ::android::hardware::media::omx::V1_0::IOmxObserver;
+using ::android::hardware::media::omx::V1_0::IOmxNode;
+using ::android::hardware::media::omx::V1_0::Message;
+using ::android::hardware::media::omx::V1_0::CodecBuffer;
+using ::android::hidl::allocator::V1_0::IAllocator;
+using ::android::hidl::memory::V1_0::IMemory;
+using ::android::hidl::memory::V1_0::IMapper;
+using ::android::hardware::Return;
+using ::android::hardware::Void;
+using ::android::hardware::hidl_vec;
+using ::android::hardware::hidl_string;
+using ::android::sp;
+
+#include <VtsHalHidlTargetTestBase.h>
+#include <getopt.h>
+#include <media_audio_hidl_test_common.h>
+#include <media_hidl_test_common.h>
+#include <fstream>
+
+// A class for test environment setup
+class ComponentTestEnvironment : public ::testing::Environment {
+ public:
+ virtual void SetUp() {}
+ virtual void TearDown() {}
+
+ ComponentTestEnvironment() : instance("default") {}
+
+ void setInstance(const char* _instance) { instance = _instance; }
+
+ void setComponent(const char* _component) { component = _component; }
+
+ void setRole(const char* _role) { role = _role; }
+
+ void setQuirks(int _quirks) { quirks = _quirks; }
+
+ const hidl_string getInstance() const { return instance; }
+
+ const hidl_string getComponent() const { return component; }
+
+ const hidl_string getRole() const { return role; }
+
+ int getQuirks() const { return quirks; }
+
+ int initFromOptions(int argc, char** argv) {
+ static struct option options[] = {
+ {"instance", required_argument, 0, 'I'},
+ {"component", required_argument, 0, 'C'},
+ {"role", required_argument, 0, 'R'},
+ {"quirks", required_argument, 0, 'Q'},
+ {0, 0, 0, 0}};
+
+ while (true) {
+ int index = 0;
+ int c = getopt_long(argc, argv, "I:C:Q:R:", options, &index);
+ if (c == -1) {
+ break;
+ }
+
+ switch (c) {
+ case 'I':
+ setInstance(optarg);
+ break;
+ case 'C':
+ setComponent(optarg);
+ break;
+ case 'Q':
+ setQuirks(atoi(optarg));
+ break;
+ case 'R':
+ setRole(optarg);
+ break;
+ case '?':
+ break;
+ }
+ }
+
+ if (optind < argc) {
+ fprintf(stderr,
+ "unrecognized option: %s\n\n"
+ "usage: %s <gtest options> <test options>\n\n"
+ "test options are:\n\n"
+ "-I, --instance: HAL instance to test\n"
+ "-C, --component: OMX component to test\n"
+ "-R, --Role: OMX component Role\n"
+ "-Q, --quirks: Component quirks\n",
+ argv[optind ?: 1], argv[0]);
+ return 2;
+ }
+ return 0;
+ }
+
+ private:
+ hidl_string instance;
+ hidl_string component;
+ hidl_string role;
+ // to be removed when IOmxNode::setQuirks is removed
+ int quirks;
+};
+
+static ComponentTestEnvironment* gEnv = nullptr;
+
+class AudioEncHidlTest : public ::testing::VtsHalHidlTargetTestBase {
+ public:
+ virtual void SetUp() override {
+ android::hardware::media::omx::V1_0::Status status;
+ omx = ::testing::VtsHalHidlTargetTestBase::getService<IOmx>(
+ gEnv->getInstance());
+ ASSERT_NE(omx, nullptr);
+ observer = new CodecObserver();
+ ASSERT_NE(observer, nullptr);
+ ASSERT_EQ(strncmp(gEnv->getComponent().c_str(), "OMX.", 4), 0)
+ << "Invalid Component Name";
+ EXPECT_TRUE(omx->allocateNode(
+ gEnv->getComponent(), observer,
+ [&](android::hardware::media::omx::V1_0::Status _s,
+ sp<IOmxNode> const& _nl) {
+ status = _s;
+ this->omxNode = _nl;
+ })
+ .isOk());
+ ASSERT_NE(omxNode, nullptr);
+ ASSERT_NE(gEnv->getRole().empty(), true) << "Invalid Component Role";
+ struct StringToName {
+ const char* Name;
+ standardComp CompName;
+ };
+ const StringToName kStringToName[] = {
+ {"mp3", mp3}, {"amrnb", amrnb}, {"amrwb", amrwb},
+ {"aac", aac}, {"vorbis", vorbis}, {"opus", opus},
+ {"pcm", pcm}, {"flac", flac},
+ };
+ const size_t kNumStringToName =
+ sizeof(kStringToName) / sizeof(kStringToName[0]);
+ const char* pch;
+ char substring[OMX_MAX_STRINGNAME_SIZE];
+ strcpy(substring, gEnv->getRole().c_str());
+ pch = strchr(substring, '.');
+ ASSERT_NE(pch, nullptr);
+ compName = unknown_comp;
+ for (size_t i = 0; i < kNumStringToName; ++i) {
+ if (!strcasecmp(pch + 1, kStringToName[i].Name)) {
+ compName = kStringToName[i].CompName;
+ break;
+ }
+ }
+ ASSERT_NE(compName, unknown_comp);
+ struct CompToCoding {
+ standardComp CompName;
+ OMX_AUDIO_CODINGTYPE eEncoding;
+ };
+ static const CompToCoding kCompToCoding[] = {
+ {mp3, OMX_AUDIO_CodingMP3},
+ {amrnb, OMX_AUDIO_CodingAMR},
+ {amrwb, OMX_AUDIO_CodingAMR},
+ {aac, OMX_AUDIO_CodingAAC},
+ {vorbis, OMX_AUDIO_CodingVORBIS},
+ {pcm, OMX_AUDIO_CodingPCM},
+ {opus, (OMX_AUDIO_CODINGTYPE)OMX_AUDIO_CodingAndroidOPUS},
+ {flac, OMX_AUDIO_CodingFLAC},
+ };
+ static const size_t kNumCompToCoding =
+ sizeof(kCompToCoding) / sizeof(kCompToCoding[0]);
+ size_t i;
+ for (i = 0; i < kNumCompToCoding; ++i) {
+ if (kCompToCoding[i].CompName == compName) {
+ eEncoding = kCompToCoding[i].eEncoding;
+ break;
+ }
+ }
+ ASSERT_NE(i, kNumCompToCoding);
+ }
+
+ virtual void TearDown() override {
+ if (omxNode != nullptr) {
+ EXPECT_TRUE((omxNode->freeNode()).isOk());
+ omxNode = nullptr;
+ }
+ }
+
+ enum standardComp {
+ mp3,
+ amrnb,
+ amrwb,
+ aac,
+ vorbis,
+ opus,
+ pcm,
+ flac,
+ unknown_comp,
+ };
+
+ sp<IOmx> omx;
+ sp<CodecObserver> observer;
+ sp<IOmxNode> omxNode;
+ standardComp compName;
+ OMX_AUDIO_CODINGTYPE eEncoding;
+};
+
+// Set Component Role
+TEST_F(AudioEncHidlTest, SetRole) {
+ android::hardware::media::omx::V1_0::Status status;
+ status = setRole(omxNode, gEnv->getRole().c_str());
+ ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
+}
+
+// Enumerate Port Format
+TEST_F(AudioEncHidlTest, EnumeratePortFormat) {
+ android::hardware::media::omx::V1_0::Status status;
+ uint32_t kPortIndexInput = 0, kPortIndexOutput = 1;
+ status = setRole(omxNode, gEnv->getRole().c_str());
+ ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
+ OMX_PORT_PARAM_TYPE params;
+ status = getParam(omxNode, OMX_IndexParamAudioInit, ¶ms);
+ if (status == ::android::hardware::media::omx::V1_0::Status::OK) {
+ ASSERT_EQ(params.nPorts, 2U);
+ kPortIndexInput = params.nStartPortNumber;
+ kPortIndexOutput = kPortIndexInput + 1;
+ }
+ status = setAudioPortFormat(omxNode, kPortIndexInput, OMX_AUDIO_CodingPCM);
+ EXPECT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
+ status = setAudioPortFormat(omxNode, kPortIndexOutput, eEncoding);
+ EXPECT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
+}
+
+int main(int argc, char** argv) {
+ gEnv = new ComponentTestEnvironment();
+ ::testing::AddGlobalTestEnvironment(gEnv);
+ ::testing::InitGoogleTest(&argc, argv);
+ int status = gEnv->initFromOptions(argc, argv);
+ if (status == 0) {
+ status = RUN_ALL_TESTS();
+ ALOGI("Test result = %d", status);
+ }
+ return status;
+}
diff --git a/media/omx/1.0/vts/functional/audio/media_audio_hidl_test_common.cpp b/media/omx/1.0/vts/functional/audio/media_audio_hidl_test_common.cpp
new file mode 100644
index 0000000..e01e9aa
--- /dev/null
+++ b/media/omx/1.0/vts/functional/audio/media_audio_hidl_test_common.cpp
@@ -0,0 +1,316 @@
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#define LOG_TAG "media_omx_hidl_audio_test_common"
+#include <android-base/logging.h>
+
+#include <android/hardware/media/omx/1.0/IOmx.h>
+#include <android/hardware/media/omx/1.0/IOmxNode.h>
+#include <android/hardware/media/omx/1.0/IOmxObserver.h>
+#include <android/hardware/media/omx/1.0/types.h>
+#include <android/hidl/allocator/1.0/IAllocator.h>
+#include <android/hidl/memory/1.0/IMapper.h>
+#include <android/hidl/memory/1.0/IMemory.h>
+
+using ::android::hardware::media::omx::V1_0::IOmx;
+using ::android::hardware::media::omx::V1_0::IOmxObserver;
+using ::android::hardware::media::omx::V1_0::IOmxNode;
+using ::android::hardware::media::omx::V1_0::Message;
+using ::android::hardware::media::omx::V1_0::CodecBuffer;
+using ::android::hidl::allocator::V1_0::IAllocator;
+using ::android::hidl::memory::V1_0::IMemory;
+using ::android::hidl::memory::V1_0::IMapper;
+using ::android::hardware::Return;
+using ::android::hardware::Void;
+using ::android::hardware::hidl_vec;
+using ::android::hardware::hidl_string;
+using ::android::sp;
+
+#include <VtsHalHidlTargetTestBase.h>
+#include <hidlmemory/mapping.h>
+#include <media_audio_hidl_test_common.h>
+#include <media_hidl_test_common.h>
+#include <memory>
+
+void allocatePortBuffers(sp<IOmxNode> omxNode,
+ android::Vector<BufferInfo>* buffArray,
+ OMX_U32 portIndex) {
+ android::hardware::media::omx::V1_0::Status status;
+ OMX_PARAM_PORTDEFINITIONTYPE portDef;
+
+ buffArray->clear();
+
+ sp<IAllocator> allocator = IAllocator::getService("ashmem");
+ EXPECT_NE(allocator, nullptr);
+
+ status = getPortParam(omxNode, OMX_IndexParamPortDefinition, portIndex,
+ &portDef);
+ ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
+ for (size_t i = 0; i < portDef.nBufferCountActual; i++) {
+ BufferInfo buffer;
+ buffer.owner = client;
+ buffer.omxBuffer.type = CodecBuffer::Type::SHARED_MEM;
+ buffer.omxBuffer.attr.preset.rangeOffset = 0;
+ buffer.omxBuffer.attr.preset.rangeLength = 0;
+ bool success;
+ allocator->allocate(
+ portDef.nBufferSize,
+ [&success, &buffer](bool _s,
+ ::android::hardware::hidl_memory const& mem) {
+ success = _s;
+ buffer.omxBuffer.sharedMemory = mem;
+ });
+ ASSERT_EQ(success, true);
+ buffer.mMemory = mapMemory(buffer.omxBuffer.sharedMemory);
+ ASSERT_NE(buffer.mMemory, nullptr);
+ omxNode->useBuffer(
+ portIndex, buffer.omxBuffer,
+ [&status, &buffer](android::hardware::media::omx::V1_0::Status _s,
+ uint32_t id) {
+ status = _s;
+ buffer.id = id;
+ });
+ buffArray->push(buffer);
+ ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
+ }
+}
+
+size_t getEmptyBufferID(android::Vector<BufferInfo>* buffArray) {
+ for (size_t i = 0; i < buffArray->size(); i++) {
+ if ((*buffArray)[i].owner == client) return i;
+ }
+ return buffArray->size();
+}
+
+void dispatchInputBuffer(sp<IOmxNode> omxNode,
+ android::Vector<BufferInfo>* buffArray,
+ size_t bufferIndex, int bytesCount, uint32_t flags,
+ uint64_t timestamp) {
+ android::hardware::media::omx::V1_0::Status status;
+ CodecBuffer t;
+ t.sharedMemory = android::hardware::hidl_memory();
+ t.nativeHandle = android::hardware::hidl_handle();
+ t.type = CodecBuffer::Type::PRESET;
+ t.attr.preset.rangeOffset = 0;
+ t.attr.preset.rangeLength = bytesCount;
+ native_handle_t* fenceNh = native_handle_create(0, 0);
+ ASSERT_NE(fenceNh, nullptr);
+ status = omxNode->emptyBuffer((*buffArray)[bufferIndex].id, t, flags,
+ timestamp, fenceNh);
+ native_handle_close(fenceNh);
+ native_handle_delete(fenceNh);
+ ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
+ buffArray->editItemAt(bufferIndex).owner = component;
+}
+
+void dispatchOutputBuffer(sp<IOmxNode> omxNode,
+ android::Vector<BufferInfo>* buffArray,
+ size_t bufferIndex) {
+ android::hardware::media::omx::V1_0::Status status;
+ CodecBuffer t;
+ t.sharedMemory = android::hardware::hidl_memory();
+ t.nativeHandle = android::hardware::hidl_handle();
+ t.type = CodecBuffer::Type::PRESET;
+ t.attr.preset.rangeOffset = 0;
+ t.attr.preset.rangeLength = 0;
+ native_handle_t* fenceNh = native_handle_create(0, 0);
+ ASSERT_NE(fenceNh, nullptr);
+ status = omxNode->fillBuffer((*buffArray)[bufferIndex].id, t, fenceNh);
+ native_handle_close(fenceNh);
+ native_handle_delete(fenceNh);
+ ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
+ buffArray->editItemAt(bufferIndex).owner = component;
+}
+
+Return<android::hardware::media::omx::V1_0::Status> setAudioPortFormat(
+ sp<IOmxNode> omxNode, OMX_U32 portIndex, OMX_AUDIO_CODINGTYPE encoding) {
+ OMX_U32 index = 0;
+ OMX_AUDIO_PARAM_PORTFORMATTYPE portFormat;
+ std::vector<OMX_AUDIO_CODINGTYPE> eEncoding;
+ android::hardware::media::omx::V1_0::Status status;
+
+ while (1) {
+ portFormat.nIndex = index;
+ status = getPortParam(omxNode, OMX_IndexParamAudioPortFormat, portIndex,
+ &portFormat);
+ if (status != ::android::hardware::media::omx::V1_0::Status::OK) break;
+ eEncoding.push_back(portFormat.eEncoding);
+ index++;
+ if (index == 512) {
+ EXPECT_LE(index, 512U)
+ << "Expecting OMX_ErrorNoMore but not received";
+ break;
+ }
+ }
+ if (!index) return status;
+ for (index = 0; index < eEncoding.size(); index++) {
+ if (eEncoding[index] == encoding) {
+ portFormat.eEncoding = eEncoding[index];
+ break;
+ }
+ }
+ if (index == eEncoding.size()) {
+ ALOGI("setting default Port format");
+ portFormat.eEncoding = eEncoding[0];
+ }
+ // In setParam call nIndex shall be ignored as per omx-il specification.
+ // see how this holds up by corrupting nIndex
+ portFormat.nIndex = RANDOM_INDEX;
+ status = setPortParam(omxNode, OMX_IndexParamAudioPortFormat, portIndex,
+ &portFormat);
+ return status;
+}
+
+Return<android::hardware::media::omx::V1_0::Status> setRole(
+ sp<IOmxNode> omxNode, const char* role) {
+ OMX_PARAM_COMPONENTROLETYPE params;
+ strcpy((char*)params.cRole, role);
+ return setParam(omxNode, OMX_IndexParamStandardComponentRole, ¶ms);
+}
+
+void setupPCMPort(sp<IOmxNode> omxNode, OMX_U32 portIndex, int32_t nChannels,
+ OMX_NUMERICALDATATYPE eNumData, int32_t nBitPerSample,
+ int32_t nSamplingRate) {
+ OMX_AUDIO_PARAM_PCMMODETYPE param;
+ android::hardware::media::omx::V1_0::Status status;
+ status = getPortParam(omxNode, OMX_IndexParamAudioPcm, portIndex, ¶m);
+ EXPECT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
+ param.nChannels = nChannels;
+ param.eNumData = eNumData;
+ param.eEndian = OMX_EndianBig;
+ param.bInterleaved = OMX_TRUE;
+ param.nBitPerSample = nBitPerSample;
+ param.nSamplingRate = nSamplingRate;
+ param.ePCMMode = OMX_AUDIO_PCMModeLinear;
+ switch (nChannels) {
+ case 1:
+ param.eChannelMapping[0] = OMX_AUDIO_ChannelCF;
+ break;
+ case 2:
+ param.eChannelMapping[0] = OMX_AUDIO_ChannelLF;
+ param.eChannelMapping[1] = OMX_AUDIO_ChannelRF;
+ break;
+ default:
+ EXPECT_TRUE(false);
+ }
+ status = setPortParam(omxNode, OMX_IndexParamAudioPcm, portIndex, ¶m);
+ ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
+}
+
+void setupMP3Port(sp<IOmxNode> omxNode, OMX_U32 portIndex,
+ OMX_AUDIO_MP3STREAMFORMATTYPE eFormat, int32_t nChannels,
+ int32_t nBitRate, int32_t nSampleRate, bool isEncoder) {
+ if (isEncoder == false) return;
+ OMX_AUDIO_PARAM_MP3TYPE param;
+ android::hardware::media::omx::V1_0::Status status;
+ status = getPortParam(omxNode, OMX_IndexParamAudioMp3, portIndex, ¶m);
+ EXPECT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
+ param.nChannels = nChannels;
+ param.nBitRate = nBitRate;
+ param.nSampleRate = nSampleRate;
+ param.nAudioBandWidth = 0;
+ param.eChannelMode = (nChannels == 1) ? OMX_AUDIO_ChannelModeMono
+ : OMX_AUDIO_ChannelModeStereo;
+ param.eFormat = eFormat;
+ status = setPortParam(omxNode, OMX_IndexParamAudioMp3, portIndex, ¶m);
+ ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
+}
+
+void setupFLACPort(sp<IOmxNode> omxNode, OMX_U32 portIndex, int32_t nChannels,
+ int32_t nSampleRate, int32_t nCompressionLevel,
+ bool isEncoder) {
+ if (isEncoder == false) return;
+ android::hardware::media::omx::V1_0::Status status;
+ OMX_AUDIO_PARAM_FLACTYPE param;
+ status = getPortParam(omxNode, OMX_IndexParamAudioFlac, portIndex, ¶m);
+ EXPECT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
+ param.nChannels = nChannels;
+ param.nSampleRate = nSampleRate;
+ param.nCompressionLevel = nCompressionLevel;
+ status = setPortParam(omxNode, OMX_IndexParamAudioFlac, portIndex, ¶m);
+ ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
+}
+
+void setupOPUSPort(sp<IOmxNode> omxNode, OMX_U32 portIndex, int32_t nChannels,
+ int32_t nBitRate, int32_t nSampleRate, bool isEncoder) {
+ if (isEncoder == false) return;
+ android::hardware::media::omx::V1_0::Status status;
+ OMX_AUDIO_PARAM_ANDROID_OPUSTYPE param;
+ status =
+ getPortParam(omxNode, (OMX_INDEXTYPE)OMX_IndexParamAudioAndroidOpus,
+ portIndex, ¶m);
+ EXPECT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
+ param.nChannels = nChannels;
+ param.nBitRate = nBitRate;
+ param.nSampleRate = nSampleRate;
+ status =
+ setPortParam(omxNode, (OMX_INDEXTYPE)OMX_IndexParamAudioAndroidOpus,
+ portIndex, ¶m);
+ ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
+}
+
+void setupAMRPort(sp<IOmxNode> omxNode, OMX_U32 portIndex, int32_t nBitRate,
+ OMX_AUDIO_AMRBANDMODETYPE eAMRBandMode, bool isEncoder) {
+ if (isEncoder == false) return;
+ android::hardware::media::omx::V1_0::Status status;
+ OMX_AUDIO_PARAM_AMRTYPE param;
+ status = getPortParam(omxNode, OMX_IndexParamAudioAmr, portIndex, ¶m);
+ EXPECT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
+ param.nChannels = 1;
+ param.nBitRate = nBitRate;
+ param.eAMRBandMode = eAMRBandMode;
+ status = setPortParam(omxNode, OMX_IndexParamAudioAmr, portIndex, ¶m);
+ ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
+}
+
+void setupVORBISPort(sp<IOmxNode> omxNode, OMX_U32 portIndex, int32_t nChannels,
+ int32_t nBitRate, int32_t nSampleRate, int32_t nQuality,
+ bool isEncoder) {
+ if (isEncoder == false) return;
+ android::hardware::media::omx::V1_0::Status status;
+ OMX_AUDIO_PARAM_VORBISTYPE param;
+ status =
+ getPortParam(omxNode, OMX_IndexParamAudioVorbis, portIndex, ¶m);
+ EXPECT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
+ param.nChannels = nChannels;
+ param.nBitRate = nBitRate;
+ param.nSampleRate = nSampleRate;
+ param.nQuality = nQuality;
+ status =
+ setPortParam(omxNode, OMX_IndexParamAudioVorbis, portIndex, ¶m);
+ ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
+}
+
+void setupAACPort(sp<IOmxNode> omxNode, OMX_U32 portIndex,
+ OMX_AUDIO_AACPROFILETYPE eAACProfile,
+ OMX_AUDIO_AACSTREAMFORMATTYPE eAACStreamFormat,
+ int32_t nChannels, int32_t nBitRate, int32_t nSampleRate,
+ bool isEncoder) {
+ if (isEncoder == false) return;
+ android::hardware::media::omx::V1_0::Status status;
+ OMX_AUDIO_PARAM_AACPROFILETYPE param;
+ status = getPortParam(omxNode, OMX_IndexParamAudioAac, portIndex, ¶m);
+ EXPECT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
+ param.nChannels = nChannels;
+ param.nSampleRate = nSampleRate;
+ param.nBitRate = nBitRate;
+ param.eAACProfile = eAACProfile;
+ param.eAACStreamFormat = eAACStreamFormat;
+ param.eChannelMode = (nChannels == 1) ? OMX_AUDIO_ChannelModeMono
+ : OMX_AUDIO_ChannelModeStereo;
+ status = setPortParam(omxNode, OMX_IndexParamAudioAac, portIndex, ¶m);
+ ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
+}
diff --git a/media/omx/1.0/vts/functional/audio/media_audio_hidl_test_common.h b/media/omx/1.0/vts/functional/audio/media_audio_hidl_test_common.h
new file mode 100644
index 0000000..bdf5d52
--- /dev/null
+++ b/media/omx/1.0/vts/functional/audio/media_audio_hidl_test_common.h
@@ -0,0 +1,78 @@
+/*
+ * Copyright 2016, The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef MEDIA_AUDIO_HIDL_TEST_COMMON_H
+#define MEDIA_AUDIO_HIDL_TEST_COMMON_H
+
+#include <media_hidl_test_common.h>
+/*
+ * Random Index used for monkey testing while get/set parameters
+ */
+#define RANDOM_INDEX 1729
+
+/*
+ * Common audio utils
+ */
+void allocatePortBuffers(sp<IOmxNode> omxNode,
+ android::Vector<BufferInfo>* buffArray,
+ OMX_U32 portIndex);
+
+size_t getEmptyBufferID(android::Vector<BufferInfo>* buffArray);
+
+void dispatchInputBuffer(sp<IOmxNode> omxNode,
+ android::Vector<BufferInfo>* buffArray,
+ size_t bufferIndex, int bytesCount, uint32_t flags,
+ uint64_t timestamp);
+
+void dispatchOutputBuffer(sp<IOmxNode> omxNode,
+ android::Vector<BufferInfo>* buffArray,
+ size_t bufferIndex);
+
+Return<android::hardware::media::omx::V1_0::Status> setAudioPortFormat(
+ sp<IOmxNode> omxNode, OMX_U32 portIndex, OMX_AUDIO_CODINGTYPE encoding);
+
+Return<android::hardware::media::omx::V1_0::Status> setRole(
+ sp<IOmxNode> omxNode, const char* role);
+
+void setupPCMPort(sp<IOmxNode> omxNode, OMX_U32 portIndex, int32_t nChannels,
+ OMX_NUMERICALDATATYPE eNumData, int32_t nBitPerSample,
+ int32_t nSamplingRate);
+
+void setupMP3Port(sp<IOmxNode> omxNode, OMX_U32 portIndex,
+ OMX_AUDIO_MP3STREAMFORMATTYPE eFormat, int32_t nChannels,
+ int32_t nBitRate, int32_t nSampleRate, bool isEncoder);
+
+void setupFLACPort(sp<IOmxNode> omxNode, OMX_U32 portIndex, int32_t nChannels,
+ int32_t nSampleRate, int32_t nCompressionLevel,
+ bool isEncoder);
+
+void setupOPUSPort(sp<IOmxNode> omxNode, OMX_U32 portIndex, int32_t nChannels,
+ int32_t nBitRate, int32_t nSampleRate, bool isEncoder);
+
+void setupAMRPort(sp<IOmxNode> omxNode, OMX_U32 portIndex, int32_t nBitRate,
+ OMX_AUDIO_AMRBANDMODETYPE eAMRBandMode, bool isEncoder);
+
+void setupVORBISPort(sp<IOmxNode> omxNode, OMX_U32 portIndex, int32_t nChannels,
+ int32_t nBitRate, int32_t nSampleRate, int32_t nQuality,
+ bool isEncoder);
+
+void setupAACPort(sp<IOmxNode> omxNode, OMX_U32 portIndex,
+ OMX_AUDIO_AACPROFILETYPE eAACProfile,
+ OMX_AUDIO_AACSTREAMFORMATTYPE eAACStreamFormat,
+ int32_t nChannels, int32_t nBitRate, int32_t nSampleRate,
+ bool isEncoder);
+
+#endif // MEDIA_AUDIO_HIDL_TEST_COMMON_H
diff --git a/media/omx/1.0/vts/functional/common/media_hidl_test_common.h b/media/omx/1.0/vts/functional/common/media_hidl_test_common.h
new file mode 100644
index 0000000..9421463
--- /dev/null
+++ b/media/omx/1.0/vts/functional/common/media_hidl_test_common.h
@@ -0,0 +1,206 @@
+/*
+ * Copyright 2016, The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef MEDIA_HIDL_TEST_COMMON_H
+#define MEDIA_HIDL_TEST_COMMON_H
+
+#include <media/stagefright/foundation/ALooper.h>
+#include <utils/Condition.h>
+#include <utils/List.h>
+#include <utils/Mutex.h>
+
+#include <media/openmax/OMX_Index.h>
+#include <media/openmax/OMX_Core.h>
+#include <media/openmax/OMX_Component.h>
+#include <media/openmax/OMX_IndexExt.h>
+#include <media/openmax/OMX_AudioExt.h>
+
+/*
+ * TODO: Borrowed from Conversion.h. This is not the ideal way to do it.
+ * Loose these definitions once you include Conversion.h
+ */
+inline uint32_t toRawIndexType(OMX_INDEXTYPE l) {
+ return static_cast<uint32_t>(l);
+}
+
+inline android::hardware::media::omx::V1_0::Status toStatus(
+ android::status_t l) {
+ return static_cast<android::hardware::media::omx::V1_0::Status>(l);
+}
+
+inline hidl_vec<uint8_t> inHidlBytes(void const* l, size_t size) {
+ hidl_vec<uint8_t> t;
+ t.setToExternal(static_cast<uint8_t*>(const_cast<void*>(l)), size, false);
+ return t;
+}
+
+inline uint32_t toRawCommandType(OMX_COMMANDTYPE l) {
+ return static_cast<uint32_t>(l);
+}
+
+/*
+ * Handle Callback functions EmptythisBuffer(), FillthisBuffer(),
+ * EventHandler()
+ */
+#define DEFAULT_TIMEOUT 40000
+
+enum bufferOwner {
+ client,
+ component,
+ unknown,
+};
+
+struct BufferInfo {
+ uint32_t id;
+ bufferOwner owner;
+ android::hardware::media::omx::V1_0::CodecBuffer omxBuffer;
+ ::android::sp<IMemory> mMemory;
+};
+
+struct CodecObserver : public IOmxObserver {
+ public:
+ Return<void> onMessages(const hidl_vec<Message>& messages) override {
+ android::Mutex::Autolock autoLock(msgLock);
+ for (hidl_vec<Message>::const_iterator it = messages.begin();
+ it != messages.end(); ++it) {
+ msgQueue.push_back(*it);
+ }
+ msgCondition.signal();
+ return Void();
+ }
+ android::hardware::media::omx::V1_0::Status dequeueMessage(
+ Message* msg, int64_t timeoutUs,
+ android::Vector<BufferInfo>* iBuffers = nullptr,
+ android::Vector<BufferInfo>* oBuffers = nullptr) {
+ int64_t finishBy = android::ALooper::GetNowUs() + timeoutUs;
+ for (;;) {
+ android::Mutex::Autolock autoLock(msgLock);
+ android::List<Message>::iterator it = msgQueue.begin();
+ while (it != msgQueue.end()) {
+ if (it->type ==
+ android::hardware::media::omx::V1_0::Message::Type::EVENT) {
+ *msg = *it;
+ msgQueue.erase(it);
+ return ::android::hardware::media::omx::V1_0::Status::OK;
+ } else if (it->type == android::hardware::media::omx::V1_0::
+ Message::Type::FILL_BUFFER_DONE) {
+ if (oBuffers) {
+ size_t i;
+ for (i = 0; i < oBuffers->size(); ++i) {
+ if ((*oBuffers)[i].id ==
+ it->data.bufferData.buffer) {
+ oBuffers->editItemAt(i).owner = client;
+ msgQueue.erase(it);
+ break;
+ }
+ }
+ EXPECT_LE(i, oBuffers->size());
+ }
+ } else if (it->type == android::hardware::media::omx::V1_0::
+ Message::Type::EMPTY_BUFFER_DONE) {
+ if (iBuffers) {
+ size_t i;
+ for (i = 0; i < iBuffers->size(); ++i) {
+ if ((*iBuffers)[i].id ==
+ it->data.bufferData.buffer) {
+ iBuffers->editItemAt(i).owner = client;
+ msgQueue.erase(it);
+ break;
+ }
+ }
+ EXPECT_LE(i, iBuffers->size());
+ }
+ }
+ ++it;
+ }
+ android::status_t err =
+ (timeoutUs < 0)
+ ? msgCondition.wait(msgLock)
+ : msgCondition.waitRelative(
+ msgLock,
+ (finishBy - android::ALooper::GetNowUs()) * 1000);
+ if (err == android::TIMED_OUT) return toStatus(err);
+ }
+ }
+
+ android::List<Message> msgQueue;
+ android::Mutex msgLock;
+ android::Condition msgCondition;
+};
+
+/*
+ * Useful Wrapper utilities
+ */
+template <class T>
+void InitOMXParams(T* params) {
+ params->nSize = sizeof(T);
+ params->nVersion.s.nVersionMajor = 1;
+ params->nVersion.s.nVersionMinor = 0;
+ params->nVersion.s.nRevision = 0;
+ params->nVersion.s.nStep = 0;
+}
+
+template <class T>
+Return<android::hardware::media::omx::V1_0::Status> getParam(
+ sp<IOmxNode> omxNode, OMX_INDEXTYPE omxIdx, T* params) {
+ android::hardware::media::omx::V1_0::Status status;
+ InitOMXParams(params);
+ omxNode->getParameter(
+ toRawIndexType(omxIdx), inHidlBytes(params, sizeof(*params)),
+ [&status, ¶ms](android::hardware::media::omx::V1_0::Status _s,
+ hidl_vec<uint8_t> const& outParams) {
+ status = _s;
+ std::copy(outParams.data(), outParams.data() + outParams.size(),
+ static_cast<uint8_t*>(static_cast<void*>(params)));
+ });
+ return status;
+}
+
+template <class T>
+Return<android::hardware::media::omx::V1_0::Status> setParam(
+ sp<IOmxNode> omxNode, OMX_INDEXTYPE omxIdx, T* params) {
+ InitOMXParams(params);
+ return omxNode->setParameter(toRawIndexType(omxIdx),
+ inHidlBytes(params, sizeof(*params)));
+}
+
+template <class T>
+Return<android::hardware::media::omx::V1_0::Status> getPortParam(
+ sp<IOmxNode> omxNode, OMX_INDEXTYPE omxIdx, OMX_U32 nPortIndex, T* params) {
+ android::hardware::media::omx::V1_0::Status status;
+ InitOMXParams(params);
+ params->nPortIndex = nPortIndex;
+ omxNode->getParameter(
+ toRawIndexType(omxIdx), inHidlBytes(params, sizeof(*params)),
+ [&status, ¶ms](android::hardware::media::omx::V1_0::Status _s,
+ hidl_vec<uint8_t> const& outParams) {
+ status = _s;
+ std::copy(outParams.data(), outParams.data() + outParams.size(),
+ static_cast<uint8_t*>(static_cast<void*>(params)));
+ });
+ return status;
+}
+
+template <class T>
+Return<android::hardware::media::omx::V1_0::Status> setPortParam(
+ sp<IOmxNode> omxNode, OMX_INDEXTYPE omxIdx, OMX_U32 nPortIndex, T* params) {
+ InitOMXParams(params);
+ params->nPortIndex = nPortIndex;
+ return omxNode->setParameter(toRawIndexType(omxIdx),
+ inHidlBytes(params, sizeof(*params)));
+}
+
+#endif // MEDIA_HIDL_TEST_COMMON_H
diff --git a/media/omx/1.0/vts/functional/component/Android.bp b/media/omx/1.0/vts/functional/component/Android.bp
new file mode 100644
index 0000000..02fe182
--- /dev/null
+++ b/media/omx/1.0/vts/functional/component/Android.bp
@@ -0,0 +1,45 @@
+//
+// Copyright (C) 2017 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+cc_test {
+ name: "VtsHalMediaOmxV1_0TargetComponentTest",
+ defaults: ["hidl_defaults"],
+ srcs: ["VtsHalMediaOmxV1_0TargetComponentTest.cpp"],
+ shared_libs: [
+ "libbase",
+ "liblog",
+ "libcutils",
+ "libhidlbase",
+ "libhidltransport",
+ "libhwbinder",
+ "libnativehelper",
+ "libutils",
+ "libstagefright_foundation",
+ "android.hidl.allocator@1.0",
+ "android.hidl.memory@1.0",
+ "android.hardware.media.omx@1.0",
+ ],
+ static_libs: ["VtsHalHidlTargetTestBase"],
+ cflags: [
+ "-O0",
+ "-g",
+ ],
+ include_dirs: [
+ "frameworks/native/include/media/openmax/",
+ "hardware/interfaces/media/omx/1.0/vts/functional/common",
+ ],
+}
+
diff --git a/media/omx/1.0/vts/functional/component/VtsHalMediaOmxV1_0TargetComponentTest.cpp b/media/omx/1.0/vts/functional/component/VtsHalMediaOmxV1_0TargetComponentTest.cpp
new file mode 100644
index 0000000..fdffd66
--- /dev/null
+++ b/media/omx/1.0/vts/functional/component/VtsHalMediaOmxV1_0TargetComponentTest.cpp
@@ -0,0 +1,1213 @@
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#define LOG_TAG "media_omx_hidl_component_test"
+#include <android-base/logging.h>
+
+#include <android/hardware/media/omx/1.0/IOmx.h>
+#include <android/hardware/media/omx/1.0/IOmxNode.h>
+#include <android/hardware/media/omx/1.0/IOmxObserver.h>
+#include <android/hardware/media/omx/1.0/types.h>
+#include <android/hidl/allocator/1.0/IAllocator.h>
+#include <android/hidl/memory/1.0/IMapper.h>
+#include <android/hidl/memory/1.0/IMemory.h>
+
+using ::android::hardware::media::omx::V1_0::IOmx;
+using ::android::hardware::media::omx::V1_0::IOmxObserver;
+using ::android::hardware::media::omx::V1_0::IOmxNode;
+using ::android::hardware::media::omx::V1_0::Message;
+using ::android::hardware::media::omx::V1_0::CodecBuffer;
+using ::android::hidl::allocator::V1_0::IAllocator;
+using ::android::hidl::memory::V1_0::IMemory;
+using ::android::hidl::memory::V1_0::IMapper;
+using ::android::hardware::Return;
+using ::android::hardware::Void;
+using ::android::hardware::hidl_vec;
+using ::android::hardware::hidl_string;
+using ::android::sp;
+
+#include <VtsHalHidlTargetTestBase.h>
+#include <getopt.h>
+#include <media_hidl_test_common.h>
+
+// A class for test environment setup
+class ComponentTestEnvironment : public ::testing::Environment {
+ public:
+ virtual void SetUp() {}
+ virtual void TearDown() {}
+
+ ComponentTestEnvironment() : instance("default") {}
+
+ void setInstance(const char* _instance) { instance = _instance; }
+
+ void setComponent(const char* _component) { component = _component; }
+
+ void setRole(const char* _role) { role = _role; }
+
+ void setQuirks(int _quirks) { quirks = _quirks; }
+
+ const hidl_string getInstance() const { return instance; }
+
+ const hidl_string getComponent() const { return component; }
+
+ const hidl_string getRole() const { return role; }
+
+ int getQuirks() const { return quirks; }
+
+ int initFromOptions(int argc, char** argv) {
+ static struct option options[] = {
+ {"instance", required_argument, 0, 'I'},
+ {"component", required_argument, 0, 'C'},
+ {"role", required_argument, 0, 'R'},
+ {"quirks", required_argument, 0, 'Q'},
+ {0, 0, 0, 0}};
+
+ while (true) {
+ int index = 0;
+ int c = getopt_long(argc, argv, "I:C:Q:R:", options, &index);
+ if (c == -1) {
+ break;
+ }
+
+ switch (c) {
+ case 'I':
+ setInstance(optarg);
+ break;
+ case 'C':
+ setComponent(optarg);
+ break;
+ case 'Q':
+ setQuirks(atoi(optarg));
+ break;
+ case 'R':
+ setRole(optarg);
+ break;
+ case '?':
+ break;
+ }
+ }
+
+ if (optind < argc) {
+ fprintf(stderr,
+ "unrecognized option: %s\n\n"
+ "usage: %s <gtest options> <test options>\n\n"
+ "test options are:\n\n"
+ "-I, --instance: HAL instance to test\n"
+ "-C, --component: OMX component to test\n"
+ "-R, --Role: OMX component Role\n"
+ "-Q, --quirks: Component quirks\n",
+ argv[optind ?: 1], argv[0]);
+ return 2;
+ }
+ return 0;
+ }
+
+ private:
+ hidl_string instance;
+ hidl_string component;
+ hidl_string role;
+ // to be removed when IOmxNode::setQuirks is removed
+ int quirks;
+};
+
+static ComponentTestEnvironment* gEnv = nullptr;
+
+class ComponentHidlTest : public ::testing::VtsHalHidlTargetTestBase {
+ public:
+ virtual void SetUp() override {
+ android::hardware::media::omx::V1_0::Status status;
+ omx = ::testing::VtsHalHidlTargetTestBase::getService<IOmx>(
+ gEnv->getInstance());
+ ASSERT_NE(omx, nullptr);
+ observer = new CodecObserver();
+ ASSERT_NE(observer, nullptr);
+ ASSERT_EQ(strncmp(gEnv->getComponent().c_str(), "OMX.", 4), 0)
+ << "Invalid Component Name";
+ EXPECT_TRUE(omx->allocateNode(
+ gEnv->getComponent(), observer,
+ [&](android::hardware::media::omx::V1_0::Status _s,
+ sp<IOmxNode> const& _nl) {
+ status = _s;
+ this->omxNode = _nl;
+ })
+ .isOk());
+ ASSERT_NE(omxNode, nullptr);
+ ASSERT_NE(gEnv->getRole().empty(), true) << "Invalid Component Role";
+ struct StringToClass {
+ const char* Class;
+ standardCompClass CompClass;
+ };
+ const StringToClass kStringToClass[] = {
+ {"audio_decoder", audio_decoder},
+ {"audio_encoder", audio_encoder},
+ {"video_decoder", video_decoder},
+ {"video_encoder", video_encoder},
+ };
+ const size_t kNumStringToClass =
+ sizeof(kStringToClass) / sizeof(kStringToClass[0]);
+ const char* pch;
+ char substring[OMX_MAX_STRINGNAME_SIZE];
+ strcpy(substring, gEnv->getRole().c_str());
+ pch = strchr(substring, '.');
+ ASSERT_NE(pch, nullptr) << "Invalid Component Role";
+ substring[pch - substring] = '\0';
+ compClass = unknown_class;
+ for (size_t i = 0; i < kNumStringToClass; ++i) {
+ if (!strcasecmp(substring, kStringToClass[i].Class)) {
+ compClass = kStringToClass[i].CompClass;
+ break;
+ }
+ }
+ ASSERT_NE(compClass, unknown_class) << "Invalid Component Class";
+
+ allocator = ::testing::VtsHalHidlTargetTestBase::getService<IAllocator>(
+ "ashmem");
+ ASSERT_NE(allocator, nullptr);
+ }
+
+ virtual void TearDown() override {
+ if (omxNode != nullptr) {
+ EXPECT_TRUE((omxNode->freeNode()).isOk());
+ omxNode = nullptr;
+ }
+ }
+
+ enum standardCompClass {
+ audio_decoder,
+ audio_encoder,
+ video_decoder,
+ video_encoder,
+ unknown_class,
+ };
+
+ sp<IOmx> omx;
+ sp<CodecObserver> observer;
+ sp<IOmxNode> omxNode;
+ sp<IAllocator> allocator;
+ standardCompClass compClass;
+};
+
+#define RANDOM_INDEX 1729
+
+void allocatePortBuffers(sp<IOmxNode> omxNode, sp<IAllocator> allocator,
+ android::Vector<BufferInfo>* buffArray,
+ OMX_U32 portIndex) {
+ android::hardware::media::omx::V1_0::Status status;
+ OMX_PARAM_PORTDEFINITIONTYPE portDef;
+
+ buffArray->clear();
+
+ status = getPortParam(omxNode, OMX_IndexParamPortDefinition, portIndex,
+ &portDef);
+ ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
+ for (size_t i = 0; i < portDef.nBufferCountActual; i++) {
+ BufferInfo buffer;
+ buffer.owner = client;
+ buffer.omxBuffer.type = CodecBuffer::Type::SHARED_MEM;
+ buffer.omxBuffer.attr.preset.rangeOffset = 0;
+ buffer.omxBuffer.attr.preset.rangeLength = 0;
+ bool success;
+ allocator->allocate(
+ portDef.nBufferSize,
+ [&success, &buffer](bool _s,
+ ::android::hardware::hidl_memory const& mem) {
+ success = _s;
+ buffer.omxBuffer.sharedMemory = mem;
+ });
+ ASSERT_EQ(success, true);
+
+ omxNode->useBuffer(
+ portIndex, buffer.omxBuffer,
+ [&status, &buffer](android::hardware::media::omx::V1_0::Status _s,
+ uint32_t id) {
+ status = _s;
+ buffer.id = id;
+ });
+ buffArray->push(buffer);
+ ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
+ }
+}
+
+Return<android::hardware::media::omx::V1_0::Status> setVideoPortFormat(
+ sp<IOmxNode> omxNode, OMX_U32 portIndex,
+ OMX_VIDEO_CODINGTYPE compressionFormat, OMX_COLOR_FORMATTYPE colorFormat,
+ OMX_U32 frameRate) {
+ OMX_U32 index = 0;
+ OMX_VIDEO_PARAM_PORTFORMATTYPE portFormat;
+ std::vector<OMX_COLOR_FORMATTYPE> eColorFormat;
+ std::vector<OMX_VIDEO_CODINGTYPE> eCompressionFormat;
+ android::hardware::media::omx::V1_0::Status status;
+
+ while (1) {
+ portFormat.nIndex = index;
+ status = getPortParam(omxNode, OMX_IndexParamVideoPortFormat, portIndex,
+ &portFormat);
+ if (status != ::android::hardware::media::omx::V1_0::Status::OK) break;
+ if (compressionFormat == OMX_VIDEO_CodingUnused)
+ eColorFormat.push_back(portFormat.eColorFormat);
+ else
+ eCompressionFormat.push_back(portFormat.eCompressionFormat);
+ index++;
+ if (index == 512) {
+ EXPECT_LE(index, 512U)
+ << "Expecting OMX_ErrorNoMore but not received";
+ break;
+ }
+ }
+ if (!index) return status;
+ if (compressionFormat == OMX_VIDEO_CodingUnused) {
+ for (index = 0; index < eColorFormat.size(); index++) {
+ if (eColorFormat[index] == colorFormat) {
+ portFormat.eColorFormat = eColorFormat[index];
+ break;
+ }
+ }
+ if (index == eColorFormat.size()) {
+ ALOGI("setting default color format");
+ portFormat.eColorFormat = eColorFormat[0];
+ }
+ portFormat.eCompressionFormat = OMX_VIDEO_CodingUnused;
+ } else {
+ for (index = 0; index < eCompressionFormat.size(); index++) {
+ if (eCompressionFormat[index] == compressionFormat) {
+ portFormat.eCompressionFormat = eCompressionFormat[index];
+ break;
+ }
+ }
+ if (index == eCompressionFormat.size()) {
+ ALOGI("setting default compression format");
+ portFormat.eCompressionFormat = eCompressionFormat[0];
+ }
+ portFormat.eColorFormat = OMX_COLOR_FormatUnused;
+ }
+ // In setParam call nIndex shall be ignored as per omx-il specification.
+ // see how this holds up by corrupting nIndex
+ portFormat.nIndex = RANDOM_INDEX;
+ portFormat.xFramerate = frameRate;
+ status = setPortParam(omxNode, OMX_IndexParamVideoPortFormat, portIndex,
+ &portFormat);
+ return status;
+}
+
+Return<android::hardware::media::omx::V1_0::Status> setAudioPortFormat(
+ sp<IOmxNode> omxNode, OMX_U32 portIndex, OMX_AUDIO_CODINGTYPE encoding) {
+ OMX_U32 index = 0;
+ OMX_AUDIO_PARAM_PORTFORMATTYPE portFormat;
+ std::vector<OMX_AUDIO_CODINGTYPE> eEncoding;
+ android::hardware::media::omx::V1_0::Status status;
+
+ while (1) {
+ portFormat.nIndex = index;
+ status = getPortParam(omxNode, OMX_IndexParamAudioPortFormat, portIndex,
+ &portFormat);
+ if (status != ::android::hardware::media::omx::V1_0::Status::OK) break;
+ eEncoding.push_back(portFormat.eEncoding);
+ index++;
+ if (index == 512) {
+ EXPECT_LE(index, 512U)
+ << "Expecting OMX_ErrorNoMore but not received";
+ break;
+ }
+ }
+ if (!index) return status;
+ for (index = 0; index < eEncoding.size(); index++) {
+ if (eEncoding[index] == encoding) {
+ portFormat.eEncoding = eEncoding[index];
+ break;
+ }
+ }
+ if (index == eEncoding.size()) {
+ ALOGI("setting default Port format");
+ portFormat.eEncoding = eEncoding[0];
+ }
+ // In setParam call nIndex shall be ignored as per omx-il specification.
+ // see how this holds up by corrupting nIndex
+ portFormat.nIndex = RANDOM_INDEX;
+ status = setPortParam(omxNode, OMX_IndexParamAudioPortFormat, portIndex,
+ &portFormat);
+ return status;
+}
+
+Return<android::hardware::media::omx::V1_0::Status> setRole(
+ sp<IOmxNode> omxNode, const char* role) {
+ OMX_PARAM_COMPONENTROLETYPE params;
+ strcpy((char*)params.cRole, role);
+ return setParam(omxNode, OMX_IndexParamStandardComponentRole, ¶ms);
+}
+
+// Set Component Role
+TEST_F(ComponentHidlTest, SetRole) {
+ android::hardware::media::omx::V1_0::Status status;
+ status = setRole(omxNode, gEnv->getRole().c_str());
+ EXPECT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
+}
+
+// Get Number of Ports and their Indices for all Domains
+// (Audio/Video/Image/Other)
+TEST_F(ComponentHidlTest, GetPortIndices) {
+ android::hardware::media::omx::V1_0::Status status;
+ OMX_PORT_PARAM_TYPE params;
+
+ status = setRole(omxNode, gEnv->getRole().c_str());
+ ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
+
+ // All standard OMX components shall support following OMX Index types
+ status = getParam(omxNode, OMX_IndexParamAudioInit, ¶ms);
+ EXPECT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
+ status = getParam(omxNode, OMX_IndexParamVideoInit, ¶ms);
+ EXPECT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
+ status = getParam(omxNode, OMX_IndexParamImageInit, ¶ms);
+ EXPECT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
+ status = getParam(omxNode, OMX_IndexParamOtherInit, ¶ms);
+ EXPECT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
+}
+
+// Enumerate Port Format
+TEST_F(ComponentHidlTest, EnumeratePortFormat) {
+ android::hardware::media::omx::V1_0::Status status;
+ uint32_t kPortIndexInput = 0, kPortIndexOutput = 1;
+
+ status = setRole(omxNode, gEnv->getRole().c_str());
+ ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
+ OMX_PORT_PARAM_TYPE params;
+ if (compClass == audio_decoder || compClass == audio_encoder) {
+ status = getParam(omxNode, OMX_IndexParamAudioInit, ¶ms);
+ } else {
+ status = getParam(omxNode, OMX_IndexParamVideoInit, ¶ms);
+ }
+ if (status == ::android::hardware::media::omx::V1_0::Status::OK) {
+ ASSERT_EQ(params.nPorts, 2U);
+ kPortIndexInput = params.nStartPortNumber;
+ kPortIndexOutput = kPortIndexInput + 1;
+ }
+
+ OMX_COLOR_FORMATTYPE colorFormat = OMX_COLOR_FormatYUV420Planar;
+ OMX_U32 frameRate = 24 << 16;
+
+ if (compClass == audio_encoder) {
+ status =
+ setAudioPortFormat(omxNode, kPortIndexInput, OMX_AUDIO_CodingPCM);
+ EXPECT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
+ status = setAudioPortFormat(omxNode, kPortIndexOutput,
+ OMX_AUDIO_CodingAutoDetect);
+ EXPECT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
+ } else if (compClass == audio_decoder) {
+ status = setAudioPortFormat(omxNode, kPortIndexInput,
+ OMX_AUDIO_CodingAutoDetect);
+ EXPECT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
+ status =
+ setAudioPortFormat(omxNode, kPortIndexOutput, OMX_AUDIO_CodingPCM);
+ EXPECT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
+ } else if (compClass == video_encoder) {
+ status =
+ setVideoPortFormat(omxNode, kPortIndexInput, OMX_VIDEO_CodingUnused,
+ colorFormat, frameRate);
+ EXPECT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
+ status = setVideoPortFormat(omxNode, kPortIndexOutput,
+ OMX_VIDEO_CodingAutoDetect,
+ OMX_COLOR_FormatUnused, 0U);
+ EXPECT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
+ } else {
+ status = setVideoPortFormat(omxNode, kPortIndexInput,
+ OMX_VIDEO_CodingAutoDetect,
+ OMX_COLOR_FormatUnused, 0U);
+ EXPECT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
+ status =
+ setVideoPortFormat(omxNode, kPortIndexOutput,
+ OMX_VIDEO_CodingUnused, colorFormat, frameRate);
+ EXPECT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
+ }
+}
+
+// r/w default i/o port parameters
+TEST_F(ComponentHidlTest, SetDefaultPortParams) {
+ android::hardware::media::omx::V1_0::Status status;
+ uint32_t kPortIndexInput = 0, kPortIndexOutput = 1;
+
+ status = setRole(omxNode, gEnv->getRole().c_str());
+ ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
+ OMX_PORT_PARAM_TYPE params;
+ if (compClass == audio_decoder || compClass == audio_encoder) {
+ status = getParam(omxNode, OMX_IndexParamAudioInit, ¶ms);
+ } else {
+ status = getParam(omxNode, OMX_IndexParamVideoInit, ¶ms);
+ }
+ if (status == ::android::hardware::media::omx::V1_0::Status::OK) {
+ ASSERT_EQ(params.nPorts, 2U);
+ kPortIndexInput = params.nStartPortNumber;
+ kPortIndexOutput = kPortIndexInput + 1;
+ }
+
+ OMX_PARAM_PORTDEFINITIONTYPE iPortDef;
+ status = getPortParam(omxNode, OMX_IndexParamPortDefinition,
+ kPortIndexInput, &iPortDef);
+ EXPECT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
+
+ if (status == android::hardware::media::omx::V1_0::Status::OK) {
+ EXPECT_EQ(iPortDef.eDir, OMX_DirInput);
+ EXPECT_EQ(iPortDef.bEnabled, OMX_TRUE);
+ EXPECT_EQ(iPortDef.bPopulated, 0);
+ EXPECT_GE(iPortDef.nBufferCountMin, 1U);
+ EXPECT_GE(iPortDef.nBufferCountActual, iPortDef.nBufferCountMin);
+ if (compClass == audio_encoder || compClass == audio_decoder) {
+ EXPECT_EQ(iPortDef.eDomain, OMX_PortDomainAudio);
+ if (compClass == audio_decoder) {
+ iPortDef.format.audio.bFlagErrorConcealment = OMX_TRUE;
+ status = setPortParam(omxNode, OMX_IndexParamPortDefinition,
+ kPortIndexInput, &iPortDef);
+ }
+ EXPECT_EQ(status,
+ ::android::hardware::media::omx::V1_0::Status::OK);
+ } else if (compClass == video_encoder || compClass == video_decoder) {
+ EXPECT_EQ(iPortDef.eDomain, OMX_PortDomainVideo);
+ }
+ OMX_PARAM_PORTDEFINITIONTYPE dummy = iPortDef;
+ iPortDef.nBufferCountActual = iPortDef.nBufferCountMin - 1;
+ status = setPortParam(omxNode, OMX_IndexParamPortDefinition,
+ kPortIndexInput, &iPortDef);
+ EXPECT_NE(status, ::android::hardware::media::omx::V1_0::Status::OK);
+ // Edit Read-Only fields.
+ iPortDef.eDir = OMX_DirOutput; // Read Only field
+ iPortDef.nBufferCountActual = dummy.nBufferCountActual << 1;
+ iPortDef.nBufferCountMin = dummy.nBufferCountMin
+ << 1; // Read Only field
+ iPortDef.nBufferSize = dummy.nBufferSize << 1; // Read Only field
+ status = setPortParam(omxNode, OMX_IndexParamPortDefinition,
+ kPortIndexInput, &iPortDef);
+ EXPECT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
+ status = getPortParam(omxNode, OMX_IndexParamPortDefinition,
+ kPortIndexInput, &iPortDef);
+ EXPECT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
+ EXPECT_EQ(iPortDef.nBufferCountActual, dummy.nBufferCountActual << 1);
+ if ((iPortDef.eDir != OMX_DirInput) ||
+ (iPortDef.nBufferCountMin != dummy.nBufferCountMin) ||
+ (iPortDef.nBufferSize != dummy.nBufferSize)) {
+ ALOGI(
+ "Warning, Component does not seem to preserve Read-Only "
+ "fields");
+ printf(
+ "Warning, Component does not seem to preserve Read-Only fields "
+ "\n");
+ }
+ }
+
+ OMX_PARAM_PORTDEFINITIONTYPE oPortDef;
+ status = getPortParam(omxNode, OMX_IndexParamPortDefinition,
+ kPortIndexOutput, &oPortDef);
+ EXPECT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
+ if (status == ::android::hardware::media::omx::V1_0::Status::OK) {
+ EXPECT_EQ(oPortDef.eDir, OMX_DirOutput);
+ EXPECT_EQ(oPortDef.bEnabled, OMX_TRUE);
+ EXPECT_EQ(oPortDef.bPopulated, 0);
+ EXPECT_GE(oPortDef.nBufferCountMin, 1U);
+ EXPECT_GE(oPortDef.nBufferCountActual, oPortDef.nBufferCountMin);
+ if (compClass == audio_encoder || compClass == audio_decoder) {
+ EXPECT_EQ(oPortDef.eDomain, OMX_PortDomainAudio);
+ if (compClass == audio_encoder) {
+ oPortDef.format.audio.bFlagErrorConcealment = OMX_TRUE;
+ status = setPortParam(omxNode, OMX_IndexParamPortDefinition,
+ kPortIndexOutput, &oPortDef);
+ }
+ EXPECT_EQ(status,
+ ::android::hardware::media::omx::V1_0::Status::OK);
+ } else if (compClass == video_encoder || compClass == video_decoder) {
+ EXPECT_EQ(oPortDef.eDomain, OMX_PortDomainVideo);
+ }
+ OMX_PARAM_PORTDEFINITIONTYPE dummy = oPortDef;
+ oPortDef.nBufferCountActual = oPortDef.nBufferCountMin - 1;
+ status = setPortParam(omxNode, OMX_IndexParamPortDefinition,
+ kPortIndexOutput, &oPortDef);
+ EXPECT_NE(status, ::android::hardware::media::omx::V1_0::Status::OK);
+ // Edit Read-Only fields.
+ oPortDef.eDir = OMX_DirInput; // Read Only field
+ oPortDef.nBufferCountActual = dummy.nBufferCountActual << 1;
+ oPortDef.nBufferCountMin = dummy.nBufferCountMin
+ << 1; // Read Only field
+ oPortDef.nBufferSize = dummy.nBufferSize << 1; // Read Only field
+ status = setPortParam(omxNode, OMX_IndexParamPortDefinition,
+ kPortIndexOutput, &oPortDef);
+ EXPECT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
+ status = getPortParam(omxNode, OMX_IndexParamPortDefinition,
+ kPortIndexOutput, &oPortDef);
+ EXPECT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
+ EXPECT_EQ(oPortDef.nBufferCountActual, dummy.nBufferCountActual << 1);
+ if ((oPortDef.eDir != OMX_DirOutput) ||
+ (oPortDef.nBufferCountMin != dummy.nBufferCountMin) ||
+ (oPortDef.nBufferSize != dummy.nBufferSize)) {
+ ALOGI(
+ "Warning, Component does not seem to preserve Read-Only "
+ "fields");
+ printf(
+ "Warning, Component does not seem to preserve Read-Only fields "
+ "\n");
+ }
+ }
+}
+
+// Test State Transitions & Flush
+TEST_F(ComponentHidlTest, StateTransitions_Flush) {
+ android::hardware::media::omx::V1_0::Status status;
+ uint32_t kPortIndexInput = 0, kPortIndexOutput = 1;
+ Message msg;
+
+ status = setRole(omxNode, gEnv->getRole().c_str());
+ ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
+ OMX_PORT_PARAM_TYPE params;
+ if (compClass == audio_decoder || compClass == audio_encoder) {
+ status = getParam(omxNode, OMX_IndexParamAudioInit, ¶ms);
+ } else {
+ status = getParam(omxNode, OMX_IndexParamVideoInit, ¶ms);
+ }
+ if (status == ::android::hardware::media::omx::V1_0::Status::OK) {
+ ASSERT_EQ(params.nPorts, 2U);
+ kPortIndexInput = params.nStartPortNumber;
+ kPortIndexOutput = kPortIndexInput + 1;
+ }
+
+ android::Vector<BufferInfo> iBuffer, oBuffer;
+
+ // set state to idle
+ status = omxNode->sendCommand(toRawCommandType(OMX_CommandStateSet),
+ OMX_StateIdle);
+ ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
+
+ // Dont switch states until the ports got their buffers
+ status =
+ observer->dequeueMessage(&msg, DEFAULT_TIMEOUT, &iBuffer, &oBuffer);
+ ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::TIMED_OUT);
+
+ // allocate buffers on input port
+ allocatePortBuffers(omxNode, allocator, &iBuffer, kPortIndexInput);
+
+ // Dont switch states until the ports got their buffers
+ status =
+ observer->dequeueMessage(&msg, DEFAULT_TIMEOUT, &iBuffer, &oBuffer);
+ ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::TIMED_OUT);
+
+ // allocate buffers on output port
+ allocatePortBuffers(omxNode, allocator, &oBuffer, kPortIndexOutput);
+
+ status =
+ observer->dequeueMessage(&msg, DEFAULT_TIMEOUT, &iBuffer, &oBuffer);
+ ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
+ ASSERT_EQ(msg.type, Message::Type::EVENT);
+ ASSERT_EQ(msg.data.eventData.event, OMX_EventCmdComplete);
+ ASSERT_EQ(msg.data.eventData.data1, OMX_CommandStateSet);
+ ASSERT_EQ(msg.data.eventData.data2, OMX_StateIdle);
+
+ // set state to executing
+ status = omxNode->sendCommand(toRawCommandType(OMX_CommandStateSet),
+ OMX_StateExecuting);
+ ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
+ status =
+ observer->dequeueMessage(&msg, DEFAULT_TIMEOUT, &iBuffer, &oBuffer);
+ ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
+ ASSERT_EQ(msg.type, Message::Type::EVENT);
+ ASSERT_EQ(msg.data.eventData.event, OMX_EventCmdComplete);
+ ASSERT_EQ(msg.data.eventData.data1, OMX_CommandStateSet);
+ ASSERT_EQ(msg.data.eventData.data2, OMX_StateExecuting);
+
+ CodecBuffer t;
+ t.sharedMemory = android::hardware::hidl_memory();
+ t.nativeHandle = android::hardware::hidl_handle();
+ t.type = CodecBuffer::Type::PRESET;
+ t.attr.preset.rangeOffset = 0;
+ t.attr.preset.rangeLength = 0;
+ for (size_t i = 0; i < oBuffer.size(); ++i) {
+ native_handle_t* fenceNh = native_handle_create(0, 0);
+ status = omxNode->fillBuffer(oBuffer[i].id, t, fenceNh);
+ native_handle_close(fenceNh);
+ native_handle_delete(fenceNh);
+ ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
+ oBuffer.editItemAt(i).owner = component;
+ }
+
+ // set state to Idle
+ status = omxNode->sendCommand(toRawCommandType(OMX_CommandStateSet),
+ OMX_StateIdle);
+ ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
+ status =
+ observer->dequeueMessage(&msg, DEFAULT_TIMEOUT, &iBuffer, &oBuffer);
+ ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
+ ASSERT_EQ(msg.type, Message::Type::EVENT);
+ ASSERT_EQ(msg.data.eventData.event, OMX_EventCmdComplete);
+ ASSERT_EQ(msg.data.eventData.data1, OMX_CommandStateSet);
+ ASSERT_EQ(msg.data.eventData.data2, OMX_StateIdle);
+
+ // test if client got all its buffers back
+ for (size_t i = 0; i < oBuffer.size(); ++i) {
+ EXPECT_EQ(oBuffer[i].owner, client);
+ }
+
+ // set state to executing
+ status = omxNode->sendCommand(toRawCommandType(OMX_CommandStateSet),
+ OMX_StateExecuting);
+ ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
+ status =
+ observer->dequeueMessage(&msg, DEFAULT_TIMEOUT, &iBuffer, &oBuffer);
+ ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
+ ASSERT_EQ(msg.type, Message::Type::EVENT);
+ ASSERT_EQ(msg.data.eventData.event, OMX_EventCmdComplete);
+ ASSERT_EQ(msg.data.eventData.data1, OMX_CommandStateSet);
+ ASSERT_EQ(msg.data.eventData.data2, OMX_StateExecuting);
+
+ for (size_t i = 0; i < oBuffer.size(); i += 2) {
+ native_handle_t* fenceNh = native_handle_create(0, 0);
+ status = omxNode->fillBuffer(oBuffer[i].id, t, fenceNh);
+ native_handle_close(fenceNh);
+ native_handle_delete(fenceNh);
+ ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
+ oBuffer.editItemAt(i).owner = component;
+ }
+
+ status = omxNode->sendCommand(toRawCommandType(OMX_CommandFlush),
+ kPortIndexOutput);
+ ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
+ status =
+ observer->dequeueMessage(&msg, DEFAULT_TIMEOUT, &iBuffer, &oBuffer);
+ ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
+ ASSERT_EQ(msg.type, Message::Type::EVENT);
+ ASSERT_EQ(msg.data.eventData.event, OMX_EventCmdComplete);
+ ASSERT_EQ(msg.data.eventData.data1, OMX_CommandFlush);
+ ASSERT_EQ(msg.data.eventData.data2, kPortIndexOutput);
+
+ // test if client got all its buffers back
+ for (size_t i = 0; i < oBuffer.size(); ++i) {
+ EXPECT_EQ(oBuffer[i].owner, client);
+ }
+
+ // set state to Idle
+ status = omxNode->sendCommand(toRawCommandType(OMX_CommandStateSet),
+ OMX_StateIdle);
+ ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
+ status =
+ observer->dequeueMessage(&msg, DEFAULT_TIMEOUT, &iBuffer, &oBuffer);
+ ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
+ ASSERT_EQ(msg.type, Message::Type::EVENT);
+ ASSERT_EQ(msg.data.eventData.event, OMX_EventCmdComplete);
+ ASSERT_EQ(msg.data.eventData.data1, OMX_CommandStateSet);
+ ASSERT_EQ(msg.data.eventData.data2, OMX_StateIdle);
+
+ // set state to Loaded
+ status = omxNode->sendCommand(toRawCommandType(OMX_CommandStateSet),
+ OMX_StateLoaded);
+ ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
+
+ // dont change state until all buffers are freed
+ status =
+ observer->dequeueMessage(&msg, DEFAULT_TIMEOUT, &iBuffer, &oBuffer);
+ ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::TIMED_OUT);
+
+ for (size_t i = 0; i < iBuffer.size(); ++i) {
+ status = omxNode->freeBuffer(kPortIndexInput, iBuffer[i].id);
+ ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
+ }
+
+ // dont change state until all buffers are freed
+ status =
+ observer->dequeueMessage(&msg, DEFAULT_TIMEOUT, &iBuffer, &oBuffer);
+ ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::TIMED_OUT);
+
+ for (size_t i = 0; i < oBuffer.size(); ++i) {
+ status = omxNode->freeBuffer(kPortIndexOutput, oBuffer[i].id);
+ ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
+ }
+
+ status =
+ observer->dequeueMessage(&msg, DEFAULT_TIMEOUT, &iBuffer, &oBuffer);
+ ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
+ ASSERT_EQ(msg.type, Message::Type::EVENT);
+ ASSERT_EQ(msg.data.eventData.event, OMX_EventCmdComplete);
+ ASSERT_EQ(msg.data.eventData.data1, OMX_CommandStateSet);
+ ASSERT_EQ(msg.data.eventData.data2, OMX_StateLoaded);
+}
+
+// Test State Transitions
+TEST_F(ComponentHidlTest, StateTransitions_M) {
+ android::hardware::media::omx::V1_0::Status status;
+ uint32_t kPortIndexInput = 0, kPortIndexOutput = 1;
+ Message msg;
+
+ status = setRole(omxNode, gEnv->getRole().c_str());
+ ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
+ OMX_PORT_PARAM_TYPE params;
+ if (compClass == audio_decoder || compClass == audio_encoder) {
+ status = getParam(omxNode, OMX_IndexParamAudioInit, ¶ms);
+ } else {
+ status = getParam(omxNode, OMX_IndexParamVideoInit, ¶ms);
+ }
+ if (status == ::android::hardware::media::omx::V1_0::Status::OK) {
+ ASSERT_EQ(params.nPorts, 2U);
+ kPortIndexInput = params.nStartPortNumber;
+ kPortIndexOutput = kPortIndexInput + 1;
+ }
+
+ android::Vector<BufferInfo> iBuffer, oBuffer;
+
+ // set state to loaded ; receive error OMX_ErrorSameState
+ status = omxNode->sendCommand(toRawCommandType(OMX_CommandStateSet),
+ OMX_StateLoaded);
+ EXPECT_NE(status, android::hardware::media::omx::V1_0::Status::OK);
+
+ // set state to executing ; receive error OMX_ErrorIncorrectStateTransition
+ status = omxNode->sendCommand(toRawCommandType(OMX_CommandStateSet),
+ OMX_StateExecuting);
+ EXPECT_NE(status, android::hardware::media::omx::V1_0::Status::OK);
+
+ // set state to idle
+ status = omxNode->sendCommand(toRawCommandType(OMX_CommandStateSet),
+ OMX_StateIdle);
+ ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
+
+ // allocate buffers on i/o port
+ allocatePortBuffers(omxNode, allocator, &iBuffer, kPortIndexInput);
+ allocatePortBuffers(omxNode, allocator, &oBuffer, kPortIndexOutput);
+
+ status =
+ observer->dequeueMessage(&msg, DEFAULT_TIMEOUT, &iBuffer, &oBuffer);
+ ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
+ ASSERT_EQ(msg.type, Message::Type::EVENT);
+ ASSERT_EQ(msg.data.eventData.event, OMX_EventCmdComplete);
+ ASSERT_EQ(msg.data.eventData.data1, OMX_CommandStateSet);
+ ASSERT_EQ(msg.data.eventData.data2, OMX_StateIdle);
+
+ // set state to idle ; receive error OMX_ErrorSameState
+ status = omxNode->sendCommand(toRawCommandType(OMX_CommandStateSet),
+ OMX_StateIdle);
+ EXPECT_NE(status, android::hardware::media::omx::V1_0::Status::OK);
+
+ // set state to executing
+ status = omxNode->sendCommand(toRawCommandType(OMX_CommandStateSet),
+ OMX_StateExecuting);
+ ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
+ status =
+ observer->dequeueMessage(&msg, DEFAULT_TIMEOUT, &iBuffer, &oBuffer);
+ ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
+ ASSERT_EQ(msg.type, Message::Type::EVENT);
+ ASSERT_EQ(msg.data.eventData.event, OMX_EventCmdComplete);
+ ASSERT_EQ(msg.data.eventData.data1, OMX_CommandStateSet);
+ ASSERT_EQ(msg.data.eventData.data2, OMX_StateExecuting);
+
+ // set state to executing ; receive error OMX_ErrorSameState
+ status = omxNode->sendCommand(toRawCommandType(OMX_CommandStateSet),
+ OMX_StateExecuting);
+ EXPECT_NE(status, android::hardware::media::omx::V1_0::Status::OK);
+
+ // set state to Loaded ; receive error OMX_ErrorIncorrectStateTransition
+ status = omxNode->sendCommand(toRawCommandType(OMX_CommandStateSet),
+ OMX_StateLoaded);
+ EXPECT_NE(status, android::hardware::media::omx::V1_0::Status::OK);
+
+ // set state to Idle
+ status = omxNode->sendCommand(toRawCommandType(OMX_CommandStateSet),
+ OMX_StateIdle);
+ ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
+ status =
+ observer->dequeueMessage(&msg, DEFAULT_TIMEOUT, &iBuffer, &oBuffer);
+ ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
+ ASSERT_EQ(msg.type, Message::Type::EVENT);
+ ASSERT_EQ(msg.data.eventData.event, OMX_EventCmdComplete);
+ ASSERT_EQ(msg.data.eventData.data1, OMX_CommandStateSet);
+ ASSERT_EQ(msg.data.eventData.data2, OMX_StateIdle);
+
+ // set state to Loaded
+ status = omxNode->sendCommand(toRawCommandType(OMX_CommandStateSet),
+ OMX_StateLoaded);
+ ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
+
+ for (size_t i = 0; i < iBuffer.size(); ++i) {
+ status = omxNode->freeBuffer(kPortIndexInput, iBuffer[i].id);
+ ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
+ }
+ for (size_t i = 0; i < oBuffer.size(); ++i) {
+ status = omxNode->freeBuffer(kPortIndexOutput, oBuffer[i].id);
+ ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
+ }
+
+ status =
+ observer->dequeueMessage(&msg, DEFAULT_TIMEOUT, &iBuffer, &oBuffer);
+ ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
+ ASSERT_EQ(msg.type, Message::Type::EVENT);
+ ASSERT_EQ(msg.data.eventData.event, OMX_EventCmdComplete);
+ ASSERT_EQ(msg.data.eventData.data1, OMX_CommandStateSet);
+ ASSERT_EQ(msg.data.eventData.data2, OMX_StateLoaded);
+}
+
+// Enable and Disable Input and Output ports when the component is in Loaded
+// State
+TEST_F(ComponentHidlTest, PortEnableDisable_Loaded) {
+ android::hardware::media::omx::V1_0::Status status;
+ OMX_U32 portBase = 0;
+ Message msg;
+ status = setRole(omxNode, gEnv->getRole().c_str());
+ ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
+ OMX_PORT_PARAM_TYPE params;
+ if (compClass == audio_decoder || compClass == audio_encoder) {
+ status = getParam(omxNode, OMX_IndexParamAudioInit, ¶ms);
+ } else {
+ status = getParam(omxNode, OMX_IndexParamVideoInit, ¶ms);
+ }
+ if (status == ::android::hardware::media::omx::V1_0::Status::OK) {
+ ASSERT_EQ(params.nPorts, 2U);
+ portBase = params.nStartPortNumber;
+ }
+
+ for (size_t i = portBase; i < portBase + 2; i++) {
+ status =
+ omxNode->sendCommand(toRawCommandType(OMX_CommandPortDisable), i);
+ ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
+ status = observer->dequeueMessage(&msg, DEFAULT_TIMEOUT);
+ ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
+ ASSERT_EQ(msg.type, Message::Type::EVENT);
+ if (msg.data.eventData.event == OMX_EventCmdComplete) {
+ ASSERT_EQ(msg.data.eventData.data1, OMX_CommandPortDisable);
+ ASSERT_EQ(msg.data.eventData.data2, i);
+ // If you can disable a port, then you should be able to enable it
+ // as well
+ status = omxNode->sendCommand(
+ toRawCommandType(OMX_CommandPortEnable), i);
+ ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
+ status = observer->dequeueMessage(&msg, DEFAULT_TIMEOUT);
+ ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
+ ASSERT_EQ(msg.type, Message::Type::EVENT);
+ ASSERT_EQ(msg.data.eventData.data1, OMX_CommandPortEnable);
+ ASSERT_EQ(msg.data.eventData.data2, i);
+ } else if (msg.data.eventData.event == OMX_EventError) {
+ ALOGI("Port %d Disabling failed with error %d", (int)i,
+ (int)msg.data.eventData.event);
+ } else {
+ // something unexpected happened
+ ASSERT_TRUE(false);
+ }
+ }
+}
+
+// Enable and Disable Input and Output ports when the component is in Idle State
+TEST_F(ComponentHidlTest, PortEnableDisable_Idle) {
+ android::hardware::media::omx::V1_0::Status status;
+ uint32_t kPortIndexInput = 0, kPortIndexOutput = 1;
+ OMX_U32 portBase = 0;
+ Message msg;
+ status = setRole(omxNode, gEnv->getRole().c_str());
+ ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
+ OMX_PORT_PARAM_TYPE params;
+ if (compClass == audio_decoder || compClass == audio_encoder) {
+ status = getParam(omxNode, OMX_IndexParamAudioInit, ¶ms);
+ } else {
+ status = getParam(omxNode, OMX_IndexParamVideoInit, ¶ms);
+ }
+ if (status == ::android::hardware::media::omx::V1_0::Status::OK) {
+ ASSERT_EQ(params.nPorts, 2U);
+ portBase = params.nStartPortNumber;
+ }
+ kPortIndexInput = portBase;
+ kPortIndexOutput = portBase + 1;
+
+ // Component State :: Idle
+ android::Vector<BufferInfo> pBuffer[2];
+ // set state to idle
+ status = omxNode->sendCommand(toRawCommandType(OMX_CommandStateSet),
+ OMX_StateIdle);
+ ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
+
+ // allocate buffers on input port
+ allocatePortBuffers(omxNode, allocator, &pBuffer[0], kPortIndexInput);
+ allocatePortBuffers(omxNode, allocator, &pBuffer[1], kPortIndexOutput);
+
+ status = observer->dequeueMessage(&msg, DEFAULT_TIMEOUT, &pBuffer[0],
+ &pBuffer[1]);
+ ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
+ ASSERT_EQ(msg.type, Message::Type::EVENT);
+ ASSERT_EQ(msg.data.eventData.event, OMX_EventCmdComplete);
+ ASSERT_EQ(msg.data.eventData.data1, OMX_CommandStateSet);
+ ASSERT_EQ(msg.data.eventData.data2, OMX_StateIdle);
+
+ for (size_t i = portBase; i < portBase + 2; i++) {
+ status =
+ omxNode->sendCommand(toRawCommandType(OMX_CommandPortDisable), i);
+ ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
+
+ status = observer->dequeueMessage(&msg, DEFAULT_TIMEOUT, &pBuffer[0],
+ &pBuffer[1]);
+ if (status == android::hardware::media::omx::V1_0::Status::OK) {
+ ASSERT_EQ(msg.type, Message::Type::EVENT);
+ if (msg.data.eventData.event == OMX_EventCmdComplete) {
+ // do not disable the port until all the buffers are freed
+ ASSERT_TRUE(false);
+ } else if (msg.data.eventData.event == OMX_EventError) {
+ ALOGI("Port %d Disabling failed with error %d", (int)i,
+ (int)msg.data.eventData.event);
+ } else {
+ // something unexpected happened
+ ASSERT_TRUE(false);
+ }
+ } else if (status ==
+ android::hardware::media::omx::V1_0::Status::TIMED_OUT) {
+ for (size_t j = 0; j < pBuffer[i - portBase].size(); ++j) {
+ status = omxNode->freeBuffer(i, pBuffer[i - portBase][j].id);
+ ASSERT_EQ(status,
+ android::hardware::media::omx::V1_0::Status::OK);
+ }
+
+ status = observer->dequeueMessage(&msg, DEFAULT_TIMEOUT,
+ &pBuffer[0], &pBuffer[1]);
+ ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
+ ASSERT_EQ(msg.type, Message::Type::EVENT);
+ ASSERT_EQ(msg.data.eventData.event, OMX_EventCmdComplete);
+ ASSERT_EQ(msg.data.eventData.data1, OMX_CommandPortDisable);
+ ASSERT_EQ(msg.data.eventData.data2, i);
+
+ // If you can disable a port, then you should be able to enable it
+ // as well
+ status = omxNode->sendCommand(
+ toRawCommandType(OMX_CommandPortEnable), i);
+ ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
+
+ // do not enable the port until all the buffers are supplied
+ status = observer->dequeueMessage(&msg, DEFAULT_TIMEOUT,
+ &pBuffer[0], &pBuffer[1]);
+ ASSERT_EQ(status,
+ android::hardware::media::omx::V1_0::Status::TIMED_OUT);
+
+ allocatePortBuffers(omxNode, allocator, &pBuffer[i - portBase], i);
+ status = observer->dequeueMessage(&msg, DEFAULT_TIMEOUT,
+ &pBuffer[0], &pBuffer[1]);
+ ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
+ ASSERT_EQ(msg.type, Message::Type::EVENT);
+ ASSERT_EQ(msg.data.eventData.data1, OMX_CommandPortEnable);
+ ASSERT_EQ(msg.data.eventData.data2, i);
+ } else {
+ // something unexpected happened
+ ASSERT_TRUE(false);
+ }
+ }
+}
+
+// Enable and Disable Input and Output ports when the component is in execute
+TEST_F(ComponentHidlTest, PortEnableDisable_Execute) {
+ android::hardware::media::omx::V1_0::Status status;
+ uint32_t kPortIndexInput = 0, kPortIndexOutput = 1;
+ OMX_U32 portBase = 0;
+ Message msg;
+ status = setRole(omxNode, gEnv->getRole().c_str());
+ ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
+ OMX_PORT_PARAM_TYPE params;
+ if (compClass == audio_decoder || compClass == audio_encoder) {
+ status = getParam(omxNode, OMX_IndexParamAudioInit, ¶ms);
+ } else {
+ status = getParam(omxNode, OMX_IndexParamVideoInit, ¶ms);
+ }
+ if (status == ::android::hardware::media::omx::V1_0::Status::OK) {
+ ASSERT_EQ(params.nPorts, 2U);
+ portBase = params.nStartPortNumber;
+ }
+ kPortIndexInput = portBase;
+ kPortIndexOutput = portBase + 1;
+
+ // Component State :: Idle
+ android::Vector<BufferInfo> pBuffer[2];
+ // set state to idle
+ status = omxNode->sendCommand(toRawCommandType(OMX_CommandStateSet),
+ OMX_StateIdle);
+ ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
+
+ // allocate buffers on input port
+ allocatePortBuffers(omxNode, allocator, &pBuffer[0], kPortIndexInput);
+ allocatePortBuffers(omxNode, allocator, &pBuffer[1], kPortIndexOutput);
+
+ status = observer->dequeueMessage(&msg, DEFAULT_TIMEOUT, &pBuffer[0],
+ &pBuffer[1]);
+ ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
+ ASSERT_EQ(msg.type, Message::Type::EVENT);
+ ASSERT_EQ(msg.data.eventData.event, OMX_EventCmdComplete);
+ ASSERT_EQ(msg.data.eventData.data1, OMX_CommandStateSet);
+ ASSERT_EQ(msg.data.eventData.data2, OMX_StateIdle);
+
+ // Component State :: Execute
+ status = omxNode->sendCommand(toRawCommandType(OMX_CommandStateSet),
+ OMX_StateExecuting);
+ ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
+ status = observer->dequeueMessage(&msg, DEFAULT_TIMEOUT, &pBuffer[0],
+ &pBuffer[1]);
+ ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
+ ASSERT_EQ(msg.type, Message::Type::EVENT);
+ ASSERT_EQ(msg.data.eventData.event, OMX_EventCmdComplete);
+ ASSERT_EQ(msg.data.eventData.data1, OMX_CommandStateSet);
+ ASSERT_EQ(msg.data.eventData.data2, OMX_StateExecuting);
+
+ CodecBuffer t;
+ t.sharedMemory = android::hardware::hidl_memory();
+ t.nativeHandle = android::hardware::hidl_handle();
+ t.type = CodecBuffer::Type::PRESET;
+ t.attr.preset.rangeOffset = 0;
+ t.attr.preset.rangeLength = 0;
+ for (size_t i = 0; i < pBuffer[1].size(); ++i) {
+ native_handle_t* fenceNh = native_handle_create(0, 0);
+ status = omxNode->fillBuffer(pBuffer[1][i].id, t, fenceNh);
+ native_handle_close(fenceNh);
+ native_handle_delete(fenceNh);
+ ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
+ pBuffer[1].editItemAt(i).owner = component;
+ }
+
+ for (size_t i = portBase; i < portBase + 2; i++) {
+ status =
+ omxNode->sendCommand(toRawCommandType(OMX_CommandPortDisable), i);
+ ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
+
+ status = observer->dequeueMessage(&msg, DEFAULT_TIMEOUT, &pBuffer[0],
+ &pBuffer[1]);
+ if (status == android::hardware::media::omx::V1_0::Status::OK) {
+ ASSERT_EQ(msg.type, Message::Type::EVENT);
+ if (msg.data.eventData.event == OMX_EventCmdComplete) {
+ // do not disable the port until all the buffers are freed
+ ASSERT_TRUE(false);
+ } else if (msg.data.eventData.event == OMX_EventError) {
+ ALOGI("Port %d Disabling failed with error %d", (int)i,
+ (int)msg.data.eventData.event);
+ } else {
+ // something unexpected happened
+ ASSERT_TRUE(false);
+ }
+ } else if (status ==
+ android::hardware::media::omx::V1_0::Status::TIMED_OUT) {
+ for (size_t j = 0; j < pBuffer[i - portBase].size(); ++j) {
+ // test if client got all its buffers back
+ EXPECT_EQ(pBuffer[i - portBase][j].owner, client);
+ // free the buffers
+ status = omxNode->freeBuffer(i, pBuffer[i - portBase][j].id);
+ ASSERT_EQ(status,
+ android::hardware::media::omx::V1_0::Status::OK);
+ }
+
+ status = observer->dequeueMessage(&msg, DEFAULT_TIMEOUT,
+ &pBuffer[0], &pBuffer[1]);
+ ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
+ ASSERT_EQ(msg.type, Message::Type::EVENT);
+ ASSERT_EQ(msg.data.eventData.event, OMX_EventCmdComplete);
+ ASSERT_EQ(msg.data.eventData.data1, OMX_CommandPortDisable);
+ ASSERT_EQ(msg.data.eventData.data2, i);
+
+ // If you can disable a port, then you should be able to enable it
+ // as well
+ status = omxNode->sendCommand(
+ toRawCommandType(OMX_CommandPortEnable), i);
+ ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
+
+ // do not enable the port until all the buffers are supplied
+ status = observer->dequeueMessage(&msg, DEFAULT_TIMEOUT,
+ &pBuffer[0], &pBuffer[1]);
+ ASSERT_EQ(status,
+ android::hardware::media::omx::V1_0::Status::TIMED_OUT);
+
+ allocatePortBuffers(omxNode, allocator, &pBuffer[i - portBase], i);
+ status = observer->dequeueMessage(&msg, DEFAULT_TIMEOUT,
+ &pBuffer[0], &pBuffer[1]);
+ ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
+ ASSERT_EQ(msg.type, Message::Type::EVENT);
+ ASSERT_EQ(msg.data.eventData.data1, OMX_CommandPortEnable);
+ ASSERT_EQ(msg.data.eventData.data2, i);
+ } else {
+ // something unexpected happened
+ ASSERT_TRUE(false);
+ }
+ }
+}
+
+// Enable and Disable Input and Output ports, (in loaded state)
+TEST_F(ComponentHidlTest, PortEnableDisable_M) {
+ android::hardware::media::omx::V1_0::Status status;
+ OMX_U32 portBase = 0;
+ Message msg;
+ status = setRole(omxNode, gEnv->getRole().c_str());
+ ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
+ OMX_PORT_PARAM_TYPE params;
+ if (compClass == audio_decoder || compClass == audio_encoder) {
+ status = getParam(omxNode, OMX_IndexParamAudioInit, ¶ms);
+ } else {
+ status = getParam(omxNode, OMX_IndexParamVideoInit, ¶ms);
+ }
+ if (status == ::android::hardware::media::omx::V1_0::Status::OK) {
+ ASSERT_EQ(params.nPorts, 2U);
+ portBase = params.nStartPortNumber;
+ }
+
+ // disable invalid port, expecting OMX_ErrorBadPortIndex
+ status = omxNode->sendCommand(toRawCommandType(OMX_CommandPortDisable),
+ RANDOM_INDEX);
+ ASSERT_NE(status, android::hardware::media::omx::V1_0::Status::OK);
+
+ // enable invalid port, expecting OMX_ErrorBadPortIndex
+ status = omxNode->sendCommand(toRawCommandType(OMX_CommandPortEnable),
+ RANDOM_INDEX);
+ ASSERT_NE(status, android::hardware::media::omx::V1_0::Status::OK);
+
+ // disable all ports
+ status =
+ omxNode->sendCommand(toRawCommandType(OMX_CommandPortDisable), OMX_ALL);
+ ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
+ for (size_t i = 0; i < 2; i++) {
+ status = observer->dequeueMessage(&msg, DEFAULT_TIMEOUT);
+ ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
+ ASSERT_EQ(msg.type, Message::Type::EVENT);
+ if (msg.data.eventData.event == OMX_EventCmdComplete) {
+ ASSERT_EQ(msg.data.eventData.data1, OMX_CommandPortDisable);
+ if (msg.data.eventData.data2 != portBase ||
+ msg.data.eventData.data2 != portBase + 1)
+ EXPECT_TRUE(false);
+ } else if (msg.data.eventData.event == OMX_EventError) {
+ ALOGI("Port %d Disabling failed with error %d", (int)i,
+ (int)msg.data.eventData.event);
+ } else {
+ // something unexpected happened
+ ASSERT_TRUE(false);
+ }
+ }
+
+ // enable all ports
+ status =
+ omxNode->sendCommand(toRawCommandType(OMX_CommandPortEnable), OMX_ALL);
+ ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
+ for (size_t i = 0; i < 2; i++) {
+ status = observer->dequeueMessage(&msg, DEFAULT_TIMEOUT);
+ ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
+ ASSERT_EQ(msg.type, Message::Type::EVENT);
+ if (msg.data.eventData.event == OMX_EventCmdComplete) {
+ ASSERT_EQ(msg.data.eventData.data1, OMX_CommandPortEnable);
+ if (msg.data.eventData.data2 != portBase ||
+ msg.data.eventData.data2 != portBase + 1)
+ EXPECT_TRUE(false);
+ } else if (msg.data.eventData.event == OMX_EventError) {
+ ALOGI("Port %d Enabling failed with error %d", (int)i,
+ (int)msg.data.eventData.event);
+ } else {
+ // something unexpected happened
+ ASSERT_TRUE(false);
+ }
+ }
+}
+
+int main(int argc, char** argv) {
+ gEnv = new ComponentTestEnvironment();
+ ::testing::AddGlobalTestEnvironment(gEnv);
+ ::testing::InitGoogleTest(&argc, argv);
+ int status = gEnv->initFromOptions(argc, argv);
+ if (status == 0) {
+ status = RUN_ALL_TESTS();
+ ALOGI("Test result = %d", status);
+ }
+ return status;
+}
diff --git a/media/omx/1.0/vts/functional/master/Android.bp b/media/omx/1.0/vts/functional/master/Android.bp
new file mode 100644
index 0000000..6edbf4a
--- /dev/null
+++ b/media/omx/1.0/vts/functional/master/Android.bp
@@ -0,0 +1,38 @@
+//
+// Copyright (C) 2017 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+cc_test {
+ name: "VtsHalMediaOmxV1_0TargetMasterTest",
+ defaults: ["hidl_defaults"],
+ srcs: ["VtsHalMediaOmxV1_0TargetMasterTest.cpp"],
+ shared_libs: [
+ "libbase",
+ "liblog",
+ "libcutils",
+ "libhidlbase",
+ "libhidltransport",
+ "libhwbinder",
+ "libnativehelper",
+ "libutils",
+ "android.hardware.media.omx@1.0",
+ ],
+ static_libs: ["VtsHalHidlTargetTestBase"],
+ cflags: [
+ "-O0",
+ "-g",
+ ],
+}
+
diff --git a/media/omx/1.0/vts/functional/master/VtsHalMediaOmxV1_0TargetMasterTest.cpp b/media/omx/1.0/vts/functional/master/VtsHalMediaOmxV1_0TargetMasterTest.cpp
new file mode 100644
index 0000000..65b999e
--- /dev/null
+++ b/media/omx/1.0/vts/functional/master/VtsHalMediaOmxV1_0TargetMasterTest.cpp
@@ -0,0 +1,120 @@
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#define LOG_TAG "media_omx_hidl_master_test"
+#include <android-base/logging.h>
+
+#include <android/hardware/media/omx/1.0/IOmx.h>
+#include <android/hardware/media/omx/1.0/types.h>
+#include <getopt.h>
+#include <log/log.h>
+#include <VtsHalHidlTargetTestBase.h>
+
+using ::android::hardware::media::omx::V1_0::IOmx;
+using ::android::hardware::Return;
+using ::android::hardware::Void;
+using ::android::hardware::hidl_vec;
+using ::android::hardware::hidl_string;
+using ::android::sp;
+
+// A class for test environment setup
+class ComponentTestEnvironment : public ::testing::Environment {
+ public:
+ virtual void SetUp() {}
+ virtual void TearDown() {}
+
+ ComponentTestEnvironment() : instance("default") {}
+
+ void setInstance(const char* _instance) { instance = _instance; }
+
+ const hidl_string getInstance() const { return instance; }
+
+ int initFromOptions(int argc, char** argv) {
+ static struct option options[] = {
+ {"instance", required_argument, 0, 'I'}, {0, 0, 0, 0}};
+
+ while (true) {
+ int index = 0;
+ int c = getopt_long(argc, argv, "I:", options, &index);
+ if (c == -1) {
+ break;
+ }
+
+ switch (c) {
+ case 'I':
+ setInstance(optarg);
+ break;
+ case '?':
+ break;
+ }
+ }
+
+ if (optind < argc) {
+ fprintf(stderr,
+ "unrecognized option: %s\n\n"
+ "usage: %s <gtest options> <test options>\n\n"
+ "test options are:\n\n"
+ "-I, --instance: HAL instance to test\n",
+ argv[optind ?: 1], argv[0]);
+ return 2;
+ }
+ return 0;
+ }
+
+ private:
+ hidl_string instance;
+};
+
+static ComponentTestEnvironment* gEnv = nullptr;
+
+class MasterHidlTest : public ::testing::VtsHalHidlTargetTestBase {
+ public:
+ virtual void SetUp() override {
+ omx = ::testing::VtsHalHidlTargetTestBase::getService<IOmx>(
+ gEnv->getInstance());
+ ASSERT_NE(omx, nullptr);
+ }
+
+ virtual void TearDown() override {}
+
+ sp<IOmx> omx;
+};
+
+// enumerate list of components and roles
+TEST_F(MasterHidlTest, ListNodes) {
+ android::hardware::media::omx::V1_0::Status status;
+ hidl_vec<IOmx::ComponentInfo> nodeList;
+ EXPECT_TRUE(
+ omx->listNodes([&status, &nodeList](
+ android::hardware::media::omx::V1_0::Status _s,
+ hidl_vec<IOmx::ComponentInfo> const& _nl) {
+ status = _s;
+ nodeList = _nl;
+ })
+ .isOk());
+}
+
+int main(int argc, char** argv) {
+ gEnv = new ComponentTestEnvironment();
+ ::testing::AddGlobalTestEnvironment(gEnv);
+ ::testing::InitGoogleTest(&argc, argv);
+ int status = gEnv->initFromOptions(argc, argv);
+ if (status == 0) {
+ status = RUN_ALL_TESTS();
+ ALOGI("Test result = %d", status);
+ }
+ return status;
+}
diff --git a/memtrack/1.0/Android.bp b/memtrack/1.0/Android.bp
index 4f13463..4a4e179 100644
--- a/memtrack/1.0/Android.bp
+++ b/memtrack/1.0/Android.bp
@@ -44,6 +44,7 @@
generated_sources: ["android.hardware.memtrack@1.0_genc++"],
generated_headers: ["android.hardware.memtrack@1.0_genc++_headers"],
export_generated_headers: ["android.hardware.memtrack@1.0_genc++_headers"],
+ vendor_available: true,
shared_libs: [
"libhidlbase",
"libhidltransport",
diff --git a/memtrack/1.0/Android.mk b/memtrack/1.0/Android.mk
index 62bee97..8583b0a 100644
--- a/memtrack/1.0/Android.mk
+++ b/memtrack/1.0/Android.mk
@@ -5,7 +5,7 @@
################################################################################
include $(CLEAR_VARS)
-LOCAL_MODULE := android.hardware.memtrack@1.0-java
+LOCAL_MODULE := android.hardware.memtrack-V1.0-java
LOCAL_MODULE_CLASS := JAVA_LIBRARIES
intermediates := $(call local-generated-sources-dir, COMMON)
@@ -13,7 +13,7 @@
HIDL := $(HOST_OUT_EXECUTABLES)/hidl-gen$(HOST_EXECUTABLE_SUFFIX)
LOCAL_JAVA_LIBRARIES := \
- android.hidl.base@1.0-java \
+ android.hidl.base-V1.0-java \
#
@@ -118,7 +118,7 @@
################################################################################
include $(CLEAR_VARS)
-LOCAL_MODULE := android.hardware.memtrack@1.0-java-static
+LOCAL_MODULE := android.hardware.memtrack-V1.0-java-static
LOCAL_MODULE_CLASS := JAVA_LIBRARIES
intermediates := $(call local-generated-sources-dir, COMMON)
@@ -126,7 +126,7 @@
HIDL := $(HOST_OUT_EXECUTABLES)/hidl-gen$(HOST_EXECUTABLE_SUFFIX)
LOCAL_STATIC_JAVA_LIBRARIES := \
- android.hidl.base@1.0-java-static \
+ android.hidl.base-V1.0-java-static \
#
diff --git a/nfc/1.0/Android.bp b/nfc/1.0/Android.bp
index 7ee3a9e..f583a42 100644
--- a/nfc/1.0/Android.bp
+++ b/nfc/1.0/Android.bp
@@ -51,6 +51,7 @@
generated_sources: ["android.hardware.nfc@1.0_genc++"],
generated_headers: ["android.hardware.nfc@1.0_genc++_headers"],
export_generated_headers: ["android.hardware.nfc@1.0_genc++_headers"],
+ vendor_available: true,
shared_libs: [
"libhidlbase",
"libhidltransport",
diff --git a/nfc/1.0/Android.mk b/nfc/1.0/Android.mk
index 6f09764..3ea7707 100644
--- a/nfc/1.0/Android.mk
+++ b/nfc/1.0/Android.mk
@@ -5,7 +5,7 @@
################################################################################
include $(CLEAR_VARS)
-LOCAL_MODULE := android.hardware.nfc@1.0-java
+LOCAL_MODULE := android.hardware.nfc-V1.0-java
LOCAL_MODULE_CLASS := JAVA_LIBRARIES
intermediates := $(call local-generated-sources-dir, COMMON)
@@ -13,7 +13,7 @@
HIDL := $(HOST_OUT_EXECUTABLES)/hidl-gen$(HOST_EXECUTABLE_SUFFIX)
LOCAL_JAVA_LIBRARIES := \
- android.hidl.base@1.0-java \
+ android.hidl.base-V1.0-java \
#
@@ -103,7 +103,7 @@
################################################################################
include $(CLEAR_VARS)
-LOCAL_MODULE := android.hardware.nfc@1.0-java-static
+LOCAL_MODULE := android.hardware.nfc-V1.0-java-static
LOCAL_MODULE_CLASS := JAVA_LIBRARIES
intermediates := $(call local-generated-sources-dir, COMMON)
@@ -111,7 +111,7 @@
HIDL := $(HOST_OUT_EXECUTABLES)/hidl-gen$(HOST_EXECUTABLE_SUFFIX)
LOCAL_STATIC_JAVA_LIBRARIES := \
- android.hidl.base@1.0-java-static \
+ android.hidl.base-V1.0-java-static \
#
@@ -201,7 +201,7 @@
################################################################################
include $(CLEAR_VARS)
-LOCAL_MODULE := android.hardware.nfc@1.0-java-constants
+LOCAL_MODULE := android.hardware.nfc-V1.0-java-constants
LOCAL_MODULE_CLASS := JAVA_LIBRARIES
intermediates := $(call local-generated-sources-dir, COMMON)
diff --git a/power/1.0/Android.bp b/power/1.0/Android.bp
index f9d18c8..5958b12 100644
--- a/power/1.0/Android.bp
+++ b/power/1.0/Android.bp
@@ -44,6 +44,7 @@
generated_sources: ["android.hardware.power@1.0_genc++"],
generated_headers: ["android.hardware.power@1.0_genc++_headers"],
export_generated_headers: ["android.hardware.power@1.0_genc++_headers"],
+ vendor_available: true,
shared_libs: [
"libhidlbase",
"libhidltransport",
diff --git a/power/1.0/Android.mk b/power/1.0/Android.mk
index 98d95a8..8a89a45 100644
--- a/power/1.0/Android.mk
+++ b/power/1.0/Android.mk
@@ -5,7 +5,7 @@
################################################################################
include $(CLEAR_VARS)
-LOCAL_MODULE := android.hardware.power@1.0-java
+LOCAL_MODULE := android.hardware.power-V1.0-java
LOCAL_MODULE_CLASS := JAVA_LIBRARIES
intermediates := $(call local-generated-sources-dir, COMMON)
@@ -13,7 +13,7 @@
HIDL := $(HOST_OUT_EXECUTABLES)/hidl-gen$(HOST_EXECUTABLE_SUFFIX)
LOCAL_JAVA_LIBRARIES := \
- android.hidl.base@1.0-java \
+ android.hidl.base-V1.0-java \
#
@@ -137,7 +137,7 @@
################################################################################
include $(CLEAR_VARS)
-LOCAL_MODULE := android.hardware.power@1.0-java-static
+LOCAL_MODULE := android.hardware.power-V1.0-java-static
LOCAL_MODULE_CLASS := JAVA_LIBRARIES
intermediates := $(call local-generated-sources-dir, COMMON)
@@ -145,7 +145,7 @@
HIDL := $(HOST_OUT_EXECUTABLES)/hidl-gen$(HOST_EXECUTABLE_SUFFIX)
LOCAL_STATIC_JAVA_LIBRARIES := \
- android.hidl.base@1.0-java-static \
+ android.hidl.base-V1.0-java-static \
#
diff --git a/power/1.0/default/Power.cpp b/power/1.0/default/Power.cpp
index 6ea9167..51f87f5 100644
--- a/power/1.0/default/Power.cpp
+++ b/power/1.0/default/Power.cpp
@@ -145,25 +145,27 @@
}
IPower* HIDL_FETCH_IPower(const char* /* name */) {
- int ret = 0;
- const hw_module_t* hw_module = NULL;
- power_module_t *power_module;
- ret = hw_get_module(POWER_HARDWARE_MODULE_ID, &hw_module);
- if (ret == 0 && hw_module->methods->open) {
- ret = hw_module->methods->open(hw_module, POWER_HARDWARE_MODULE_ID,
- reinterpret_cast<hw_device_t**>(&power_module));
- if (ret == 0) {
- return new Power(power_module);
- }
- else {
- ALOGE("Passthrough failed to load legacy power HAL.");
+ const hw_module_t* hw_module = nullptr;
+ power_module_t* power_module = nullptr;
+ int err = hw_get_module(POWER_HARDWARE_MODULE_ID, &hw_module);
+ if (err) {
+ ALOGE("hw_get_module %s failed: %d", POWER_HARDWARE_MODULE_ID, err);
+ return nullptr;
+ }
+
+ if (!hw_module->methods || !hw_module->methods->open) {
+ power_module = reinterpret_cast<power_module_t*>(
+ const_cast<hw_module_t*>(hw_module));
+ } else {
+ err = hw_module->methods->open(
+ hw_module, POWER_HARDWARE_MODULE_ID,
+ reinterpret_cast<hw_device_t**>(&power_module));
+ if (err) {
+ ALOGE("Passthrough failed to load legacy HAL.");
return nullptr;
}
}
- else {
- ALOGE ("hw_get_module %s failed: %d", POWER_HARDWARE_MODULE_ID, ret);
- return nullptr;
- }
+ return new Power(power_module);
}
} // namespace implementation
diff --git a/radio/1.0/Android.bp b/radio/1.0/Android.bp
index e457795..768de49 100644
--- a/radio/1.0/Android.bp
+++ b/radio/1.0/Android.bp
@@ -72,6 +72,7 @@
generated_sources: ["android.hardware.radio@1.0_genc++"],
generated_headers: ["android.hardware.radio@1.0_genc++_headers"],
export_generated_headers: ["android.hardware.radio@1.0_genc++_headers"],
+ vendor_available: true,
shared_libs: [
"libhidlbase",
"libhidltransport",
diff --git a/radio/1.0/Android.mk b/radio/1.0/Android.mk
index 94072fb..a71e672 100644
--- a/radio/1.0/Android.mk
+++ b/radio/1.0/Android.mk
@@ -5,7 +5,7 @@
################################################################################
include $(CLEAR_VARS)
-LOCAL_MODULE := android.hardware.radio@1.0-java
+LOCAL_MODULE := android.hardware.radio-V1.0-java
LOCAL_MODULE_CLASS := JAVA_LIBRARIES
intermediates := $(call local-generated-sources-dir, COMMON)
@@ -13,7 +13,7 @@
HIDL := $(HOST_OUT_EXECUTABLES)/hidl-gen$(HOST_EXECUTABLE_SUFFIX)
LOCAL_JAVA_LIBRARIES := \
- android.hidl.base@1.0-java \
+ android.hidl.base-V1.0-java \
#
@@ -1841,6 +1841,25 @@
LOCAL_GENERATED_SOURCES += $(GEN)
#
+# Build types.hal (P2Constant)
+#
+GEN := $(intermediates)/android/hardware/radio/V1_0/P2Constant.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava \
+ -randroid.hardware:hardware/interfaces \
+ -randroid.hidl:system/libhidl/transport \
+ android.hardware.radio@1.0::types.P2Constant
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
# Build types.hal (PcoDataInfo)
#
GEN := $(intermediates)/android/hardware/radio/V1_0/PcoDataInfo.java
@@ -3039,7 +3058,7 @@
################################################################################
include $(CLEAR_VARS)
-LOCAL_MODULE := android.hardware.radio@1.0-java-static
+LOCAL_MODULE := android.hardware.radio-V1.0-java-static
LOCAL_MODULE_CLASS := JAVA_LIBRARIES
intermediates := $(call local-generated-sources-dir, COMMON)
@@ -3047,7 +3066,7 @@
HIDL := $(HOST_OUT_EXECUTABLES)/hidl-gen$(HOST_EXECUTABLE_SUFFIX)
LOCAL_STATIC_JAVA_LIBRARIES := \
- android.hidl.base@1.0-java-static \
+ android.hidl.base-V1.0-java-static \
#
@@ -4875,6 +4894,25 @@
LOCAL_GENERATED_SOURCES += $(GEN)
#
+# Build types.hal (P2Constant)
+#
+GEN := $(intermediates)/android/hardware/radio/V1_0/P2Constant.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava \
+ -randroid.hardware:hardware/interfaces \
+ -randroid.hidl:system/libhidl/transport \
+ android.hardware.radio@1.0::types.P2Constant
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
# Build types.hal (PcoDataInfo)
#
GEN := $(intermediates)/android/hardware/radio/V1_0/PcoDataInfo.java
diff --git a/radio/1.0/IRadio.hal b/radio/1.0/IRadio.hal
index 2976290..236dbf5 100644
--- a/radio/1.0/IRadio.hal
+++ b/radio/1.0/IRadio.hal
@@ -1285,10 +1285,11 @@
*
* @param serial Serial number of request.
* @param aid AID value, See ETSI 102.221 and 101.220.
+ * @param p2 P2 value, described in ISO 7816-4. Ignore if equal to P2Constant:NO_P2
*
* Response callback is IRadioResponse.iccOpenLogicalChannelResponse()
*/
- oneway iccOpenLogicalChannel(int32_t serial, string aid);
+ oneway iccOpenLogicalChannel(int32_t serial, string aid, int32_t p2);
/**
* Close a previously opened logical channel. This command reflects TS 27.007
diff --git a/radio/1.0/types.hal b/radio/1.0/types.hal
index 2224c8b..c5d7f8a 100644
--- a/radio/1.0/types.hal
+++ b/radio/1.0/types.hal
@@ -1161,6 +1161,10 @@
// this doesn't mean no data is expected.
};
+enum P2Constant : int32_t {
+ NO_P2 = -1, // No P2 value is provided
+};
+
struct RadioResponseInfo {
RadioResponseType type; // Response type
int32_t serial; // Serial number of the request
diff --git a/radio/1.0/vts/functional/radio_hidl_hal_icc.cpp b/radio/1.0/vts/functional/radio_hidl_hal_icc.cpp
index 19738d5..b759c48 100644
--- a/radio/1.0/vts/functional/radio_hidl_hal_icc.cpp
+++ b/radio/1.0/vts/functional/radio_hidl_hal_icc.cpp
@@ -246,12 +246,15 @@
*/
TEST_F(RadioHidlTest, iccOpenLogicalChannel) {
int serial = 1;
-
+ int p2 = 0x04;
+ // Specified in ISO 7816-4 clause 7.1.1 0x04 means that FCP template is
+ // requested.
for (int i = 0; i < (int)cardStatus.applications.size(); i++) {
- radio->iccOpenLogicalChannel(++serial, cardStatus.applications[i].aidPtr);
- EXPECT_EQ(std::cv_status::no_timeout, wait());
- EXPECT_EQ(serial, radioRsp->rspInfo.serial);
- EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
+ radio->iccOpenLogicalChannel(++serial, cardStatus.applications[i].aidPtr,
+ p2);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(serial, radioRsp->rspInfo.serial);
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
}
}
@@ -317,4 +320,4 @@
if (cardStatus.cardState == CardState::ABSENT) {
ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::PASSWORD_INCORRECT);
}
-}
\ No newline at end of file
+}
diff --git a/radio/1.0/vts/functional/radio_hidl_hal_test.cpp b/radio/1.0/vts/functional/radio_hidl_hal_test.cpp
index 9094f39..d40f15a 100644
--- a/radio/1.0/vts/functional/radio_hidl_hal_test.cpp
+++ b/radio/1.0/vts/functional/radio_hidl_hal_test.cpp
@@ -18,7 +18,7 @@
void RadioHidlTest::SetUp() {
radio = ::testing::VtsHalHidlTargetTestBase::getService<IRadio>(
- hidl_string("rild"));
+ hidl_string(RADIO_SERVICE_NAME));
ASSERT_NE(radio, nullptr);
radioRsp = new RadioResponse(*this);
diff --git a/radio/1.0/vts/functional/radio_hidl_hal_utils.h b/radio/1.0/vts/functional/radio_hidl_hal_utils.h
index 6826238..51db87b 100644
--- a/radio/1.0/vts/functional/radio_hidl_hal_utils.h
+++ b/radio/1.0/vts/functional/radio_hidl_hal_utils.h
@@ -81,6 +81,7 @@
using ::android::sp;
#define TIMEOUT_PERIOD 40
+#define RADIO_SERVICE_NAME "slot1"
class RadioHidlTest;
extern CardStatus cardStatus;
diff --git a/radio/1.0/vts/functional/sap_hidl_hal_test.cpp b/radio/1.0/vts/functional/sap_hidl_hal_test.cpp
index 88274cd..02accef 100644
--- a/radio/1.0/vts/functional/sap_hidl_hal_test.cpp
+++ b/radio/1.0/vts/functional/sap_hidl_hal_test.cpp
@@ -18,7 +18,7 @@
void SapHidlTest::SetUp() {
sap = ::testing::VtsHalHidlTargetTestBase::getService<ISap>(
- hidl_string("sap_uim_socket1"));
+ hidl_string(SAP_SERVICE_NAME));
ASSERT_NE(sap, nullptr);
sapCb = new SapCallback(*this);
diff --git a/radio/1.0/vts/functional/sap_hidl_hal_utils.h b/radio/1.0/vts/functional/sap_hidl_hal_utils.h
index 2ee3c96..38fb003 100644
--- a/radio/1.0/vts/functional/sap_hidl_hal_utils.h
+++ b/radio/1.0/vts/functional/sap_hidl_hal_utils.h
@@ -34,6 +34,7 @@
using ::android::sp;
#define TIMEOUT_PERIOD 40
+#define SAP_SERVICE_NAME "slot1"
class SapHidlTest;
diff --git a/radio/deprecated/1.0/Android.bp b/radio/deprecated/1.0/Android.bp
index f8a9c64..e81186c 100644
--- a/radio/deprecated/1.0/Android.bp
+++ b/radio/deprecated/1.0/Android.bp
@@ -54,6 +54,7 @@
generated_sources: ["android.hardware.radio.deprecated@1.0_genc++"],
generated_headers: ["android.hardware.radio.deprecated@1.0_genc++_headers"],
export_generated_headers: ["android.hardware.radio.deprecated@1.0_genc++_headers"],
+ vendor_available: true,
shared_libs: [
"libhidlbase",
"libhidltransport",
diff --git a/radio/deprecated/1.0/Android.mk b/radio/deprecated/1.0/Android.mk
index 4cce633..11377d8 100644
--- a/radio/deprecated/1.0/Android.mk
+++ b/radio/deprecated/1.0/Android.mk
@@ -5,7 +5,7 @@
################################################################################
include $(CLEAR_VARS)
-LOCAL_MODULE := android.hardware.radio.deprecated@1.0-java
+LOCAL_MODULE := android.hardware.radio.deprecated-V1.0-java
LOCAL_MODULE_CLASS := JAVA_LIBRARIES
intermediates := $(call local-generated-sources-dir, COMMON)
@@ -13,8 +13,8 @@
HIDL := $(HOST_OUT_EXECUTABLES)/hidl-gen$(HOST_EXECUTABLE_SUFFIX)
LOCAL_JAVA_LIBRARIES := \
- android.hardware.radio@1.0-java \
- android.hidl.base@1.0-java \
+ android.hardware.radio-V1.0-java \
+ android.hidl.base-V1.0-java \
#
@@ -83,7 +83,7 @@
################################################################################
include $(CLEAR_VARS)
-LOCAL_MODULE := android.hardware.radio.deprecated@1.0-java-static
+LOCAL_MODULE := android.hardware.radio.deprecated-V1.0-java-static
LOCAL_MODULE_CLASS := JAVA_LIBRARIES
intermediates := $(call local-generated-sources-dir, COMMON)
@@ -91,8 +91,8 @@
HIDL := $(HOST_OUT_EXECUTABLES)/hidl-gen$(HOST_EXECUTABLE_SUFFIX)
LOCAL_STATIC_JAVA_LIBRARIES := \
- android.hardware.radio@1.0-java-static \
- android.hidl.base@1.0-java-static \
+ android.hardware.radio-V1.0-java-static \
+ android.hidl.base-V1.0-java-static \
#
diff --git a/renderscript/1.0/Android.bp b/renderscript/1.0/Android.bp
index 9f2a589..b82dc4a 100644
--- a/renderscript/1.0/Android.bp
+++ b/renderscript/1.0/Android.bp
@@ -51,6 +51,7 @@
generated_sources: ["android.hardware.renderscript@1.0_genc++"],
generated_headers: ["android.hardware.renderscript@1.0_genc++_headers"],
export_generated_headers: ["android.hardware.renderscript@1.0_genc++_headers"],
+ vendor_available: true,
shared_libs: [
"libhidlbase",
"libhidltransport",
diff --git a/renderscript/1.0/Android.mk b/renderscript/1.0/Android.mk
index 5c3a37d..cdd580a 100644
--- a/renderscript/1.0/Android.mk
+++ b/renderscript/1.0/Android.mk
@@ -5,7 +5,7 @@
################################################################################
include $(CLEAR_VARS)
-LOCAL_MODULE := android.hardware.renderscript@1.0-java-constants
+LOCAL_MODULE := android.hardware.renderscript-V1.0-java-constants
LOCAL_MODULE_CLASS := JAVA_LIBRARIES
intermediates := $(call local-generated-sources-dir, COMMON)
diff --git a/renderscript/1.0/vts/functional/VtsCopyTests.cpp b/renderscript/1.0/vts/functional/VtsCopyTests.cpp
index 168e681..f47253f 100644
--- a/renderscript/1.0/vts/functional/VtsCopyTests.cpp
+++ b/renderscript/1.0/vts/functional/VtsCopyTests.cpp
@@ -30,12 +30,18 @@
TEST_F(RenderscriptHidlTest, Simple1DCopyTest) {
// float1
Element element = context->elementCreate(DataType::FLOAT_32, DataKind::USER, false, 1);
+ ASSERT_NE(Element(0), element);
+
// 128 x float1
Type type = context->typeCreate(element, 128, 0, 0, false, false, YuvFormat::YUV_NONE);
+ ASSERT_NE(Type(0), type);
+
// 128 x float1
Allocation allocation = context->allocationCreateTyped(type, AllocationMipmapControl::NONE,
(int)AllocationUsageType::SCRIPT,
(Ptr)nullptr);
+ ASSERT_NE(Allocation(0), allocation);
+
std::vector<float> dataIn(128), dataOut(128);
std::generate(dataIn.begin(), dataIn.end(), [](){ static int val = 0; return (float)val++; });
hidl_vec<uint8_t> _data;
@@ -60,12 +66,18 @@
TEST_F(RenderscriptHidlTest, Simple2DCopyTest) {
// float1
Element element = context->elementCreate(DataType::FLOAT_32, DataKind::USER, false, 1);
+ ASSERT_NE(Element(0), element);
+
// 128 x 128 x float1
Type type = context->typeCreate(element, 128, 128, 0, false, false, YuvFormat::YUV_NONE);
+ ASSERT_NE(Type(0), type);
+
// 128 x 128 x float1
Allocation allocation = context->allocationCreateTyped(type, AllocationMipmapControl::NONE,
(int)AllocationUsageType::SCRIPT,
(Ptr)nullptr);
+ ASSERT_NE(Allocation(0), allocation);
+
std::vector<float> dataIn(128*128), dataOut(128*128);
std::generate(dataIn.begin(), dataIn.end(), [](){ static int val = 0; return (float)val++; });
hidl_vec<uint8_t> _data;
@@ -91,12 +103,18 @@
TEST_F(RenderscriptHidlTest, Simple3DCopyTest) {
// float1
Element element = context->elementCreate(DataType::FLOAT_32, DataKind::USER, false, 1);
+ ASSERT_NE(Element(0), element);
+
// 32 x 32 x 32 x float1
Type type = context->typeCreate(element, 32, 32, 32, false, false, YuvFormat::YUV_NONE);
+ ASSERT_NE(Type(0), type);
+
// 32 x 32 x 32 x float1
Allocation allocation = context->allocationCreateTyped(type, AllocationMipmapControl::NONE,
(int)AllocationUsageType::SCRIPT,
(Ptr)nullptr);
+ ASSERT_NE(Allocation(0), allocation);
+
std::vector<float> dataIn(32*32*32), dataOut(32*32*32);
std::generate(dataIn.begin(), dataIn.end(), [](){ static int val = 0; return (float)val++; });
hidl_vec<uint8_t> _data;
@@ -122,8 +140,12 @@
TEST_F(RenderscriptHidlTest, SimpleBitmapTest) {
// float1
Element element = context->elementCreate(DataType::FLOAT_32, DataKind::USER, false, 1);
+ ASSERT_NE(Element(0), element);
+
// 512 x 512 x float1
Type type = context->typeCreate(element, 512, 512, 0, false, false, YuvFormat::YUV_NONE);
+ ASSERT_NE(Type(0), type);
+
std::vector<float> dataIn(512*512), dataOut1(512*512), dataOut2(512*512);
std::generate(dataIn.begin(), dataIn.end(), [](){ static int val = 0; return (float)val++; });
hidl_vec<uint8_t> _data;
@@ -133,7 +155,7 @@
AllocationMipmapControl::NONE,
_data,
(int)AllocationUsageType::SCRIPT);
- EXPECT_NE(Allocation(0), allocation);
+ ASSERT_NE(Allocation(0), allocation);
context->allocationCopyToBitmap(allocation, (Ptr)dataOut1.data(),
(Size)dataOut1.size()*sizeof(float));
@@ -158,10 +180,16 @@
TEST_F(RenderscriptHidlTest, AllocationCopy2DRangeTest) {
// float1
Element element = context->elementCreate(DataType::FLOAT_32, DataKind::USER, false, 1);
+ ASSERT_NE(Element(0), element);
+
// 512 x 512 x float1
Type typeSrc = context->typeCreate(element, 512, 512, 0, false, false, YuvFormat::YUV_NONE);
+ ASSERT_NE(Type(0), typeSrc);
+
// 256 x 256 x float1
Type typeDst = context->typeCreate(element, 256, 256, 0, false, false, YuvFormat::YUV_NONE);
+ ASSERT_NE(Type(0), typeDst);
+
std::vector<float> dataIn(512*512), dataOut(256*256), expected(256*256);
std::generate(dataIn.begin(), dataIn.end(), [](){ static int val = 0; return (float)val++; });
hidl_vec<uint8_t> _data;
@@ -170,10 +198,14 @@
Allocation allocSrc = context->allocationCreateFromBitmap(typeSrc,
AllocationMipmapControl::NONE, _data,
(int)AllocationUsageType::SCRIPT);
+ ASSERT_NE(Allocation(0), allocSrc);
+
// 256 x 256 x float1
Allocation allocDst = context->allocationCreateTyped(typeDst, AllocationMipmapControl::NONE,
(int)AllocationUsageType::SCRIPT,
(Ptr)nullptr);
+ ASSERT_NE(Allocation(0), allocDst);
+
context->allocationCopy2DRange(allocDst, 0, 0, 0, AllocationCubemapFace::POSITIVE_X, 256, 256,
allocSrc, 128, 128, 0, AllocationCubemapFace::POSITIVE_X);
context->allocationRead(allocDst, (Ptr)dataOut.data(), (Size)dataOut.size()*sizeof(float));
@@ -200,10 +232,16 @@
TEST_F(RenderscriptHidlTest, AllocationCopy3DRangeTest) {
// float1
Element element = context->elementCreate(DataType::FLOAT_32, DataKind::USER, false, 1);
+ ASSERT_NE(Element(0), element);
+
// 128 x 128 x 128 x float1
Type typeSrc = context->typeCreate(element, 128, 128, 128, false, false, YuvFormat::YUV_NONE);
+ ASSERT_NE(Type(0), typeSrc);
+
// 64 x 64 x 64 x float1
Type typeDst = context->typeCreate(element, 64, 64, 64, false, false, YuvFormat::YUV_NONE);
+ ASSERT_NE(Type(0), typeDst);
+
std::vector<float> dataIn(128*128*128), dataOut(64*64*64), expected(64*64*64);
std::generate(dataIn.begin(), dataIn.end(), [](){ static int val = 0; return (float)val++; });
hidl_vec<uint8_t> _data;
@@ -212,10 +250,14 @@
Allocation allocSrc = context->allocationCreateTyped(typeSrc, AllocationMipmapControl::NONE,
(int)AllocationUsageType::SCRIPT,
(Ptr)nullptr);
+ ASSERT_NE(Allocation(0), allocSrc);
+
// 256 x 256 x float1
Allocation allocDst = context->allocationCreateTyped(typeDst, AllocationMipmapControl::NONE,
(int)AllocationUsageType::SCRIPT,
(Ptr)nullptr);
+ ASSERT_NE(Allocation(0), allocDst);
+
context->allocation3DWrite(allocSrc, 0, 0, 0, 0, 128, 128, 128, _data, 128*sizeof(float));
context->allocationCopy3DRange(allocDst, 0, 0, 0, 0, 64, 64, 64, allocSrc, 32, 32, 32, 0);
context->allocationRead(allocDst, (Ptr)dataOut.data(), (Size)dataOut.size()*sizeof(float));
@@ -243,8 +285,12 @@
TEST_F(RenderscriptHidlTest, SimpleAdapterTest) {
// float1
Element element = context->elementCreate(DataType::FLOAT_32, DataKind::USER, false, 1);
+ ASSERT_NE(Element(0), element);
+
// 512 x 512 x float1
Type type = context->typeCreate(element, 512, 512, 0, false, false, YuvFormat::YUV_NONE);
+ ASSERT_NE(Type(0), type);
+
std::vector<float> dataIn(512*512), dataOut(256*256), expected;
std::generate(dataIn.begin(), dataIn.end(), [](){ static int val = 0; return (float)val++; });
hidl_vec<uint8_t> _data;
@@ -254,11 +300,15 @@
AllocationMipmapControl::NONE,
_data,
(int)AllocationUsageType::SCRIPT);
+ ASSERT_NE(Allocation(0), allocation);
+
// 256 x 256 x float1
Type subType = context->typeCreate(element, 256, 256, 0, false, false, YuvFormat::YUV_NONE);
+ ASSERT_NE(Type(0), subType);
+
// 256 x 256 x float1
AllocationAdapter allocationAdapter = context->allocationAdapterCreate(subType, allocation);
- EXPECT_NE(AllocationAdapter(0), allocationAdapter);
+ ASSERT_NE(AllocationAdapter(0), allocationAdapter);
std::vector<uint32_t> offsets(9, 0);
offsets[0] = 128;
@@ -292,8 +342,12 @@
TEST_F(RenderscriptHidlTest, SimpleMipmapTest) {
// uint8_t
Element element = context->elementCreate(DataType::UNSIGNED_8, DataKind::USER, false, 1);
+ ASSERT_NE(Element(0), element);
+
// 64 x 64 x uint8_t
Type type = context->typeCreate(element, 64, 64, 0, true, false, YuvFormat::YUV_NONE);
+ ASSERT_NE(Type(0), type);
+
std::vector<uint8_t> dataIn(64*64), dataOut(32*32), expected(32*32);
std::generate(dataIn.begin(), dataIn.end(),
[](){ static int val = 0; return (uint8_t)(0xFF & val++); });
@@ -303,6 +357,8 @@
Allocation allocation = context->allocationCreateTyped(type, AllocationMipmapControl::FULL,
(int)AllocationUsageType::SCRIPT,
(Ptr)nullptr);
+ ASSERT_NE(Allocation(0), allocation);
+
context->allocation2DWrite(allocation, 0, 0, 0, AllocationCubemapFace::POSITIVE_X, 64, 64,
_data, 64*sizeof(uint8_t));
context->allocationGenerateMipmaps(allocation);
@@ -333,8 +389,12 @@
TEST_F(RenderscriptHidlTest, SimpleCubemapTest) {
// float1
Element element = context->elementCreate(DataType::FLOAT_32, DataKind::USER, false, 1);
+ ASSERT_NE(Element(0), element);
+
// 128 x 128 x float1
Type type = context->typeCreate(element, 128, 128, 0, false, true, YuvFormat::YUV_NONE);
+ ASSERT_NE(Type(0), type);
+
std::vector<float> dataIn(128*128*6), dataOut(128*128), expected(128*128);
std::generate(dataIn.begin(), dataIn.end(), [](){ static int val = 0; return (float)val++; });
hidl_vec<uint8_t> _data;
@@ -342,7 +402,7 @@
// 128 x 128 x float1 x 6
Allocation allocation = context->allocationCubeCreateFromBitmap(
type, AllocationMipmapControl::NONE, _data, (int)AllocationUsageType::SCRIPT);
- EXPECT_NE(Allocation(0), allocation);
+ ASSERT_NE(Allocation(0), allocation);
context->allocation2DRead(allocation, 0, 0, 0, AllocationCubemapFace::NEGATIVE_Z, 128,
128, (Ptr)dataOut.data(), (Size)dataOut.size()*sizeof(float),
@@ -367,13 +427,16 @@
*/
TEST_F(RenderscriptHidlTest, ComplexElementTest) {
Element element1 = context->elementCreate(DataType::UNSIGNED_8, DataKind::USER, false, 1);
+ ASSERT_NE(Element(0), element1);
+
Element element2 = context->elementCreate(DataType::UNSIGNED_32, DataKind::USER, false, 1);
+ ASSERT_NE(Element(0), element2);
hidl_vec<Element> eins = {element1, element2};
hidl_vec<hidl_string> names = {hidl_string("first"), hidl_string("second")};
hidl_vec<Size> arraySizesPtr = {1, 1};
Element element3 = context->elementComplexCreate(eins, names, arraySizesPtr);
- EXPECT_NE(Element(0), element3);
+ ASSERT_NE(Element(0), element3);
std::vector<Element> ids;
std::vector<std::string> namesOut;
@@ -395,10 +458,14 @@
// 1 x (uint8_t, uint32_t)
Type type = context->typeCreate(element3, 1, 0, 0, false, false, YuvFormat::YUV_NONE);
+ ASSERT_NE(Type(0), type);
+
// 1 x (uint8_t, uint32_t)
Allocation allocation = context->allocationCreateTyped(type, AllocationMipmapControl::NONE,
(int)AllocationUsageType::SCRIPT,
(Ptr)nullptr);
+ ASSERT_NE(Allocation(0), allocation);
+
std::vector<uint32_t> dataIn(1), dataOut(1);
std::generate(dataIn.begin(), dataIn.end(), [](){ static uint32_t val = 0; return val++; });
hidl_vec<uint8_t> _data;
diff --git a/renderscript/1.0/vts/functional/VtsMiscellaneousTests.cpp b/renderscript/1.0/vts/functional/VtsMiscellaneousTests.cpp
index 39d63ca..278dbf3 100644
--- a/renderscript/1.0/vts/functional/VtsMiscellaneousTests.cpp
+++ b/renderscript/1.0/vts/functional/VtsMiscellaneousTests.cpp
@@ -46,18 +46,18 @@
TEST_F(RenderscriptHidlTest, ElementTypeAllocationCreate) {
// Element create test
Element element = context->elementCreate(DataType::FLOAT_32, DataKind::USER, false, 1);
- EXPECT_NE(Element(0), element);
+ ASSERT_NE(Element(0), element);
// Type create test
Type type = context->typeCreate(element, 1, 0, 0, false, false, YuvFormat::YUV_NONE);
- EXPECT_NE(Type(0), type);
+ ASSERT_NE(Type(0), type);
// Allocation create test
Allocation allocation = context->allocationCreateTyped(type, AllocationMipmapControl::NONE,
(int)((uint32_t)AllocationUsageType::ALL
& ~(uint32_t)AllocationUsageType::OEM),
(Ptr)nullptr);
- EXPECT_NE(Allocation(0), allocation);
+ ASSERT_NE(Allocation(0), allocation);
// Allocation type test
Type type2 = context->allocationGetType(allocation);
@@ -74,8 +74,11 @@
TEST_F(RenderscriptHidlTest, MetadataTest) {
// float1
Element element = context->elementCreate(DataType::FLOAT_32, DataKind::USER, false, 1);
+ ASSERT_NE(Element(0), element);
+
// 128 x float1
Type type = context->typeCreate(element, 128, 0, 0, false, false, YuvFormat::YUV_NONE);
+ ASSERT_NE(Type(0), type);
std::vector<uint32_t> elementMetadata(5);
context->elementGetNativeMetadata(element, [&](const hidl_vec<uint32_t>& _metadata){
@@ -107,24 +110,30 @@
TEST_F(RenderscriptHidlTest, ResizeTest) {
// float1
Element element = context->elementCreate(DataType::FLOAT_32, DataKind::USER, false, 1);
+ ASSERT_NE(Element(0), element);
+
// 128 x float1
Type type = context->typeCreate(element, 128, 0, 0, false, false, YuvFormat::YUV_NONE);
+ ASSERT_NE(Type(0), type);
+
// 128 x float1
Allocation allocation = context->allocationCreateTyped(type, AllocationMipmapControl::NONE,
(int)AllocationUsageType::SCRIPT,
(Ptr)nullptr);
+ ASSERT_NE(Allocation(0), allocation);
+
Ptr dataPtr1, dataPtr2;
Size stride;
context->allocationGetPointer(allocation, 0, AllocationCubemapFace::POSITIVE_X, 0,
[&](Ptr _dataPtr, Size _stride){
dataPtr1 = _dataPtr; stride = _stride; });
- EXPECT_EQ(0ul, stride);
+ EXPECT_EQ(Size(0), stride);
context->allocationResize1D(allocation, 1024*1024);
context->allocationGetPointer(allocation, 0, AllocationCubemapFace::POSITIVE_X, 0,
[&](Ptr _dataPtr, Size _stride){
dataPtr2 = _dataPtr; stride = _stride; });
- EXPECT_EQ(0ul, stride);
+ EXPECT_EQ(Size(0), stride);
EXPECT_NE(dataPtr1, dataPtr2);
}
@@ -139,8 +148,12 @@
TEST_F(RenderscriptHidlTest, NativeWindowIoTest) {
// uint8x4
Element element = context->elementCreate(DataType::UNSIGNED_8, DataKind::USER, false, 4);
+ ASSERT_NE(Element(0), element);
+
// 512 x 512 x uint8x4
Type type = context->typeCreate(element, 512, 512, 0, false, false, YuvFormat::YUV_NONE);
+ ASSERT_NE(Type(0), type);
+
std::vector<uint32_t> dataIn(512*512), dataOut(512*512);
std::generate(dataIn.begin(), dataIn.end(), [](){ static uint32_t val = 0; return val++; });
hidl_vec<uint8_t> _data;
@@ -150,14 +163,20 @@
(int)(AllocationUsageType::SCRIPT
| AllocationUsageType::IO_INPUT),
(Ptr)nullptr);
+ ASSERT_NE(Allocation(0), allocationRecv);
+
Allocation allocationSend = context->allocationCreateTyped(type, AllocationMipmapControl::NONE,
(int)(AllocationUsageType::SCRIPT
| AllocationUsageType::IO_OUTPUT),
(Ptr)nullptr);
+ ASSERT_NE(Allocation(0), allocationSend);
+
NativeWindow nativeWindow = context->allocationGetNativeWindow(allocationRecv);
- EXPECT_NE(NativeWindow(0), nativeWindow);
+ ASSERT_NE(NativeWindow(0), nativeWindow);
((ANativeWindow *)nativeWindow)->incStrong(nullptr);
+ native_window_api_connect((ANativeWindow*)nativeWindow,
+ NATIVE_WINDOW_API_CPU);
context->allocationSetNativeWindow(allocationSend, nativeWindow);
context->allocation2DWrite(allocationSend, 0, 0, 0, AllocationCubemapFace::POSITIVE_X, 512, 512,
@@ -174,14 +193,20 @@
* two allocations with IO_INPUT are made to share the same BufferQueue.
*
* Calls: elementCreate, typeCreate, allocationCreateTyped,
- * allocationCreateFromBitmap, allocationSetupBufferQueue,
- * allocationShareBufferQueue
+ * allocationSetupBufferQueue, allocationShareBufferQueue,
+ * allocationGetNativeWindow, allocationSetNativeWindow,
+ * allocation2DWrite, allocation2DRead, allocationIoSend,
+ * allocationIoReceive
*/
TEST_F(RenderscriptHidlTest, BufferQueueTest) {
// uint8x4
Element element = context->elementCreate(DataType::UNSIGNED_8, DataKind::USER, false, 4);
+ ASSERT_NE(Element(0), element);
+
// 512 x 512 x uint8x4
Type type = context->typeCreate(element, 512, 512, 0, false, false, YuvFormat::YUV_NONE);
+ ASSERT_NE(Type(0), type);
+
std::vector<uint32_t> dataIn(512*512), dataOut1(512*512), dataOut2(512*512);
std::generate(dataIn.begin(), dataIn.end(), [](){ static uint32_t val = 0; return val++; });
hidl_vec<uint8_t> _data;
@@ -191,23 +216,33 @@
(int)(AllocationUsageType::SCRIPT
| AllocationUsageType::IO_INPUT),
(Ptr)nullptr);
+ ASSERT_NE(Allocation(0), allocationRecv1);
+
Allocation allocationRecv2 = context->allocationCreateTyped(type, AllocationMipmapControl::NONE,
(int)(AllocationUsageType::SCRIPT
| AllocationUsageType::IO_INPUT),
(Ptr)nullptr);
+ ASSERT_NE(Allocation(0), allocationRecv2);
+
Allocation allocationSend = context->allocationCreateTyped(type, AllocationMipmapControl::NONE,
(int)(AllocationUsageType::SCRIPT
| AllocationUsageType::IO_INPUT),
(Ptr)nullptr);
+ ASSERT_NE(Allocation(0), allocationSend);
+
context->allocationSetupBufferQueue(allocationRecv1, 2);
context->allocationShareBufferQueue(allocationRecv2, allocationRecv1);
NativeWindow nativeWindow1 = context->allocationGetNativeWindow(allocationRecv1);
- EXPECT_NE(NativeWindow(0), nativeWindow1);
+ ASSERT_NE(NativeWindow(0), nativeWindow1);
+
NativeWindow nativeWindow2 = context->allocationGetNativeWindow(allocationRecv2);
+ ASSERT_NE(NativeWindow(0), nativeWindow2);
EXPECT_EQ(nativeWindow2, nativeWindow1);
((ANativeWindow *)nativeWindow1)->incStrong(nullptr);
+ native_window_api_connect((ANativeWindow*)nativeWindow1,
+ NATIVE_WINDOW_API_CPU);
context->allocationSetNativeWindow(allocationSend, nativeWindow1);
context->allocation2DWrite(allocationSend, 0, 0, 0, AllocationCubemapFace::POSITIVE_X, 512, 512,
@@ -269,6 +304,8 @@
context->contextSetCacheDir("/data/local/tmp/temp/");
Element element = context->elementCreate(DataType::UNSIGNED_8, DataKind::USER, false, 1);
+ ASSERT_NE(Element(0), element);
+
std::string nameIn = "element_test_name";
std::string nameOut = "not_name";
hidl_string _nameIn;
diff --git a/renderscript/1.0/vts/functional/VtsScriptTests.cpp b/renderscript/1.0/vts/functional/VtsScriptTests.cpp
index 6bb375a..fed7c6e 100644
--- a/renderscript/1.0/vts/functional/VtsScriptTests.cpp
+++ b/renderscript/1.0/vts/functional/VtsScriptTests.cpp
@@ -25,6 +25,8 @@
TEST_F(RenderscriptHidlTest, IntrinsicTest) {
// uint8
Element element = context->elementCreate(DataType::UNSIGNED_8, DataKind::USER, false, 1);
+ EXPECT_NE(Element(0), element);
+
Script script = context->scriptIntrinsicCreate(ScriptIntrinsicID::ID_BLUR, element);
EXPECT_NE(Script(0), script);
@@ -43,7 +45,7 @@
hidl_vec<uint8_t> bitcode;
bitcode.setToExternal((uint8_t*)bitCode, bitCodeLength);
Script script = context->scriptCCreate("struct_test", "/data/local/tmp/", bitcode);
- EXPECT_NE(Script(0), script);
+ ASSERT_NE(Script(0), script);
// arg tests
context->scriptSetVarI(script, mExportVarIdx_var_int, 100);
@@ -75,12 +77,18 @@
// float1
Element element = context->elementCreate(DataType::FLOAT_32, DataKind::USER, false, 1);
+ ASSERT_NE(Element(0), element);
+
// 128 x float1
Type type = context->typeCreate(element, 128, 0, 0, false, false, YuvFormat::YUV_NONE);
+ ASSERT_NE(Type(0), type);
+
// 128 x float1
Allocation allocationIn = context->allocationCreateTyped(type, AllocationMipmapControl::NONE,
(int)AllocationUsageType::SCRIPT,
(Ptr)nullptr);
+ ASSERT_NE(Allocation(0), allocationIn);
+
Allocation allocationOut = Allocation(0);
context->scriptSetVarObj(script, mExportVarIdx_var_allocation, (ObjectBase)allocationIn);
context->scriptGetVarV(script, mExportVarIdx_var_allocation, sizeof(ObjectBase),
@@ -107,6 +115,8 @@
_dimsVE.setToExternal((uint32_t*)dimsVE.data(), dimsVE.size());
// intx2 to represent point2 which is {int, int}
Element elementVE = context->elementCreate(DataType::SIGNED_32, DataKind::USER, false, 2);
+ ASSERT_NE(Element(0), elementVE);
+
context->scriptSetVarVE(script, mExportVarIdx_var_point2, _dataVE, elementVE, _dimsVE);
context->scriptGetVarV(script, mExportVarIdx_var_point2, 2*sizeof(int),
[&](const hidl_vec<uint8_t>& _data){
@@ -126,7 +136,7 @@
hidl_vec<uint8_t> bitcode;
bitcode.setToExternal((uint8_t*)bitCode, bitCodeLength);
Script script = context->scriptCCreate("struct_test", "/data/local/tmp/", bitcode);
- EXPECT_NE(Script(0), script);
+ ASSERT_NE(Script(0), script);
// invoke test
int resultI = 0;
@@ -185,12 +195,16 @@
hidl_vec<uint8_t> bitcode;
bitcode.setToExternal((uint8_t*)bitCode, bitCodeLength);
Script script = context->scriptCCreate("struct_test", "/data/local/tmp/", bitcode);
- EXPECT_NE(Script(0), script);
+ ASSERT_NE(Script(0), script);
// uint8_t
Element element = context->elementCreate(DataType::UNSIGNED_8, DataKind::USER, false, 1);
+ ASSERT_NE(Element(0), element);
+
// 64 x uint8_t
Type type = context->typeCreate(element, 64, 0, 0, false, false, YuvFormat::YUV_NONE);
+ ASSERT_NE(Type(0), type);
+
std::vector<uint8_t> dataIn(64), dataOut(64), expected(64);
std::generate(dataIn.begin(), dataIn.end(), [](){ static uint8_t val = 0; return val++; });
std::generate(expected.begin(), expected.end(), [](){ static uint8_t val = 1; return val++; });
@@ -200,9 +214,13 @@
Allocation allocation = context->allocationCreateTyped(type, AllocationMipmapControl::NONE,
(int)AllocationUsageType::SCRIPT,
(Ptr)nullptr);
+ ASSERT_NE(Allocation(0), allocation);
+
Allocation vout = context->allocationCreateTyped(type, AllocationMipmapControl::NONE,
(int)AllocationUsageType::SCRIPT,
(Ptr)nullptr);
+ ASSERT_NE(Allocation(0), vout);
+
context->allocation1DWrite(allocation, 0, 0, (Size)dataIn.size(), _data);
hidl_vec<Allocation> vains;
vains.setToExternal(&allocation, 1);
@@ -223,13 +241,19 @@
hidl_vec<uint8_t> bitcode;
bitcode.setToExternal((uint8_t*)bitCode, bitCodeLength);
Script script = context->scriptCCreate("struct_test", "/data/local/tmp/", bitcode);
- EXPECT_NE(Script(0), script);
+ ASSERT_NE(Script(0), script);
// uint8_t
Element element = context->elementCreate(DataType::SIGNED_32, DataKind::USER, false, 1);
+ ASSERT_NE(Element(0), element);
+
// 64 x uint8_t
Type type = context->typeCreate(element, 64, 0, 0, false, false, YuvFormat::YUV_NONE);
+ ASSERT_NE(Type(0), type);
+
Type type2 = context->typeCreate(element, 1, 0, 0, false, false, YuvFormat::YUV_NONE);
+ ASSERT_NE(Type(0), type2);
+
std::vector<int> dataIn(64), dataOut(1);
std::generate(dataIn.begin(), dataIn.end(), [](){ static int val = 0; return val++; });
hidl_vec<uint8_t> _data;
@@ -238,9 +262,13 @@
Allocation allocation = context->allocationCreateTyped(type, AllocationMipmapControl::NONE,
(int)AllocationUsageType::SCRIPT,
(Ptr)nullptr);
+ ASSERT_NE(Allocation(0), allocation);
+
Allocation vaout = context->allocationCreateTyped(type2, AllocationMipmapControl::NONE,
(int)AllocationUsageType::SCRIPT,
(Ptr)nullptr);
+ ASSERT_NE(Allocation(0), vaout);
+
context->allocation1DWrite(allocation, 0, 0, (Size)dataIn.size(), _data);
hidl_vec<Allocation> vains;
vains.setToExternal(&allocation, 1);
@@ -257,22 +285,29 @@
* RenderScript script, represented in the bitcode.
*
* Calls: scriptCCreate, elementCreate, typeCreate, allocationCreateTyped,
- * scriptSetVarV, scriptBindAllocation, allocationRead
+ * allocation1DWrite, scriptBindAllocation, scriptSetVarV, scriptBindAllocation,
+ * allocationRead, scriptInvokeV, allocationRead
*/
TEST_F(RenderscriptHidlTest, ScriptBindTest) {
hidl_vec<uint8_t> bitcode;
bitcode.setToExternal((uint8_t*)bitCode, bitCodeLength);
Script script = context->scriptCCreate("struct_test", "/data/local/tmp/", bitcode);
- EXPECT_NE(Script(0), script);
+ ASSERT_NE(Script(0), script);
// in32
Element element = context->elementCreate(DataType::SIGNED_32, DataKind::USER, false, 1);
+ ASSERT_NE(Element(0), element);
+
// 64 x int32
Type type = context->typeCreate(element, 64, 0, 0, false, false, YuvFormat::YUV_NONE);
+ ASSERT_NE(Type(0), type);
+
// 64 x int32
Allocation allocation = context->allocationCreateTyped(type, AllocationMipmapControl::NONE,
(int)AllocationUsageType::SCRIPT,
(Ptr)nullptr);
+ ASSERT_NE(Allocation(0), allocation);
+
std::vector<int> dataIn(64), dataOut(64), expected(64, 5);
hidl_vec<uint8_t> _data;
_data.setToExternal((uint8_t*)dataIn.data(), dataIn.size()*sizeof(int));
@@ -295,7 +330,8 @@
*
* Calls: elementCreate, typeCreate, allocationCreateTyped, allocation2DWrite,
* scriptIntrinsicCreate, scriptKernelIDCreate, scriptFieldIDCreate,
- * scriptGroupCreate, scriptGroupSetOutput, scriptGroupExecute, allocation2DRead
+ * scriptGroupCreate, scriptSetVarObj, scriptGroupSetOutput, scriptGroupExecute,
+ * contextFinish, allocation2DRead
*/
TEST_F(RenderscriptHidlTest, ScriptGroupTest) {
std::vector<uint8_t> dataIn(256*256*1, 128), dataOut(256*256*4, 0), zeros(256*256*4, 0);
@@ -305,36 +341,49 @@
// 256 x 256 YUV pixels
Element element1 = context->elementCreate(DataType::UNSIGNED_8, DataKind::PIXEL_YUV, true, 1);
+ ASSERT_NE(Element(0), element1);
+
Type type1 = context->typeCreate(element1, 256, 256, 0, false, false, YuvFormat::YUV_420_888);
+ ASSERT_NE(Type(0), type1);
+
Allocation allocation1 = context->allocationCreateTyped(type1, AllocationMipmapControl::NONE,
(int)AllocationUsageType::SCRIPT,
(Ptr)nullptr);
+ ASSERT_NE(Allocation(0), allocation1);
+
context->allocation2DWrite(allocation1, 0, 0, 0, AllocationCubemapFace::POSITIVE_X, 256, 256,
_dataIn, 0);
// 256 x 256 RGBA pixels
Element element2 = context->elementCreate(DataType::UNSIGNED_8, DataKind::PIXEL_RGBA, true, 4);
+ ASSERT_NE(Element(0), element2);
+
Type type2 = context->typeCreate(element2, 256, 256, 0, false, false, YuvFormat::YUV_NONE);
+ ASSERT_NE(Type(0), type2);
+
Allocation allocation2 = context->allocationCreateTyped(type2, AllocationMipmapControl::NONE,
(int)AllocationUsageType::SCRIPT,
(Ptr)nullptr);
+ ASSERT_NE(Allocation(0), allocation2);
+
context->allocation2DWrite(allocation2, 0, 0, 0, AllocationCubemapFace::POSITIVE_X, 256, 256,
_dataOut, 0);
// create scripts
Script yuv2rgb = context->scriptIntrinsicCreate(ScriptIntrinsicID::ID_YUV_TO_RGB, element1);
- EXPECT_NE(Script(0), yuv2rgb);
+ ASSERT_NE(Script(0), yuv2rgb);
ScriptKernelID yuv2rgbKID = context->scriptKernelIDCreate(yuv2rgb, 0, 2);
- EXPECT_NE(ScriptKernelID(0), yuv2rgbKID);
+ ASSERT_NE(ScriptKernelID(0), yuv2rgbKID);
Script blur = context->scriptIntrinsicCreate(ScriptIntrinsicID::ID_BLUR, element2);
- EXPECT_NE(Script(0), blur);
+ ASSERT_NE(Script(0), blur);
ScriptKernelID blurKID = context->scriptKernelIDCreate(blur, 0, 2);
- EXPECT_NE(ScriptKernelID(0), blurKID);
+ ASSERT_NE(ScriptKernelID(0), blurKID);
+
ScriptFieldID blurFID = context->scriptFieldIDCreate(blur, 1);
- EXPECT_NE(ScriptFieldID(0), blurFID);
+ ASSERT_NE(ScriptFieldID(0), blurFID);
// ScriptGroup
hidl_vec<ScriptKernelID> kernels = {yuv2rgbKID, blurKID};
@@ -343,7 +392,7 @@
hidl_vec<ScriptFieldID> dstF = {blurFID};
hidl_vec<Type> types = {type2};
ScriptGroup scriptGroup = context->scriptGroupCreate(kernels, srcK, dstK, dstF, types);
- EXPECT_NE(ScriptGroup(0), scriptGroup);
+ ASSERT_NE(ScriptGroup(0), scriptGroup);
context->scriptSetVarObj(yuv2rgb, 0, (ObjectBase)allocation1);
context->scriptGroupSetOutput(scriptGroup, blurKID, allocation2);
@@ -360,14 +409,16 @@
* Similar to the ScriptGroup test, this test verifies the execution flow of
* RenderScript kernels and invokables.
*
- * Calls: scriptFieldIDCreate, closureCreate, scriptInvokeIDCreate,
- * invokeClosureCreate, closureSetGlobal, scriptGroup2Create, scriptGroupExecute
+ * Calls: scriptCCreate, elementCreate, typeCreate, allocationCreateTyped,
+ * allocation1DWrite, scriptFieldIDCreate, scriptInvokeIDCreate,
+ * invokeClosureCreate, closureCreate, closureSetGlobal, scriptGroup2Create,
+ * scriptGroupExecute, allocationRead
*/
TEST_F(RenderscriptHidlTest, ScriptGroup2Test) {
hidl_vec<uint8_t> bitcode;
bitcode.setToExternal((uint8_t*)bitCode, bitCodeLength);
Script script = context->scriptCCreate("struct_test", "/data/local/tmp/", bitcode);
- EXPECT_NE(Script(0), script);
+ ASSERT_NE(Script(0), script);
std::vector<uint8_t> dataIn(128, 128), dataOut(128, 0), expected(128, 7+1);
hidl_vec<uint8_t> _dataIn, _dataOut;
@@ -375,19 +426,23 @@
// 256 x 256 YUV pixels
Element element = context->elementCreate(DataType::UNSIGNED_8, DataKind::USER, false, 1);
+ ASSERT_NE(Element(0), element);
+
Type type = context->typeCreate(element, 128, 0, 0, false, false, YuvFormat::YUV_NONE);
+ ASSERT_NE(Type(0), type);
+
Allocation allocation = context->allocationCreateTyped(type, AllocationMipmapControl::NONE,
(int)AllocationUsageType::SCRIPT,
(Ptr)nullptr);
+ ASSERT_NE(Allocation(0), allocation);
+
context->allocation1DWrite(allocation, 0, 0, (Size)_dataIn.size(), _dataIn);
ScriptFieldID fieldID = context->scriptFieldIDCreate(script, mExportVarIdx_var_allocation);
- EXPECT_NE(ScriptFieldID(0), fieldID);
ASSERT_NE(ScriptFieldID(0), fieldID);
// invoke
ScriptInvokeID invokeID = context->scriptInvokeIDCreate(script, mExportFuncIdx_setAllocation);
- EXPECT_NE(ScriptInvokeID(0), invokeID);
ASSERT_NE(ScriptInvokeID(0), invokeID);
int dim = 128;
@@ -397,12 +452,10 @@
hidl_vec<int64_t> values1 = {int64_t(0)};
hidl_vec<int32_t> sizes1 = {int32_t(0)};
Closure closure1 = context->invokeClosureCreate(invokeID, params, fieldIDS1, values1, sizes1);
- EXPECT_NE(Closure(0), closure1);
ASSERT_NE(Closure(0), closure1);
// kernel
ScriptKernelID kernelID = context->scriptKernelIDCreate(script, mExportForEachIdx_increment, 3);
- EXPECT_NE(ScriptKernelID(0), kernelID);
ASSERT_NE(ScriptKernelID(0), kernelID);
hidl_vec<ScriptFieldID> fieldIDS2 = {ScriptFieldID(0)};
@@ -412,7 +465,6 @@
hidl_vec<ScriptFieldID> depFieldIDS2 = {fieldID};
Closure closure2 = context->closureCreate(kernelID, allocation /* returnValue */, fieldIDS2,
values2, sizes2, depClosures2, depFieldIDS2);
- EXPECT_NE(Closure(0), closure2);
ASSERT_NE(Closure(0), closure2);
// set argument
@@ -424,7 +476,6 @@
hidl_string cacheDir = "/data/local/tmp";
hidl_vec<Closure> closures = {closure1, closure2};
ScriptGroup2 scriptGroup2 = context->scriptGroup2Create(name, cacheDir, closures);
- EXPECT_NE(ScriptGroup2(0), scriptGroup2);
ASSERT_NE(ScriptGroup2(0), scriptGroup2);
context->scriptGroupExecute(scriptGroup2);
@@ -436,14 +487,15 @@
* Similar to the ScriptGroup test, this test verifies a single kernel can be
* called by ScriptGroup with an unbound allocation specified before launch
*
- * Calls: scriptFieldIDCreate, closureCreate, scriptInvokeIDCreate,
- * invokeClosureCreate, closureSetArg, scriptGroup2Create, scriptGroupExecute
+ * Calls: scriptCCreate, elementCreate, typeCreate, allocationCreateTyped,
+ * allocation1DWrite, scriptKernelIDCreate, closureCreate, closureSetArg,
+ * scriptGroup2Create, scriptGroupExecute, allocationRead
*/
TEST_F(RenderscriptHidlTest, ScriptGroup2KernelTest) {
hidl_vec<uint8_t> bitcode;
bitcode.setToExternal((uint8_t*)bitCode, bitCodeLength);
Script script = context->scriptCCreate("struct_test", "/data/local/tmp/", bitcode);
- EXPECT_NE(Script(0), script);
+ ASSERT_NE(Script(0), script);
std::vector<uint8_t> dataIn(128, 128), dataOut(128, 0), expected(128, 128 + 1);
hidl_vec<uint8_t> _dataIn, _dataOut;
@@ -451,15 +503,20 @@
// 256 x 256 YUV pixels
Element element = context->elementCreate(DataType::UNSIGNED_8, DataKind::USER, false, 1);
+ ASSERT_NE(Element(0), element);
+
Type type = context->typeCreate(element, 128, 0, 0, false, false, YuvFormat::YUV_NONE);
+ ASSERT_NE(Type(0), type);
+
Allocation allocation = context->allocationCreateTyped(type, AllocationMipmapControl::NONE,
(int)AllocationUsageType::SCRIPT,
(Ptr)nullptr);
+ ASSERT_NE(Allocation(0), allocation);
+
context->allocation1DWrite(allocation, 0, 0, (Size)_dataIn.size(), _dataIn);
// kernel
ScriptKernelID kernelID = context->scriptKernelIDCreate(script, mExportForEachIdx_increment, 3);
- EXPECT_NE(ScriptKernelID(0), kernelID);
ASSERT_NE(ScriptKernelID(0), kernelID);
hidl_vec<ScriptFieldID> fieldIDS = {ScriptFieldID(0)};
@@ -469,7 +526,6 @@
hidl_vec<ScriptFieldID> depFieldIDS = {ScriptFieldID(0)};
Closure closure = context->closureCreate(kernelID, allocation /* returnValue */, fieldIDS,
values, sizes, depClosures, depFieldIDS);
- EXPECT_NE(Closure(0), closure);
ASSERT_NE(Closure(0), closure);
// set argument
@@ -480,7 +536,6 @@
hidl_string cacheDir = "/data/local/tmp";
hidl_vec<Closure> closures = {closure};
ScriptGroup2 scriptGroup2 = context->scriptGroup2Create(name, cacheDir, closures);
- EXPECT_NE(ScriptGroup2(0), scriptGroup2);
ASSERT_NE(ScriptGroup2(0), scriptGroup2);
context->scriptGroupExecute(scriptGroup2);
diff --git a/sensors/1.0/Android.bp b/sensors/1.0/Android.bp
index 9f7895d..043e139 100644
--- a/sensors/1.0/Android.bp
+++ b/sensors/1.0/Android.bp
@@ -44,6 +44,7 @@
generated_sources: ["android.hardware.sensors@1.0_genc++"],
generated_headers: ["android.hardware.sensors@1.0_genc++_headers"],
export_generated_headers: ["android.hardware.sensors@1.0_genc++_headers"],
+ vendor_available: true,
shared_libs: [
"libhidlbase",
"libhidltransport",
diff --git a/sensors/1.0/Android.mk b/sensors/1.0/Android.mk
index 29f7c7e..18528a9 100644
--- a/sensors/1.0/Android.mk
+++ b/sensors/1.0/Android.mk
@@ -5,7 +5,7 @@
################################################################################
include $(CLEAR_VARS)
-LOCAL_MODULE := android.hardware.sensors@1.0-java-constants
+LOCAL_MODULE := android.hardware.sensors-V1.0-java-constants
LOCAL_MODULE_CLASS := JAVA_LIBRARIES
intermediates := $(call local-generated-sources-dir, COMMON)
diff --git a/sensors/1.0/default/Android.bp b/sensors/1.0/default/Android.bp
index 2ab1b90..8144590 100644
--- a/sensors/1.0/default/Android.bp
+++ b/sensors/1.0/default/Android.bp
@@ -23,6 +23,7 @@
cc_library_static {
name: "android.hardware.sensors@1.0-convert",
+ vendor_available: true,
defaults: ["hidl_defaults"],
srcs: ["convert.cpp"],
export_include_dirs: ["include"],
diff --git a/soundtrigger/2.0/Android.bp b/soundtrigger/2.0/Android.bp
index d2a04be..742311d 100644
--- a/soundtrigger/2.0/Android.bp
+++ b/soundtrigger/2.0/Android.bp
@@ -51,6 +51,7 @@
generated_sources: ["android.hardware.soundtrigger@2.0_genc++"],
generated_headers: ["android.hardware.soundtrigger@2.0_genc++_headers"],
export_generated_headers: ["android.hardware.soundtrigger@2.0_genc++_headers"],
+ vendor_available: true,
shared_libs: [
"libhidlbase",
"libhidltransport",
diff --git a/soundtrigger/2.0/types.hal b/soundtrigger/2.0/types.hal
index fc7d019..99bbd56 100644
--- a/soundtrigger/2.0/types.hal
+++ b/soundtrigger/2.0/types.hal
@@ -75,8 +75,3 @@
vec<ConfidenceLevel> levels;
};
-/** TODO(elaurent) remove when Java build problem is fixed */
-union Dummy {
- uint32_t dummy1;
- int32_t dummy2;
-};
diff --git a/tests/bar/1.0/Android.bp b/tests/bar/1.0/Android.bp
index 2edde20..f7a6f75 100644
--- a/tests/bar/1.0/Android.bp
+++ b/tests/bar/1.0/Android.bp
@@ -72,6 +72,7 @@
generated_sources: ["android.hardware.tests.bar@1.0_genc++"],
generated_headers: ["android.hardware.tests.bar@1.0_genc++_headers"],
export_generated_headers: ["android.hardware.tests.bar@1.0_genc++_headers"],
+ vendor_available: true,
shared_libs: [
"libhidlbase",
"libhidltransport",
diff --git a/tests/baz/1.0/Android.bp b/tests/baz/1.0/Android.bp
index 1d5013b..e55a782 100644
--- a/tests/baz/1.0/Android.bp
+++ b/tests/baz/1.0/Android.bp
@@ -65,6 +65,7 @@
generated_sources: ["android.hardware.tests.baz@1.0_genc++"],
generated_headers: ["android.hardware.tests.baz@1.0_genc++_headers"],
export_generated_headers: ["android.hardware.tests.baz@1.0_genc++_headers"],
+ vendor_available: true,
shared_libs: [
"libhidlbase",
"libhidltransport",
diff --git a/tests/baz/1.0/Android.mk b/tests/baz/1.0/Android.mk
index 9d4d6b6..29874da 100644
--- a/tests/baz/1.0/Android.mk
+++ b/tests/baz/1.0/Android.mk
@@ -5,7 +5,7 @@
################################################################################
include $(CLEAR_VARS)
-LOCAL_MODULE := android.hardware.tests.baz@1.0-java
+LOCAL_MODULE := android.hardware.tests.baz-V1.0-java
LOCAL_MODULE_CLASS := JAVA_LIBRARIES
intermediates := $(call local-generated-sources-dir, COMMON)
@@ -13,7 +13,7 @@
HIDL := $(HOST_OUT_EXECUTABLES)/hidl-gen$(HOST_EXECUTABLE_SUFFIX)
LOCAL_JAVA_LIBRARIES := \
- android.hidl.base@1.0-java \
+ android.hidl.base-V1.0-java \
#
@@ -101,7 +101,7 @@
################################################################################
include $(CLEAR_VARS)
-LOCAL_MODULE := android.hardware.tests.baz@1.0-java-static
+LOCAL_MODULE := android.hardware.tests.baz-V1.0-java-static
LOCAL_MODULE_CLASS := JAVA_LIBRARIES
intermediates := $(call local-generated-sources-dir, COMMON)
@@ -109,7 +109,7 @@
HIDL := $(HOST_OUT_EXECUTABLES)/hidl-gen$(HOST_EXECUTABLE_SUFFIX)
LOCAL_STATIC_JAVA_LIBRARIES := \
- android.hidl.base@1.0-java-static \
+ android.hidl.base-V1.0-java-static \
#
diff --git a/tests/expression/1.0/Android.bp b/tests/expression/1.0/Android.bp
index 5279503..6fcc0f8 100644
--- a/tests/expression/1.0/Android.bp
+++ b/tests/expression/1.0/Android.bp
@@ -47,6 +47,7 @@
generated_sources: ["android.hardware.tests.expression@1.0_genc++"],
generated_headers: ["android.hardware.tests.expression@1.0_genc++_headers"],
export_generated_headers: ["android.hardware.tests.expression@1.0_genc++_headers"],
+ vendor_available: true,
shared_libs: [
"libhidlbase",
"libhidltransport",
diff --git a/tests/expression/1.0/Android.mk b/tests/expression/1.0/Android.mk
index 6bc9390..1a32ef5 100644
--- a/tests/expression/1.0/Android.mk
+++ b/tests/expression/1.0/Android.mk
@@ -5,7 +5,7 @@
################################################################################
include $(CLEAR_VARS)
-LOCAL_MODULE := android.hardware.tests.expression@1.0-java
+LOCAL_MODULE := android.hardware.tests.expression-V1.0-java
LOCAL_MODULE_CLASS := JAVA_LIBRARIES
intermediates := $(call local-generated-sources-dir, COMMON)
@@ -13,7 +13,7 @@
HIDL := $(HOST_OUT_EXECUTABLES)/hidl-gen$(HOST_EXECUTABLE_SUFFIX)
LOCAL_JAVA_LIBRARIES := \
- android.hidl.base@1.0-java \
+ android.hidl.base-V1.0-java \
#
@@ -61,7 +61,7 @@
################################################################################
include $(CLEAR_VARS)
-LOCAL_MODULE := android.hardware.tests.expression@1.0-java-static
+LOCAL_MODULE := android.hardware.tests.expression-V1.0-java-static
LOCAL_MODULE_CLASS := JAVA_LIBRARIES
intermediates := $(call local-generated-sources-dir, COMMON)
@@ -69,7 +69,7 @@
HIDL := $(HOST_OUT_EXECUTABLES)/hidl-gen$(HOST_EXECUTABLE_SUFFIX)
LOCAL_STATIC_JAVA_LIBRARIES := \
- android.hidl.base@1.0-java-static \
+ android.hidl.base-V1.0-java-static \
#
diff --git a/tests/extension/light/2.0/Android.bp b/tests/extension/light/2.0/Android.bp
index 93f9da1..14403b6 100644
--- a/tests/extension/light/2.0/Android.bp
+++ b/tests/extension/light/2.0/Android.bp
@@ -44,6 +44,7 @@
generated_sources: ["android.hardware.tests.extension.light@2.0_genc++"],
generated_headers: ["android.hardware.tests.extension.light@2.0_genc++_headers"],
export_generated_headers: ["android.hardware.tests.extension.light@2.0_genc++_headers"],
+ vendor_available: true,
shared_libs: [
"libhidlbase",
"libhidltransport",
diff --git a/tests/extension/light/2.0/Android.mk b/tests/extension/light/2.0/Android.mk
index 16424a3..f1e10e4 100644
--- a/tests/extension/light/2.0/Android.mk
+++ b/tests/extension/light/2.0/Android.mk
@@ -5,7 +5,7 @@
################################################################################
include $(CLEAR_VARS)
-LOCAL_MODULE := android.hardware.tests.extension.light@2.0-java
+LOCAL_MODULE := android.hardware.tests.extension.light-V2.0-java
LOCAL_MODULE_CLASS := JAVA_LIBRARIES
intermediates := $(call local-generated-sources-dir, COMMON)
@@ -13,8 +13,8 @@
HIDL := $(HOST_OUT_EXECUTABLES)/hidl-gen$(HOST_EXECUTABLE_SUFFIX)
LOCAL_JAVA_LIBRARIES := \
- android.hardware.light@2.0-java \
- android.hidl.base@1.0-java \
+ android.hardware.light-V2.0-java \
+ android.hidl.base-V1.0-java \
#
@@ -100,7 +100,7 @@
################################################################################
include $(CLEAR_VARS)
-LOCAL_MODULE := android.hardware.tests.extension.light@2.0-java-static
+LOCAL_MODULE := android.hardware.tests.extension.light-V2.0-java-static
LOCAL_MODULE_CLASS := JAVA_LIBRARIES
intermediates := $(call local-generated-sources-dir, COMMON)
@@ -108,8 +108,8 @@
HIDL := $(HOST_OUT_EXECUTABLES)/hidl-gen$(HOST_EXECUTABLE_SUFFIX)
LOCAL_STATIC_JAVA_LIBRARIES := \
- android.hardware.light@2.0-java-static \
- android.hidl.base@1.0-java-static \
+ android.hardware.light-V2.0-java-static \
+ android.hidl.base-V1.0-java-static \
#
diff --git a/tests/foo/1.0/Android.bp b/tests/foo/1.0/Android.bp
index b221201..a631be8 100644
--- a/tests/foo/1.0/Android.bp
+++ b/tests/foo/1.0/Android.bp
@@ -72,6 +72,7 @@
generated_sources: ["android.hardware.tests.foo@1.0_genc++"],
generated_headers: ["android.hardware.tests.foo@1.0_genc++_headers"],
export_generated_headers: ["android.hardware.tests.foo@1.0_genc++_headers"],
+ vendor_available: true,
shared_libs: [
"libhidlbase",
"libhidltransport",
diff --git a/tests/foo/1.0/default/lib/Android.bp b/tests/foo/1.0/default/lib/Android.bp
index 895582c..b512311 100644
--- a/tests/foo/1.0/default/lib/Android.bp
+++ b/tests/foo/1.0/default/lib/Android.bp
@@ -1,5 +1,6 @@
cc_library_shared {
name: "libfootest",
+ vendor: true,
defaults: ["hidl_defaults"],
srcs: [
"FooHelper.cpp"
diff --git a/tests/hash/1.0/Android.bp b/tests/hash/1.0/Android.bp
index c217e5c..aeefeed 100644
--- a/tests/hash/1.0/Android.bp
+++ b/tests/hash/1.0/Android.bp
@@ -40,6 +40,7 @@
generated_sources: ["android.hardware.tests.hash@1.0_genc++"],
generated_headers: ["android.hardware.tests.hash@1.0_genc++_headers"],
export_generated_headers: ["android.hardware.tests.hash@1.0_genc++_headers"],
+ vendor_available: true,
shared_libs: [
"libhidlbase",
"libhidltransport",
diff --git a/tests/hash/1.0/Android.mk b/tests/hash/1.0/Android.mk
index 15428b4..586df6e 100644
--- a/tests/hash/1.0/Android.mk
+++ b/tests/hash/1.0/Android.mk
@@ -5,7 +5,7 @@
################################################################################
include $(CLEAR_VARS)
-LOCAL_MODULE := android.hardware.tests.hash@1.0-java
+LOCAL_MODULE := android.hardware.tests.hash-V1.0-java
LOCAL_MODULE_CLASS := JAVA_LIBRARIES
intermediates := $(call local-generated-sources-dir, COMMON)
@@ -13,7 +13,7 @@
HIDL := $(HOST_OUT_EXECUTABLES)/hidl-gen$(HOST_EXECUTABLE_SUFFIX)
LOCAL_JAVA_LIBRARIES := \
- android.hidl.base@1.0-java \
+ android.hidl.base-V1.0-java \
#
@@ -40,7 +40,7 @@
################################################################################
include $(CLEAR_VARS)
-LOCAL_MODULE := android.hardware.tests.hash@1.0-java-static
+LOCAL_MODULE := android.hardware.tests.hash-V1.0-java-static
LOCAL_MODULE_CLASS := JAVA_LIBRARIES
intermediates := $(call local-generated-sources-dir, COMMON)
@@ -48,7 +48,7 @@
HIDL := $(HOST_OUT_EXECUTABLES)/hidl-gen$(HOST_EXECUTABLE_SUFFIX)
LOCAL_STATIC_JAVA_LIBRARIES := \
- android.hidl.base@1.0-java-static \
+ android.hidl.base-V1.0-java-static \
#
diff --git a/tests/inheritance/1.0/Android.bp b/tests/inheritance/1.0/Android.bp
index f50aee4..11ee4f9 100644
--- a/tests/inheritance/1.0/Android.bp
+++ b/tests/inheritance/1.0/Android.bp
@@ -61,6 +61,7 @@
generated_sources: ["android.hardware.tests.inheritance@1.0_genc++"],
generated_headers: ["android.hardware.tests.inheritance@1.0_genc++_headers"],
export_generated_headers: ["android.hardware.tests.inheritance@1.0_genc++_headers"],
+ vendor_available: true,
shared_libs: [
"libhidlbase",
"libhidltransport",
diff --git a/tests/inheritance/1.0/Android.mk b/tests/inheritance/1.0/Android.mk
index 21aac00..0ff9abc 100644
--- a/tests/inheritance/1.0/Android.mk
+++ b/tests/inheritance/1.0/Android.mk
@@ -5,7 +5,7 @@
################################################################################
include $(CLEAR_VARS)
-LOCAL_MODULE := android.hardware.tests.inheritance@1.0-java
+LOCAL_MODULE := android.hardware.tests.inheritance-V1.0-java
LOCAL_MODULE_CLASS := JAVA_LIBRARIES
intermediates := $(call local-generated-sources-dir, COMMON)
@@ -13,7 +13,7 @@
HIDL := $(HOST_OUT_EXECUTABLES)/hidl-gen$(HOST_EXECUTABLE_SUFFIX)
LOCAL_JAVA_LIBRARIES := \
- android.hidl.base@1.0-java \
+ android.hidl.base-V1.0-java \
#
@@ -107,7 +107,7 @@
################################################################################
include $(CLEAR_VARS)
-LOCAL_MODULE := android.hardware.tests.inheritance@1.0-java-static
+LOCAL_MODULE := android.hardware.tests.inheritance-V1.0-java-static
LOCAL_MODULE_CLASS := JAVA_LIBRARIES
intermediates := $(call local-generated-sources-dir, COMMON)
@@ -115,7 +115,7 @@
HIDL := $(HOST_OUT_EXECUTABLES)/hidl-gen$(HOST_EXECUTABLE_SUFFIX)
LOCAL_STATIC_JAVA_LIBRARIES := \
- android.hidl.base@1.0-java-static \
+ android.hidl.base-V1.0-java-static \
#
diff --git a/tests/libhwbinder/1.0/Android.bp b/tests/libhwbinder/1.0/Android.bp
index 580e961..9c0fe45 100644
--- a/tests/libhwbinder/1.0/Android.bp
+++ b/tests/libhwbinder/1.0/Android.bp
@@ -40,6 +40,7 @@
generated_sources: ["android.hardware.tests.libhwbinder@1.0_genc++"],
generated_headers: ["android.hardware.tests.libhwbinder@1.0_genc++_headers"],
export_generated_headers: ["android.hardware.tests.libhwbinder@1.0_genc++_headers"],
+ vendor_available: true,
shared_libs: [
"libhidlbase",
"libhidltransport",
diff --git a/tests/libhwbinder/1.0/Android.mk b/tests/libhwbinder/1.0/Android.mk
index 2ee26d6..4a5f779 100644
--- a/tests/libhwbinder/1.0/Android.mk
+++ b/tests/libhwbinder/1.0/Android.mk
@@ -5,7 +5,7 @@
################################################################################
include $(CLEAR_VARS)
-LOCAL_MODULE := android.hardware.tests.libhwbinder@1.0-java
+LOCAL_MODULE := android.hardware.tests.libhwbinder-V1.0-java
LOCAL_MODULE_CLASS := JAVA_LIBRARIES
intermediates := $(call local-generated-sources-dir, COMMON)
@@ -13,7 +13,7 @@
HIDL := $(HOST_OUT_EXECUTABLES)/hidl-gen$(HOST_EXECUTABLE_SUFFIX)
LOCAL_JAVA_LIBRARIES := \
- android.hidl.base@1.0-java \
+ android.hidl.base-V1.0-java \
#
@@ -40,7 +40,7 @@
################################################################################
include $(CLEAR_VARS)
-LOCAL_MODULE := android.hardware.tests.libhwbinder@1.0-java-static
+LOCAL_MODULE := android.hardware.tests.libhwbinder-V1.0-java-static
LOCAL_MODULE_CLASS := JAVA_LIBRARIES
intermediates := $(call local-generated-sources-dir, COMMON)
@@ -48,7 +48,7 @@
HIDL := $(HOST_OUT_EXECUTABLES)/hidl-gen$(HOST_EXECUTABLE_SUFFIX)
LOCAL_STATIC_JAVA_LIBRARIES := \
- android.hidl.base@1.0-java-static \
+ android.hidl.base-V1.0-java-static \
#
diff --git a/tests/memory/1.0/Android.bp b/tests/memory/1.0/Android.bp
index 49faf41..e49f436 100644
--- a/tests/memory/1.0/Android.bp
+++ b/tests/memory/1.0/Android.bp
@@ -40,6 +40,7 @@
generated_sources: ["android.hardware.tests.memory@1.0_genc++"],
generated_headers: ["android.hardware.tests.memory@1.0_genc++_headers"],
export_generated_headers: ["android.hardware.tests.memory@1.0_genc++_headers"],
+ vendor_available: true,
shared_libs: [
"libhidlbase",
"libhidltransport",
diff --git a/tests/msgq/1.0/Android.bp b/tests/msgq/1.0/Android.bp
index 2d42699..98bdd19 100644
--- a/tests/msgq/1.0/Android.bp
+++ b/tests/msgq/1.0/Android.bp
@@ -47,6 +47,7 @@
generated_sources: ["android.hardware.tests.msgq@1.0_genc++"],
generated_headers: ["android.hardware.tests.msgq@1.0_genc++_headers"],
export_generated_headers: ["android.hardware.tests.msgq@1.0_genc++_headers"],
+ vendor_available: true,
shared_libs: [
"libhidlbase",
"libhidltransport",
diff --git a/tests/pointer/1.0/Android.bp b/tests/pointer/1.0/Android.bp
index 7f66e2a..48f2ec0 100644
--- a/tests/pointer/1.0/Android.bp
+++ b/tests/pointer/1.0/Android.bp
@@ -47,6 +47,7 @@
generated_sources: ["android.hardware.tests.pointer@1.0_genc++"],
generated_headers: ["android.hardware.tests.pointer@1.0_genc++_headers"],
export_generated_headers: ["android.hardware.tests.pointer@1.0_genc++_headers"],
+ vendor_available: true,
shared_libs: [
"libhidlbase",
"libhidltransport",
diff --git a/tests/pointer/1.0/default/lib/Android.bp b/tests/pointer/1.0/default/lib/Android.bp
index ae07b04..1fe0896 100644
--- a/tests/pointer/1.0/default/lib/Android.bp
+++ b/tests/pointer/1.0/default/lib/Android.bp
@@ -1,5 +1,6 @@
cc_library_shared {
name: "libpointertest",
+ vendor: true,
defaults: ["hidl_defaults"],
srcs: [
"PointerHelper.cpp"
diff --git a/tests/versioning/1.0/Android.bp b/tests/versioning/1.0/Android.bp
index fbabc10..ee41ea4 100644
--- a/tests/versioning/1.0/Android.bp
+++ b/tests/versioning/1.0/Android.bp
@@ -40,6 +40,7 @@
generated_sources: ["android.hardware.tests.versioning@1.0_genc++"],
generated_headers: ["android.hardware.tests.versioning@1.0_genc++_headers"],
export_generated_headers: ["android.hardware.tests.versioning@1.0_genc++_headers"],
+ vendor_available: true,
shared_libs: [
"libhidlbase",
"libhidltransport",
diff --git a/tests/versioning/1.0/Android.mk b/tests/versioning/1.0/Android.mk
index ba18384..81ffd08 100644
--- a/tests/versioning/1.0/Android.mk
+++ b/tests/versioning/1.0/Android.mk
@@ -5,7 +5,7 @@
################################################################################
include $(CLEAR_VARS)
-LOCAL_MODULE := android.hardware.tests.versioning@1.0-java
+LOCAL_MODULE := android.hardware.tests.versioning-V1.0-java
LOCAL_MODULE_CLASS := JAVA_LIBRARIES
intermediates := $(call local-generated-sources-dir, COMMON)
@@ -13,7 +13,7 @@
HIDL := $(HOST_OUT_EXECUTABLES)/hidl-gen$(HOST_EXECUTABLE_SUFFIX)
LOCAL_JAVA_LIBRARIES := \
- android.hidl.base@1.0-java \
+ android.hidl.base-V1.0-java \
#
@@ -40,7 +40,7 @@
################################################################################
include $(CLEAR_VARS)
-LOCAL_MODULE := android.hardware.tests.versioning@1.0-java-static
+LOCAL_MODULE := android.hardware.tests.versioning-V1.0-java-static
LOCAL_MODULE_CLASS := JAVA_LIBRARIES
intermediates := $(call local-generated-sources-dir, COMMON)
@@ -48,7 +48,7 @@
HIDL := $(HOST_OUT_EXECUTABLES)/hidl-gen$(HOST_EXECUTABLE_SUFFIX)
LOCAL_STATIC_JAVA_LIBRARIES := \
- android.hidl.base@1.0-java-static \
+ android.hidl.base-V1.0-java-static \
#
diff --git a/tests/versioning/2.2/Android.bp b/tests/versioning/2.2/Android.bp
index 953b6df..bf412a6 100644
--- a/tests/versioning/2.2/Android.bp
+++ b/tests/versioning/2.2/Android.bp
@@ -47,6 +47,7 @@
generated_sources: ["android.hardware.tests.versioning@2.2_genc++"],
generated_headers: ["android.hardware.tests.versioning@2.2_genc++_headers"],
export_generated_headers: ["android.hardware.tests.versioning@2.2_genc++_headers"],
+ vendor_available: true,
shared_libs: [
"libhidlbase",
"libhidltransport",
diff --git a/tests/versioning/2.2/Android.mk b/tests/versioning/2.2/Android.mk
index e2a2ff7..4fccce6 100644
--- a/tests/versioning/2.2/Android.mk
+++ b/tests/versioning/2.2/Android.mk
@@ -5,7 +5,7 @@
################################################################################
include $(CLEAR_VARS)
-LOCAL_MODULE := android.hardware.tests.versioning@2.2-java
+LOCAL_MODULE := android.hardware.tests.versioning-V2.2-java
LOCAL_MODULE_CLASS := JAVA_LIBRARIES
intermediates := $(call local-generated-sources-dir, COMMON)
@@ -13,7 +13,7 @@
HIDL := $(HOST_OUT_EXECUTABLES)/hidl-gen$(HOST_EXECUTABLE_SUFFIX)
LOCAL_JAVA_LIBRARIES := \
- android.hidl.base@1.0-java \
+ android.hidl.base-V1.0-java \
#
@@ -59,7 +59,7 @@
################################################################################
include $(CLEAR_VARS)
-LOCAL_MODULE := android.hardware.tests.versioning@2.2-java-static
+LOCAL_MODULE := android.hardware.tests.versioning-V2.2-java-static
LOCAL_MODULE_CLASS := JAVA_LIBRARIES
intermediates := $(call local-generated-sources-dir, COMMON)
@@ -67,7 +67,7 @@
HIDL := $(HOST_OUT_EXECUTABLES)/hidl-gen$(HOST_EXECUTABLE_SUFFIX)
LOCAL_STATIC_JAVA_LIBRARIES := \
- android.hidl.base@1.0-java-static \
+ android.hidl.base-V1.0-java-static \
#
diff --git a/tests/versioning/2.3/Android.bp b/tests/versioning/2.3/Android.bp
index 3cc2076..a8aee8e 100644
--- a/tests/versioning/2.3/Android.bp
+++ b/tests/versioning/2.3/Android.bp
@@ -54,6 +54,7 @@
generated_sources: ["android.hardware.tests.versioning@2.3_genc++"],
generated_headers: ["android.hardware.tests.versioning@2.3_genc++_headers"],
export_generated_headers: ["android.hardware.tests.versioning@2.3_genc++_headers"],
+ vendor_available: true,
shared_libs: [
"libhidlbase",
"libhidltransport",
diff --git a/tests/versioning/2.3/Android.mk b/tests/versioning/2.3/Android.mk
index 68e6be4..36326d6 100644
--- a/tests/versioning/2.3/Android.mk
+++ b/tests/versioning/2.3/Android.mk
@@ -5,7 +5,7 @@
################################################################################
include $(CLEAR_VARS)
-LOCAL_MODULE := android.hardware.tests.versioning@2.3-java
+LOCAL_MODULE := android.hardware.tests.versioning-V2.3-java
LOCAL_MODULE_CLASS := JAVA_LIBRARIES
intermediates := $(call local-generated-sources-dir, COMMON)
@@ -13,9 +13,9 @@
HIDL := $(HOST_OUT_EXECUTABLES)/hidl-gen$(HOST_EXECUTABLE_SUFFIX)
LOCAL_JAVA_LIBRARIES := \
- android.hardware.tests.versioning@1.0-java \
- android.hardware.tests.versioning@2.2-java \
- android.hidl.base@1.0-java \
+ android.hardware.tests.versioning-V1.0-java \
+ android.hardware.tests.versioning-V2.2-java \
+ android.hidl.base-V1.0-java \
#
@@ -80,7 +80,7 @@
################################################################################
include $(CLEAR_VARS)
-LOCAL_MODULE := android.hardware.tests.versioning@2.3-java-static
+LOCAL_MODULE := android.hardware.tests.versioning-V2.3-java-static
LOCAL_MODULE_CLASS := JAVA_LIBRARIES
intermediates := $(call local-generated-sources-dir, COMMON)
@@ -88,9 +88,9 @@
HIDL := $(HOST_OUT_EXECUTABLES)/hidl-gen$(HOST_EXECUTABLE_SUFFIX)
LOCAL_STATIC_JAVA_LIBRARIES := \
- android.hardware.tests.versioning@1.0-java-static \
- android.hardware.tests.versioning@2.2-java-static \
- android.hidl.base@1.0-java-static \
+ android.hardware.tests.versioning-V1.0-java-static \
+ android.hardware.tests.versioning-V2.2-java-static \
+ android.hidl.base-V1.0-java-static \
#
diff --git a/tests/versioning/2.4/Android.bp b/tests/versioning/2.4/Android.bp
index 9d8303c..37e787f 100644
--- a/tests/versioning/2.4/Android.bp
+++ b/tests/versioning/2.4/Android.bp
@@ -40,6 +40,7 @@
generated_sources: ["android.hardware.tests.versioning@2.4_genc++"],
generated_headers: ["android.hardware.tests.versioning@2.4_genc++_headers"],
export_generated_headers: ["android.hardware.tests.versioning@2.4_genc++_headers"],
+ vendor_available: true,
shared_libs: [
"libhidlbase",
"libhidltransport",
diff --git a/tests/versioning/2.4/Android.mk b/tests/versioning/2.4/Android.mk
index e41397f..c716172 100644
--- a/tests/versioning/2.4/Android.mk
+++ b/tests/versioning/2.4/Android.mk
@@ -5,7 +5,7 @@
################################################################################
include $(CLEAR_VARS)
-LOCAL_MODULE := android.hardware.tests.versioning@2.4-java
+LOCAL_MODULE := android.hardware.tests.versioning-V2.4-java
LOCAL_MODULE_CLASS := JAVA_LIBRARIES
intermediates := $(call local-generated-sources-dir, COMMON)
@@ -13,9 +13,9 @@
HIDL := $(HOST_OUT_EXECUTABLES)/hidl-gen$(HOST_EXECUTABLE_SUFFIX)
LOCAL_JAVA_LIBRARIES := \
- android.hardware.tests.versioning@2.2-java \
- android.hardware.tests.versioning@2.3-java \
- android.hidl.base@1.0-java \
+ android.hardware.tests.versioning-V2.2-java \
+ android.hardware.tests.versioning-V2.3-java \
+ android.hidl.base-V1.0-java \
#
@@ -42,7 +42,7 @@
################################################################################
include $(CLEAR_VARS)
-LOCAL_MODULE := android.hardware.tests.versioning@2.4-java-static
+LOCAL_MODULE := android.hardware.tests.versioning-V2.4-java-static
LOCAL_MODULE_CLASS := JAVA_LIBRARIES
intermediates := $(call local-generated-sources-dir, COMMON)
@@ -50,9 +50,9 @@
HIDL := $(HOST_OUT_EXECUTABLES)/hidl-gen$(HOST_EXECUTABLE_SUFFIX)
LOCAL_STATIC_JAVA_LIBRARIES := \
- android.hardware.tests.versioning@2.2-java-static \
- android.hardware.tests.versioning@2.3-java-static \
- android.hidl.base@1.0-java-static \
+ android.hardware.tests.versioning-V2.2-java-static \
+ android.hardware.tests.versioning-V2.3-java-static \
+ android.hidl.base-V1.0-java-static \
#
diff --git a/thermal/1.0/Android.bp b/thermal/1.0/Android.bp
index d7d5184..41f5ab8 100644
--- a/thermal/1.0/Android.bp
+++ b/thermal/1.0/Android.bp
@@ -44,6 +44,7 @@
generated_sources: ["android.hardware.thermal@1.0_genc++"],
generated_headers: ["android.hardware.thermal@1.0_genc++_headers"],
export_generated_headers: ["android.hardware.thermal@1.0_genc++_headers"],
+ vendor_available: true,
shared_libs: [
"libhidlbase",
"libhidltransport",
diff --git a/thermal/1.0/Android.mk b/thermal/1.0/Android.mk
index 7748b9e..5a0a9a0 100644
--- a/thermal/1.0/Android.mk
+++ b/thermal/1.0/Android.mk
@@ -5,7 +5,7 @@
################################################################################
include $(CLEAR_VARS)
-LOCAL_MODULE := android.hardware.thermal@1.0-java
+LOCAL_MODULE := android.hardware.thermal-V1.0-java
LOCAL_MODULE_CLASS := JAVA_LIBRARIES
intermediates := $(call local-generated-sources-dir, COMMON)
@@ -13,7 +13,7 @@
HIDL := $(HOST_OUT_EXECUTABLES)/hidl-gen$(HOST_EXECUTABLE_SUFFIX)
LOCAL_JAVA_LIBRARIES := \
- android.hidl.base@1.0-java \
+ android.hidl.base-V1.0-java \
#
@@ -175,7 +175,7 @@
################################################################################
include $(CLEAR_VARS)
-LOCAL_MODULE := android.hardware.thermal@1.0-java-static
+LOCAL_MODULE := android.hardware.thermal-V1.0-java-static
LOCAL_MODULE_CLASS := JAVA_LIBRARIES
intermediates := $(call local-generated-sources-dir, COMMON)
@@ -183,7 +183,7 @@
HIDL := $(HOST_OUT_EXECUTABLES)/hidl-gen$(HOST_EXECUTABLE_SUFFIX)
LOCAL_STATIC_JAVA_LIBRARIES := \
- android.hidl.base@1.0-java-static \
+ android.hidl.base-V1.0-java-static \
#
@@ -345,7 +345,7 @@
################################################################################
include $(CLEAR_VARS)
-LOCAL_MODULE := android.hardware.thermal@1.0-java-constants
+LOCAL_MODULE := android.hardware.thermal-V1.0-java-constants
LOCAL_MODULE_CLASS := JAVA_LIBRARIES
intermediates := $(call local-generated-sources-dir, COMMON)
diff --git a/tv/cec/1.0/Android.bp b/tv/cec/1.0/Android.bp
index a5d7b86..3f8973d 100644
--- a/tv/cec/1.0/Android.bp
+++ b/tv/cec/1.0/Android.bp
@@ -51,6 +51,7 @@
generated_sources: ["android.hardware.tv.cec@1.0_genc++"],
generated_headers: ["android.hardware.tv.cec@1.0_genc++_headers"],
export_generated_headers: ["android.hardware.tv.cec@1.0_genc++_headers"],
+ vendor_available: true,
shared_libs: [
"libhidlbase",
"libhidltransport",
diff --git a/tv/cec/1.0/Android.mk b/tv/cec/1.0/Android.mk
index b08099e..1e3853d 100644
--- a/tv/cec/1.0/Android.mk
+++ b/tv/cec/1.0/Android.mk
@@ -5,7 +5,7 @@
################################################################################
include $(CLEAR_VARS)
-LOCAL_MODULE := android.hardware.tv.cec@1.0-java
+LOCAL_MODULE := android.hardware.tv.cec-V1.0-java
LOCAL_MODULE_CLASS := JAVA_LIBRARIES
intermediates := $(call local-generated-sources-dir, COMMON)
@@ -13,7 +13,7 @@
HIDL := $(HOST_OUT_EXECUTABLES)/hidl-gen$(HOST_EXECUTABLE_SUFFIX)
LOCAL_JAVA_LIBRARIES := \
- android.hidl.base@1.0-java \
+ android.hidl.base-V1.0-java \
#
@@ -293,7 +293,7 @@
################################################################################
include $(CLEAR_VARS)
-LOCAL_MODULE := android.hardware.tv.cec@1.0-java-static
+LOCAL_MODULE := android.hardware.tv.cec-V1.0-java-static
LOCAL_MODULE_CLASS := JAVA_LIBRARIES
intermediates := $(call local-generated-sources-dir, COMMON)
@@ -301,7 +301,7 @@
HIDL := $(HOST_OUT_EXECUTABLES)/hidl-gen$(HOST_EXECUTABLE_SUFFIX)
LOCAL_STATIC_JAVA_LIBRARIES := \
- android.hidl.base@1.0-java-static \
+ android.hidl.base-V1.0-java-static \
#
diff --git a/tv/input/1.0/Android.bp b/tv/input/1.0/Android.bp
index e9c2d63..65a7b02 100644
--- a/tv/input/1.0/Android.bp
+++ b/tv/input/1.0/Android.bp
@@ -51,6 +51,7 @@
generated_sources: ["android.hardware.tv.input@1.0_genc++"],
generated_headers: ["android.hardware.tv.input@1.0_genc++_headers"],
export_generated_headers: ["android.hardware.tv.input@1.0_genc++_headers"],
+ vendor_available: true,
shared_libs: [
"libhidlbase",
"libhidltransport",
diff --git a/tv/input/1.0/Android.mk b/tv/input/1.0/Android.mk
index 87654da..aa1cf70 100644
--- a/tv/input/1.0/Android.mk
+++ b/tv/input/1.0/Android.mk
@@ -5,7 +5,7 @@
################################################################################
include $(CLEAR_VARS)
-LOCAL_MODULE := android.hardware.tv.input@1.0-java-constants
+LOCAL_MODULE := android.hardware.tv.input-V1.0-java-constants
LOCAL_MODULE_CLASS := JAVA_LIBRARIES
intermediates := $(call local-generated-sources-dir, COMMON)
diff --git a/usb/1.0/Android.bp b/usb/1.0/Android.bp
index f939c8b..11856a0 100644
--- a/usb/1.0/Android.bp
+++ b/usb/1.0/Android.bp
@@ -51,6 +51,7 @@
generated_sources: ["android.hardware.usb@1.0_genc++"],
generated_headers: ["android.hardware.usb@1.0_genc++_headers"],
export_generated_headers: ["android.hardware.usb@1.0_genc++_headers"],
+ vendor_available: true,
shared_libs: [
"libhidlbase",
"libhidltransport",
diff --git a/usb/1.0/Android.mk b/usb/1.0/Android.mk
index 7be7147..62f6935 100644
--- a/usb/1.0/Android.mk
+++ b/usb/1.0/Android.mk
@@ -5,7 +5,7 @@
################################################################################
include $(CLEAR_VARS)
-LOCAL_MODULE := android.hardware.usb@1.0-java
+LOCAL_MODULE := android.hardware.usb-V1.0-java
LOCAL_MODULE_CLASS := JAVA_LIBRARIES
intermediates := $(call local-generated-sources-dir, COMMON)
@@ -13,7 +13,7 @@
HIDL := $(HOST_OUT_EXECUTABLES)/hidl-gen$(HOST_EXECUTABLE_SUFFIX)
LOCAL_JAVA_LIBRARIES := \
- android.hidl.base@1.0-java \
+ android.hidl.base-V1.0-java \
#
@@ -198,7 +198,7 @@
################################################################################
include $(CLEAR_VARS)
-LOCAL_MODULE := android.hardware.usb@1.0-java-static
+LOCAL_MODULE := android.hardware.usb-V1.0-java-static
LOCAL_MODULE_CLASS := JAVA_LIBRARIES
intermediates := $(call local-generated-sources-dir, COMMON)
@@ -206,7 +206,7 @@
HIDL := $(HOST_OUT_EXECUTABLES)/hidl-gen$(HOST_EXECUTABLE_SUFFIX)
LOCAL_STATIC_JAVA_LIBRARIES := \
- android.hidl.base@1.0-java-static \
+ android.hidl.base-V1.0-java-static \
#
@@ -391,7 +391,7 @@
################################################################################
include $(CLEAR_VARS)
-LOCAL_MODULE := android.hardware.usb@1.0-java-constants
+LOCAL_MODULE := android.hardware.usb-V1.0-java-constants
LOCAL_MODULE_CLASS := JAVA_LIBRARIES
intermediates := $(call local-generated-sources-dir, COMMON)
diff --git a/vibrator/1.0/Android.bp b/vibrator/1.0/Android.bp
index 11ae996..204ff50 100644
--- a/vibrator/1.0/Android.bp
+++ b/vibrator/1.0/Android.bp
@@ -44,6 +44,7 @@
generated_sources: ["android.hardware.vibrator@1.0_genc++"],
generated_headers: ["android.hardware.vibrator@1.0_genc++_headers"],
export_generated_headers: ["android.hardware.vibrator@1.0_genc++_headers"],
+ vendor_available: true,
shared_libs: [
"libhidlbase",
"libhidltransport",
diff --git a/vibrator/1.0/Android.mk b/vibrator/1.0/Android.mk
index d921a7e..c54b655 100644
--- a/vibrator/1.0/Android.mk
+++ b/vibrator/1.0/Android.mk
@@ -5,7 +5,7 @@
################################################################################
include $(CLEAR_VARS)
-LOCAL_MODULE := android.hardware.vibrator@1.0-java
+LOCAL_MODULE := android.hardware.vibrator-V1.0-java
LOCAL_MODULE_CLASS := JAVA_LIBRARIES
intermediates := $(call local-generated-sources-dir, COMMON)
@@ -13,7 +13,7 @@
HIDL := $(HOST_OUT_EXECUTABLES)/hidl-gen$(HOST_EXECUTABLE_SUFFIX)
LOCAL_JAVA_LIBRARIES := \
- android.hidl.base@1.0-java \
+ android.hidl.base-V1.0-java \
#
@@ -36,6 +36,25 @@
LOCAL_GENERATED_SOURCES += $(GEN)
#
+# Build types.hal (EffectStrength)
+#
+GEN := $(intermediates)/android/hardware/vibrator/V1_0/EffectStrength.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava \
+ -randroid.hardware:hardware/interfaces \
+ -randroid.hidl:system/libhidl/transport \
+ android.hardware.vibrator@1.0::types.EffectStrength
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
# Build types.hal (Status)
#
GEN := $(intermediates)/android/hardware/vibrator/V1_0/Status.java
@@ -80,7 +99,7 @@
################################################################################
include $(CLEAR_VARS)
-LOCAL_MODULE := android.hardware.vibrator@1.0-java-static
+LOCAL_MODULE := android.hardware.vibrator-V1.0-java-static
LOCAL_MODULE_CLASS := JAVA_LIBRARIES
intermediates := $(call local-generated-sources-dir, COMMON)
@@ -88,7 +107,7 @@
HIDL := $(HOST_OUT_EXECUTABLES)/hidl-gen$(HOST_EXECUTABLE_SUFFIX)
LOCAL_STATIC_JAVA_LIBRARIES := \
- android.hidl.base@1.0-java-static \
+ android.hidl.base-V1.0-java-static \
#
@@ -111,6 +130,25 @@
LOCAL_GENERATED_SOURCES += $(GEN)
#
+# Build types.hal (EffectStrength)
+#
+GEN := $(intermediates)/android/hardware/vibrator/V1_0/EffectStrength.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava \
+ -randroid.hardware:hardware/interfaces \
+ -randroid.hidl:system/libhidl/transport \
+ android.hardware.vibrator@1.0::types.EffectStrength
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
# Build types.hal (Status)
#
GEN := $(intermediates)/android/hardware/vibrator/V1_0/Status.java
@@ -155,10 +193,10 @@
################################################################################
include $(CLEAR_VARS)
-LOCAL_MODULE := android.hardware.vibrator@1.0-java-constants
+LOCAL_MODULE := android.hardware.vibrator-V1.0-java-constants
LOCAL_MODULE_CLASS := JAVA_LIBRARIES
-intermediates := $(local-generated-sources-dir)
+intermediates := $(call local-generated-sources-dir, COMMON)
HIDL := $(HOST_OUT_EXECUTABLES)/hidl-gen$(HOST_EXECUTABLE_SUFFIX)
#
diff --git a/vr/1.0/Android.bp b/vr/1.0/Android.bp
index b48d010..66c346e 100644
--- a/vr/1.0/Android.bp
+++ b/vr/1.0/Android.bp
@@ -40,6 +40,7 @@
generated_sources: ["android.hardware.vr@1.0_genc++"],
generated_headers: ["android.hardware.vr@1.0_genc++_headers"],
export_generated_headers: ["android.hardware.vr@1.0_genc++_headers"],
+ vendor_available: true,
shared_libs: [
"libhidlbase",
"libhidltransport",
diff --git a/vr/1.0/Android.mk b/vr/1.0/Android.mk
index 0fbdaf7..fc5c675d 100644
--- a/vr/1.0/Android.mk
+++ b/vr/1.0/Android.mk
@@ -5,7 +5,7 @@
################################################################################
include $(CLEAR_VARS)
-LOCAL_MODULE := android.hardware.vr@1.0-java
+LOCAL_MODULE := android.hardware.vr-V1.0-java
LOCAL_MODULE_CLASS := JAVA_LIBRARIES
intermediates := $(call local-generated-sources-dir, COMMON)
@@ -13,7 +13,7 @@
HIDL := $(HOST_OUT_EXECUTABLES)/hidl-gen$(HOST_EXECUTABLE_SUFFIX)
LOCAL_JAVA_LIBRARIES := \
- android.hidl.base@1.0-java \
+ android.hidl.base-V1.0-java \
#
@@ -40,7 +40,7 @@
################################################################################
include $(CLEAR_VARS)
-LOCAL_MODULE := android.hardware.vr@1.0-java-static
+LOCAL_MODULE := android.hardware.vr-V1.0-java-static
LOCAL_MODULE_CLASS := JAVA_LIBRARIES
intermediates := $(call local-generated-sources-dir, COMMON)
@@ -48,7 +48,7 @@
HIDL := $(HOST_OUT_EXECUTABLES)/hidl-gen$(HOST_EXECUTABLE_SUFFIX)
LOCAL_STATIC_JAVA_LIBRARIES := \
- android.hidl.base@1.0-java-static \
+ android.hidl.base-V1.0-java-static \
#
diff --git a/wifi/1.0/Android.bp b/wifi/1.0/Android.bp
index df5c9d2..9126aaf 100644
--- a/wifi/1.0/Android.bp
+++ b/wifi/1.0/Android.bp
@@ -128,6 +128,7 @@
generated_sources: ["android.hardware.wifi@1.0_genc++"],
generated_headers: ["android.hardware.wifi@1.0_genc++_headers"],
export_generated_headers: ["android.hardware.wifi@1.0_genc++_headers"],
+ vendor_available: true,
shared_libs: [
"libhidlbase",
"libhidltransport",
diff --git a/wifi/1.0/Android.mk b/wifi/1.0/Android.mk
index 82409de..08cdcfa 100644
--- a/wifi/1.0/Android.mk
+++ b/wifi/1.0/Android.mk
@@ -5,7 +5,7 @@
################################################################################
include $(CLEAR_VARS)
-LOCAL_MODULE := android.hardware.wifi@1.0-java
+LOCAL_MODULE := android.hardware.wifi-V1.0-java
LOCAL_MODULE_CLASS := JAVA_LIBRARIES
intermediates := $(call local-generated-sources-dir, COMMON)
@@ -13,7 +13,7 @@
HIDL := $(HOST_OUT_EXECUTABLES)/hidl-gen$(HOST_EXECUTABLE_SUFFIX)
LOCAL_JAVA_LIBRARIES := \
- android.hidl.base@1.0-java \
+ android.hidl.base-V1.0-java \
#
@@ -1884,7 +1884,7 @@
################################################################################
include $(CLEAR_VARS)
-LOCAL_MODULE := android.hardware.wifi@1.0-java-static
+LOCAL_MODULE := android.hardware.wifi-V1.0-java-static
LOCAL_MODULE_CLASS := JAVA_LIBRARIES
intermediates := $(call local-generated-sources-dir, COMMON)
@@ -1892,7 +1892,7 @@
HIDL := $(HOST_OUT_EXECUTABLES)/hidl-gen$(HOST_EXECUTABLE_SUFFIX)
LOCAL_STATIC_JAVA_LIBRARIES := \
- android.hidl.base@1.0-java-static \
+ android.hidl.base-V1.0-java-static \
#
diff --git a/wifi/1.0/IWifiStaIface.hal b/wifi/1.0/IWifiStaIface.hal
index 43c3126..644e78a 100644
--- a/wifi/1.0/IWifiStaIface.hal
+++ b/wifi/1.0/IWifiStaIface.hal
@@ -145,6 +145,31 @@
* program if present.
* Must fail if |StaIfaceCapabilityMask.APF| is not set.
*
+ * APF docs
+ * ==========================================================================
+ * APF functionality, instructions and bytecode/binary format is described in:
+ * http://android.googlesource.com/platform/hardware/google/apf/
+ * +/b75c9f3714cfae3dad3d976958e063150781437e/apf.h
+ *
+ * The interpreter API is described here:
+ * http://android.googlesource.com/platform/hardware/google/apf/+/
+ * b75c9f3714cfae3dad3d976958e063150781437e/apf_interpreter.h#32
+ *
+ * The assembler/generator API is described in javadocs here:
+ * http://android.googlesource.com/platform/frameworks/base/+/
+ * 4456f33a958a7f09e608399da83c4d12b2e7d191/services/net/java/android/net/
+ * apf/ApfGenerator.java
+ *
+ * Disassembler usage is described here:
+ * http://android.googlesource.com/platform/hardware/google/apf/+/
+ * b75c9f3714cfae3dad3d976958e063150781437e/apf_disassembler.c#65
+ *
+ * The BPF to APF translator usage is described here:
+ * http://android.googlesource.com/platform/frameworks/base/+/
+ * 4456f33a958a7f09e608399da83c4d12b2e7d191/tests/net/java/android/net/
+ * apf/Bpf2Apf.java
+ * ==========================================================================
+ *
* @param cmdId command Id to use for this invocation.
* @param APF Program to be set.
* @return status WifiStatus of the operation.
diff --git a/wifi/supplicant/1.0/Android.bp b/wifi/supplicant/1.0/Android.bp
index a0adb8d..d6cb071 100644
--- a/wifi/supplicant/1.0/Android.bp
+++ b/wifi/supplicant/1.0/Android.bp
@@ -121,6 +121,7 @@
generated_sources: ["android.hardware.wifi.supplicant@1.0_genc++"],
generated_headers: ["android.hardware.wifi.supplicant@1.0_genc++_headers"],
export_generated_headers: ["android.hardware.wifi.supplicant@1.0_genc++_headers"],
+ vendor_available: true,
shared_libs: [
"libhidlbase",
"libhidltransport",
diff --git a/wifi/supplicant/1.0/Android.mk b/wifi/supplicant/1.0/Android.mk
index dd210d0..18c7833 100644
--- a/wifi/supplicant/1.0/Android.mk
+++ b/wifi/supplicant/1.0/Android.mk
@@ -5,7 +5,7 @@
################################################################################
include $(CLEAR_VARS)
-LOCAL_MODULE := android.hardware.wifi.supplicant@1.0-java
+LOCAL_MODULE := android.hardware.wifi.supplicant-V1.0-java
LOCAL_MODULE_CLASS := JAVA_LIBRARIES
intermediates := $(call local-generated-sources-dir, COMMON)
@@ -13,7 +13,7 @@
HIDL := $(HOST_OUT_EXECUTABLES)/hidl-gen$(HOST_EXECUTABLE_SUFFIX)
LOCAL_JAVA_LIBRARIES := \
- android.hidl.base@1.0-java \
+ android.hidl.base-V1.0-java \
#
@@ -384,7 +384,7 @@
################################################################################
include $(CLEAR_VARS)
-LOCAL_MODULE := android.hardware.wifi.supplicant@1.0-java-static
+LOCAL_MODULE := android.hardware.wifi.supplicant-V1.0-java-static
LOCAL_MODULE_CLASS := JAVA_LIBRARIES
intermediates := $(call local-generated-sources-dir, COMMON)
@@ -392,7 +392,7 @@
HIDL := $(HOST_OUT_EXECUTABLES)/hidl-gen$(HOST_EXECUTABLE_SUFFIX)
LOCAL_STATIC_JAVA_LIBRARIES := \
- android.hidl.base@1.0-java-static \
+ android.hidl.base-V1.0-java-static \
#
diff --git a/wifi/supplicant/1.0/vts/functional/supplicant_hidl_call_util.h b/wifi/supplicant/1.0/vts/functional/supplicant_hidl_call_util.h
new file mode 100644
index 0000000..1c0fcec
--- /dev/null
+++ b/wifi/supplicant/1.0/vts/functional/supplicant_hidl_call_util.h
@@ -0,0 +1,127 @@
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// This file is copied from
+// hardware/interfaces/wifi/1.0/vts/functional/wifi_hidl_call_util.h
+// Please make sure these two file are consistent.
+
+#pragma once
+
+#include <functional>
+#include <tuple>
+#include <type_traits>
+#include <utility>
+
+#include <VtsHalHidlTargetTestBase.h>
+
+namespace {
+namespace detail {
+template <typename>
+struct functionArgSaver;
+
+// Provides a std::function that takes one argument, and a buffer
+// wherein the function will store its argument. The buffer has
+// the same type as the argument, but with const and reference
+// modifiers removed.
+template <typename ArgT>
+struct functionArgSaver<std::function<void(ArgT)>> final {
+ using StorageT = typename std::remove_const<
+ typename std::remove_reference<ArgT>::type>::type;
+
+ std::function<void(ArgT)> saveArgs = [this](ArgT arg) {
+ this->saved_values = arg;
+ };
+
+ StorageT saved_values;
+};
+
+// Provides a std::function that takes two arguments, and a buffer
+// wherein the function will store its arguments. The buffer is a
+// std::pair, whose elements have the same types as the arguments
+// (but with const and reference modifiers removed).
+template <typename Arg1T, typename Arg2T>
+struct functionArgSaver<std::function<void(Arg1T, Arg2T)>> final {
+ using StorageT =
+ std::pair<typename std::remove_const<
+ typename std::remove_reference<Arg1T>::type>::type,
+ typename std::remove_const<
+ typename std::remove_reference<Arg2T>::type>::type>;
+
+ std::function<void(Arg1T, Arg2T)> saveArgs = [this](Arg1T arg1,
+ Arg2T arg2) {
+ this->saved_values = {arg1, arg2};
+ };
+
+ StorageT saved_values;
+};
+
+// Provides a std::function that takes three or more arguments, and a
+// buffer wherein the function will store its arguments. The buffer is a
+// std::tuple whose elements have the same types as the arguments (but
+// with const and reference modifiers removed).
+template <typename... ArgT>
+struct functionArgSaver<std::function<void(ArgT...)>> final {
+ using StorageT = std::tuple<typename std::remove_const<
+ typename std::remove_reference<ArgT>::type>::type...>;
+
+ std::function<void(ArgT...)> saveArgs = [this](ArgT... arg) {
+ this->saved_values = {arg...};
+ };
+
+ StorageT saved_values;
+};
+
+// Invokes |method| on |object|, providing |method| a CallbackT as the
+// final argument. Returns a copy of the parameters that |method| provided
+// to CallbackT. (The parameters are returned by value.)
+template <typename CallbackT, typename MethodT, typename ObjectT,
+ typename... ArgT>
+typename functionArgSaver<CallbackT>::StorageT invokeMethod(
+ MethodT method, ObjectT object, ArgT&&... methodArg) {
+ functionArgSaver<CallbackT> result_buffer;
+ const auto& res = ((*object).*method)(std::forward<ArgT>(methodArg)...,
+ result_buffer.saveArgs);
+ EXPECT_TRUE(res.isOk());
+ return result_buffer.saved_values;
+}
+} // namespace detail
+} // namespace
+
+// Invokes |method| on |strong_pointer|, passing provided arguments through to
+// |method|.
+//
+// Returns either:
+// - A copy of the result callback parameter (for callbacks with a single
+// parameter), OR
+// - A pair containing a copy of the result callback parameters (for callbacks
+// with two parameters), OR
+// - A tuple containing a copy of the result callback paramters (for callbacks
+// with three or more parameters).
+//
+// Example usage:
+// EXPECT_EQ(WifiStatusCode::SUCCESS,
+// HIDL_INVOKE(strong_pointer, methodReturningWifiStatus).code);
+// EXPECT_EQ(WifiStatusCode::SUCCESS,
+// HIDL_INVOKE(strong_pointer, methodReturningWifiStatusAndOneMore)
+// .first.code);
+// EXPECT_EQ(WifiStatusCode::SUCCESS, std::get<0>(
+// HIDL_INVOKE(strong_pointer, methodReturningWifiStatusAndTwoMore))
+// .code);
+#define HIDL_INVOKE(strong_pointer, method, ...) \
+ (detail::invokeMethod< \
+ std::remove_reference<decltype(*strong_pointer)>::type::method##_cb>( \
+ &std::remove_reference<decltype(*strong_pointer)>::type::method, \
+ strong_pointer, ##__VA_ARGS__))
diff --git a/wifi/supplicant/1.0/vts/functional/supplicant_p2p_iface_hidl_test.cpp b/wifi/supplicant/1.0/vts/functional/supplicant_p2p_iface_hidl_test.cpp
index 72a3c42..0181f7b 100644
--- a/wifi/supplicant/1.0/vts/functional/supplicant_p2p_iface_hidl_test.cpp
+++ b/wifi/supplicant/1.0/vts/functional/supplicant_p2p_iface_hidl_test.cpp
@@ -20,6 +20,7 @@
#include <android/hardware/wifi/supplicant/1.0/ISupplicantP2pIface.h>
+#include "supplicant_hidl_call_util.h"
#include "supplicant_hidl_test_utils.h"
using ::android::sp;
@@ -28,6 +29,7 @@
using ::android::hardware::hidl_vec;
using ::android::hardware::Return;
using ::android::hardware::Void;
+using ::android::hardware::wifi::supplicant::V1_0::IfaceType;
using ::android::hardware::wifi::supplicant::V1_0::ISupplicantP2pIface;
using ::android::hardware::wifi::supplicant::V1_0::ISupplicantP2pIfaceCallback;
using ::android::hardware::wifi::supplicant::V1_0::SupplicantNetworkId;
@@ -38,16 +40,30 @@
constexpr uint8_t kTestSsidPostfix[] = {'t', 'e', 's', 't'};
constexpr uint8_t kTestMacAddr[] = {0x56, 0x67, 0x67, 0xf4, 0x56, 0x92};
constexpr uint8_t kTestPeerMacAddr[] = {0x56, 0x67, 0x55, 0xf4, 0x56, 0x92};
+constexpr uint8_t kTestBonjourServiceQuery[] = {'t', 'e', 's', 't', 'q',
+ 'u', 'e', 'r', 'y'};
+constexpr uint8_t kTestBonjourServiceResponse[] = {
+ 't', 'e', 's', 't', 'r', 'e', 's', 'p', 'o', 'n', 's', 'e'};
+constexpr uint8_t kTestWfdDeviceInfo[] = {[0 ... 5] = 0x01};
constexpr char kTestConnectPin[] = "34556665";
constexpr char kTestGroupIfName[] = "TestGroup";
+constexpr char kTestWpsDeviceName[] = "TestWpsDeviceName";
+constexpr char kTestWpsManufacturer[] = "TestManufacturer";
+constexpr char kTestWpsModelName[] = "TestModelName";
+constexpr char kTestWpsModelNumber[] = "TestModelNumber";
+constexpr char kTestWpsSerialNumber[] = "TestSerialNumber";
+constexpr char kTestUpnpServiceName[] = "TestServiceName";
+constexpr uint8_t kTestWpsDeviceType[] = {[0 ... 7] = 0x01};
+constexpr uint16_t kTestWpsConfigMethods = 0xffff;
constexpr uint32_t kTestConnectGoIntent = 6;
constexpr uint32_t kTestFindTimeout = 5;
-constexpr SupplicantNetworkId kTestNetworkId = 5;
+constexpr uint32_t kTestSetGroupIdleTimeout = 6;
constexpr uint32_t kTestChannel = 1;
constexpr uint32_t kTestOperatingClass = 81;
constexpr uint32_t kTestFreqRange[] = {2412, 2432};
constexpr uint32_t kTestExtListenPeriod = 400;
constexpr uint32_t kTestExtListenInterval = 400;
+constexpr SupplicantNetworkId kTestNetworkId = 5;
} // namespace
class SupplicantP2pIfaceHidlTest : public ::testing::VtsHalHidlTargetTestBase {
@@ -178,6 +194,26 @@
}
/*
+ * GetName
+ */
+TEST_F(SupplicantP2pIfaceHidlTest, GetName) {
+ const auto& status_and_interface_name = HIDL_INVOKE(p2p_iface_, getName);
+ EXPECT_EQ(SupplicantStatusCode::SUCCESS,
+ status_and_interface_name.first.code);
+ EXPECT_FALSE(std::string(status_and_interface_name.second).empty());
+}
+
+/*
+ * GetType
+ */
+TEST_F(SupplicantP2pIfaceHidlTest, GetType) {
+ const auto& status_and_interface_type = HIDL_INVOKE(p2p_iface_, getType);
+ EXPECT_EQ(SupplicantStatusCode::SUCCESS,
+ status_and_interface_type.first.code);
+ EXPECT_EQ(status_and_interface_type.second, IfaceType::P2P);
+}
+
+/*
* GetDeviceAddress
*/
TEST_F(SupplicantP2pIfaceHidlTest, GetDeviceAddress) {
@@ -219,10 +255,6 @@
p2p_iface_->stopFind([](const SupplicantStatus& status) {
EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
});
-
- p2p_iface_->stopFind([](const SupplicantStatus& status) {
- EXPECT_NE(SupplicantStatusCode::SUCCESS, status.code);
- });
}
/*
@@ -290,6 +322,15 @@
}
/*
+ * RemoveGroup
+ */
+TEST_F(SupplicantP2pIfaceHidlTest, RemoveGroup) {
+ // This is not going to work with fake values.
+ EXPECT_NE(SupplicantStatusCode::SUCCESS,
+ HIDL_INVOKE(p2p_iface_, removeGroup, kTestGroupIfName).code);
+}
+
+/*
* Reject
*/
TEST_F(SupplicantP2pIfaceHidlTest, Reject) {
@@ -411,3 +452,170 @@
status.code);
});
}
+
+/*
+ * SetGroupIdle
+ */
+TEST_F(SupplicantP2pIfaceHidlTest, SetGroupIdle) {
+ // This is not going to work with fake values.
+ EXPECT_NE(SupplicantStatusCode::SUCCESS,
+ HIDL_INVOKE(p2p_iface_, setGroupIdle, kTestGroupIfName,
+ kTestSetGroupIdleTimeout)
+ .code);
+}
+
+/*
+ * SetPowerSave
+ */
+TEST_F(SupplicantP2pIfaceHidlTest, SetPowerSave) {
+ // This is not going to work with fake values.
+ EXPECT_NE(
+ SupplicantStatusCode::SUCCESS,
+ HIDL_INVOKE(p2p_iface_, setPowerSave, kTestGroupIfName, true).code);
+ // This is not going to work with fake values.
+ EXPECT_NE(
+ SupplicantStatusCode::SUCCESS,
+ HIDL_INVOKE(p2p_iface_, setPowerSave, kTestGroupIfName, false).code);
+}
+
+/*
+ * SetWpsDeviceName
+ */
+TEST_F(SupplicantP2pIfaceHidlTest, SetWpsDeviceName) {
+ EXPECT_EQ(
+ SupplicantStatusCode::SUCCESS,
+ HIDL_INVOKE(p2p_iface_, setWpsDeviceName, kTestWpsDeviceName).code);
+}
+
+/*
+ * SetWpsDeviceType
+ */
+TEST_F(SupplicantP2pIfaceHidlTest, SetWpsDeviceType) {
+ EXPECT_EQ(
+ SupplicantStatusCode::SUCCESS,
+ HIDL_INVOKE(p2p_iface_, setWpsDeviceType, kTestWpsDeviceType).code);
+}
+
+/*
+ * SetWpsManufacturer
+ */
+TEST_F(SupplicantP2pIfaceHidlTest, SetWpsManufacturer) {
+ EXPECT_EQ(
+ SupplicantStatusCode::SUCCESS,
+ HIDL_INVOKE(p2p_iface_, setWpsManufacturer, kTestWpsManufacturer).code);
+}
+
+/*
+ * SetWpsModelName
+ */
+TEST_F(SupplicantP2pIfaceHidlTest, SetWpsModelName) {
+ EXPECT_EQ(SupplicantStatusCode::SUCCESS,
+ HIDL_INVOKE(p2p_iface_, setWpsModelName, kTestWpsModelName).code);
+}
+
+/*
+ * SetWpsModelNumber
+ */
+TEST_F(SupplicantP2pIfaceHidlTest, SetWpsModelNumber) {
+ EXPECT_EQ(
+ SupplicantStatusCode::SUCCESS,
+ HIDL_INVOKE(p2p_iface_, setWpsModelNumber, kTestWpsModelNumber).code);
+}
+
+/*
+ * SetWpsSerialNumber
+ */
+TEST_F(SupplicantP2pIfaceHidlTest, SetWpsSerialNumber) {
+ EXPECT_EQ(
+ SupplicantStatusCode::SUCCESS,
+ HIDL_INVOKE(p2p_iface_, setWpsSerialNumber, kTestWpsSerialNumber).code);
+}
+
+/*
+ * SetWpsConfigMethods
+ */
+TEST_F(SupplicantP2pIfaceHidlTest, SetWpsConfigMethods) {
+ EXPECT_EQ(
+ SupplicantStatusCode::SUCCESS,
+ HIDL_INVOKE(p2p_iface_, setWpsConfigMethods, kTestWpsConfigMethods)
+ .code);
+}
+
+/*
+ * AddAndRemoveBonjourService
+ * This tests that we are able to add a bonjour service, and we can remove it
+ * by using the same query data.
+ * This also tests that removeBonjourSerive() returns error when there is no
+ * existing bonjour service with the same query data.
+ */
+TEST_F(SupplicantP2pIfaceHidlTest, AddAndRemoveBonjourService) {
+ EXPECT_EQ(SupplicantStatusCode::SUCCESS,
+ HIDL_INVOKE(
+ p2p_iface_, addBonjourService,
+ std::vector<uint8_t>(kTestBonjourServiceQuery,
+ kTestBonjourServiceQuery +
+ sizeof(kTestBonjourServiceQuery)),
+ std::vector<uint8_t>(kTestBonjourServiceResponse,
+ kTestBonjourServiceResponse +
+ sizeof(kTestBonjourServiceResponse)))
+ .code);
+ EXPECT_EQ(
+ SupplicantStatusCode::SUCCESS,
+ HIDL_INVOKE(p2p_iface_, removeBonjourService,
+ std::vector<uint8_t>(kTestBonjourServiceQuery,
+ kTestBonjourServiceQuery +
+ sizeof(kTestBonjourServiceQuery)))
+ .code);
+ // This will fail because boujour service with kTestBonjourServiceQuery was
+ // already removed.
+ EXPECT_NE(
+ SupplicantStatusCode::SUCCESS,
+ HIDL_INVOKE(p2p_iface_, removeBonjourService,
+ std::vector<uint8_t>(kTestBonjourServiceQuery,
+ kTestBonjourServiceQuery +
+ sizeof(kTestBonjourServiceQuery)))
+ .code);
+}
+
+/*
+ * AddAndRemoveUpnpService
+ * This tests that we are able to add a upnp service, and we can remove it
+ * by using the same service name.
+ * This also tests that removeUpnpService() returns error when there is no
+ * exsiting upnp service with the same service name.
+ */
+TEST_F(SupplicantP2pIfaceHidlTest, AddAndRemoveUpnpService) {
+ EXPECT_EQ(SupplicantStatusCode::SUCCESS,
+ HIDL_INVOKE(p2p_iface_, addUpnpService, 0 /* version */,
+ kTestUpnpServiceName)
+ .code);
+ EXPECT_EQ(SupplicantStatusCode::SUCCESS,
+ HIDL_INVOKE(p2p_iface_, removeUpnpService, 0 /* version */,
+ kTestUpnpServiceName)
+ .code);
+ // This will fail because Upnp service with kTestUpnpServiceName was
+ // already removed.
+ EXPECT_NE(SupplicantStatusCode::SUCCESS,
+ HIDL_INVOKE(p2p_iface_, removeUpnpService, 0 /* version */,
+ kTestUpnpServiceName)
+ .code);
+}
+
+/*
+ * EnableWfd
+ */
+TEST_F(SupplicantP2pIfaceHidlTest, EnableWfd) {
+ EXPECT_EQ(SupplicantStatusCode::SUCCESS,
+ HIDL_INVOKE(p2p_iface_, enableWfd, true).code);
+ EXPECT_EQ(SupplicantStatusCode::SUCCESS,
+ HIDL_INVOKE(p2p_iface_, enableWfd, false).code);
+}
+
+/*
+ * SetWfdDeviceInfo
+ */
+TEST_F(SupplicantP2pIfaceHidlTest, SetWfdDeviceInfo) {
+ EXPECT_EQ(
+ SupplicantStatusCode::SUCCESS,
+ HIDL_INVOKE(p2p_iface_, setWfdDeviceInfo, kTestWfdDeviceInfo).code);
+}
diff --git a/wifi/supplicant/1.0/vts/functional/supplicant_sta_iface_hidl_test.cpp b/wifi/supplicant/1.0/vts/functional/supplicant_sta_iface_hidl_test.cpp
index 5abf4e0..c0e62d1 100644
--- a/wifi/supplicant/1.0/vts/functional/supplicant_sta_iface_hidl_test.cpp
+++ b/wifi/supplicant/1.0/vts/functional/supplicant_sta_iface_hidl_test.cpp
@@ -20,6 +20,7 @@
#include <android/hardware/wifi/supplicant/1.0/ISupplicantStaIface.h>
+#include "supplicant_hidl_call_util.h"
#include "supplicant_hidl_test_utils.h"
using ::android::sp;
@@ -28,6 +29,7 @@
using ::android::hardware::hidl_vec;
using ::android::hardware::Return;
using ::android::hardware::Void;
+using ::android::hardware::wifi::supplicant::V1_0::IfaceType;
using ::android::hardware::wifi::supplicant::V1_0::ISupplicantStaIface;
using ::android::hardware::wifi::supplicant::V1_0::ISupplicantStaIfaceCallback;
using ::android::hardware::wifi::supplicant::V1_0::ISupplicantStaNetwork;
@@ -45,7 +47,18 @@
ISupplicantStaIface::Hs20AnqpSubtypes::WAN_METRICS,
ISupplicantStaIface::Hs20AnqpSubtypes::OPERATOR_FRIENDLY_NAME};
constexpr char kTestHs20IconFile[] = "TestFile";
+constexpr char kTestWpsDeviceName[] = "TestWpsDeviceName";
+constexpr char kTestWpsManufacturer[] = "TestManufacturer";
+constexpr char kTestWpsModelName[] = "TestModelName";
+constexpr char kTestWpsModelNumber[] = "TestModelNumber";
+constexpr char kTestWpsSerialNumber[] = "TestSerialNumber";
+constexpr char kTestRadioWorkName[] = "TestRadioWork";
+constexpr uint32_t kTestRadioWorkFrequency = 2412;
+constexpr uint32_t kTestRadioWorkTimeout = 8;
+constexpr uint32_t kTestRadioWorkId = 16;
constexpr int8_t kTestCountryCode[] = {'U', 'S'};
+constexpr uint8_t kTestWpsDeviceType[] = {[0 ... 7] = 0x01};
+constexpr uint16_t kTestWpsConfigMethods = 0xffff;
} // namespace
class SupplicantStaIfaceHidlTest : public ::testing::VtsHalHidlTargetTestBase {
@@ -163,6 +176,26 @@
}
/*
+ * GetName
+ */
+TEST_F(SupplicantStaIfaceHidlTest, GetName) {
+ const auto& status_and_interface_name = HIDL_INVOKE(sta_iface_, getName);
+ EXPECT_EQ(SupplicantStatusCode::SUCCESS,
+ status_and_interface_name.first.code);
+ EXPECT_FALSE(std::string(status_and_interface_name.second).empty());
+}
+
+/*
+ * GetType
+ */
+TEST_F(SupplicantStaIfaceHidlTest, GetType) {
+ const auto& status_and_interface_type = HIDL_INVOKE(sta_iface_, getType);
+ EXPECT_EQ(SupplicantStatusCode::SUCCESS,
+ status_and_interface_type.first.code);
+ EXPECT_EQ(status_and_interface_type.second, IfaceType::STA);
+}
+
+/*
* listNetworks.
*/
TEST_F(SupplicantStaIfaceHidlTest, listNetworks) {
@@ -405,3 +438,101 @@
EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
});
}
+
+/*
+ * SetWpsDeviceName
+ */
+TEST_F(SupplicantStaIfaceHidlTest, SetWpsDeviceName) {
+ EXPECT_EQ(
+ SupplicantStatusCode::SUCCESS,
+ HIDL_INVOKE(sta_iface_, setWpsDeviceName, kTestWpsDeviceName).code);
+}
+
+/*
+ * SetWpsDeviceType
+ */
+TEST_F(SupplicantStaIfaceHidlTest, SetWpsDeviceType) {
+ EXPECT_EQ(
+ SupplicantStatusCode::SUCCESS,
+ HIDL_INVOKE(sta_iface_, setWpsDeviceType, kTestWpsDeviceType).code);
+}
+
+/*
+ * SetWpsManufacturer
+ */
+TEST_F(SupplicantStaIfaceHidlTest, SetWpsManufacturer) {
+ EXPECT_EQ(
+ SupplicantStatusCode::SUCCESS,
+ HIDL_INVOKE(sta_iface_, setWpsManufacturer, kTestWpsManufacturer).code);
+}
+
+/*
+ * SetWpsModelName
+ */
+TEST_F(SupplicantStaIfaceHidlTest, SetWpsModelName) {
+ EXPECT_EQ(SupplicantStatusCode::SUCCESS,
+ HIDL_INVOKE(sta_iface_, setWpsModelName, kTestWpsModelName).code);
+}
+
+/*
+ * SetWpsModelNumber
+ */
+TEST_F(SupplicantStaIfaceHidlTest, SetWpsModelNumber) {
+ EXPECT_EQ(
+ SupplicantStatusCode::SUCCESS,
+ HIDL_INVOKE(sta_iface_, setWpsModelNumber, kTestWpsModelNumber).code);
+}
+
+/*
+ * SetWpsSerialNumber
+ */
+TEST_F(SupplicantStaIfaceHidlTest, SetWpsSerialNumber) {
+ EXPECT_EQ(
+ SupplicantStatusCode::SUCCESS,
+ HIDL_INVOKE(sta_iface_, setWpsSerialNumber, kTestWpsSerialNumber).code);
+}
+
+/*
+ * SetWpsConfigMethods
+ */
+TEST_F(SupplicantStaIfaceHidlTest, SetWpsConfigMethods) {
+ EXPECT_EQ(
+ SupplicantStatusCode::SUCCESS,
+ HIDL_INVOKE(sta_iface_, setWpsConfigMethods, kTestWpsConfigMethods)
+ .code);
+}
+
+/*
+ * SetExternalSim
+ */
+TEST_F(SupplicantStaIfaceHidlTest, SetExternalSim) {
+ EXPECT_EQ(SupplicantStatusCode::SUCCESS,
+ HIDL_INVOKE(sta_iface_, setExternalSim, true).code);
+ EXPECT_EQ(SupplicantStatusCode::SUCCESS,
+ HIDL_INVOKE(sta_iface_, setExternalSim, false).code);
+}
+
+/*
+ * AddExtRadioWork
+ */
+TEST_F(SupplicantStaIfaceHidlTest, AddExtRadioWork) {
+ const auto& status_and_radio_work_id =
+ HIDL_INVOKE(sta_iface_, addExtRadioWork, kTestRadioWorkName,
+ kTestRadioWorkFrequency, kTestRadioWorkTimeout);
+ EXPECT_EQ(SupplicantStatusCode::SUCCESS,
+ status_and_radio_work_id.first.code);
+ // removeExtRadio only succeeds if the added radio work hasn't started yet.
+ // So there this no guaranteed result from calling removeExtRadioWork here.
+ // That being said, currently we are not able to test addExtRadioWork and
+ // removeExtRadioWork in a row.
+}
+
+/*
+ * RemoveExtRadioWork
+ */
+TEST_F(SupplicantStaIfaceHidlTest, RemoveExtRadioWork) {
+ // This fails because there is no on going radio work with kTestRadioWorkId.
+ EXPECT_NE(
+ SupplicantStatusCode::SUCCESS,
+ HIDL_INVOKE(sta_iface_, removeExtRadioWork, kTestRadioWorkId).code);
+}
diff --git a/wifi/supplicant/1.0/vts/functional/supplicant_sta_network_hidl_test.cpp b/wifi/supplicant/1.0/vts/functional/supplicant_sta_network_hidl_test.cpp
index aa84e9a..832dd41 100644
--- a/wifi/supplicant/1.0/vts/functional/supplicant_sta_network_hidl_test.cpp
+++ b/wifi/supplicant/1.0/vts/functional/supplicant_sta_network_hidl_test.cpp
@@ -22,6 +22,7 @@
#include <android/hardware/wifi/supplicant/1.0/ISupplicantStaNetwork.h>
+#include "supplicant_hidl_call_util.h"
#include "supplicant_hidl_test_utils.h"
using ::android::sp;
@@ -30,6 +31,7 @@
using ::android::hardware::hidl_vec;
using ::android::hardware::Return;
using ::android::hardware::Void;
+using ::android::hardware::wifi::supplicant::V1_0::IfaceType;
using ::android::hardware::wifi::supplicant::V1_0::ISupplicantStaIface;
using ::android::hardware::wifi::supplicant::V1_0::ISupplicantStaNetwork;
using ::android::hardware::wifi::supplicant::V1_0::
@@ -39,7 +41,7 @@
namespace {
constexpr char kTestSsidStr[] = "TestSsid1234";
-constexpr char kTestPsk[] = "TestPsk123";
+constexpr char kTestPskPassphrase[] = "TestPsk123";
constexpr char kTestIdStr[] = "TestIdstr";
constexpr char kTestEapPasswdStr[] = "TestEapPasswd1234";
constexpr char kTestEapCert[] = "keystore://CERT";
@@ -54,7 +56,10 @@
constexpr uint8_t kTestIk[] = {[0 ... 15] = 0x65};
constexpr uint8_t kTestCk[] = {[0 ... 15] = 0x45};
constexpr uint8_t kTestIdentity[] = {0x45, 0x67, 0x98, 0x67, 0x56};
+constexpr uint8_t kTestPsk[] = {[0 ... 31] = 0x12};
+constexpr uint8_t kTestAutParam[] = {[0 ... 13] = 0xe1};
constexpr uint32_t kTestWepTxKeyIdx = 2;
+constexpr uint32_t kTestUpdateIdentifier = 21;
constexpr uint32_t kTestKeyMgmt = (ISupplicantStaNetwork::KeyMgmtMask::WPA_PSK |
ISupplicantStaNetwork::KeyMgmtMask::WPA_EAP);
constexpr uint32_t kTestProto = (ISupplicantStaNetwork::ProtoMask::OSEN |
@@ -137,6 +142,27 @@
});
}
+/*
+ * GetInterfaceName
+ */
+TEST_F(SupplicantStaNetworkHidlTest, GetInterfaceName) {
+ const auto& status_and_interface_name =
+ HIDL_INVOKE(sta_network_, getInterfaceName);
+ EXPECT_EQ(SupplicantStatusCode::SUCCESS,
+ status_and_interface_name.first.code);
+ EXPECT_FALSE(std::string(status_and_interface_name.second).empty());
+}
+
+/*
+ * GetType
+ */
+TEST_F(SupplicantStaNetworkHidlTest, GetType) {
+ const auto& status_and_interface_type = HIDL_INVOKE(sta_network_, getType);
+ EXPECT_EQ(SupplicantStatusCode::SUCCESS,
+ status_and_interface_type.first.code);
+ EXPECT_EQ(status_and_interface_type.second, IfaceType::STA);
+}
+
/* Tests out the various setter/getter methods. */
/*
* SetGetSsid
@@ -246,17 +272,29 @@
*/
TEST_F(SupplicantStaNetworkHidlTest, SetGetPskPassphrase) {
sta_network_->setPskPassphrase(
- kTestPsk, [](const SupplicantStatus& status) {
+ kTestPskPassphrase, [](const SupplicantStatus& status) {
EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
});
sta_network_->getPskPassphrase(
[&](const SupplicantStatus& status, const hidl_string& psk) {
EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
- EXPECT_EQ(kTestPsk, std::string(psk.c_str()));
+ EXPECT_EQ(kTestPskPassphrase, std::string(psk.c_str()));
});
}
/*
+ * SetGetPsk
+ */
+TEST_F(SupplicantStaNetworkHidlTest, SetGetPsk) {
+ EXPECT_EQ(SupplicantStatusCode::SUCCESS,
+ HIDL_INVOKE(sta_network_, setPsk, kTestPsk).code);
+ const auto& status_and_psk = HIDL_INVOKE(sta_network_, getPsk);
+ EXPECT_EQ(SupplicantStatusCode::SUCCESS, status_and_psk.first.code);
+ hidl_array<uint8_t, 32> expected_psk(kTestPsk);
+ EXPECT_EQ(expected_psk, status_and_psk.second);
+}
+
+/*
* SetGetWepKeys
*/
TEST_F(SupplicantStaNetworkHidlTest, SetGetWepTxKeyIdx) {
@@ -361,6 +399,12 @@
* SetGetEapPhase2Method
*/
TEST_F(SupplicantStaNetworkHidlTest, SetGetEapPhase2Method) {
+ ISupplicantStaNetwork::EapMethod set_eap_method =
+ ISupplicantStaNetwork::EapMethod::PEAP;
+ sta_network_->setEapMethod(
+ set_eap_method, [](const SupplicantStatus& status) {
+ EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
+ });
ISupplicantStaNetwork::EapPhase2Method set_eap_phase2_method =
ISupplicantStaNetwork::EapPhase2Method::NONE;
sta_network_->setEapPhase2Method(
@@ -500,6 +544,21 @@
}
/*
+ * SetGetEapSubjectMatch
+ */
+TEST_F(SupplicantStaNetworkHidlTest, SetGetEapSubjectMatch) {
+ EXPECT_EQ(
+ SupplicantStatusCode::SUCCESS,
+ HIDL_INVOKE(sta_network_, setEapSubjectMatch, kTestEapMatch).code);
+ const auto& status_and_subject_match =
+ HIDL_INVOKE(sta_network_, getEapSubjectMatch);
+ EXPECT_EQ(SupplicantStatusCode::SUCCESS,
+ status_and_subject_match.first.code);
+ EXPECT_EQ(kTestEapMatch,
+ std::string(status_and_subject_match.second.c_str()));
+}
+
+/*
* SetGetEapDomainSuffixMatch
*/
TEST_F(SupplicantStaNetworkHidlTest, SetGetEapDomainSuffixMatch) {
@@ -634,6 +693,14 @@
}
/*
+ * SendNetworkEapSimGsmAuthFailure
+ */
+TEST_F(SupplicantStaNetworkHidlTest, SendNetworkEapSimGsmAuthFailure) {
+ EXPECT_EQ(SupplicantStatusCode::SUCCESS,
+ HIDL_INVOKE(sta_network_, sendNetworkEapSimGsmAuthFailure).code);
+}
+
+/*
* SendNetworkEapSimUmtsAuthResponse
*/
TEST_F(SupplicantStaNetworkHidlTest, SendNetworkEapSimUmtsAuthResponse) {
@@ -648,6 +715,24 @@
}
/*
+ * SendNetworkEapSimUmtsAuthFailure
+ */
+TEST_F(SupplicantStaNetworkHidlTest, SendNetworkEapSimUmtsAuthFailure) {
+ EXPECT_EQ(SupplicantStatusCode::SUCCESS,
+ HIDL_INVOKE(sta_network_, sendNetworkEapSimUmtsAuthFailure).code);
+}
+
+/*
+ * SendNetworkEapSimUmtsAutsResponse
+ */
+TEST_F(SupplicantStaNetworkHidlTest, SendNetworkEapSimUmtsAutsResponse) {
+ EXPECT_EQ(SupplicantStatusCode::SUCCESS,
+ HIDL_INVOKE(sta_network_, sendNetworkEapSimUmtsAutsResponse,
+ kTestAutParam)
+ .code);
+}
+
+/*
* SendNetworkEapIdentityResponse
*/
TEST_F(SupplicantStaNetworkHidlTest, SendNetworkEapIdentityResponse) {
@@ -658,3 +743,40 @@
EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
});
}
+
+/*
+ * SetUpdateIdentifier
+ */
+TEST_F(SupplicantStaNetworkHidlTest, SetUpdateIdentifier) {
+ EXPECT_EQ(
+ SupplicantStatusCode::SUCCESS,
+ HIDL_INVOKE(sta_network_, setUpdateIdentifier, kTestUpdateIdentifier)
+ .code);
+}
+
+/*
+ * SetProactiveKeyCaching
+ */
+TEST_F(SupplicantStaNetworkHidlTest, SetProactiveKeyCaching) {
+ EXPECT_EQ(SupplicantStatusCode::SUCCESS,
+ HIDL_INVOKE(sta_network_, setProactiveKeyCaching, true).code);
+ EXPECT_EQ(SupplicantStatusCode::SUCCESS,
+ HIDL_INVOKE(sta_network_, setProactiveKeyCaching, false).code);
+}
+
+/*
+ * GetWpsNfcConfigurationToken
+ */
+TEST_F(SupplicantStaNetworkHidlTest, GetWpsNfcConfigurationToken) {
+ ASSERT_EQ(SupplicantStatusCode::SUCCESS,
+ HIDL_INVOKE(sta_network_, setSsid, ssid_).code);
+ ASSERT_EQ(SupplicantStatusCode::SUCCESS,
+ HIDL_INVOKE(sta_network_, setKeyMgmt, kTestKeyMgmt).code);
+ ASSERT_EQ(
+ SupplicantStatusCode::SUCCESS,
+ HIDL_INVOKE(sta_network_, setPskPassphrase, kTestPskPassphrase).code);
+ const auto& status_and_token =
+ HIDL_INVOKE(sta_network_, getWpsNfcConfigurationToken);
+ EXPECT_EQ(SupplicantStatusCode::SUCCESS, status_and_token.first.code);
+ EXPECT_FALSE(0 == status_and_token.second.size());
+}