Merge "supplicant(interface): Uprev to 1.1"
diff --git a/audio/2.0/default/Stream.h b/audio/2.0/default/Stream.h
index 82f05a7..e29af53 100644
--- a/audio/2.0/default/Stream.h
+++ b/audio/2.0/default/Stream.h
@@ -49,6 +49,13 @@
struct Stream : public IStream, public ParametersUtil {
explicit Stream(audio_stream_t* stream);
+ /** 1GiB is the maximum buffer size the HAL client is allowed to request.
+ * This value has been chosen to be under SIZE_MAX and still big enough
+ * for all audio use case.
+ * Keep private for 2.0, put in .hal in 2.1
+ */
+ static constexpr uint32_t MAX_BUFFER_SIZE = 2 << 30 /* == 1GiB */;
+
// Methods from ::android::hardware::audio::V2_0::IStream follow.
Return<uint64_t> getFrameSize() override;
Return<uint64_t> getFrameCount() override;
diff --git a/audio/2.0/default/StreamIn.cpp b/audio/2.0/default/StreamIn.cpp
index b81cbb9..9c933a9 100644
--- a/audio/2.0/default/StreamIn.cpp
+++ b/audio/2.0/default/StreamIn.cpp
@@ -347,14 +347,10 @@
sendError(Result::INVALID_ARGUMENTS);
return Void();
}
- // A message queue asserts if it can not handle the requested buffer,
- // thus the client has to guess the maximum size it can handle
- // Choose an arbitrary margin for the overhead of a message queue
- size_t metadataOverhead = 100000;
- if (frameSize >
- (std::numeric_limits<size_t>::max() - metadataOverhead) / framesCount) {
- ALOGE("Buffer too big: %u*%u bytes can not fit in a message queue",
- frameSize, framesCount);
+
+ if (frameSize > Stream::MAX_BUFFER_SIZE / framesCount) {
+ ALOGE("Buffer too big: %u*%u bytes > MAX_BUFFER_SIZE (%u)", frameSize, framesCount,
+ Stream::MAX_BUFFER_SIZE);
sendError(Result::INVALID_ARGUMENTS);
return Void();
}
diff --git a/audio/2.0/default/StreamOut.cpp b/audio/2.0/default/StreamOut.cpp
index 290d0b1..22dcd0c 100644
--- a/audio/2.0/default/StreamOut.cpp
+++ b/audio/2.0/default/StreamOut.cpp
@@ -323,14 +323,9 @@
sendError(Result::INVALID_ARGUMENTS);
return Void();
}
- // A message queue asserts if it can not handle the requested buffer,
- // thus the client has to guess the maximum size it can handle
- size_t metadataOverhead =
- 100000; // Arbitrary margin for the overhead of a message queue
- if (frameSize >
- (std::numeric_limits<size_t>::max() - metadataOverhead) / framesCount) {
- ALOGE("Buffer too big: %u*%u bytes can not fit in a message queue",
- frameSize, framesCount);
+ if (frameSize > Stream::MAX_BUFFER_SIZE / framesCount) {
+ ALOGE("Buffer too big: %u*%u bytes > MAX_BUFFER_SIZE (%u)", frameSize, framesCount,
+ Stream::MAX_BUFFER_SIZE);
sendError(Result::INVALID_ARGUMENTS);
return Void();
}
diff --git a/audio/common/Android.mk b/audio/common/Android.mk
deleted file mode 100644
index f9e3276..0000000
--- a/audio/common/Android.mk
+++ /dev/null
@@ -1,19 +0,0 @@
-#
-# Copyright (C) 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.
-#
-
-LOCAL_PATH := $(call my-dir)
-
-include $(call all-subdir-makefiles)
diff --git a/audio/effect/2.0/vts/Android.mk b/audio/effect/2.0/vts/Android.mk
deleted file mode 100644
index abdd5bf..0000000
--- a/audio/effect/2.0/vts/Android.mk
+++ /dev/null
@@ -1,21 +0,0 @@
-#
-# Copyright (C) 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.
-#
-
-LOCAL_PATH := $(call my-dir)
-
-include $(CLEAR_VARS)
-
-include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/audio/effect/Android.mk b/audio/effect/Android.mk
deleted file mode 100644
index f9e3276..0000000
--- a/audio/effect/Android.mk
+++ /dev/null
@@ -1,19 +0,0 @@
-#
-# Copyright (C) 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.
-#
-
-LOCAL_PATH := $(call my-dir)
-
-include $(call all-subdir-makefiles)
diff --git a/boot/1.0/vts/Android.mk b/boot/1.0/vts/Android.mk
deleted file mode 100644
index df5dac8..0000000
--- a/boot/1.0/vts/Android.mk
+++ /dev/null
@@ -1,19 +0,0 @@
-#
-# Copyright (C) 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.
-#
-
-LOCAL_PATH := $(call my-dir)
-
-include $(call all-subdir-makefiles)
\ No newline at end of file
diff --git a/cas/1.0/vts/functional/Android.bp b/cas/1.0/vts/functional/Android.bp
index d601235..e1e09e9 100644
--- a/cas/1.0/vts/functional/Android.bp
+++ b/cas/1.0/vts/functional/Android.bp
@@ -18,6 +18,15 @@
name: "VtsHalCasV1_0TargetTest",
defaults: ["VtsHalTargetTestDefaults"],
srcs: ["VtsHalCasV1_0TargetTest.cpp"],
- static_libs: ["android.hardware.cas@1.0"],
+ static_libs: [
+ "android.hardware.cas@1.0",
+ "android.hardware.cas.native@1.0",
+ "android.hidl.allocator@1.0",
+ "android.hidl.memory@1.0",
+ "libhidlmemory",
+ ],
+ shared_libs: [
+ "libbinder",
+ ],
}
diff --git a/cas/1.0/vts/functional/VtsHalCasV1_0TargetTest.cpp b/cas/1.0/vts/functional/VtsHalCasV1_0TargetTest.cpp
index f346bae..4a6ccd7 100644
--- a/cas/1.0/vts/functional/VtsHalCasV1_0TargetTest.cpp
+++ b/cas/1.0/vts/functional/VtsHalCasV1_0TargetTest.cpp
@@ -22,30 +22,190 @@
#include <android/hardware/cas/1.0/ICasListener.h>
#include <android/hardware/cas/1.0/IDescramblerBase.h>
#include <android/hardware/cas/1.0/IMediaCasService.h>
+#include <android/hardware/cas/1.0/types.h>
+#include <android/hardware/cas/native/1.0/IDescrambler.h>
+#include <android/hardware/cas/native/1.0/types.h>
+#include <binder/MemoryDealer.h>
#include <hidl/HidlSupport.h>
#include <hidl/HidlTransportSupport.h>
+#include <hidl/Status.h>
+#include <utils/Condition.h>
+#include <utils/Mutex.h>
-#include <cinttypes>
-#include <utility>
-
-// CA System Ids used for testing
#define CLEAR_KEY_SYSTEM_ID 0xF6D8
#define INVALID_SYSTEM_ID 0
+#define WAIT_TIMEOUT 3000000000
+
+#define PROVISION_STR \
+ "{ " \
+ " \"id\": 21140844, " \
+ " \"name\": \"Test Title\", " \
+ " \"lowercase_organization_name\": \"Android\", " \
+ " \"asset_key\": { " \
+ " \"encryption_key\": \"nezAr3CHFrmBR9R8Tedotw==\" " \
+ " }, " \
+ " \"cas_type\": 1, " \
+ " \"track_types\": [ ] " \
+ "} "
using android::Condition;
using android::hardware::cas::V1_0::ICas;
using android::hardware::cas::V1_0::ICasListener;
using android::hardware::cas::V1_0::IDescramblerBase;
+using android::hardware::cas::native::V1_0::IDescrambler;
+using android::hardware::cas::native::V1_0::SubSample;
+using android::hardware::cas::native::V1_0::SharedBuffer;
+using android::hardware::cas::native::V1_0::DestinationBuffer;
+using android::hardware::cas::native::V1_0::BufferType;
+using android::hardware::cas::native::V1_0::ScramblingControl;
using android::hardware::cas::V1_0::IMediaCasService;
using android::hardware::cas::V1_0::HidlCasPluginDescriptor;
using android::hardware::Void;
using android::hardware::hidl_vec;
+using android::hardware::hidl_string;
+using android::hardware::hidl_handle;
+using android::hardware::hidl_memory;
using android::hardware::Return;
+using android::hardware::cas::V1_0::Status;
+using android::IMemory;
+using android::IMemoryHeap;
+using android::MemoryDealer;
using android::Mutex;
using android::sp;
namespace {
+const uint8_t kEcmBinaryBuffer[] = {
+ 0x00, 0x00, 0x01, 0xf0, 0x00, 0x50, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x46, 0x00,
+ 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x27, 0x10, 0x02, 0x00,
+ 0x01, 0x77, 0x01, 0x42, 0x95, 0x6c, 0x0e, 0xe3, 0x91, 0xbc, 0xfd, 0x05, 0xb1, 0x60, 0x4f,
+ 0x17, 0x82, 0xa4, 0x86, 0x9b, 0x23, 0x56, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
+ 0x27, 0x10, 0x02, 0x00, 0x01, 0x77, 0x01, 0x42, 0x95, 0x6c, 0xd7, 0x43, 0x62, 0xf8, 0x1c,
+ 0x62, 0x19, 0x05, 0xc7, 0x3a, 0x42, 0xcd, 0xfd, 0xd9, 0x13, 0x48,
+};
+
+const SubSample kSubSamples[] = {{162, 0}, {0, 184}, {0, 184}};
+
+const uint8_t kInBinaryBuffer[] = {
+ 0x00, 0x00, 0x00, 0x01, 0x09, 0xf0, 0x00, 0x00, 0x00, 0x01, 0x67, 0x42, 0xc0, 0x1e, 0xdb, 0x01,
+ 0x40, 0x16, 0xec, 0x04, 0x40, 0x00, 0x00, 0x03, 0x00, 0x40, 0x00, 0x00, 0x0f, 0x03, 0xc5, 0x8b,
+ 0xb8, 0x00, 0x00, 0x00, 0x01, 0x68, 0xca, 0x8c, 0xb2, 0x00, 0x00, 0x01, 0x06, 0x05, 0xff, 0xff,
+ 0x70, 0xdc, 0x45, 0xe9, 0xbd, 0xe6, 0xd9, 0x48, 0xb7, 0x96, 0x2c, 0xd8, 0x20, 0xd9, 0x23, 0xee,
+ 0xef, 0x78, 0x32, 0x36, 0x34, 0x20, 0x2d, 0x20, 0x63, 0x6f, 0x72, 0x65, 0x20, 0x31, 0x34, 0x32,
+ 0x20, 0x2d, 0x20, 0x48, 0x2e, 0x32, 0x36, 0x34, 0x2f, 0x4d, 0x50, 0x45, 0x47, 0x2d, 0x34, 0x20,
+ 0x41, 0x56, 0x43, 0x20, 0x63, 0x6f, 0x64, 0x65, 0x63, 0x20, 0x2d, 0x20, 0x43, 0x6f, 0x70, 0x79,
+ 0x6c, 0x65, 0x66, 0x74, 0x20, 0x32, 0x30, 0x30, 0x33, 0x2d, 0x32, 0x30, 0x31, 0x34, 0x20, 0x2d,
+ 0x20, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, 0x2f, 0x77, 0x77, 0x77, 0x2e, 0x76, 0x69, 0x64, 0x65,
+ 0x6f, 0x6c, 0x61, 0x6e, 0x2e, 0x6f, 0x72, 0x67, 0x2f, 0x78, 0x32, 0x36, 0x34, 0x2e, 0x68, 0x74,
+ 0x6d, 0x6c, 0x6e, 0x45, 0x21, 0x82, 0x38, 0xf0, 0x9d, 0x7d, 0x96, 0xe6, 0x94, 0xae, 0xe2, 0x87,
+ 0x8f, 0x04, 0x49, 0xe5, 0xf6, 0x8c, 0x8b, 0x9a, 0x10, 0x18, 0xba, 0x94, 0xe9, 0x22, 0x31, 0x04,
+ 0x7e, 0x60, 0x5b, 0xc4, 0x24, 0x00, 0x90, 0x62, 0x0d, 0xdc, 0x85, 0x74, 0x75, 0x78, 0xd0, 0x14,
+ 0x08, 0xcb, 0x02, 0x1d, 0x7d, 0x9d, 0x34, 0xe8, 0x81, 0xb9, 0xf7, 0x09, 0x28, 0x79, 0x29, 0x8d,
+ 0xe3, 0x14, 0xed, 0x5f, 0xca, 0xaf, 0xf4, 0x1c, 0x49, 0x15, 0xe1, 0x80, 0x29, 0x61, 0x76, 0x80,
+ 0x43, 0xf8, 0x58, 0x53, 0x40, 0xd7, 0x31, 0x6d, 0x61, 0x81, 0x41, 0xe9, 0x77, 0x9f, 0x9c, 0xe1,
+ 0x6d, 0xf2, 0xee, 0xd9, 0xc8, 0x67, 0xd2, 0x5f, 0x48, 0x73, 0xe3, 0x5c, 0xcd, 0xa7, 0x45, 0x58,
+ 0xbb, 0xdd, 0x28, 0x1d, 0x68, 0xfc, 0xb4, 0xc6, 0xf6, 0x92, 0xf6, 0x30, 0x03, 0xaa, 0xe4, 0x32,
+ 0xf6, 0x34, 0x51, 0x4b, 0x0f, 0x8c, 0xf9, 0xac, 0x98, 0x22, 0xfb, 0x49, 0xc8, 0xbf, 0xca, 0x8c,
+ 0x80, 0x86, 0x5d, 0xd7, 0xa4, 0x52, 0xb1, 0xd9, 0xa6, 0x04, 0x4e, 0xb3, 0x2d, 0x1f, 0xb8, 0x35,
+ 0xcc, 0x45, 0x6d, 0x9c, 0x20, 0xa7, 0xa4, 0x34, 0x59, 0x72, 0xe3, 0xae, 0xba, 0x49, 0xde, 0xd1,
+ 0xaa, 0xee, 0x3d, 0x77, 0xfc, 0x5d, 0xc6, 0x1f, 0x9d, 0xac, 0xc2, 0x15, 0x66, 0xb8, 0xe1, 0x54,
+ 0x4e, 0x74, 0x93, 0xdb, 0x9a, 0x24, 0x15, 0x6e, 0x20, 0xa3, 0x67, 0x3e, 0x5a, 0x24, 0x41, 0x5e,
+ 0xb0, 0xe6, 0x35, 0x87, 0x1b, 0xc8, 0x7a, 0xf9, 0x77, 0x65, 0xe0, 0x01, 0xf2, 0x4c, 0xe4, 0x2b,
+ 0xa9, 0x64, 0x96, 0x96, 0x0b, 0x46, 0xca, 0xea, 0x79, 0x0e, 0x78, 0xa3, 0x5f, 0x43, 0xfc, 0x47,
+ 0x6a, 0x12, 0xfa, 0xc4, 0x33, 0x0e, 0x88, 0x1c, 0x19, 0x3a, 0x00, 0xc3, 0x4e, 0xb5, 0xd8, 0xfa,
+ 0x8e, 0xf1, 0xbc, 0x3d, 0xb2, 0x7e, 0x50, 0x8d, 0x67, 0xc3, 0x6b, 0xed, 0xe2, 0xea, 0xa6, 0x1f,
+ 0x25, 0x24, 0x7c, 0x94, 0x74, 0x50, 0x49, 0xe3, 0xc6, 0x58, 0x2e, 0xfd, 0x28, 0xb4, 0xc6, 0x73,
+ 0xb1, 0x53, 0x74, 0x27, 0x94, 0x5c, 0xdf, 0x69, 0xb7, 0xa1, 0xd7, 0xf5, 0xd3, 0x8a, 0x2c, 0x2d,
+ 0xb4, 0x5e, 0x8a, 0x16, 0x14, 0x54, 0x64, 0x6e, 0x00, 0x6b, 0x11, 0x59, 0x8a, 0x63, 0x38, 0x80,
+ 0x76, 0xc3, 0xd5, 0x59, 0xf7, 0x3f, 0xd2, 0xfa, 0xa5, 0xca, 0x82, 0xff, 0x4a, 0x62, 0xf0, 0xe3,
+ 0x42, 0xf9, 0x3b, 0x38, 0x27, 0x8a, 0x89, 0xaa, 0x50, 0x55, 0x4b, 0x29, 0xf1, 0x46, 0x7c, 0x75,
+ 0xef, 0x65, 0xaf, 0x9b, 0x0d, 0x6d, 0xda, 0x25, 0x94, 0x14, 0xc1, 0x1b, 0xf0, 0xc5, 0x4c, 0x24,
+ 0x0e, 0x65,
+};
+
+const uint8_t kOutRefBinaryBuffer[] = {
+ 0x00, 0x00, 0x00, 0x01, 0x09, 0xf0, 0x00, 0x00, 0x00, 0x01, 0x67, 0x42, 0xc0, 0x1e, 0xdb, 0x01,
+ 0x40, 0x16, 0xec, 0x04, 0x40, 0x00, 0x00, 0x03, 0x00, 0x40, 0x00, 0x00, 0x0f, 0x03, 0xc5, 0x8b,
+ 0xb8, 0x00, 0x00, 0x00, 0x01, 0x68, 0xca, 0x8c, 0xb2, 0x00, 0x00, 0x01, 0x06, 0x05, 0xff, 0xff,
+ 0x70, 0xdc, 0x45, 0xe9, 0xbd, 0xe6, 0xd9, 0x48, 0xb7, 0x96, 0x2c, 0xd8, 0x20, 0xd9, 0x23, 0xee,
+ 0xef, 0x78, 0x32, 0x36, 0x34, 0x20, 0x2d, 0x20, 0x63, 0x6f, 0x72, 0x65, 0x20, 0x31, 0x34, 0x32,
+ 0x20, 0x2d, 0x20, 0x48, 0x2e, 0x32, 0x36, 0x34, 0x2f, 0x4d, 0x50, 0x45, 0x47, 0x2d, 0x34, 0x20,
+ 0x41, 0x56, 0x43, 0x20, 0x63, 0x6f, 0x64, 0x65, 0x63, 0x20, 0x2d, 0x20, 0x43, 0x6f, 0x70, 0x79,
+ 0x6c, 0x65, 0x66, 0x74, 0x20, 0x32, 0x30, 0x30, 0x33, 0x2d, 0x32, 0x30, 0x31, 0x34, 0x20, 0x2d,
+ 0x20, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, 0x2f, 0x77, 0x77, 0x77, 0x2e, 0x76, 0x69, 0x64, 0x65,
+ 0x6f, 0x6c, 0x61, 0x6e, 0x2e, 0x6f, 0x72, 0x67, 0x2f, 0x78, 0x32, 0x36, 0x34, 0x2e, 0x68, 0x74,
+ 0x6d, 0x6c, 0x20, 0x2d, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x3a, 0x20, 0x63, 0x61,
+ 0x62, 0x61, 0x63, 0x3d, 0x30, 0x20, 0x72, 0x65, 0x66, 0x3d, 0x32, 0x20, 0x64, 0x65, 0x62, 0x6c,
+ 0x6f, 0x63, 0x6b, 0x3d, 0x31, 0x3a, 0x30, 0x3a, 0x30, 0x20, 0x61, 0x6e, 0x61, 0x6c, 0x79, 0x73,
+ 0x65, 0x3d, 0x30, 0x78, 0x31, 0x3a, 0x30, 0x78, 0x31, 0x31, 0x31, 0x20, 0x6d, 0x65, 0x3d, 0x68,
+ 0x65, 0x78, 0x20, 0x73, 0x75, 0x62, 0x6d, 0x65, 0x3d, 0x37, 0x20, 0x70, 0x73, 0x79, 0x3d, 0x31,
+ 0x20, 0x70, 0x73, 0x79, 0x5f, 0x72, 0x64, 0x3d, 0x31, 0x2e, 0x30, 0x30, 0x3a, 0x30, 0x2e, 0x30,
+ 0x30, 0x20, 0x6d, 0x69, 0x78, 0x65, 0x64, 0x5f, 0x72, 0x65, 0x66, 0x3d, 0x31, 0x20, 0x6d, 0x65,
+ 0x5f, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x3d, 0x31, 0x36, 0x20, 0x63, 0x68, 0x72, 0x6f, 0x6d, 0x61,
+ 0x5f, 0x6d, 0x65, 0x3d, 0x31, 0x20, 0x74, 0x72, 0x65, 0x6c, 0x6c, 0x69, 0x73, 0x3d, 0x31, 0x20,
+ 0x38, 0x78, 0x38, 0x64, 0x63, 0x74, 0x3d, 0x30, 0x20, 0x63, 0x71, 0x6d, 0x3d, 0x30, 0x20, 0x64,
+ 0x65, 0x61, 0x64, 0x7a, 0x6f, 0x6e, 0x65, 0x3d, 0x32, 0x31, 0x2c, 0x31, 0x31, 0x20, 0x66, 0x61,
+ 0x73, 0x74, 0x5f, 0x70, 0x73, 0x6b, 0x69, 0x70, 0x3d, 0x31, 0x20, 0x63, 0x68, 0x72, 0x6f, 0x6d,
+ 0x61, 0x5f, 0x71, 0x70, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x3d, 0x2d, 0x32, 0x20, 0x74,
+ 0x68, 0x72, 0x65, 0x61, 0x64, 0x73, 0x3d, 0x36, 0x30, 0x20, 0x6c, 0x6f, 0x6f, 0x6b, 0x61, 0x68,
+ 0x65, 0x61, 0x64, 0x5f, 0x74, 0x68, 0x72, 0x65, 0x61, 0x64, 0x73, 0x3d, 0x35, 0x20, 0x73, 0x6c,
+ 0x69, 0x63, 0x65, 0x64, 0x5f, 0x74, 0x68, 0x72, 0x65, 0x61, 0x64, 0x73, 0x3d, 0x30, 0x20, 0x6e,
+ 0x72, 0x3d, 0x30, 0x20, 0x64, 0x65, 0x63, 0x69, 0x6d, 0x61, 0x74, 0x65, 0x3d, 0x31, 0x20, 0x69,
+ 0x6e, 0x74, 0x65, 0x72, 0x6c, 0x61, 0x63, 0x65, 0x64, 0x3d, 0x30, 0x20, 0x62, 0x6c, 0x75, 0x72,
+ 0x61, 0x79, 0x5f, 0x63, 0x6f, 0x6d, 0x70, 0x61, 0x74, 0x3d, 0x30, 0x20, 0x63, 0x6f, 0x6e, 0x73,
+ 0x74, 0x72, 0x61, 0x69, 0x6e, 0x65, 0x64, 0x5f, 0x69, 0x6e, 0x74, 0x72, 0x61, 0x3d, 0x30, 0x20,
+ 0x62, 0x66, 0x72, 0x61, 0x6d, 0x65, 0x73, 0x3d, 0x30, 0x20, 0x77, 0x65, 0x69, 0x67, 0x68, 0x74,
+ 0x70, 0x3d, 0x30, 0x20, 0x6b, 0x65, 0x79, 0x69, 0x6e, 0x74, 0x3d, 0x32, 0x35, 0x30, 0x20, 0x6b,
+ 0x65, 0x79, 0x69, 0x6e, 0x74, 0x5f, 0x6d, 0x69, 0x6e, 0x3d, 0x32, 0x35, 0x20, 0x73, 0x63, 0x65,
+ 0x6e, 0x65,
+};
+
+class MediaCasListener : public ICasListener {
+ public:
+ virtual Return<void> onEvent(int32_t event, int32_t arg,
+ const hidl_vec<uint8_t>& data) override {
+ android::Mutex::Autolock autoLock(mMsgLock);
+ mEvent = event;
+ mEventArg = arg;
+ mEventData = data;
+
+ mEventReceived = true;
+ mMsgCondition.signal();
+ return Void();
+ }
+
+ void testEventEcho(sp<ICas>& mediaCas, int32_t& event, int32_t& eventArg,
+ hidl_vec<uint8_t>& eventData);
+
+ private:
+ int32_t mEvent = -1;
+ int32_t mEventArg = -1;
+ bool mEventReceived = false;
+ hidl_vec<uint8_t> mEventData;
+ android::Mutex mMsgLock;
+ android::Condition mMsgCondition;
+};
+
+void MediaCasListener::testEventEcho(sp<ICas>& mediaCas, int32_t& event, int32_t& eventArg,
+ hidl_vec<uint8_t>& eventData) {
+ mEventReceived = false;
+ auto returnStatus = mediaCas->sendEvent(event, eventArg, eventData);
+ EXPECT_TRUE(returnStatus.isOk());
+ EXPECT_EQ(Status::OK, returnStatus);
+
+ android::Mutex::Autolock autoLock(mMsgLock);
+ while (!mEventReceived) {
+ if (-ETIMEDOUT == mMsgCondition.waitRelative(mMsgLock, WAIT_TIMEOUT)) {
+ EXPECT_TRUE(false) << "event not received within timeout";
+ return;
+ }
+ }
+
+ EXPECT_EQ(mEvent, event);
+ EXPECT_EQ(mEventArg, eventArg);
+ EXPECT_TRUE(mEventData == eventData);
+}
+
class MediaCasHidlTest : public ::testing::VtsHalHidlTargetTestBase {
public:
virtual void SetUp() override {
@@ -59,17 +219,118 @@
static void description(const std::string& description) {
RecordProperty("description", description);
}
+
+ sp<ICas> mMediaCas;
+ sp<IDescramblerBase> mDescramblerBase;
+ sp<MediaCasListener> mCasListener;
+
+ ::testing::AssertionResult createCasPlugin(int32_t caSystemId);
+ ::testing::AssertionResult openCasSession(std::vector<uint8_t>* sessionId);
+ ::testing::AssertionResult descrambleTestInputBuffer(const sp<IDescrambler>& descrambler,
+ Status* descrambleStatus,
+ sp<IMemory>* hidlInMemory);
};
-class MediaCasListener : public ICasListener {
- public:
- virtual ::android::hardware::Return<void> onEvent(
- int32_t event, int32_t arg, const ::android::hardware::hidl_vec<uint8_t>& data) override {
- ALOGI("Info: received event: %d, arg: %d, size: %zu", event, arg, data.size());
-
- return Void();
+::testing::AssertionResult MediaCasHidlTest::createCasPlugin(int32_t caSystemId) {
+ auto status = mService->isSystemIdSupported(caSystemId);
+ if (!status.isOk() || !status) {
+ return ::testing::AssertionFailure();
}
-};
+ status = mService->isDescramblerSupported(caSystemId);
+ if (!status.isOk() || !status) {
+ return ::testing::AssertionFailure();
+ }
+
+ mCasListener = new MediaCasListener();
+ auto pluginStatus = mService->createPlugin(caSystemId, mCasListener);
+ if (!pluginStatus.isOk()) {
+ return ::testing::AssertionFailure();
+ }
+ mMediaCas = pluginStatus;
+ if (mMediaCas == nullptr) {
+ return ::testing::AssertionFailure();
+ }
+
+ auto descramblerStatus = mService->createDescrambler(caSystemId);
+ if (!descramblerStatus.isOk()) {
+ return ::testing::AssertionFailure();
+ }
+ mDescramblerBase = descramblerStatus;
+ return ::testing::AssertionResult(mDescramblerBase != nullptr);
+}
+
+::testing::AssertionResult MediaCasHidlTest::openCasSession(std::vector<uint8_t>* sessionId) {
+ Status sessionStatus;
+ auto returnVoid = mMediaCas->openSession([&](Status status, const hidl_vec<uint8_t>& id) {
+ sessionStatus = status;
+ *sessionId = id;
+ });
+ return ::testing::AssertionResult(returnVoid.isOk() && (Status::OK == sessionStatus));
+}
+
+::testing::AssertionResult MediaCasHidlTest::descrambleTestInputBuffer(
+ const sp<IDescrambler>& descrambler, Status* descrambleStatus, sp<IMemory>* inMemory) {
+ hidl_vec<SubSample> hidlSubSamples;
+ hidlSubSamples.setToExternal(const_cast<SubSample*>(kSubSamples),
+ (sizeof(kSubSamples) / sizeof(SubSample)), false /*own*/);
+
+ sp<MemoryDealer> dealer = new MemoryDealer(sizeof(kInBinaryBuffer), "vts-cas");
+ if (nullptr == dealer.get()) {
+ ALOGE("couldn't get MemoryDealer!");
+ return ::testing::AssertionFailure();
+ }
+
+ sp<IMemory> mem = dealer->allocate(sizeof(kInBinaryBuffer));
+ if (nullptr == mem.get()) {
+ ALOGE("couldn't allocate IMemory!");
+ return ::testing::AssertionFailure();
+ }
+ *inMemory = mem;
+
+ // build hidl_memory from memory heap
+ ssize_t offset;
+ size_t size;
+ sp<IMemoryHeap> heap = mem->getMemory(&offset, &size);
+ if (nullptr == heap.get()) {
+ ALOGE("couldn't get memory heap!");
+ return ::testing::AssertionFailure();
+ }
+
+ native_handle_t* nativeHandle = native_handle_create(1, 0);
+ if (!nativeHandle) {
+ ALOGE("failed to create native handle!");
+ return ::testing::AssertionFailure();
+ }
+ nativeHandle->data[0] = heap->getHeapID();
+
+ uint8_t* ipBuffer = static_cast<uint8_t*>(static_cast<void*>(mem->pointer()));
+ memcpy(ipBuffer, kInBinaryBuffer, sizeof(kInBinaryBuffer));
+
+ SharedBuffer srcBuffer = {
+ .heapBase = hidl_memory("ashmem", hidl_handle(nativeHandle), heap->getSize()),
+ .offset = (uint64_t) offset,
+ .size = (uint64_t) size
+ };
+
+ DestinationBuffer dstBuffer;
+ dstBuffer.type = BufferType::SHARED_MEMORY;
+ dstBuffer.nonsecureMemory = srcBuffer;
+
+ uint32_t outBytes;
+ hidl_string detailedError;
+ auto returnVoid = descrambler->descramble(
+ ScramblingControl::EVENKEY /*2*/, hidlSubSamples, srcBuffer, 0, dstBuffer, 0,
+ [&](Status status, uint32_t bytesWritten, const hidl_string& detailedErr) {
+ *descrambleStatus = status;
+ outBytes = bytesWritten;
+ detailedError = detailedErr;
+ });
+ if (!returnVoid.isOk() || *descrambleStatus != Status::OK) {
+ ALOGI("descramble failed, trans=%s, status=%d, outBytes=%u, error=%s",
+ returnVoid.description().c_str(), *descrambleStatus, outBytes, detailedError.c_str());
+ }
+ return ::testing::AssertionResult(returnVoid.isOk());
+}
TEST_F(MediaCasHidlTest, EnumeratePlugins) {
description("Test enumerate plugins");
@@ -87,17 +348,8 @@
sp<MediaCasListener> casListener = new MediaCasListener();
for (size_t i = 0; i < descriptors.size(); i++) {
int32_t caSystemId = descriptors[i].caSystemId;
- bool status = mService->isSystemIdSupported(caSystemId);
- ASSERT_EQ(status, true);
- status = mService->isDescramblerSupported(caSystemId);
- ASSERT_EQ(status, true);
-
- sp<ICas> mediaCas = mService->createPlugin(caSystemId, casListener);
- ASSERT_NE(mediaCas, nullptr);
-
- sp<IDescramblerBase> descramblerBase = mService->createDescrambler(caSystemId);
- ASSERT_NE(descramblerBase, nullptr);
+ ASSERT_TRUE(createCasPlugin(caSystemId));
}
}
@@ -108,10 +360,14 @@
ASSERT_FALSE(mService->isSystemIdSupported(INVALID_SYSTEM_ID));
ASSERT_FALSE(mService->isDescramblerSupported(INVALID_SYSTEM_ID));
- sp<ICas> mediaCas = mService->createPlugin(INVALID_SYSTEM_ID, casListener);
+ auto pluginStatus = mService->createPlugin(INVALID_SYSTEM_ID, casListener);
+ ASSERT_TRUE(pluginStatus.isOk());
+ sp<ICas> mediaCas = pluginStatus;
EXPECT_EQ(mediaCas, nullptr);
- sp<IDescramblerBase> descramblerBase = mService->createDescrambler(INVALID_SYSTEM_ID);
+ auto descramblerStatus = mService->createDescrambler(INVALID_SYSTEM_ID);
+ ASSERT_TRUE(descramblerStatus.isOk());
+ sp<IDescramblerBase> descramblerBase = descramblerStatus;
EXPECT_EQ(descramblerBase, nullptr);
}
@@ -120,7 +376,7 @@
hidl_vec<HidlCasPluginDescriptor> descriptors;
EXPECT_TRUE(mService
->enumeratePlugins([&descriptors](
- hidl_vec<HidlCasPluginDescriptor> const& _desc) { descriptors = _desc; })
+ hidl_vec<HidlCasPluginDescriptor> const& desc) { descriptors = desc; })
.isOk());
if (descriptors.size() == 0) {
@@ -137,6 +393,210 @@
ASSERT_TRUE(false) << "ClearKey plugin not installed";
}
+TEST_F(MediaCasHidlTest, TestClearKeyApis) {
+ description("Test that valid call sequences succeed");
+
+ ASSERT_TRUE(createCasPlugin(CLEAR_KEY_SYSTEM_ID));
+
+ auto returnStatus = mMediaCas->provision(hidl_string(PROVISION_STR));
+ EXPECT_TRUE(returnStatus.isOk());
+ EXPECT_EQ(Status::OK, returnStatus);
+
+ hidl_vec<uint8_t> hidlPvtData;
+ hidlPvtData.resize(256);
+ returnStatus = mMediaCas->setPrivateData(hidlPvtData);
+ EXPECT_TRUE(returnStatus.isOk());
+ EXPECT_EQ(Status::OK, returnStatus);
+
+ std::vector<uint8_t> sessionId;
+ ASSERT_TRUE(openCasSession(&sessionId));
+ returnStatus = mMediaCas->setSessionPrivateData(sessionId, hidlPvtData);
+ EXPECT_TRUE(returnStatus.isOk());
+ EXPECT_EQ(Status::OK, returnStatus);
+
+ std::vector<uint8_t> streamSessionId;
+ ASSERT_TRUE(openCasSession(&streamSessionId));
+ returnStatus = mMediaCas->setSessionPrivateData(streamSessionId, hidlPvtData);
+ EXPECT_TRUE(returnStatus.isOk());
+ EXPECT_EQ(Status::OK, returnStatus);
+
+ returnStatus = mDescramblerBase->setMediaCasSession(sessionId);
+ EXPECT_TRUE(returnStatus.isOk());
+ EXPECT_EQ(Status::OK, returnStatus);
+
+ returnStatus = mDescramblerBase->setMediaCasSession(streamSessionId);
+ EXPECT_TRUE(returnStatus.isOk());
+ EXPECT_EQ(Status::OK, returnStatus);
+
+ hidl_vec<uint8_t> hidlNullPtr;
+ hidlNullPtr.setToExternal(static_cast<uint8_t*>(nullptr), 0);
+ returnStatus = mMediaCas->refreshEntitlements(3, hidlNullPtr);
+ EXPECT_TRUE(returnStatus.isOk());
+ EXPECT_EQ(Status::OK, returnStatus);
+
+ uint8_t refreshData[] = {0, 1, 2, 3};
+ hidl_vec<uint8_t> hidlRefreshData;
+ hidlRefreshData.setToExternal(static_cast<uint8_t*>(refreshData), sizeof(refreshData));
+ returnStatus = mMediaCas->refreshEntitlements(10, hidlRefreshData);
+ EXPECT_TRUE(returnStatus.isOk());
+ EXPECT_EQ(Status::OK, returnStatus);
+
+ int32_t eventID = 1;
+ int32_t eventArg = 2;
+ mCasListener->testEventEcho(mMediaCas, eventID, eventArg, hidlNullPtr);
+
+ eventID = 3;
+ eventArg = 4;
+ uint8_t eventData[] = {'e', 'v', 'e', 'n', 't', 'd', 'a', 't', 'a'};
+ hidl_vec<uint8_t> hidlEventData;
+ hidlEventData.setToExternal(static_cast<uint8_t*>(eventData), sizeof(eventData));
+ mCasListener->testEventEcho(mMediaCas, eventID, eventArg, hidlEventData);
+
+ uint8_t clearKeyEmmData[] = {'c', 'l', 'e', 'a', 'r', 'k', 'e', 'y', 'e', 'm', 'm'};
+ hidl_vec<uint8_t> hidlClearKeyEmm;
+ hidlClearKeyEmm.setToExternal(static_cast<uint8_t*>(clearKeyEmmData), sizeof(clearKeyEmmData));
+ returnStatus = mMediaCas->processEmm(hidlClearKeyEmm);
+ EXPECT_TRUE(returnStatus.isOk());
+ EXPECT_EQ(Status::OK, returnStatus);
+
+ hidl_vec<uint8_t> hidlEcm;
+ hidlEcm.setToExternal(const_cast<uint8_t*>(kEcmBinaryBuffer), sizeof(kEcmBinaryBuffer));
+ returnStatus = mMediaCas->processEcm(sessionId, hidlEcm);
+ EXPECT_TRUE(returnStatus.isOk());
+ EXPECT_EQ(Status::OK, returnStatus);
+ returnStatus = mMediaCas->processEcm(streamSessionId, hidlEcm);
+ EXPECT_TRUE(returnStatus.isOk());
+ EXPECT_EQ(Status::OK, returnStatus);
+
+ sp<IDescrambler> descrambler;
+ descrambler = IDescrambler::castFrom(mDescramblerBase);
+ ASSERT_NE(descrambler, nullptr);
+
+ Status descrambleStatus = Status::OK;
+ sp<IMemory> dataMemory;
+
+ ASSERT_TRUE(descrambleTestInputBuffer(descrambler, &descrambleStatus, &dataMemory));
+ EXPECT_EQ(Status::OK, descrambleStatus);
+
+ ASSERT_NE(nullptr, dataMemory.get());
+ uint8_t* opBuffer = static_cast<uint8_t*>(static_cast<void*>(dataMemory->pointer()));
+
+ int compareResult =
+ memcmp(static_cast<const void*>(opBuffer), static_cast<const void*>(kOutRefBinaryBuffer),
+ sizeof(kOutRefBinaryBuffer));
+ EXPECT_EQ(0, compareResult);
+}
+
+TEST_F(MediaCasHidlTest, TestClearKeySessionClosedAfterRelease) {
+ description("Test that all sessions are closed after a MediaCas object is released");
+
+ ASSERT_TRUE(createCasPlugin(CLEAR_KEY_SYSTEM_ID));
+
+ auto returnStatus = mMediaCas->provision(hidl_string(PROVISION_STR));
+ EXPECT_TRUE(returnStatus.isOk());
+ EXPECT_EQ(Status::OK, returnStatus);
+
+ std::vector<uint8_t> sessionId;
+ ASSERT_TRUE(openCasSession(&sessionId));
+ std::vector<uint8_t> streamSessionId;
+ ASSERT_TRUE(openCasSession(&streamSessionId));
+
+ returnStatus = mMediaCas->release();
+ EXPECT_TRUE(returnStatus.isOk());
+ EXPECT_EQ(Status::OK, returnStatus);
+
+ returnStatus = mDescramblerBase->setMediaCasSession(sessionId);
+ EXPECT_TRUE(returnStatus.isOk());
+ EXPECT_EQ(Status::ERROR_CAS_SESSION_NOT_OPENED, returnStatus);
+
+ returnStatus = mDescramblerBase->setMediaCasSession(streamSessionId);
+ EXPECT_TRUE(returnStatus.isOk());
+ EXPECT_EQ(Status::ERROR_CAS_SESSION_NOT_OPENED, returnStatus);
+}
+
+TEST_F(MediaCasHidlTest, TestClearKeyErrors) {
+ description("Test that invalid call sequences fail with expected error codes");
+
+ ASSERT_TRUE(createCasPlugin(CLEAR_KEY_SYSTEM_ID));
+
+ /*
+ * Test MediaCas error codes
+ */
+ // Provision should fail with an invalid asset string
+ auto returnStatus = mMediaCas->provision(hidl_string("invalid asset string"));
+ EXPECT_TRUE(returnStatus.isOk());
+ EXPECT_EQ(Status::ERROR_CAS_NO_LICENSE, returnStatus);
+
+ // Open a session, then close it so that it should become invalid
+ std::vector<uint8_t> invalidSessionId;
+ ASSERT_TRUE(openCasSession(&invalidSessionId));
+ returnStatus = mMediaCas->closeSession(invalidSessionId);
+ EXPECT_TRUE(returnStatus.isOk());
+ EXPECT_EQ(Status::OK, returnStatus);
+
+ // processEcm should fail with an invalid session id
+ hidl_vec<uint8_t> hidlEcm;
+ hidlEcm.setToExternal(const_cast<uint8_t*>(kEcmBinaryBuffer), sizeof(kEcmBinaryBuffer));
+ returnStatus = mMediaCas->processEcm(invalidSessionId, hidlEcm);
+ EXPECT_TRUE(returnStatus.isOk());
+ EXPECT_EQ(Status::ERROR_CAS_SESSION_NOT_OPENED, returnStatus);
+
+ std::vector<uint8_t> sessionId;
+ ASSERT_TRUE(openCasSession(&sessionId));
+
+ // processEcm should fail without provisioning
+ hidlEcm.setToExternal(const_cast<uint8_t*>(kEcmBinaryBuffer), sizeof(kEcmBinaryBuffer));
+ returnStatus = mMediaCas->processEcm(sessionId, hidlEcm);
+ EXPECT_TRUE(returnStatus.isOk());
+ EXPECT_EQ(Status::ERROR_CAS_NOT_PROVISIONED, returnStatus);
+
+ returnStatus = mMediaCas->provision(hidl_string(PROVISION_STR));
+ EXPECT_TRUE(returnStatus.isOk());
+ EXPECT_EQ(Status::OK, returnStatus);
+
+ // processEcm should fail with ecm buffer that's too short
+ hidlEcm.setToExternal(const_cast<uint8_t*>(kEcmBinaryBuffer), 8);
+ returnStatus = mMediaCas->processEcm(sessionId, hidlEcm);
+ EXPECT_TRUE(returnStatus.isOk());
+ EXPECT_EQ(Status::BAD_VALUE, returnStatus);
+
+ // processEcm should fail with ecm with bad descriptor count
+ uint8_t badDescriptor[sizeof(kEcmBinaryBuffer)];
+ memcpy(badDescriptor, kEcmBinaryBuffer, sizeof(kEcmBinaryBuffer));
+ badDescriptor[17] = 0x03; // change the descriptor count field to 3 (invalid)
+ hidlEcm.setToExternal(static_cast<uint8_t*>(badDescriptor), sizeof(badDescriptor));
+ returnStatus = mMediaCas->processEcm(sessionId, hidlEcm);
+ EXPECT_TRUE(returnStatus.isOk());
+ EXPECT_EQ(Status::ERROR_CAS_UNKNOWN, returnStatus);
+
+ /*
+ * Test MediaDescrambler error codes
+ */
+ // setMediaCasSession should fail with an invalid session id
+ returnStatus = mDescramblerBase->setMediaCasSession(invalidSessionId);
+ EXPECT_TRUE(returnStatus.isOk());
+ EXPECT_EQ(Status::ERROR_CAS_SESSION_NOT_OPENED, returnStatus);
+
+ // descramble should fail without a valid session
+ sp<IDescrambler> descrambler;
+ descrambler = IDescrambler::castFrom(mDescramblerBase);
+ ASSERT_NE(descrambler, nullptr);
+
+ Status descrambleStatus = Status::OK;
+ sp<IMemory> dataMemory;
+
+ ASSERT_TRUE(descrambleTestInputBuffer(descrambler, &descrambleStatus, &dataMemory));
+ EXPECT_EQ(Status::ERROR_CAS_DECRYPT_UNIT_NOT_INITIALIZED, descrambleStatus);
+
+ // Now set a valid session, should still fail because no valid ecm is processed
+ returnStatus = mDescramblerBase->setMediaCasSession(sessionId);
+ EXPECT_TRUE(returnStatus.isOk());
+ EXPECT_EQ(Status::OK, returnStatus);
+
+ ASSERT_TRUE(descrambleTestInputBuffer(descrambler, &descrambleStatus, &dataMemory));
+ EXPECT_EQ(Status::ERROR_CAS_DECRYPT, descrambleStatus);
+}
+
} // anonymous namespace
int main(int argc, char** argv) {
diff --git a/current.txt b/current.txt
index 6958edb..30b6677 100644
--- a/current.txt
+++ b/current.txt
@@ -247,5 +247,10 @@
619600109232ed64b827c8a11beed8070b1827ae464547d7aa146cf0473b4bca android.hardware.cas.native@1.0::IDescrambler
0a159f81359cd4f71bbe00972ee8403ea79351fb7c0cd48be72ebb3e424dbaef android.hardware.radio@1.0::types
09342041e17c429fce0034b9096d17849122111436a5f0053e7e59500e1cb89c android.hardware.media.omx@1.0::IOmxStore
+246a56d37d57a47224562c9d077b4a2886ce6242b9311bd98a17325944c280d7 android.hardware.neuralnetworks@1.0::types
+93eb3757ceaf21590fa4cd1d4a7dfe3b3794af5396100a6d25630879352abce9 android.hardware.neuralnetworks@1.0::IDevice
+f66f9a38541bf92001d3adcce678cd7e3da2262124befb460b1c9aea9492813b android.hardware.neuralnetworks@1.0::IExecutionCallback
+953607822954435874f4b81686440a604e2a88cdd2d9164c6293f3d5772510d7 android.hardware.neuralnetworks@1.0::IPreparedModel
+73e03573494ba96f0e711ab7f1956c5b2d54c3da690cd7ecf4d6d0f287447730 android.hardware.neuralnetworks@1.0::IPreparedModelCallback
f4945e397b5dea41bb64518dfde59be71245d8a125fd1e0acffeb57ac7b08fed android.hardware.thermal@1.1::IThermal
c8bc853546dd55584611def2a9fa1d99f657e3366c976d2f60fe6b8aa6d2cb87 android.hardware.thermal@1.1::IThermalCallback
diff --git a/graphics/allocator/2.0/Android.mk b/graphics/allocator/2.0/Android.mk
deleted file mode 100644
index f9e3276..0000000
--- a/graphics/allocator/2.0/Android.mk
+++ /dev/null
@@ -1,19 +0,0 @@
-#
-# Copyright (C) 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.
-#
-
-LOCAL_PATH := $(call my-dir)
-
-include $(call all-subdir-makefiles)
diff --git a/graphics/allocator/Android.mk b/graphics/allocator/Android.mk
deleted file mode 100644
index f9e3276..0000000
--- a/graphics/allocator/Android.mk
+++ /dev/null
@@ -1,19 +0,0 @@
-#
-# Copyright (C) 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.
-#
-
-LOCAL_PATH := $(call my-dir)
-
-include $(call all-subdir-makefiles)
diff --git a/graphics/composer/2.1/Android.mk b/graphics/composer/2.1/Android.mk
deleted file mode 100644
index f9e3276..0000000
--- a/graphics/composer/2.1/Android.mk
+++ /dev/null
@@ -1,19 +0,0 @@
-#
-# Copyright (C) 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.
-#
-
-LOCAL_PATH := $(call my-dir)
-
-include $(call all-subdir-makefiles)
diff --git a/graphics/composer/Android.mk b/graphics/composer/Android.mk
deleted file mode 100644
index f9e3276..0000000
--- a/graphics/composer/Android.mk
+++ /dev/null
@@ -1,19 +0,0 @@
-#
-# Copyright (C) 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.
-#
-
-LOCAL_PATH := $(call my-dir)
-
-include $(call all-subdir-makefiles)
diff --git a/graphics/mapper/2.0/Android.mk b/graphics/mapper/2.0/Android.mk
deleted file mode 100644
index f9e3276..0000000
--- a/graphics/mapper/2.0/Android.mk
+++ /dev/null
@@ -1,19 +0,0 @@
-#
-# Copyright (C) 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.
-#
-
-LOCAL_PATH := $(call my-dir)
-
-include $(call all-subdir-makefiles)
diff --git a/graphics/mapper/Android.mk b/graphics/mapper/Android.mk
deleted file mode 100644
index f9e3276..0000000
--- a/graphics/mapper/Android.mk
+++ /dev/null
@@ -1,19 +0,0 @@
-#
-# Copyright (C) 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.
-#
-
-LOCAL_PATH := $(call my-dir)
-
-include $(call all-subdir-makefiles)
diff --git a/health/2.0/vts/OWNERS b/health/2.0/vts/OWNERS
new file mode 100644
index 0000000..885f6a8
--- /dev/null
+++ b/health/2.0/vts/OWNERS
@@ -0,0 +1,6 @@
+elsk@google.com
+sspatil@google.com
+
+# VTS team
+yim@google.com
+ryanjcampbell@google.com
diff --git a/health/2.0/vts/functional/Android.bp b/health/2.0/vts/functional/Android.bp
new file mode 100644
index 0000000..4ad01b9
--- /dev/null
+++ b/health/2.0/vts/functional/Android.bp
@@ -0,0 +1,25 @@
+//
+// 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: "VtsHalHealthV2_0TargetTest",
+ defaults: ["VtsHalTargetTestDefaults"],
+ srcs: ["VtsHalHealthV2_0TargetTest.cpp"],
+ static_libs: [
+ "android.hardware.health@1.0",
+ "android.hardware.health@2.0",
+ ],
+}
diff --git a/health/2.0/vts/functional/VtsHalHealthV2_0TargetTest.cpp b/health/2.0/vts/functional/VtsHalHealthV2_0TargetTest.cpp
new file mode 100644
index 0000000..8abed0c
--- /dev/null
+++ b/health/2.0/vts/functional/VtsHalHealthV2_0TargetTest.cpp
@@ -0,0 +1,248 @@
+/*
+ * 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 "mHealthhidl_hal_test"
+
+#include <mutex>
+
+#include <VtsHalHidlTargetTestBase.h>
+#include <android-base/logging.h>
+#include <android/hardware/health/2.0/IHealth.h>
+#include <android/hardware/health/2.0/types.h>
+
+using ::testing::AssertionFailure;
+using ::testing::AssertionResult;
+using ::testing::AssertionSuccess;
+using ::testing::VtsHalHidlTargetTestBase;
+using ::testing::VtsHalHidlTargetTestEnvBase;
+
+namespace android {
+namespace hardware {
+namespace health {
+namespace V2_0 {
+
+using V1_0::BatteryStatus;
+using V1_0::HealthInfo;
+
+// Test environment for graphics.composer
+class HealthHidlEnvironment : public VtsHalHidlTargetTestEnvBase {
+ public:
+ // get the test environment singleton
+ static HealthHidlEnvironment* Instance() {
+ static HealthHidlEnvironment* instance = new HealthHidlEnvironment;
+ return instance;
+ }
+
+ virtual void registerTestServices() override { registerTestService<IHealth>(); }
+
+ private:
+ HealthHidlEnvironment() {}
+
+ GTEST_DISALLOW_COPY_AND_ASSIGN_(HealthHidlEnvironment);
+};
+
+class HealthHidlTest : public ::testing::VtsHalHidlTargetTestBase {
+ public:
+ virtual void SetUp() override {
+ std::string serviceName = HealthHidlEnvironment::Instance()->getServiceName<IHealth>();
+ LOG(INFO) << "get service with name:" << serviceName;
+ ASSERT_FALSE(serviceName.empty());
+ mHealth = ::testing::VtsHalHidlTargetTestBase::getService<IHealth>(serviceName);
+ ASSERT_NE(mHealth, nullptr);
+ }
+
+ sp<IHealth> mHealth;
+};
+
+class Callback : public IHealthInfoCallback {
+ using Function = std::function<void(const HealthInfo&)>;
+
+ public:
+ Callback(const Function& f) : mInternal(f) {}
+ Return<void> healthInfoChanged(const HealthInfo& info) override {
+ std::unique_lock<std::mutex> lock(mMutex);
+ if (mInternal) mInternal(info);
+ return Void();
+ }
+ void clear() {
+ std::unique_lock<std::mutex> lock(mMutex);
+ mInternal = nullptr;
+ }
+
+ private:
+ std::mutex mMutex;
+ Function mInternal;
+};
+
+#define ASSERT_OK(r) ASSERT_TRUE(isOk(r))
+#define EXPECT_OK(r) EXPECT_TRUE(isOk(r))
+template <typename T>
+AssertionResult isOk(const Return<T>& r) {
+ return r.isOk() ? AssertionSuccess() : (AssertionFailure() << r.description());
+}
+
+#define ASSERT_ALL_OK(r) ASSERT_TRUE(isAllOk(r))
+// Both isOk() and Result::SUCCESS
+AssertionResult isAllOk(const Return<Result>& r) {
+ if (!r.isOk()) {
+ return AssertionFailure() << r.description();
+ }
+ if (static_cast<Result>(r) != Result::SUCCESS) {
+ return AssertionFailure() << toString(static_cast<Result>(r));
+ }
+ return AssertionSuccess();
+}
+
+/**
+ * Test whether callbacks work. Tested functions are IHealth::registerCallback,
+ * unregisterCallback, and update.
+ */
+TEST_F(HealthHidlTest, Callbacks) {
+ using namespace std::chrono_literals;
+
+ std::mutex mutex;
+ std::condition_variable cv;
+ bool firstCallbackInvoked = false;
+ bool secondCallbackInvoked = false;
+
+ sp<Callback> firstCallback = new Callback([&](const auto&) {
+ std::unique_lock<std::mutex> lk(mutex);
+ firstCallbackInvoked = true;
+ });
+
+ sp<Callback> secondCallback = new Callback([&](const auto&) {
+ std::unique_lock<std::mutex> lk(mutex);
+ secondCallbackInvoked = true;
+ cv.notify_all();
+ });
+
+ ASSERT_ALL_OK(mHealth->registerCallback(firstCallback));
+ ASSERT_ALL_OK(mHealth->registerCallback(secondCallback));
+
+ // assert that the first callback is invoked when update is called.
+ {
+ std::unique_lock<std::mutex> lk(mutex);
+ firstCallbackInvoked = false;
+ secondCallbackInvoked = false;
+ }
+
+ ASSERT_ALL_OK(mHealth->update());
+
+ {
+ std::unique_lock<std::mutex> lk(mutex);
+ EXPECT_TRUE(cv.wait_for(lk, 1s, [&] {
+ return firstCallbackInvoked && secondCallbackInvoked;
+ })) << "Timeout.";
+ ASSERT_TRUE(firstCallbackInvoked);
+ ASSERT_TRUE(secondCallbackInvoked);
+ }
+
+ ASSERT_ALL_OK(mHealth->unregisterCallback(firstCallback));
+
+ // assert that the second callback is still invoked even though the first is unregistered.
+ {
+ std::unique_lock<std::mutex> lk(mutex);
+ firstCallbackInvoked = false;
+ secondCallbackInvoked = false;
+ }
+
+ ASSERT_ALL_OK(mHealth->update());
+
+ {
+ std::unique_lock<std::mutex> lk(mutex);
+ EXPECT_TRUE(cv.wait_for(lk, 1s, [&] { return secondCallbackInvoked; })) << "Timeout.";
+ ASSERT_FALSE(firstCallbackInvoked);
+ ASSERT_TRUE(secondCallbackInvoked);
+ }
+
+ ASSERT_ALL_OK(mHealth->unregisterCallback(secondCallback));
+
+ // avoid reference to lambda function that goes out of scope.
+ firstCallback->clear();
+ secondCallback->clear();
+}
+
+TEST_F(HealthHidlTest, UnregisterNonExistentCallback) {
+ sp<Callback> callback = new Callback([](const auto&) {});
+ auto ret = mHealth->unregisterCallback(callback);
+ ASSERT_OK(ret);
+ ASSERT_EQ(Result::NOT_FOUND, static_cast<Result>(ret)) << "Actual: " << toString(ret);
+}
+
+/**
+ * Pass the test if:
+ * - Property is not supported (res == NOT_SUPPORTED)
+ * - Result is success, and predicate is true
+ * @param res the Result value.
+ * @param valueStr the string representation for actual value (for error message)
+ * @param pred a predicate that test whether the value is valid
+ */
+#define EXPECT_VALID_OR_UNSUPPORTED_PROP(res, valueStr, pred) \
+ EXPECT_TRUE(isPropertyOk(res, valueStr, pred, #pred))
+
+AssertionResult isPropertyOk(Result res, const std::string& valueStr, bool pred,
+ const std::string& predStr) {
+ if (res == Result::SUCCESS) {
+ if (pred) {
+ return AssertionSuccess();
+ }
+ return AssertionFailure() << "value doesn't match.\nActual: " << valueStr
+ << "\nExpected: " << predStr;
+ }
+ if (res == Result::NOT_SUPPORTED) {
+ return AssertionSuccess();
+ }
+ return AssertionFailure() << "Result is not SUCCESS or NOT_SUPPORTED: " << toString(res);
+}
+
+TEST_F(HealthHidlTest, Properties) {
+ EXPECT_OK(mHealth->getChargeCounter([](auto result, auto value) {
+ EXPECT_VALID_OR_UNSUPPORTED_PROP(result, std::to_string(value), value > 0);
+ }));
+ EXPECT_OK(mHealth->getCurrentNow([](auto result, auto value) {
+ EXPECT_VALID_OR_UNSUPPORTED_PROP(result, std::to_string(value), value != INT32_MIN);
+ }));
+ EXPECT_OK(mHealth->getCurrentAverage([](auto result, auto value) {
+ EXPECT_VALID_OR_UNSUPPORTED_PROP(result, std::to_string(value), value != INT32_MIN);
+ }));
+ EXPECT_OK(mHealth->getCapacity([](auto result, auto value) {
+ EXPECT_VALID_OR_UNSUPPORTED_PROP(result, std::to_string(value), 0 <= value && value <= 100);
+ }));
+ EXPECT_OK(mHealth->getEnergyCounter([](auto result, auto value) {
+ EXPECT_VALID_OR_UNSUPPORTED_PROP(result, std::to_string(value), value != INT64_MIN);
+ }));
+ EXPECT_OK(mHealth->getChargeStatus([](auto result, auto value) {
+ EXPECT_VALID_OR_UNSUPPORTED_PROP(
+ result, toString(value),
+ value == BatteryStatus::CHARGING || value == BatteryStatus::DISCHARGING ||
+ value == BatteryStatus::NOT_CHARGING || value == BatteryStatus::FULL);
+ }));
+}
+
+} // namespace V2_0
+} // namespace health
+} // namespace hardware
+} // namespace android
+
+int main(int argc, char** argv) {
+ using ::android::hardware::health::V2_0::HealthHidlEnvironment;
+ ::testing::AddGlobalTestEnvironment(HealthHidlEnvironment::Instance());
+ ::testing::InitGoogleTest(&argc, argv);
+ HealthHidlEnvironment::Instance()->init(&argc, argv);
+ int status = RUN_ALL_TESTS();
+ LOG(INFO) << "Test result = " << status;
+ return status;
+}
diff --git a/health/Android.bp b/health/Android.bp
index 2c931e5..ca89713 100644
--- a/health/Android.bp
+++ b/health/Android.bp
@@ -5,4 +5,5 @@
"1.0/default/libhealthd",
"1.0/vts/functional",
"2.0",
+ "2.0/vts/functional",
]
diff --git a/ir/Android.mk b/ir/Android.mk
deleted file mode 100644
index f9e3276..0000000
--- a/ir/Android.mk
+++ /dev/null
@@ -1,19 +0,0 @@
-#
-# Copyright (C) 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.
-#
-
-LOCAL_PATH := $(call my-dir)
-
-include $(call all-subdir-makefiles)
diff --git a/keymaster/3.0/vts/functional/attestation_record.cpp b/keymaster/3.0/vts/functional/attestation_record.cpp
index 5d96fff..a428989 100644
--- a/keymaster/3.0/vts/functional/attestation_record.cpp
+++ b/keymaster/3.0/vts/functional/attestation_record.cpp
@@ -274,10 +274,12 @@
*keymaster_security_level =
static_cast<SecurityLevel>(ASN1_ENUMERATED_get(record->keymaster_security_level));
- attestation_challenge->setToExternal(record->attestation_challenge->data,
- record->attestation_challenge->length);
-
- unique_id->setToExternal(record->unique_id->data, record->unique_id->length);
+ auto& chall = record->attestation_challenge;
+ attestation_challenge->resize(chall->length);
+ memcpy(attestation_challenge->data(), chall->data, chall->length);
+ auto& uid = record->unique_id;
+ unique_id->resize(uid->length);
+ memcpy(unique_id->data(), uid->data, uid->length);
ErrorCode error = extract_auth_list(record->software_enforced, software_enforced);
if (error != ErrorCode::OK) return error;
diff --git a/light/2.0/vts/Android.mk b/light/2.0/vts/Android.mk
deleted file mode 100644
index 089503b..0000000
--- a/light/2.0/vts/Android.mk
+++ /dev/null
@@ -1,19 +0,0 @@
-#
-# Copyright (C) 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.
-#
-
-LOCAL_PATH := $(call my-dir)
-
-include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/media/omx/1.0/vts/functional/audio/VtsHalMediaOmxV1_0TargetAudioDecTest.cpp b/media/omx/1.0/vts/functional/audio/VtsHalMediaOmxV1_0TargetAudioDecTest.cpp
index 1161444..9e185f2 100644
--- a/media/omx/1.0/vts/functional/audio/VtsHalMediaOmxV1_0TargetAudioDecTest.cpp
+++ b/media/omx/1.0/vts/functional/audio/VtsHalMediaOmxV1_0TargetAudioDecTest.cpp
@@ -165,6 +165,7 @@
this->omxNode = _nl;
})
.isOk());
+ ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
ASSERT_NE(omxNode, nullptr);
ASSERT_NE(gEnv->getRole().empty(), true) << "Invalid Component Role";
struct StringToName {
@@ -423,6 +424,9 @@
ASSERT_EQ(status,
::android::hardware::media::omx::V1_0::Status::OK);
*nChannels = param.nChannels;
+ // NOTE: For amrnb sample rate is 8k and amrwb sample rate is 16k.
+ // There is no nSampleRate field in OMX_AUDIO_PARAM_AMRTYPE. Just
+ // return 8k to avoid returning uninit variable.
*nSampleRate = 8000;
break;
}
@@ -548,13 +552,13 @@
// set Port Params
int32_t nChannels;
int32_t nSampleRate;
- getInputChannelInfo(omxNode, kPortIndexInput, eEncoding, &nChannels,
- &nSampleRate);
+ ASSERT_NO_FATAL_FAILURE(getInputChannelInfo(
+ omxNode, kPortIndexInput, eEncoding, &nChannels, &nSampleRate));
// Configure output port
// SPECIAL CASE: Soft Vorbis, Opus and Raw Decoders do not offer way
- // to
- // configure output PCM port. The port undergoes auto configuration
- // internally basing on parsed elementary stream information.
+ // to configure output PCM port. The port undergoes auto
+ // configuration internally basing on parsed elementary stream
+ // information.
if (comp != AudioDecHidlTest::standardComp::vorbis &&
comp != AudioDecHidlTest::standardComp::opus &&
comp != AudioDecHidlTest::standardComp::raw) {
@@ -563,9 +567,8 @@
nSampleRate);
}
- // If you can disable a port, then you should be able to
- // enable
- // it as well
+ // 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);
@@ -576,7 +579,8 @@
ASSERT_EQ(status,
android::hardware::media::omx::V1_0::Status::TIMED_OUT);
- allocatePortBuffers(omxNode, oBuffer, kPortIndexOutput);
+ ASSERT_NO_FATAL_FAILURE(
+ allocatePortBuffers(omxNode, oBuffer, kPortIndexOutput));
status = observer->dequeueMessage(&msg, DEFAULT_TIMEOUT, iBuffer,
oBuffer);
ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
@@ -586,14 +590,14 @@
// dispatch output buffers
for (size_t i = 0; i < oBuffer->size(); i++) {
- dispatchOutputBuffer(omxNode, oBuffer, i);
+ ASSERT_NO_FATAL_FAILURE(
+ dispatchOutputBuffer(omxNode, oBuffer, i));
}
} else {
ASSERT_TRUE(false);
}
} else {
- EXPECT_TRUE(false);
- return;
+ ASSERT_TRUE(false);
}
}
@@ -613,11 +617,12 @@
status =
observer->dequeueMessage(&msg, DEFAULT_TIMEOUT_Q, iBuffer, oBuffer);
if (status == android::hardware::media::omx::V1_0::Status::OK) {
- EXPECT_EQ(msg.type, Message::Type::EVENT);
+ ASSERT_EQ(msg.type, Message::Type::EVENT);
packedArgs audioArgs = {eEncoding, comp};
- portReconfiguration(omxNode, observer, iBuffer, oBuffer,
- kPortIndexInput, kPortIndexOutput, msg,
- PortMode::PRESET_BYTE_BUFFER, &audioArgs);
+ ASSERT_NO_FATAL_FAILURE(
+ portReconfiguration(omxNode, observer, iBuffer, oBuffer,
+ kPortIndexInput, kPortIndexOutput, msg,
+ PortMode::PRESET_BYTE_BUFFER, &audioArgs));
}
// status == TIMED_OUT, it could be due to process time being large
// than DEFAULT_TIMEOUT or component needs output buffers to start
@@ -630,7 +635,8 @@
// Dispatch an output buffer assuming outQueue.empty() is true
size_t index;
if ((index = getEmptyBufferID(oBuffer)) < oBuffer->size()) {
- dispatchOutputBuffer(omxNode, oBuffer, index);
+ ASSERT_NO_FATAL_FAILURE(
+ dispatchOutputBuffer(omxNode, oBuffer, index));
timeOut = TIMEOUT_COUNTER_Q;
}
}
@@ -660,9 +666,10 @@
if (status == android::hardware::media::omx::V1_0::Status::OK &&
msg.type == Message::Type::EVENT) {
packedArgs audioArgs = {eEncoding, comp};
- portReconfiguration(omxNode, observer, iBuffer, oBuffer,
- kPortIndexInput, kPortIndexOutput, msg,
- PortMode::PRESET_BYTE_BUFFER, &audioArgs);
+ ASSERT_NO_FATAL_FAILURE(
+ portReconfiguration(omxNode, observer, iBuffer, oBuffer,
+ kPortIndexInput, kPortIndexOutput, msg,
+ PortMode::PRESET_BYTE_BUFFER, &audioArgs));
}
if (frameID == (int)Info->size() || frameID == (offset + range)) break;
@@ -684,15 +691,16 @@
if (signalEOS && ((frameID == (int)Info->size() - 1) ||
(frameID == (offset + range - 1))))
flags |= OMX_BUFFERFLAG_EOS;
- dispatchInputBuffer(omxNode, iBuffer, index,
- (*Info)[frameID].bytesCount, flags,
- (*Info)[frameID].timestamp);
+ ASSERT_NO_FATAL_FAILURE(dispatchInputBuffer(
+ omxNode, iBuffer, index, (*Info)[frameID].bytesCount, flags,
+ (*Info)[frameID].timestamp));
frameID++;
iQueued = true;
}
// Dispatch output buffer
if ((index = getEmptyBufferID(oBuffer)) < oBuffer->size()) {
- dispatchOutputBuffer(omxNode, oBuffer, index);
+ ASSERT_NO_FATAL_FAILURE(
+ dispatchOutputBuffer(omxNode, oBuffer, index));
oQueued = true;
}
// Reset Counters when either input or output buffer is dispatched
@@ -701,8 +709,7 @@
else
timeOut--;
if (timeOut == 0) {
- EXPECT_TRUE(false) << "Wait on Input/Output is found indefinite";
- break;
+ ASSERT_TRUE(false) << "Wait on Input/Output is found indefinite";
}
}
}
@@ -784,8 +791,8 @@
setDefaultPortParam(omxNode, kPortIndexInput, eEncoding, 1, 8000,
OMX_AUDIO_PCMModeLinear, OMX_NumericalDataSigned,
32);
- getInputChannelInfo(omxNode, kPortIndexInput, eEncoding, &nChannels,
- &nSampleRate);
+ ASSERT_NO_FATAL_FAILURE(getInputChannelInfo(
+ omxNode, kPortIndexInput, eEncoding, &nChannels, &nSampleRate));
// Configure output port
// SPECIAL CASE: Soft Vorbis, Opus and Raw Decoders do not offer way to
// configure output PCM port. The port undergoes auto configuration
@@ -798,28 +805,33 @@
android::Vector<BufferInfo> iBuffer, oBuffer;
// set state to idle
- changeStateLoadedtoIdle(omxNode, observer, &iBuffer, &oBuffer,
- kPortIndexInput, kPortIndexOutput);
+ ASSERT_NO_FATAL_FAILURE(changeStateLoadedtoIdle(omxNode, observer, &iBuffer,
+ &oBuffer, kPortIndexInput,
+ kPortIndexOutput));
// set state to executing
- changeStateIdletoExecute(omxNode, observer);
+ ASSERT_NO_FATAL_FAILURE(changeStateIdletoExecute(omxNode, observer));
// Port Reconfiguration
eleStream.open(mURL, std::ifstream::binary);
ASSERT_EQ(eleStream.is_open(), true);
- decodeNFrames(omxNode, observer, &iBuffer, &oBuffer, eEncoding,
- kPortIndexInput, kPortIndexOutput, eleStream, &Info, 0,
- (int)Info.size(), compName);
+ ASSERT_NO_FATAL_FAILURE(decodeNFrames(
+ omxNode, observer, &iBuffer, &oBuffer, eEncoding, kPortIndexInput,
+ kPortIndexOutput, eleStream, &Info, 0, (int)Info.size(), compName));
eleStream.close();
- waitOnInputConsumption(omxNode, observer, &iBuffer, &oBuffer, eEncoding,
- kPortIndexInput, kPortIndexOutput, compName);
+ ASSERT_NO_FATAL_FAILURE(
+ waitOnInputConsumption(omxNode, observer, &iBuffer, &oBuffer, eEncoding,
+ kPortIndexInput, kPortIndexOutput, compName));
packedArgs audioArgs = {eEncoding, compName};
- testEOS(omxNode, observer, &iBuffer, &oBuffer, false, eosFlag, nullptr,
- portReconfiguration, kPortIndexInput, kPortIndexOutput, &audioArgs);
+ ASSERT_NO_FATAL_FAILURE(testEOS(
+ omxNode, observer, &iBuffer, &oBuffer, false, eosFlag, nullptr,
+ portReconfiguration, kPortIndexInput, kPortIndexOutput, &audioArgs));
if (timestampDevTest) EXPECT_EQ(timestampUslist.empty(), true);
// set state to idle
- changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer);
+ ASSERT_NO_FATAL_FAILURE(
+ changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer));
// set state to executing
- changeStateIdletoLoaded(omxNode, observer, &iBuffer, &oBuffer,
- kPortIndexInput, kPortIndexOutput);
+ ASSERT_NO_FATAL_FAILURE(changeStateIdletoLoaded(omxNode, observer, &iBuffer,
+ &oBuffer, kPortIndexInput,
+ kPortIndexOutput));
}
// end of sequence test
@@ -845,8 +857,8 @@
setDefaultPortParam(omxNode, kPortIndexInput, eEncoding, 1, 8000,
OMX_AUDIO_PCMModeLinear, OMX_NumericalDataSigned,
32);
- getInputChannelInfo(omxNode, kPortIndexInput, eEncoding, &nChannels,
- &nSampleRate);
+ ASSERT_NO_FATAL_FAILURE(getInputChannelInfo(
+ omxNode, kPortIndexInput, eEncoding, &nChannels, &nSampleRate));
// Configure output port
// SPECIAL CASE: Soft Vorbis, Opus and Raw Decoders do not offer way to
// configure output PCM port. The port undergoes auto configuration
@@ -859,26 +871,31 @@
android::Vector<BufferInfo> iBuffer, oBuffer;
// set state to idle
- changeStateLoadedtoIdle(omxNode, observer, &iBuffer, &oBuffer,
- kPortIndexInput, kPortIndexOutput);
+ ASSERT_NO_FATAL_FAILURE(changeStateLoadedtoIdle(omxNode, observer, &iBuffer,
+ &oBuffer, kPortIndexInput,
+ kPortIndexOutput));
// set state to executing
- changeStateIdletoExecute(omxNode, observer);
+ ASSERT_NO_FATAL_FAILURE(changeStateIdletoExecute(omxNode, observer));
// request EOS at the start
packedArgs audioArgs = {eEncoding, compName};
- testEOS(omxNode, observer, &iBuffer, &oBuffer, true, eosFlag, nullptr,
- portReconfiguration, kPortIndexInput, kPortIndexOutput, &audioArgs);
- flushPorts(omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput,
- kPortIndexOutput);
+ ASSERT_NO_FATAL_FAILURE(testEOS(
+ omxNode, observer, &iBuffer, &oBuffer, true, eosFlag, nullptr,
+ portReconfiguration, kPortIndexInput, kPortIndexOutput, &audioArgs));
+ ASSERT_NO_FATAL_FAILURE(flushPorts(omxNode, observer, &iBuffer, &oBuffer,
+ kPortIndexInput, kPortIndexOutput));
EXPECT_GE(framesReceived, 0U);
framesReceived = 0;
timestampUs = 0;
// set state to idle
- changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer);
+ ASSERT_NO_FATAL_FAILURE(
+ changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer));
+
// set state to executing
- changeStateIdletoLoaded(omxNode, observer, &iBuffer, &oBuffer,
- kPortIndexInput, kPortIndexOutput);
+ ASSERT_NO_FATAL_FAILURE(changeStateIdletoLoaded(omxNode, observer, &iBuffer,
+ &oBuffer, kPortIndexInput,
+ kPortIndexOutput));
}
// end of sequence test
@@ -924,8 +941,8 @@
setDefaultPortParam(omxNode, kPortIndexInput, eEncoding, 1, 8000,
OMX_AUDIO_PCMModeLinear, OMX_NumericalDataSigned,
32);
- getInputChannelInfo(omxNode, kPortIndexInput, eEncoding, &nChannels,
- &nSampleRate);
+ ASSERT_NO_FATAL_FAILURE(getInputChannelInfo(
+ omxNode, kPortIndexInput, eEncoding, &nChannels, &nSampleRate));
// Configure output port
// SPECIAL CASE: Soft Vorbis, Opus and Raw Decoders do not offer way to
// configure output PCM port. The port undergoes auto configuration
@@ -938,10 +955,11 @@
android::Vector<BufferInfo> iBuffer, oBuffer;
// set state to idle
- changeStateLoadedtoIdle(omxNode, observer, &iBuffer, &oBuffer,
- kPortIndexInput, kPortIndexOutput);
+ ASSERT_NO_FATAL_FAILURE(changeStateLoadedtoIdle(omxNode, observer, &iBuffer,
+ &oBuffer, kPortIndexInput,
+ kPortIndexOutput));
// set state to executing
- changeStateIdletoExecute(omxNode, observer);
+ ASSERT_NO_FATAL_FAILURE(changeStateIdletoExecute(omxNode, observer));
// request EOS for thumbnail
// signal EOS flag with last frame
@@ -949,17 +967,19 @@
while (!(Info[i].flags & OMX_BUFFERFLAG_SYNCFRAME)) i++;
eleStream.open(mURL, std::ifstream::binary);
ASSERT_EQ(eleStream.is_open(), true);
- decodeNFrames(omxNode, observer, &iBuffer, &oBuffer, eEncoding,
- kPortIndexInput, kPortIndexOutput, eleStream, &Info, 0, i + 1,
- compName);
+ ASSERT_NO_FATAL_FAILURE(decodeNFrames(
+ omxNode, observer, &iBuffer, &oBuffer, eEncoding, kPortIndexInput,
+ kPortIndexOutput, eleStream, &Info, 0, i + 1, compName));
eleStream.close();
- waitOnInputConsumption(omxNode, observer, &iBuffer, &oBuffer, eEncoding,
- kPortIndexInput, kPortIndexOutput, compName);
+ ASSERT_NO_FATAL_FAILURE(
+ waitOnInputConsumption(omxNode, observer, &iBuffer, &oBuffer, eEncoding,
+ kPortIndexInput, kPortIndexOutput, compName));
packedArgs audioArgs = {eEncoding, compName};
- testEOS(omxNode, observer, &iBuffer, &oBuffer, false, eosFlag, nullptr,
- portReconfiguration, kPortIndexInput, kPortIndexOutput, &audioArgs);
- flushPorts(omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput,
- kPortIndexOutput);
+ ASSERT_NO_FATAL_FAILURE(testEOS(
+ omxNode, observer, &iBuffer, &oBuffer, false, eosFlag, nullptr,
+ portReconfiguration, kPortIndexInput, kPortIndexOutput, &audioArgs));
+ ASSERT_NO_FATAL_FAILURE(flushPorts(omxNode, observer, &iBuffer, &oBuffer,
+ kPortIndexInput, kPortIndexOutput));
EXPECT_GE(framesReceived, 1U);
framesReceived = 0;
timestampUs = 0;
@@ -967,25 +987,29 @@
// signal EOS flag after last frame
eleStream.open(mURL, std::ifstream::binary);
ASSERT_EQ(eleStream.is_open(), true);
- decodeNFrames(omxNode, observer, &iBuffer, &oBuffer, eEncoding,
- kPortIndexInput, kPortIndexOutput, eleStream, &Info, 0, i + 1,
- compName, false);
+ ASSERT_NO_FATAL_FAILURE(decodeNFrames(
+ omxNode, observer, &iBuffer, &oBuffer, eEncoding, kPortIndexInput,
+ kPortIndexOutput, eleStream, &Info, 0, i + 1, compName, false));
eleStream.close();
- waitOnInputConsumption(omxNode, observer, &iBuffer, &oBuffer, eEncoding,
- kPortIndexInput, kPortIndexOutput, compName);
- testEOS(omxNode, observer, &iBuffer, &oBuffer, true, eosFlag, nullptr,
- portReconfiguration, kPortIndexInput, kPortIndexOutput, &audioArgs);
- flushPorts(omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput,
- kPortIndexOutput);
+ ASSERT_NO_FATAL_FAILURE(
+ waitOnInputConsumption(omxNode, observer, &iBuffer, &oBuffer, eEncoding,
+ kPortIndexInput, kPortIndexOutput, compName));
+ ASSERT_NO_FATAL_FAILURE(testEOS(
+ omxNode, observer, &iBuffer, &oBuffer, true, eosFlag, nullptr,
+ portReconfiguration, kPortIndexInput, kPortIndexOutput, &audioArgs));
+ ASSERT_NO_FATAL_FAILURE(flushPorts(omxNode, observer, &iBuffer, &oBuffer,
+ kPortIndexInput, kPortIndexOutput));
EXPECT_GE(framesReceived, 1U);
framesReceived = 0;
timestampUs = 0;
// set state to idle
- changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer);
+ ASSERT_NO_FATAL_FAILURE(
+ changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer));
// set state to executing
- changeStateIdletoLoaded(omxNode, observer, &iBuffer, &oBuffer,
- kPortIndexInput, kPortIndexOutput);
+ ASSERT_NO_FATAL_FAILURE(changeStateIdletoLoaded(omxNode, observer, &iBuffer,
+ &oBuffer, kPortIndexInput,
+ kPortIndexOutput));
}
// end of sequence test
@@ -1031,8 +1055,8 @@
setDefaultPortParam(omxNode, kPortIndexInput, eEncoding, 1, 8000,
OMX_AUDIO_PCMModeLinear, OMX_NumericalDataSigned,
32);
- getInputChannelInfo(omxNode, kPortIndexInput, eEncoding, &nChannels,
- &nSampleRate);
+ ASSERT_NO_FATAL_FAILURE(getInputChannelInfo(
+ omxNode, kPortIndexInput, eEncoding, &nChannels, &nSampleRate));
// Configure output port
// SPECIAL CASE: Soft Vorbis, Opus and Raw Decoders do not offer way to
// configure output PCM port. The port undergoes auto configuration
@@ -1045,33 +1069,39 @@
android::Vector<BufferInfo> iBuffer, oBuffer;
// set state to idle
- changeStateLoadedtoIdle(omxNode, observer, &iBuffer, &oBuffer,
- kPortIndexInput, kPortIndexOutput);
+ ASSERT_NO_FATAL_FAILURE(changeStateLoadedtoIdle(omxNode, observer, &iBuffer,
+ &oBuffer, kPortIndexInput,
+ kPortIndexOutput));
// set state to executing
- changeStateIdletoExecute(omxNode, observer);
+ ASSERT_NO_FATAL_FAILURE(changeStateIdletoExecute(omxNode, observer));
// request EOS at the end
eleStream.open(mURL, std::ifstream::binary);
ASSERT_EQ(eleStream.is_open(), true);
- decodeNFrames(omxNode, observer, &iBuffer, &oBuffer, eEncoding,
- kPortIndexInput, kPortIndexOutput, eleStream, &Info, 0,
- (int)Info.size(), compName, false);
+ ASSERT_NO_FATAL_FAILURE(decodeNFrames(omxNode, observer, &iBuffer, &oBuffer,
+ eEncoding, kPortIndexInput,
+ kPortIndexOutput, eleStream, &Info, 0,
+ (int)Info.size(), compName, false));
eleStream.close();
- waitOnInputConsumption(omxNode, observer, &iBuffer, &oBuffer, eEncoding,
- kPortIndexInput, kPortIndexOutput, compName);
+ ASSERT_NO_FATAL_FAILURE(
+ waitOnInputConsumption(omxNode, observer, &iBuffer, &oBuffer, eEncoding,
+ kPortIndexInput, kPortIndexOutput, compName));
packedArgs audioArgs = {eEncoding, compName};
- testEOS(omxNode, observer, &iBuffer, &oBuffer, true, eosFlag, nullptr,
- portReconfiguration, kPortIndexInput, kPortIndexOutput, &audioArgs);
- flushPorts(omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput,
- kPortIndexOutput);
+ ASSERT_NO_FATAL_FAILURE(testEOS(
+ omxNode, observer, &iBuffer, &oBuffer, true, eosFlag, nullptr,
+ portReconfiguration, kPortIndexInput, kPortIndexOutput, &audioArgs));
+ ASSERT_NO_FATAL_FAILURE(flushPorts(omxNode, observer, &iBuffer, &oBuffer,
+ kPortIndexInput, kPortIndexOutput));
framesReceived = 0;
timestampUs = 0;
// set state to idle
- changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer);
+ ASSERT_NO_FATAL_FAILURE(
+ changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer));
// set state to executing
- changeStateIdletoLoaded(omxNode, observer, &iBuffer, &oBuffer,
- kPortIndexInput, kPortIndexOutput);
+ ASSERT_NO_FATAL_FAILURE(changeStateIdletoLoaded(omxNode, observer, &iBuffer,
+ &oBuffer, kPortIndexInput,
+ kPortIndexOutput));
}
// test input/output port flush
@@ -1117,8 +1147,8 @@
setDefaultPortParam(omxNode, kPortIndexInput, eEncoding, 1, 8000,
OMX_AUDIO_PCMModeLinear, OMX_NumericalDataSigned,
32);
- getInputChannelInfo(omxNode, kPortIndexInput, eEncoding, &nChannels,
- &nSampleRate);
+ ASSERT_NO_FATAL_FAILURE(getInputChannelInfo(
+ omxNode, kPortIndexInput, eEncoding, &nChannels, &nSampleRate));
// Configure output port
// SPECIAL CASE: Soft Vorbis, Opus and Raw Decoders do not offer way to
// configure output PCM port. The port undergoes auto configuration
@@ -1131,10 +1161,11 @@
android::Vector<BufferInfo> iBuffer, oBuffer;
// set state to idle
- changeStateLoadedtoIdle(omxNode, observer, &iBuffer, &oBuffer,
- kPortIndexInput, kPortIndexOutput);
+ ASSERT_NO_FATAL_FAILURE(changeStateLoadedtoIdle(omxNode, observer, &iBuffer,
+ &oBuffer, kPortIndexInput,
+ kPortIndexOutput));
// set state to executing
- changeStateIdletoExecute(omxNode, observer);
+ ASSERT_NO_FATAL_FAILURE(changeStateIdletoExecute(omxNode, observer));
// Decode 128 frames and flush. here 128 is chosen to ensure there is a key
// frame after this so that the below section can be convered for all
@@ -1142,11 +1173,11 @@
int nFrames = 128;
eleStream.open(mURL, std::ifstream::binary);
ASSERT_EQ(eleStream.is_open(), true);
- decodeNFrames(omxNode, observer, &iBuffer, &oBuffer, eEncoding,
- kPortIndexInput, kPortIndexOutput, eleStream, &Info, 0,
- nFrames, compName, false);
- flushPorts(omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput,
- kPortIndexOutput);
+ ASSERT_NO_FATAL_FAILURE(decodeNFrames(
+ omxNode, observer, &iBuffer, &oBuffer, eEncoding, kPortIndexInput,
+ kPortIndexOutput, eleStream, &Info, 0, nFrames, compName, false));
+ ASSERT_NO_FATAL_FAILURE(flushPorts(omxNode, observer, &iBuffer, &oBuffer,
+ kPortIndexInput, kPortIndexOutput));
framesReceived = 0;
// Seek to next key frame and start decoding till the end
@@ -1163,19 +1194,22 @@
index++;
}
if (keyFrame) {
- decodeNFrames(omxNode, observer, &iBuffer, &oBuffer, eEncoding,
- kPortIndexInput, kPortIndexOutput, eleStream, &Info,
- index, Info.size() - index, compName, false);
+ ASSERT_NO_FATAL_FAILURE(
+ decodeNFrames(omxNode, observer, &iBuffer, &oBuffer, eEncoding,
+ kPortIndexInput, kPortIndexOutput, eleStream, &Info,
+ index, Info.size() - index, compName, false));
}
- flushPorts(omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput,
- kPortIndexOutput);
+ ASSERT_NO_FATAL_FAILURE(flushPorts(omxNode, observer, &iBuffer, &oBuffer,
+ kPortIndexInput, kPortIndexOutput));
framesReceived = 0;
// set state to idle
- changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer);
+ ASSERT_NO_FATAL_FAILURE(
+ changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer));
// set state to executing
- changeStateIdletoLoaded(omxNode, observer, &iBuffer, &oBuffer,
- kPortIndexInput, kPortIndexOutput);
+ ASSERT_NO_FATAL_FAILURE(changeStateIdletoLoaded(omxNode, observer, &iBuffer,
+ &oBuffer, kPortIndexInput,
+ kPortIndexOutput));
}
int main(int argc, char** argv) {
diff --git a/media/omx/1.0/vts/functional/audio/VtsHalMediaOmxV1_0TargetAudioEncTest.cpp b/media/omx/1.0/vts/functional/audio/VtsHalMediaOmxV1_0TargetAudioEncTest.cpp
index 66c4637..d872444 100644
--- a/media/omx/1.0/vts/functional/audio/VtsHalMediaOmxV1_0TargetAudioEncTest.cpp
+++ b/media/omx/1.0/vts/functional/audio/VtsHalMediaOmxV1_0TargetAudioEncTest.cpp
@@ -165,6 +165,7 @@
this->omxNode = _nl;
})
.isOk());
+ ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
ASSERT_NE(omxNode, nullptr);
ASSERT_NE(gEnv->getRole().empty(), true) << "Invalid Component Role";
struct StringToName {
@@ -352,7 +353,7 @@
size_t i = 0;
status =
observer->dequeueMessage(&msg, DEFAULT_TIMEOUT_Q, iBuffer, oBuffer);
- EXPECT_EQ(status,
+ ASSERT_EQ(status,
android::hardware::media::omx::V1_0::Status::TIMED_OUT);
// status == TIMED_OUT, it could be due to process time being large
// than DEFAULT_TIMEOUT or component needs output buffers to start
@@ -365,7 +366,8 @@
// Dispatch an output buffer assuming outQueue.empty() is true
size_t index;
if ((index = getEmptyBufferID(oBuffer)) < oBuffer->size()) {
- dispatchOutputBuffer(omxNode, oBuffer, index);
+ ASSERT_NO_FATAL_FAILURE(
+ dispatchOutputBuffer(omxNode, oBuffer, index));
timeOut = TIMEOUT_COUNTER_Q;
}
}
@@ -408,15 +410,16 @@
if (eleStream.gcount() != bytesCount) break;
flags = OMX_BUFFERFLAG_ENDOFFRAME;
if (signalEOS && (nFrames == 1)) flags |= OMX_BUFFERFLAG_EOS;
- dispatchInputBuffer(omxNode, iBuffer, index, bytesCount, flags,
- timestamp);
+ ASSERT_NO_FATAL_FAILURE(dispatchInputBuffer(
+ omxNode, iBuffer, index, bytesCount, flags, timestamp));
timestamp += timestampIncr;
nFrames--;
iQueued = true;
}
// Dispatch output buffer
if ((index = getEmptyBufferID(oBuffer)) < oBuffer->size()) {
- dispatchOutputBuffer(omxNode, oBuffer, index);
+ ASSERT_NO_FATAL_FAILURE(
+ dispatchOutputBuffer(omxNode, oBuffer, index));
oQueued = true;
}
// Reset Counters when either input or output buffer is dispatched
@@ -425,8 +428,7 @@
else
timeOut--;
if (timeOut == 0) {
- EXPECT_TRUE(false) << "Wait on Input/Output is found indefinite";
- break;
+ ASSERT_TRUE(false) << "Wait on Input/Output is found indefinite";
}
}
}
@@ -517,31 +519,39 @@
}
setupPCMPort(omxNode, kPortIndexInput, nChannels, OMX_NumericalDataSigned,
16, nSampleRate, OMX_AUDIO_PCMModeLinear);
+
// Configure output port
- setDefaultPortParam(omxNode, kPortIndexOutput, eEncoding, compName,
- nChannels, nSampleRate, nBitRate);
+ ASSERT_NO_FATAL_FAILURE(setDefaultPortParam(omxNode, kPortIndexOutput,
+ eEncoding, compName, nChannels,
+ nSampleRate, nBitRate));
android::Vector<BufferInfo> iBuffer, oBuffer;
// set state to idle
- changeStateLoadedtoIdle(omxNode, observer, &iBuffer, &oBuffer,
- kPortIndexInput, kPortIndexOutput);
+ ASSERT_NO_FATAL_FAILURE(changeStateLoadedtoIdle(omxNode, observer, &iBuffer,
+ &oBuffer, kPortIndexInput,
+ kPortIndexOutput));
// set state to executing
- changeStateIdletoExecute(omxNode, observer);
+ ASSERT_NO_FATAL_FAILURE(changeStateIdletoExecute(omxNode, observer));
eleStream.open(mURL, std::ifstream::binary);
ASSERT_EQ(eleStream.is_open(), true);
- encodeNFrames(omxNode, observer, &iBuffer, &oBuffer, 128, samplesPerFrame,
- nChannels, nSampleRate, eleStream);
+ ASSERT_NO_FATAL_FAILURE(encodeNFrames(omxNode, observer, &iBuffer, &oBuffer,
+ 128, samplesPerFrame, nChannels,
+ nSampleRate, eleStream));
eleStream.close();
- waitOnInputConsumption(omxNode, observer, &iBuffer, &oBuffer);
- testEOS(omxNode, observer, &iBuffer, &oBuffer, false, eosFlag);
+ ASSERT_NO_FATAL_FAILURE(
+ waitOnInputConsumption(omxNode, observer, &iBuffer, &oBuffer));
+ ASSERT_NO_FATAL_FAILURE(
+ testEOS(omxNode, observer, &iBuffer, &oBuffer, false, eosFlag));
// set state to idle
- changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer);
+ ASSERT_NO_FATAL_FAILURE(
+ changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer));
// set state to executing
- changeStateIdletoLoaded(omxNode, observer, &iBuffer, &oBuffer,
- kPortIndexInput, kPortIndexOutput);
+ ASSERT_NO_FATAL_FAILURE(changeStateIdletoLoaded(omxNode, observer, &iBuffer,
+ &oBuffer, kPortIndexInput,
+ kPortIndexOutput));
}
int main(int argc, char** argv) {
diff --git a/media/omx/1.0/vts/functional/common/media_hidl_test_common.cpp b/media/omx/1.0/vts/functional/common/media_hidl_test_common.cpp
index 28616e2..34a96a0 100644
--- a/media/omx/1.0/vts/functional/common/media_hidl_test_common.cpp
+++ b/media/omx/1.0/vts/functional/common/media_hidl_test_common.cpp
@@ -233,7 +233,7 @@
error = _s;
descriptor = _n1;
});
- EXPECT_EQ(error, android::hardware::graphics::mapper::V2_0::Error::NONE);
+ ASSERT_EQ(error, android::hardware::graphics::mapper::V2_0::Error::NONE);
static volatile int32_t nextId = 0;
uint64_t id = static_cast<uint64_t>(getpid()) << 32;
@@ -279,7 +279,7 @@
} else if (portMode == PortMode::PRESET_BYTE_BUFFER ||
portMode == PortMode::DYNAMIC_ANW_BUFFER) {
sp<IAllocator> allocator = IAllocator::getService("ashmem");
- EXPECT_NE(allocator.get(), nullptr);
+ ASSERT_NE(allocator.get(), nullptr);
buffer->owner = client;
buffer->omxBuffer.type = CodecBuffer::Type::SHARED_MEM;
@@ -319,13 +319,14 @@
OMX_PARAM_PORTDEFINITIONTYPE portDef;
status = getPortParam(omxNode, OMX_IndexParamPortDefinition, portIndex,
&portDef);
+ ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
int32_t nStride;
buffer->owner = client;
buffer->omxBuffer.type = CodecBuffer::Type::ANW_BUFFER;
- allocateGraphicBuffers(omxNode, portIndex, buffer,
- portDef.format.video.nFrameWidth,
- portDef.format.video.nFrameHeight, &nStride,
- portDef.format.video.eColorFormat);
+ ASSERT_NO_FATAL_FAILURE(allocateGraphicBuffers(
+ omxNode, portIndex, buffer, portDef.format.video.nFrameWidth,
+ portDef.format.video.nFrameHeight, &nStride,
+ portDef.format.video.eColorFormat));
omxNode->useBuffer(
portIndex, buffer->omxBuffer,
[&status, &buffer](android::hardware::media::omx::V1_0::Status _s,
@@ -352,14 +353,14 @@
for (size_t i = 0; i < portDef.nBufferCountActual; i++) {
BufferInfo buffer;
- allocateBuffer(omxNode, &buffer, portIndex, portDef.nBufferSize,
- portMode);
+ ASSERT_NO_FATAL_FAILURE(allocateBuffer(omxNode, &buffer, portIndex,
+ portDef.nBufferSize, portMode));
if (allocGrap && portMode == PortMode::DYNAMIC_ANW_BUFFER) {
int32_t nStride;
- allocateGraphicBuffers(omxNode, portIndex, &buffer,
- portDef.format.video.nFrameWidth,
- portDef.format.video.nFrameHeight, &nStride,
- portDef.format.video.eColorFormat);
+ ASSERT_NO_FATAL_FAILURE(allocateGraphicBuffers(
+ omxNode, portIndex, &buffer, portDef.format.video.nFrameWidth,
+ portDef.format.video.nFrameHeight, &nStride,
+ portDef.format.video.eColorFormat));
}
buffArray->push(buffer);
}
@@ -391,14 +392,16 @@
ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::TIMED_OUT);
// allocate buffers on input port
- allocatePortBuffers(omxNode, iBuffer, kPortIndexInput, pm[0], allocGrap);
+ ASSERT_NO_FATAL_FAILURE(allocatePortBuffers(
+ omxNode, iBuffer, kPortIndexInput, pm[0], allocGrap));
// Dont switch states until the ports are populated
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, oBuffer, kPortIndexOutput, pm[1], allocGrap);
+ ASSERT_NO_FATAL_FAILURE(allocatePortBuffers(
+ omxNode, oBuffer, kPortIndexOutput, pm[1], allocGrap));
// As the ports are populated, check if the state transition is complete
status = observer->dequeueMessage(&msg, DEFAULT_TIMEOUT, iBuffer, oBuffer);
@@ -645,7 +648,8 @@
if (signalEOS) {
if ((i = getEmptyBufferID(iBuffer)) < iBuffer->size()) {
// signal an empty buffer with flag set to EOS
- dispatchInputBuffer(omxNode, iBuffer, i, 0, OMX_BUFFERFLAG_EOS, 0);
+ ASSERT_NO_FATAL_FAILURE(dispatchInputBuffer(omxNode, iBuffer, i, 0,
+ OMX_BUFFERFLAG_EOS, 0));
} else {
ASSERT_TRUE(false);
}
@@ -656,7 +660,8 @@
// Dispatch all client owned output buffers to recover remaining frames
while (1) {
if ((i = getEmptyBufferID(oBuffer)) < oBuffer->size()) {
- dispatchOutputBuffer(omxNode, oBuffer, i, pm[1]);
+ ASSERT_NO_FATAL_FAILURE(
+ dispatchOutputBuffer(omxNode, oBuffer, i, pm[1]));
// if dispatch is successful, perhaps there is a latency
// in the component. Dont be in a haste to leave. reset timeout
// counter
@@ -672,16 +677,16 @@
if (status == android::hardware::media::omx::V1_0::Status::OK) {
if (msg.data.eventData.event == OMX_EventPortSettingsChanged) {
if (fptr) {
- (*fptr)(omxNode, observer, iBuffer, oBuffer,
- kPortIndexInput, kPortIndexOutput, msg, pm[1],
- args);
+ ASSERT_NO_FATAL_FAILURE((*fptr)(
+ omxNode, observer, iBuffer, oBuffer, kPortIndexInput,
+ kPortIndexOutput, msg, pm[1], args));
} else {
// something unexpected happened
- EXPECT_TRUE(false);
+ ASSERT_TRUE(false);
}
} else {
// something unexpected happened
- EXPECT_TRUE(false);
+ ASSERT_TRUE(false);
}
}
if (eosFlag == true) break;
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
index de043b2..bec733d 100644
--- 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
@@ -1,5 +1,5 @@
/*
- * Copyright 2016, The Android Open Source Project
+ * Copyright 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/omx/1.0/vts/functional/component/VtsHalMediaOmxV1_0TargetComponentTest.cpp b/media/omx/1.0/vts/functional/component/VtsHalMediaOmxV1_0TargetComponentTest.cpp
index 5d0ac35..401e54a 100644
--- a/media/omx/1.0/vts/functional/component/VtsHalMediaOmxV1_0TargetComponentTest.cpp
+++ b/media/omx/1.0/vts/functional/component/VtsHalMediaOmxV1_0TargetComponentTest.cpp
@@ -149,6 +149,7 @@
this->omxNode = _nl;
})
.isOk());
+ ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
ASSERT_NE(omxNode, nullptr);
ASSERT_NE(gEnv->getRole().empty(), true) << "Invalid Component Role";
struct StringToClass {
@@ -233,7 +234,6 @@
break;
}
}
- return;
}
// test dispatch message API call
@@ -410,6 +410,7 @@
std::cerr << "[ ERROR ] port direction has to be read only "
"but is changeable \n";
}
+ EXPECT_EQ(portDef.eDir, mirror.eDir);
setPortParam(omxNode, OMX_IndexParamPortDefinition, i, &mirror);
// Port Min BufferCount - Read Only
@@ -435,6 +436,7 @@
EXPECT_EQ(portDef.nBufferCountActual,
mirror.nBufferCountActual + 1);
}
+ setPortParam(omxNode, OMX_IndexParamPortDefinition, i, &mirror);
// Port BufferSize is although read only as per OMX-IL 1.2, android
// doesnt abide by this.
@@ -518,8 +520,9 @@
for (size_t i = 0; i < portDef.nBufferCountActual; i++) {
BufferInfo buffer;
- allocateBuffer(omxNode, &buffer, portBase, nBufferSize,
- PortMode::PRESET_BYTE_BUFFER);
+ ASSERT_NO_FATAL_FAILURE(allocateBuffer(omxNode, &buffer, portBase,
+ nBufferSize,
+ PortMode::PRESET_BYTE_BUFFER));
pBuffer.push(buffer);
}
@@ -560,39 +563,47 @@
PortMode portMode[2];
initPortMode(portMode, isSecure, compClass);
status = omxNode->setPortMode(kPortIndexInput, portMode[0]);
- EXPECT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
+ ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
status = omxNode->setPortMode(kPortIndexOutput, portMode[1]);
- EXPECT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
+ ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
// set state to idle
- changeStateLoadedtoIdle(omxNode, observer, &iBuffer, &oBuffer,
- kPortIndexInput, kPortIndexOutput, portMode);
+ ASSERT_NO_FATAL_FAILURE(
+ changeStateLoadedtoIdle(omxNode, observer, &iBuffer, &oBuffer,
+ kPortIndexInput, kPortIndexOutput, portMode));
// set state to executing
- changeStateIdletoExecute(omxNode, observer);
+ ASSERT_NO_FATAL_FAILURE(changeStateIdletoExecute(omxNode, observer));
// dispatch buffers
for (size_t i = 0; i < oBuffer.size(); i++) {
- dispatchOutputBuffer(omxNode, &oBuffer, i, portMode[1]);
+ ASSERT_NO_FATAL_FAILURE(
+ dispatchOutputBuffer(omxNode, &oBuffer, i, portMode[1]));
}
// flush port
- flushPorts(omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput,
- kPortIndexOutput);
+ ASSERT_NO_FATAL_FAILURE(flushPorts(omxNode, observer, &iBuffer, &oBuffer,
+ kPortIndexInput, kPortIndexOutput));
+#if 0
// TODO: Sending empty input buffers is slightly tricky.
// Components sometimes process input buffers even when output buffers are
// not dispatched. For instance Parsing sequence header does not require
// output buffers. In such instances sending 0 size input buffers might
// make component to send error events. so lets skip this aspect of testing.
// dispatch buffers
- // for (size_t i = 0; i < iBuffer.size(); i++) {
- // dispatchInputBuffer(omxNode, &iBuffer, i, 0, 0, 0, portMode[0]);
- // }
- // // flush ports
- // flushPorts(omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput,
- // kPortIndexOutput);
+ for (size_t i = 0; i < iBuffer.size(); i++) {
+ ASSERT_NO_FATAL_FAILURE(
+ dispatchInputBuffer(omxNode, &iBuffer, i, 0, 0, 0, portMode[0]));
+ }
+ // flush ports
+ ASSERT_NO_FATAL_FAILURE(flushPorts(omxNode, observer, &iBuffer, &oBuffer,
+ kPortIndexInput, kPortIndexOutput));
+#endif
+
// set state to idle
- changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer);
+ ASSERT_NO_FATAL_FAILURE(
+ changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer));
// set state to loaded
- changeStateIdletoLoaded(omxNode, observer, &iBuffer, &oBuffer,
- kPortIndexInput, kPortIndexOutput);
+ ASSERT_NO_FATAL_FAILURE(changeStateIdletoLoaded(omxNode, observer, &iBuffer,
+ &oBuffer, kPortIndexInput,
+ kPortIndexOutput));
}
// Flush test - monkeying
@@ -623,9 +634,9 @@
PortMode portMode[2];
initPortMode(portMode, isSecure, compClass);
status = omxNode->setPortMode(kPortIndexInput, portMode[0]);
- EXPECT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
+ ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
status = omxNode->setPortMode(kPortIndexOutput, portMode[1]);
- EXPECT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
+ ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
// // Flush all ports ; receive error OMX_ErrorIncorrectStateOperation
// status = omxNode->sendCommand(toRawCommandType(OMX_CommandFlush),
@@ -633,8 +644,9 @@
// ASSERT_NE(status, android::hardware::media::omx::V1_0::Status::OK);
// set state to idle
- changeStateLoadedtoIdle(omxNode, observer, &iBuffer, &oBuffer,
- kPortIndexInput, kPortIndexOutput, portMode);
+ ASSERT_NO_FATAL_FAILURE(
+ changeStateLoadedtoIdle(omxNode, observer, &iBuffer, &oBuffer,
+ kPortIndexInput, kPortIndexOutput, portMode));
// // Flush all ports ; receive error OMX_ErrorIncorrectStateOperation
// status = omxNode->sendCommand(toRawCommandType(OMX_CommandFlush),
@@ -642,10 +654,12 @@
// ASSERT_NE(status, android::hardware::media::omx::V1_0::Status::OK);
// set state to executing
- changeStateIdletoExecute(omxNode, observer);
+ ASSERT_NO_FATAL_FAILURE(changeStateIdletoExecute(omxNode, observer));
+
// dispatch buffers
for (size_t i = 0; i < oBuffer.size(); i++) {
- dispatchOutputBuffer(omxNode, &oBuffer, i, portMode[1]);
+ ASSERT_NO_FATAL_FAILURE(
+ dispatchOutputBuffer(omxNode, &oBuffer, i, portMode[1]));
}
// // flush invalid port, expecting OMX_ErrorBadPortIndex
@@ -692,10 +706,12 @@
}
// set state to idle
- changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer);
+ ASSERT_NO_FATAL_FAILURE(
+ changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer));
// set state to loaded
- changeStateIdletoLoaded(omxNode, observer, &iBuffer, &oBuffer,
- kPortIndexInput, kPortIndexOutput);
+ ASSERT_NO_FATAL_FAILURE(changeStateIdletoLoaded(omxNode, observer, &iBuffer,
+ &oBuffer, kPortIndexInput,
+ kPortIndexOutput));
}
// test port mode configuration when the component is in various states
@@ -726,13 +742,14 @@
PortMode portMode[2];
initPortMode(portMode, isSecure, compClass);
status = omxNode->setPortMode(kPortIndexInput, portMode[0]);
- EXPECT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
+ ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
status = omxNode->setPortMode(kPortIndexOutput, portMode[1]);
- EXPECT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
+ ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
// set state to idle
- changeStateLoadedtoIdle(omxNode, observer, &iBuffer, &oBuffer,
- kPortIndexInput, kPortIndexOutput, portMode);
+ ASSERT_NO_FATAL_FAILURE(
+ changeStateLoadedtoIdle(omxNode, observer, &iBuffer, &oBuffer,
+ kPortIndexInput, kPortIndexOutput, portMode));
// Only Allow Port Mode configuration in loaded state
status = omxNode->setPortMode(kPortIndexInput, portMode[0]);
EXPECT_NE(status, ::android::hardware::media::omx::V1_0::Status::OK);
@@ -740,7 +757,7 @@
EXPECT_NE(status, ::android::hardware::media::omx::V1_0::Status::OK);
// set state to executing
- changeStateIdletoExecute(omxNode, observer);
+ ASSERT_NO_FATAL_FAILURE(changeStateIdletoExecute(omxNode, observer));
// Only Allow Port Mode configuration in loaded state
status = omxNode->setPortMode(kPortIndexInput, portMode[0]);
EXPECT_NE(status, ::android::hardware::media::omx::V1_0::Status::OK);
@@ -748,10 +765,12 @@
EXPECT_NE(status, ::android::hardware::media::omx::V1_0::Status::OK);
// set state to idle
- changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer);
+ ASSERT_NO_FATAL_FAILURE(
+ changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer));
// set state to loaded
- changeStateIdletoLoaded(omxNode, observer, &iBuffer, &oBuffer,
- kPortIndexInput, kPortIndexOutput);
+ ASSERT_NO_FATAL_FAILURE(changeStateIdletoLoaded(omxNode, observer, &iBuffer,
+ &oBuffer, kPortIndexInput,
+ kPortIndexOutput));
status = omxNode->setPortMode(kPortIndexInput, portMode[0]);
EXPECT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
@@ -788,9 +807,9 @@
PortMode portMode[2];
initPortMode(portMode, isSecure, compClass);
status = omxNode->setPortMode(kPortIndexInput, portMode[0]);
- EXPECT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
+ ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
status = omxNode->setPortMode(kPortIndexOutput, portMode[1]);
- EXPECT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
+ ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
// set state to idle
status = omxNode->sendCommand(toRawCommandType(OMX_CommandStateSet),
@@ -812,8 +831,8 @@
android::hardware::media::omx::V1_0::Status::TIMED_OUT);
BufferInfo buffer;
- allocateBuffer(omxNode, &buffer, j, def.nBufferSize,
- portMode[j - portBase]);
+ ASSERT_NO_FATAL_FAILURE(allocateBuffer(
+ omxNode, &buffer, j, def.nBufferSize, portMode[j - portBase]));
pBuffer[j - portBase].push(buffer);
}
}
@@ -828,23 +847,28 @@
ASSERT_EQ(msg.data.eventData.data2, OMX_StateIdle);
// set state to executing
- changeStateIdletoExecute(omxNode, observer);
+ ASSERT_NO_FATAL_FAILURE(changeStateIdletoExecute(omxNode, observer));
// dispatch buffers
for (size_t i = 0; i < pBuffer[1].size(); i++) {
- dispatchOutputBuffer(omxNode, &pBuffer[1], i, portMode[1]);
+ ASSERT_NO_FATAL_FAILURE(
+ dispatchOutputBuffer(omxNode, &pBuffer[1], i, portMode[1]));
}
// set state to idle
- changeStateExecutetoIdle(omxNode, observer, &pBuffer[0], &pBuffer[1]);
- // // set state to executing
- // changeStateIdletoExecute(omxNode, observer);
- // // TODO: Sending empty input buffers is slightly tricky.
- // // dispatch buffers
- // for (size_t i = 0; i < pBuffer[0].size(); i++) {
- // dispatchInputBuffer(omxNode, &pBuffer[0], i, 0, 0, 0,
- // portMode[0]);
- // }
- // // set state to idle
- // changeStateExecutetoIdle(omxNode, observer, &pBuffer[0], &pBuffer[1]);
+ ASSERT_NO_FATAL_FAILURE(
+ changeStateExecutetoIdle(omxNode, observer, &pBuffer[0], &pBuffer[1]));
+#if 0
+ // set state to executing
+ ASSERT_NO_FATAL_FAILURE(changeStateIdletoExecute(omxNode, observer));
+ // TODO: Sending empty input buffers is slightly tricky.
+ // dispatch buffers
+ for (size_t i = 0; i < pBuffer[0].size(); i++) {
+ ASSERT_NO_FATAL_FAILURE(
+ dispatchInputBuffer(omxNode, &pBuffer[0], i, 0, 0, 0, portMode[0]));
+ }
+ // set state to idle
+ ASSERT_NO_FATAL_FAILURE(
+ changeStateExecutetoIdle(omxNode, observer, &pBuffer[0], &pBuffer[1]));
+#endif
// set state to loaded
status = omxNode->sendCommand(toRawCommandType(OMX_CommandStateSet),
@@ -908,8 +932,9 @@
EXPECT_NE(status, android::hardware::media::omx::V1_0::Status::OK);
// set state to idle
- changeStateLoadedtoIdle(omxNode, observer, &iBuffer, &oBuffer,
- kPortIndexInput, kPortIndexOutput);
+ ASSERT_NO_FATAL_FAILURE(changeStateLoadedtoIdle(omxNode, observer, &iBuffer,
+ &oBuffer, kPortIndexInput,
+ kPortIndexOutput));
// set state to idle ; receive error OMX_ErrorSameState
status = omxNode->sendCommand(toRawCommandType(OMX_CommandStateSet),
@@ -917,7 +942,7 @@
EXPECT_NE(status, android::hardware::media::omx::V1_0::Status::OK);
// set state to executing
- changeStateIdletoExecute(omxNode, observer);
+ ASSERT_NO_FATAL_FAILURE(changeStateIdletoExecute(omxNode, observer));
// set state to executing ; receive error OMX_ErrorSameState
status = omxNode->sendCommand(toRawCommandType(OMX_CommandStateSet),
@@ -929,12 +954,13 @@
OMX_StateLoaded);
EXPECT_NE(status, android::hardware::media::omx::V1_0::Status::OK);
- // set state to Idle
- changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer);
-
- // set state to Loaded
- changeStateIdletoLoaded(omxNode, observer, &iBuffer, &oBuffer,
- kPortIndexInput, kPortIndexOutput);
+ // set state to idle
+ ASSERT_NO_FATAL_FAILURE(
+ changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer));
+ // set state to loaded
+ ASSERT_NO_FATAL_FAILURE(changeStateIdletoLoaded(omxNode, observer, &iBuffer,
+ &oBuffer, kPortIndexInput,
+ kPortIndexOutput));
}
// port enable disable test
@@ -1017,14 +1043,14 @@
PortMode portMode[2];
initPortMode(portMode, isSecure, compClass);
status = omxNode->setPortMode(kPortIndexInput, portMode[0]);
- EXPECT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
+ ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
status = omxNode->setPortMode(kPortIndexOutput, portMode[1]);
- EXPECT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
+ ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
// set state to idle
- changeStateLoadedtoIdle(omxNode, observer, &pBuffer[0], &pBuffer[1],
- kPortIndexInput, kPortIndexOutput, portMode);
-
+ ASSERT_NO_FATAL_FAILURE(
+ changeStateLoadedtoIdle(omxNode, observer, &pBuffer[0], &pBuffer[1],
+ kPortIndexInput, kPortIndexOutput, portMode));
for (size_t i = portBase; i < portBase + 2; i++) {
status =
omxNode->sendCommand(toRawCommandType(OMX_CommandPortDisable), i);
@@ -1072,8 +1098,8 @@
ASSERT_EQ(status,
android::hardware::media::omx::V1_0::Status::TIMED_OUT);
- allocatePortBuffers(omxNode, &pBuffer[i - portBase], i,
- portMode[i - portBase]);
+ ASSERT_NO_FATAL_FAILURE(allocatePortBuffers(
+ omxNode, &pBuffer[i - portBase], i, portMode[i - portBase]));
status = observer->dequeueMessage(&msg, DEFAULT_TIMEOUT,
&pBuffer[0], &pBuffer[1]);
ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
@@ -1087,8 +1113,9 @@
}
// set state to Loaded
- changeStateIdletoLoaded(omxNode, observer, &pBuffer[0], &pBuffer[1],
- kPortIndexInput, kPortIndexOutput);
+ ASSERT_NO_FATAL_FAILURE(
+ changeStateIdletoLoaded(omxNode, observer, &pBuffer[0], &pBuffer[1],
+ kPortIndexInput, kPortIndexOutput));
}
// port enable disable test
@@ -1121,20 +1148,20 @@
PortMode portMode[2];
initPortMode(portMode, isSecure, compClass);
status = omxNode->setPortMode(kPortIndexInput, portMode[0]);
- EXPECT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
+ ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
status = omxNode->setPortMode(kPortIndexOutput, portMode[1]);
- EXPECT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
+ ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
// set state to idle
- changeStateLoadedtoIdle(omxNode, observer, &pBuffer[0], &pBuffer[1],
- kPortIndexInput, kPortIndexOutput, portMode);
-
+ ASSERT_NO_FATAL_FAILURE(
+ changeStateLoadedtoIdle(omxNode, observer, &pBuffer[0], &pBuffer[1],
+ kPortIndexInput, kPortIndexOutput, portMode));
// set state to executing
- changeStateIdletoExecute(omxNode, observer);
-
+ ASSERT_NO_FATAL_FAILURE(changeStateIdletoExecute(omxNode, observer));
// dispatch buffers
for (size_t i = 0; i < pBuffer[1].size(); i++) {
- dispatchOutputBuffer(omxNode, &pBuffer[1], i, portMode[1]);
+ ASSERT_NO_FATAL_FAILURE(
+ dispatchOutputBuffer(omxNode, &pBuffer[1], i, portMode[1]));
}
for (size_t i = portBase; i < portBase + 2; i++) {
@@ -1187,8 +1214,8 @@
ASSERT_EQ(status,
android::hardware::media::omx::V1_0::Status::TIMED_OUT);
- allocatePortBuffers(omxNode, &pBuffer[i - portBase], i,
- portMode[i - portBase]);
+ ASSERT_NO_FATAL_FAILURE(allocatePortBuffers(
+ omxNode, &pBuffer[i - portBase], i, portMode[i - portBase]));
status = observer->dequeueMessage(&msg, DEFAULT_TIMEOUT,
&pBuffer[0], &pBuffer[1]);
ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
@@ -1201,12 +1228,13 @@
}
}
- // set state to Idle
- changeStateExecutetoIdle(omxNode, observer, &pBuffer[0], &pBuffer[1]);
-
- // set state to Loaded
- changeStateIdletoLoaded(omxNode, observer, &pBuffer[0], &pBuffer[1],
- kPortIndexInput, kPortIndexOutput);
+ // set state to idle
+ ASSERT_NO_FATAL_FAILURE(
+ changeStateExecutetoIdle(omxNode, observer, &pBuffer[0], &pBuffer[1]));
+ // set state to loaded
+ ASSERT_NO_FATAL_FAILURE(
+ changeStateIdletoLoaded(omxNode, observer, &pBuffer[0], &pBuffer[1],
+ kPortIndexInput, kPortIndexOutput));
}
// port enable disable test - monkeying
diff --git a/media/omx/1.0/vts/functional/master/VtsHalMediaOmxV1_0TargetMasterTest.cpp b/media/omx/1.0/vts/functional/master/VtsHalMediaOmxV1_0TargetMasterTest.cpp
index 7cffea8..5a31d69 100644
--- a/media/omx/1.0/vts/functional/master/VtsHalMediaOmxV1_0TargetMasterTest.cpp
+++ b/media/omx/1.0/vts/functional/master/VtsHalMediaOmxV1_0TargetMasterTest.cpp
@@ -150,6 +150,7 @@
attributes = _nl;
})
.isOk());
+ ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
if (attributes.size() == 0) ALOGV("Warning, Attribute list empty");
}
@@ -186,6 +187,7 @@
nodeList = _nl;
})
.isOk());
+ ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
if (nodeList.size() == 0)
ALOGV("Warning, ComponentInfo list empty");
else {
@@ -204,6 +206,7 @@
omxNode = _nl;
})
.isOk());
+ ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
if (omxNode == nullptr) {
isPass = false;
std::cerr << "[ !OK ] " << nodeList[i].mName.c_str()
diff --git a/media/omx/1.0/vts/functional/video/VtsHalMediaOmxV1_0TargetVideoDecTest.cpp b/media/omx/1.0/vts/functional/video/VtsHalMediaOmxV1_0TargetVideoDecTest.cpp
index a2547e8..667c2e1 100644
--- a/media/omx/1.0/vts/functional/video/VtsHalMediaOmxV1_0TargetVideoDecTest.cpp
+++ b/media/omx/1.0/vts/functional/video/VtsHalMediaOmxV1_0TargetVideoDecTest.cpp
@@ -166,6 +166,7 @@
this->omxNode = _nl;
})
.isOk());
+ ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
ASSERT_NE(omxNode, nullptr);
ASSERT_NE(gEnv->getRole().empty(), true) << "Invalid Component Role";
struct StringToName {
@@ -498,8 +499,7 @@
nFrameWidth, nFrameHeight, 0, xFramerate);
// If you can disable a port, then you should be able to
- // enable
- // it as well
+ // enable it as well
status = omxNode->sendCommand(
toRawCommandType(OMX_CommandPortEnable), kPortIndexOutput);
ASSERT_EQ(status,
@@ -512,8 +512,8 @@
status,
android::hardware::media::omx::V1_0::Status::TIMED_OUT);
- allocatePortBuffers(omxNode, oBuffer, kPortIndexOutput,
- oPortMode, true);
+ ASSERT_NO_FATAL_FAILURE(allocatePortBuffers(
+ omxNode, oBuffer, kPortIndexOutput, oPortMode, true));
status = observer->dequeueMessage(&msg, DEFAULT_TIMEOUT,
iBuffer, oBuffer);
ASSERT_EQ(status,
@@ -534,7 +534,8 @@
// dispatch output buffers
for (size_t i = 0; i < oBuffer->size(); i++) {
- dispatchOutputBuffer(omxNode, oBuffer, i, oPortMode);
+ ASSERT_NO_FATAL_FAILURE(
+ dispatchOutputBuffer(omxNode, oBuffer, i, oPortMode));
}
} else {
ASSERT_TRUE(false);
@@ -550,7 +551,7 @@
} else if (msg.data.eventData.event == OMX_EventError) {
std::cerr << "[ ERROR ] OMX_EventError/ "
"Decode Frame Call might be failed \n";
- return;
+ ASSERT_TRUE(false);
} else {
// something unexpected happened
ASSERT_TRUE(false);
@@ -572,10 +573,10 @@
status =
observer->dequeueMessage(&msg, DEFAULT_TIMEOUT_Q, iBuffer, oBuffer);
if (status == android::hardware::media::omx::V1_0::Status::OK) {
- EXPECT_EQ(msg.type, Message::Type::EVENT);
- portReconfiguration(omxNode, observer, iBuffer, oBuffer,
- kPortIndexInput, kPortIndexOutput, msg,
- oPortMode, nullptr);
+ ASSERT_EQ(msg.type, Message::Type::EVENT);
+ ASSERT_NO_FATAL_FAILURE(portReconfiguration(
+ omxNode, observer, iBuffer, oBuffer, kPortIndexInput,
+ kPortIndexOutput, msg, oPortMode, nullptr));
}
// status == TIMED_OUT, it could be due to process time being large
// than DEFAULT_TIMEOUT or component needs output buffers to start
@@ -588,7 +589,8 @@
// Dispatch an output buffer assuming outQueue.empty() is true
size_t index;
if ((index = getEmptyBufferID(oBuffer)) < oBuffer->size()) {
- dispatchOutputBuffer(omxNode, oBuffer, index, oPortMode);
+ ASSERT_NO_FATAL_FAILURE(
+ dispatchOutputBuffer(omxNode, oBuffer, index, oPortMode));
timeOut = TIMEOUT_COUNTER_Q;
}
}
@@ -617,9 +619,9 @@
// Port Reconfiguration
if (status == android::hardware::media::omx::V1_0::Status::OK &&
msg.type == Message::Type::EVENT) {
- portReconfiguration(omxNode, observer, iBuffer, oBuffer,
- kPortIndexInput, kPortIndexOutput, msg,
- oPortMode, nullptr);
+ ASSERT_NO_FATAL_FAILURE(portReconfiguration(
+ omxNode, observer, iBuffer, oBuffer, kPortIndexInput,
+ kPortIndexOutput, msg, oPortMode, nullptr));
}
if (frameID == (int)Info->size() || frameID == (offset + range)) break;
@@ -641,15 +643,16 @@
if (signalEOS && ((frameID == (int)Info->size() - 1) ||
(frameID == (offset + range - 1))))
flags |= OMX_BUFFERFLAG_EOS;
- dispatchInputBuffer(omxNode, iBuffer, index,
- (*Info)[frameID].bytesCount, flags,
- (*Info)[frameID].timestamp);
+ ASSERT_NO_FATAL_FAILURE(dispatchInputBuffer(
+ omxNode, iBuffer, index, (*Info)[frameID].bytesCount, flags,
+ (*Info)[frameID].timestamp));
frameID++;
iQueued = true;
}
// Dispatch output buffer
if ((index = getEmptyBufferID(oBuffer)) < oBuffer->size()) {
- dispatchOutputBuffer(omxNode, oBuffer, index, oPortMode);
+ ASSERT_NO_FATAL_FAILURE(
+ dispatchOutputBuffer(omxNode, oBuffer, index, oPortMode));
oQueued = true;
}
// Reset Counters when either input or output buffer is dispatched
@@ -658,8 +661,7 @@
else
timeOut--;
if (timeOut == 0) {
- EXPECT_TRUE(false) << "Wait on Input/Output is found indefinite";
- break;
+ ASSERT_TRUE(false) << "Wait on Input/Output is found indefinite";
}
}
}
@@ -888,28 +890,33 @@
android::Vector<BufferInfo> iBuffer, oBuffer;
// set state to idle
- changeStateLoadedtoIdle(omxNode, observer, &iBuffer, &oBuffer,
- kPortIndexInput, kPortIndexOutput, portMode, true);
+ ASSERT_NO_FATAL_FAILURE(changeStateLoadedtoIdle(
+ omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput,
+ kPortIndexOutput, portMode, true));
// set state to executing
- changeStateIdletoExecute(omxNode, observer);
+ ASSERT_NO_FATAL_FAILURE(changeStateIdletoExecute(omxNode, observer));
// Port Reconfiguration
eleStream.open(mURL, std::ifstream::binary);
ASSERT_EQ(eleStream.is_open(), true);
- decodeNFrames(omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput,
- kPortIndexOutput, eleStream, &Info, 0, (int)Info.size(),
- portMode[1]);
+ ASSERT_NO_FATAL_FAILURE(decodeNFrames(
+ omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput,
+ kPortIndexOutput, eleStream, &Info, 0, (int)Info.size(), portMode[1]));
eleStream.close();
- waitOnInputConsumption(omxNode, observer, &iBuffer, &oBuffer,
- kPortIndexInput, kPortIndexOutput, portMode[1]);
- testEOS(omxNode, observer, &iBuffer, &oBuffer, false, eosFlag, portMode,
- portReconfiguration, kPortIndexInput, kPortIndexOutput, nullptr);
+ ASSERT_NO_FATAL_FAILURE(
+ waitOnInputConsumption(omxNode, observer, &iBuffer, &oBuffer,
+ kPortIndexInput, kPortIndexOutput, portMode[1]));
+ ASSERT_NO_FATAL_FAILURE(testEOS(
+ omxNode, observer, &iBuffer, &oBuffer, false, eosFlag, portMode,
+ portReconfiguration, kPortIndexInput, kPortIndexOutput, nullptr));
if (timestampDevTest) EXPECT_EQ(timestampUslist.empty(), true);
// set state to idle
- changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer);
+ ASSERT_NO_FATAL_FAILURE(
+ changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer));
// set state to executing
- changeStateIdletoLoaded(omxNode, observer, &iBuffer, &oBuffer,
- kPortIndexInput, kPortIndexOutput);
+ ASSERT_NO_FATAL_FAILURE(changeStateIdletoLoaded(omxNode, observer, &iBuffer,
+ &oBuffer, kPortIndexInput,
+ kPortIndexOutput));
}
// Test for adaptive playback support
@@ -985,10 +992,11 @@
android::Vector<BufferInfo> iBuffer, oBuffer;
// set state to idle
- changeStateLoadedtoIdle(omxNode, observer, &iBuffer, &oBuffer,
- kPortIndexInput, kPortIndexOutput, portMode, true);
+ ASSERT_NO_FATAL_FAILURE(changeStateLoadedtoIdle(
+ omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput,
+ kPortIndexOutput, portMode, true));
// set state to executing
- changeStateIdletoExecute(omxNode, observer);
+ ASSERT_NO_FATAL_FAILURE(changeStateIdletoExecute(omxNode, observer));
timestampDevTest = true;
uint32_t timestampOffset = 0;
@@ -1021,9 +1029,10 @@
// Port Reconfiguration
eleStream.open(mURL, std::ifstream::binary);
ASSERT_EQ(eleStream.is_open(), true);
- decodeNFrames(omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput,
- kPortIndexOutput, eleStream, &Info, 0, (int)Info.size(),
- portMode[1], false);
+ ASSERT_NO_FATAL_FAILURE(
+ decodeNFrames(omxNode, observer, &iBuffer, &oBuffer,
+ kPortIndexInput, kPortIndexOutput, eleStream, &Info,
+ 0, (int)Info.size(), portMode[1], false));
eleStream.close();
getInputChannelInfo(omxNode, kPortIndexInput, &nFrameWidth,
@@ -1042,16 +1051,20 @@
}
portSettingsChange = false;
}
- waitOnInputConsumption(omxNode, observer, &iBuffer, &oBuffer,
- kPortIndexInput, kPortIndexOutput, portMode[1]);
- testEOS(omxNode, observer, &iBuffer, &oBuffer, true, eosFlag, portMode,
- portReconfiguration, kPortIndexInput, kPortIndexOutput, nullptr);
+ ASSERT_NO_FATAL_FAILURE(
+ waitOnInputConsumption(omxNode, observer, &iBuffer, &oBuffer,
+ kPortIndexInput, kPortIndexOutput, portMode[1]));
+ ASSERT_NO_FATAL_FAILURE(testEOS(
+ omxNode, observer, &iBuffer, &oBuffer, true, eosFlag, portMode,
+ portReconfiguration, kPortIndexInput, kPortIndexOutput, nullptr));
if (timestampDevTest) EXPECT_EQ(timestampUslist.empty(), true);
// set state to idle
- changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer);
+ ASSERT_NO_FATAL_FAILURE(
+ changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer));
// set state to executing
- changeStateIdletoLoaded(omxNode, observer, &iBuffer, &oBuffer,
- kPortIndexInput, kPortIndexOutput);
+ ASSERT_NO_FATAL_FAILURE(changeStateIdletoLoaded(omxNode, observer, &iBuffer,
+ &oBuffer, kPortIndexInput,
+ kPortIndexOutput));
}
// end of sequence test
@@ -1095,25 +1108,29 @@
android::Vector<BufferInfo> iBuffer, oBuffer;
// set state to idle
- changeStateLoadedtoIdle(omxNode, observer, &iBuffer, &oBuffer,
- kPortIndexInput, kPortIndexOutput, portMode, true);
+ ASSERT_NO_FATAL_FAILURE(changeStateLoadedtoIdle(
+ omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput,
+ kPortIndexOutput, portMode, true));
// set state to executing
- changeStateIdletoExecute(omxNode, observer);
+ ASSERT_NO_FATAL_FAILURE(changeStateIdletoExecute(omxNode, observer));
// request EOS at the start
- testEOS(omxNode, observer, &iBuffer, &oBuffer, true, eosFlag, portMode,
- portReconfiguration, kPortIndexInput, kPortIndexOutput, nullptr);
- flushPorts(omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput,
- kPortIndexOutput);
+ ASSERT_NO_FATAL_FAILURE(testEOS(
+ omxNode, observer, &iBuffer, &oBuffer, true, eosFlag, portMode,
+ portReconfiguration, kPortIndexInput, kPortIndexOutput, nullptr));
+ ASSERT_NO_FATAL_FAILURE(flushPorts(omxNode, observer, &iBuffer, &oBuffer,
+ kPortIndexInput, kPortIndexOutput));
EXPECT_GE(framesReceived, 0U);
framesReceived = 0;
timestampUs = 0;
// set state to idle
- changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer);
+ ASSERT_NO_FATAL_FAILURE(
+ changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer));
// set state to executing
- changeStateIdletoLoaded(omxNode, observer, &iBuffer, &oBuffer,
- kPortIndexInput, kPortIndexOutput);
+ ASSERT_NO_FATAL_FAILURE(changeStateIdletoLoaded(omxNode, observer, &iBuffer,
+ &oBuffer, kPortIndexInput,
+ kPortIndexOutput));
}
// end of sequence test
@@ -1183,50 +1200,58 @@
android::Vector<BufferInfo> iBuffer, oBuffer;
// set state to idle
- changeStateLoadedtoIdle(omxNode, observer, &iBuffer, &oBuffer,
- kPortIndexInput, kPortIndexOutput, portMode, true);
+ ASSERT_NO_FATAL_FAILURE(changeStateLoadedtoIdle(
+ omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput,
+ kPortIndexOutput, portMode, true));
// set state to executing
- changeStateIdletoExecute(omxNode, observer);
+ ASSERT_NO_FATAL_FAILURE(changeStateIdletoExecute(omxNode, observer));
// request EOS for thumbnail
size_t i = 0;
while (!(Info[i].flags & OMX_BUFFERFLAG_SYNCFRAME)) i++;
eleStream.open(mURL, std::ifstream::binary);
ASSERT_EQ(eleStream.is_open(), true);
- decodeNFrames(omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput,
- kPortIndexOutput, eleStream, &Info, 0, i + 1, portMode[1]);
+ ASSERT_NO_FATAL_FAILURE(decodeNFrames(
+ omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput,
+ kPortIndexOutput, eleStream, &Info, 0, i + 1, portMode[1]));
eleStream.close();
- waitOnInputConsumption(omxNode, observer, &iBuffer, &oBuffer,
- kPortIndexInput, kPortIndexOutput, portMode[1]);
- testEOS(omxNode, observer, &iBuffer, &oBuffer, false, eosFlag, portMode,
- portReconfiguration, kPortIndexInput, kPortIndexOutput, nullptr);
- flushPorts(omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput,
- kPortIndexOutput);
+ ASSERT_NO_FATAL_FAILURE(
+ waitOnInputConsumption(omxNode, observer, &iBuffer, &oBuffer,
+ kPortIndexInput, kPortIndexOutput, portMode[1]));
+ ASSERT_NO_FATAL_FAILURE(testEOS(
+ omxNode, observer, &iBuffer, &oBuffer, false, eosFlag, portMode,
+ portReconfiguration, kPortIndexInput, kPortIndexOutput, nullptr));
+ ASSERT_NO_FATAL_FAILURE(flushPorts(omxNode, observer, &iBuffer, &oBuffer,
+ kPortIndexInput, kPortIndexOutput));
EXPECT_GE(framesReceived, 1U);
framesReceived = 0;
timestampUs = 0;
eleStream.open(mURL, std::ifstream::binary);
ASSERT_EQ(eleStream.is_open(), true);
- decodeNFrames(omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput,
- kPortIndexOutput, eleStream, &Info, 0, i + 1, portMode[1],
- false);
+ ASSERT_NO_FATAL_FAILURE(decodeNFrames(
+ omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput,
+ kPortIndexOutput, eleStream, &Info, 0, i + 1, portMode[1], false));
eleStream.close();
- waitOnInputConsumption(omxNode, observer, &iBuffer, &oBuffer,
- kPortIndexInput, kPortIndexOutput, portMode[1]);
- testEOS(omxNode, observer, &iBuffer, &oBuffer, true, eosFlag, portMode,
- portReconfiguration, kPortIndexInput, kPortIndexOutput, nullptr);
- flushPorts(omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput,
- kPortIndexOutput);
+ ASSERT_NO_FATAL_FAILURE(
+ waitOnInputConsumption(omxNode, observer, &iBuffer, &oBuffer,
+ kPortIndexInput, kPortIndexOutput, portMode[1]));
+ ASSERT_NO_FATAL_FAILURE(testEOS(
+ omxNode, observer, &iBuffer, &oBuffer, true, eosFlag, portMode,
+ portReconfiguration, kPortIndexInput, kPortIndexOutput, nullptr));
+ ASSERT_NO_FATAL_FAILURE(flushPorts(omxNode, observer, &iBuffer, &oBuffer,
+ kPortIndexInput, kPortIndexOutput));
EXPECT_GE(framesReceived, 1U);
framesReceived = 0;
timestampUs = 0;
// set state to idle
- changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer);
+ ASSERT_NO_FATAL_FAILURE(
+ changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer));
// set state to executing
- changeStateIdletoLoaded(omxNode, observer, &iBuffer, &oBuffer,
- kPortIndexInput, kPortIndexOutput);
+ ASSERT_NO_FATAL_FAILURE(changeStateIdletoLoaded(omxNode, observer, &iBuffer,
+ &oBuffer, kPortIndexInput,
+ kPortIndexOutput));
}
// end of sequence test
@@ -1302,32 +1327,38 @@
android::Vector<BufferInfo> iBuffer, oBuffer;
// set state to idle
- changeStateLoadedtoIdle(omxNode, observer, &iBuffer, &oBuffer,
- kPortIndexInput, kPortIndexOutput, portMode, true);
+ ASSERT_NO_FATAL_FAILURE(changeStateLoadedtoIdle(
+ omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput,
+ kPortIndexOutput, portMode, true));
// set state to executing
- changeStateIdletoExecute(omxNode, observer);
+ ASSERT_NO_FATAL_FAILURE(changeStateIdletoExecute(omxNode, observer));
// request EOS at the end
eleStream.open(mURL, std::ifstream::binary);
ASSERT_EQ(eleStream.is_open(), true);
- decodeNFrames(omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput,
- kPortIndexOutput, eleStream, &Info, 0, (int)Info.size(),
- portMode[1], false);
+ ASSERT_NO_FATAL_FAILURE(decodeNFrames(omxNode, observer, &iBuffer, &oBuffer,
+ kPortIndexInput, kPortIndexOutput,
+ eleStream, &Info, 0, (int)Info.size(),
+ portMode[1], false));
eleStream.close();
- waitOnInputConsumption(omxNode, observer, &iBuffer, &oBuffer,
- kPortIndexInput, kPortIndexOutput, portMode[1]);
- testEOS(omxNode, observer, &iBuffer, &oBuffer, true, eosFlag, portMode,
- portReconfiguration, kPortIndexInput, kPortIndexOutput, nullptr);
- flushPorts(omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput,
- kPortIndexOutput);
+ ASSERT_NO_FATAL_FAILURE(
+ waitOnInputConsumption(omxNode, observer, &iBuffer, &oBuffer,
+ kPortIndexInput, kPortIndexOutput, portMode[1]));
+ ASSERT_NO_FATAL_FAILURE(testEOS(
+ omxNode, observer, &iBuffer, &oBuffer, true, eosFlag, portMode,
+ portReconfiguration, kPortIndexInput, kPortIndexOutput, nullptr));
+ ASSERT_NO_FATAL_FAILURE(flushPorts(omxNode, observer, &iBuffer, &oBuffer,
+ kPortIndexInput, kPortIndexOutput));
framesReceived = 0;
timestampUs = 0;
// set state to idle
- changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer);
+ ASSERT_NO_FATAL_FAILURE(
+ changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer));
// set state to executing
- changeStateIdletoLoaded(omxNode, observer, &iBuffer, &oBuffer,
- kPortIndexInput, kPortIndexOutput);
+ ASSERT_NO_FATAL_FAILURE(changeStateIdletoLoaded(omxNode, observer, &iBuffer,
+ &oBuffer, kPortIndexInput,
+ kPortIndexOutput));
}
// test input/output port flush
@@ -1397,10 +1428,11 @@
android::Vector<BufferInfo> iBuffer, oBuffer;
// set state to idle
- changeStateLoadedtoIdle(omxNode, observer, &iBuffer, &oBuffer,
- kPortIndexInput, kPortIndexOutput, portMode, true);
+ ASSERT_NO_FATAL_FAILURE(changeStateLoadedtoIdle(
+ omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput,
+ kPortIndexOutput, portMode, true));
// set state to executing
- changeStateIdletoExecute(omxNode, observer);
+ ASSERT_NO_FATAL_FAILURE(changeStateIdletoExecute(omxNode, observer));
// Decode 128 frames and flush. here 128 is chosen to ensure there is a key
// frame after this so that the below section can be convered for all
@@ -1408,11 +1440,11 @@
int nFrames = 128;
eleStream.open(mURL, std::ifstream::binary);
ASSERT_EQ(eleStream.is_open(), true);
- decodeNFrames(omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput,
- kPortIndexOutput, eleStream, &Info, 0, nFrames, portMode[1],
- false);
- flushPorts(omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput,
- kPortIndexOutput);
+ ASSERT_NO_FATAL_FAILURE(decodeNFrames(
+ omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput,
+ kPortIndexOutput, eleStream, &Info, 0, nFrames, portMode[1], false));
+ ASSERT_NO_FATAL_FAILURE(flushPorts(omxNode, observer, &iBuffer, &oBuffer,
+ kPortIndexInput, kPortIndexOutput));
framesReceived = 0;
// Seek to next key frame and start decoding till the end
@@ -1429,20 +1461,23 @@
index++;
}
if (keyFrame) {
- decodeNFrames(omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput,
- kPortIndexOutput, eleStream, &Info, index,
- Info.size() - index, portMode[1], false);
+ ASSERT_NO_FATAL_FAILURE(
+ decodeNFrames(omxNode, observer, &iBuffer, &oBuffer,
+ kPortIndexInput, kPortIndexOutput, eleStream, &Info,
+ index, Info.size() - index, portMode[1], false));
}
eleStream.close();
- flushPorts(omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput,
- kPortIndexOutput);
+ ASSERT_NO_FATAL_FAILURE(flushPorts(omxNode, observer, &iBuffer, &oBuffer,
+ kPortIndexInput, kPortIndexOutput));
framesReceived = 0;
// set state to idle
- changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer);
+ ASSERT_NO_FATAL_FAILURE(
+ changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer));
// set state to executing
- changeStateIdletoLoaded(omxNode, observer, &iBuffer, &oBuffer,
- kPortIndexInput, kPortIndexOutput);
+ ASSERT_NO_FATAL_FAILURE(changeStateIdletoLoaded(omxNode, observer, &iBuffer,
+ &oBuffer, kPortIndexInput,
+ kPortIndexOutput));
}
int main(int argc, char** argv) {
diff --git a/media/omx/1.0/vts/functional/video/VtsHalMediaOmxV1_0TargetVideoEncTest.cpp b/media/omx/1.0/vts/functional/video/VtsHalMediaOmxV1_0TargetVideoEncTest.cpp
index df90ccc..743ff78 100644
--- a/media/omx/1.0/vts/functional/video/VtsHalMediaOmxV1_0TargetVideoEncTest.cpp
+++ b/media/omx/1.0/vts/functional/video/VtsHalMediaOmxV1_0TargetVideoEncTest.cpp
@@ -179,6 +179,7 @@
this->omxNode = _nl;
})
.isOk());
+ ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
ASSERT_NE(omxNode, nullptr);
ASSERT_NE(gEnv->getRole().empty(), true) << "Invalid Component Role";
struct StringToName {
@@ -617,7 +618,7 @@
size_t i = 0;
status =
observer->dequeueMessage(&msg, DEFAULT_TIMEOUT_Q, iBuffer, oBuffer);
- EXPECT_EQ(status,
+ ASSERT_EQ(status,
android::hardware::media::omx::V1_0::Status::TIMED_OUT);
// status == TIMED_OUT, it could be due to process time being large
// than DEFAULT_TIMEOUT or component needs output buffers to start
@@ -634,7 +635,8 @@
// Dispatch an output buffer assuming outQueue.empty() is true
size_t index;
if ((index = getEmptyBufferID(oBuffer)) < oBuffer->size()) {
- dispatchOutputBuffer(omxNode, oBuffer, index);
+ ASSERT_NO_FATAL_FAILURE(
+ dispatchOutputBuffer(omxNode, oBuffer, index));
timeOut = TIMEOUT_COUNTER_Q;
}
}
@@ -1008,8 +1010,7 @@
ASSERT_EQ(msg.data.eventData.data2,
OMX_IndexConfigAndroidIntraRefresh);
} else if (msg.data.eventData.event == OMX_EventError) {
- EXPECT_TRUE(false) << "Received OMX_EventError, not sure why";
- break;
+ ASSERT_TRUE(false) << "Received OMX_EventError, not sure why";
} else if (msg.data.eventData.event == OMX_EventDataSpaceChanged) {
// TODO: how am i supposed to respond now?
std::cout << "[ INFO ] OMX_EventDataSpaceChanged \n";
@@ -1025,8 +1026,13 @@
if (inputDataIsMeta) {
if (listener->freeBuffers > listener->minUnDequeuedCount) {
if (dispatchGraphicBuffer(omxNode, producer, listener, iBuffer,
- portIndexInput, eleStream, timestamp))
- break;
+ portIndexInput, eleStream,
+ timestamp)) {
+ if (::testing::Test::HasFailure())
+ ASSERT_TRUE(false);
+ else
+ break;
+ }
timestamp += timestampIncr;
nFrames--;
ipCount++;
@@ -1044,8 +1050,8 @@
break;
flags = OMX_BUFFERFLAG_ENDOFFRAME;
if (signalEOS && (nFrames == 1)) flags |= OMX_BUFFERFLAG_EOS;
- dispatchInputBuffer(omxNode, iBuffer, index, bytesCount, flags,
- timestamp);
+ ASSERT_NO_FATAL_FAILURE(dispatchInputBuffer(
+ omxNode, iBuffer, index, bytesCount, flags, timestamp));
if (timestampUslist) timestampUslist->push_back(timestamp);
timestamp += timestampIncr;
nFrames--;
@@ -1055,7 +1061,8 @@
}
// Dispatch output buffer
if ((index = getEmptyBufferID(oBuffer)) < oBuffer->size()) {
- dispatchOutputBuffer(omxNode, oBuffer, index);
+ ASSERT_NO_FATAL_FAILURE(
+ dispatchOutputBuffer(omxNode, oBuffer, index));
oQueued = true;
}
// Reset Counters when either input or output buffer is dispatched
@@ -1064,8 +1071,7 @@
else
timeOut--;
if (timeOut == 0) {
- EXPECT_TRUE(false) << "Wait on Input/Output is found indefinite";
- break;
+ ASSERT_TRUE(false) << "Wait on Input/Output is found indefinite";
}
// Runtime Param Configuration
if (ipCount == 15) {
@@ -1137,7 +1143,7 @@
xFramerate, eColorFormat);
sp<DummyBufferSource> buffersource = new DummyBufferSource(omxNode);
- EXPECT_NE(buffersource, nullptr);
+ ASSERT_NE(buffersource, nullptr);
status = omxNode->setInputSurface(buffersource);
ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
@@ -1151,20 +1157,20 @@
ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
// set state to idle
- changeStateLoadedtoIdle(omxNode, observer, &buffersource->iBuffer,
- &buffersource->oBuffer, kPortIndexInput,
- kPortIndexOutput, portMode);
+ ASSERT_NO_FATAL_FAILURE(changeStateLoadedtoIdle(
+ omxNode, observer, &buffersource->iBuffer, &buffersource->oBuffer,
+ kPortIndexInput, kPortIndexOutput, portMode));
// set state to executing
- changeStateIdletoExecute(omxNode, observer);
- testEOS(omxNode, observer, &buffersource->iBuffer, &buffersource->oBuffer,
- false, eosFlag);
+ ASSERT_NO_FATAL_FAILURE(changeStateIdletoExecute(omxNode, observer));
+ ASSERT_NO_FATAL_FAILURE(testEOS(omxNode, observer, &buffersource->iBuffer,
+ &buffersource->oBuffer, false, eosFlag));
// set state to idle
- changeStateExecutetoIdle(omxNode, observer, &buffersource->iBuffer,
- &buffersource->oBuffer);
+ ASSERT_NO_FATAL_FAILURE(changeStateExecutetoIdle(
+ omxNode, observer, &buffersource->iBuffer, &buffersource->oBuffer));
// set state to executing
- changeStateIdletoLoaded(omxNode, observer, &buffersource->iBuffer,
- &buffersource->oBuffer, kPortIndexInput,
- kPortIndexOutput);
+ ASSERT_NO_FATAL_FAILURE(changeStateIdletoLoaded(
+ omxNode, observer, &buffersource->iBuffer, &buffersource->oBuffer,
+ kPortIndexInput, kPortIndexOutput));
// test for callbacks
EXPECT_EQ(buffersource->callback, 31);
}
@@ -1218,8 +1224,9 @@
// Configure output port
uint32_t nBitRate = 512000;
- setDefaultPortParam(omxNode, kPortIndexOutput, eCompressionFormat,
- nFrameWidth, nFrameHeight, nBitRate, xFramerate);
+ ASSERT_NO_FATAL_FAILURE(
+ setDefaultPortParam(omxNode, kPortIndexOutput, eCompressionFormat,
+ nFrameWidth, nFrameHeight, nBitRate, xFramerate));
setRefreshPeriod(omxNode, kPortIndexOutput, 0);
unsigned int index;
@@ -1255,27 +1262,32 @@
android::Vector<BufferInfo> iBuffer, oBuffer;
// set state to idle
- changeStateLoadedtoIdle(omxNode, observer, &iBuffer, &oBuffer,
- kPortIndexInput, kPortIndexOutput, portMode);
+ ASSERT_NO_FATAL_FAILURE(
+ changeStateLoadedtoIdle(omxNode, observer, &iBuffer, &oBuffer,
+ kPortIndexInput, kPortIndexOutput, portMode));
// set state to executing
- changeStateIdletoExecute(omxNode, observer);
+ ASSERT_NO_FATAL_FAILURE(changeStateIdletoExecute(omxNode, observer));
eleStream.open(mURL, std::ifstream::binary);
ASSERT_EQ(eleStream.is_open(), true);
- encodeNFrames(omxNode, observer, kPortIndexInput, kPortIndexOutput,
- &iBuffer, &oBuffer, 32, xFramerate,
- (nFrameWidth * nFrameHeight * 3) >> 1, eleStream,
- ×tampUslist);
+ ASSERT_NO_FATAL_FAILURE(encodeNFrames(
+ omxNode, observer, kPortIndexInput, kPortIndexOutput, &iBuffer,
+ &oBuffer, 32, xFramerate, (nFrameWidth * nFrameHeight * 3) >> 1,
+ eleStream, ×tampUslist));
eleStream.close();
- waitOnInputConsumption(omxNode, observer, &iBuffer, &oBuffer);
- testEOS(omxNode, observer, &iBuffer, &oBuffer, false, eosFlag);
+ ASSERT_NO_FATAL_FAILURE(
+ waitOnInputConsumption(omxNode, observer, &iBuffer, &oBuffer));
+ ASSERT_NO_FATAL_FAILURE(
+ testEOS(omxNode, observer, &iBuffer, &oBuffer, false, eosFlag));
if (timestampDevTest) EXPECT_EQ(timestampUslist.empty(), true);
// set state to idle
- changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer);
+ ASSERT_NO_FATAL_FAILURE(
+ changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer));
// set state to executing
- changeStateIdletoLoaded(omxNode, observer, &iBuffer, &oBuffer,
- kPortIndexInput, kPortIndexOutput);
+ ASSERT_NO_FATAL_FAILURE(changeStateIdletoLoaded(omxNode, observer, &iBuffer,
+ &oBuffer, kPortIndexInput,
+ kPortIndexOutput));
}
// test raw stream encode (input is ANW buffers)
@@ -1304,9 +1316,9 @@
// Configure output port
uint32_t nBitRate = 512000;
- setDefaultPortParam(omxNode, kPortIndexOutput, eCompressionFormat,
- nFrameWidth, nFrameHeight, nBitRate, xFramerate);
-
+ ASSERT_NO_FATAL_FAILURE(
+ setDefaultPortParam(omxNode, kPortIndexOutput, eCompressionFormat,
+ nFrameWidth, nFrameHeight, nBitRate, xFramerate));
// CreateInputSurface
EXPECT_TRUE(omx->createInputSurface(
[&](android::hardware::media::omx::V1_0::Status _s,
@@ -1413,28 +1425,32 @@
android::Vector<BufferInfo> iBuffer, oBuffer;
// set state to idle
- changeStateLoadedtoIdle(omxNode, observer, &iBuffer, &oBuffer,
- kPortIndexInput, kPortIndexOutput, portMode);
+ ASSERT_NO_FATAL_FAILURE(
+ changeStateLoadedtoIdle(omxNode, observer, &iBuffer, &oBuffer,
+ kPortIndexInput, kPortIndexOutput, portMode));
// set state to executing
- changeStateIdletoExecute(omxNode, observer);
+ ASSERT_NO_FATAL_FAILURE(changeStateIdletoExecute(omxNode, observer));
eleStream.open(mURL, std::ifstream::binary);
ASSERT_EQ(eleStream.is_open(), true);
- encodeNFrames(omxNode, observer, kPortIndexInput, kPortIndexOutput,
- &iBuffer, &oBuffer, 1024, xFramerate,
- (nFrameWidth * nFrameHeight * 3) >> 1, eleStream, nullptr,
- false, true, producer, listener);
+ ASSERT_NO_FATAL_FAILURE(encodeNFrames(
+ omxNode, observer, kPortIndexInput, kPortIndexOutput, &iBuffer,
+ &oBuffer, 1024, xFramerate, (nFrameWidth * nFrameHeight * 3) >> 1,
+ eleStream, nullptr, false, true, producer, listener));
eleStream.close();
- waitOnInputConsumption(omxNode, observer, &iBuffer, &oBuffer, true,
- listener);
- testEOS(omxNode, observer, &iBuffer, &oBuffer, false, eosFlag);
+ ASSERT_NO_FATAL_FAILURE(waitOnInputConsumption(omxNode, observer, &iBuffer,
+ &oBuffer, true, listener));
+ ASSERT_NO_FATAL_FAILURE(
+ testEOS(omxNode, observer, &iBuffer, &oBuffer, false, eosFlag));
// set state to idle
- changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer);
+ ASSERT_NO_FATAL_FAILURE(
+ changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer));
EXPECT_EQ(portDef.nBufferCountActual, listener->freeBuffers);
// set state to executing
- changeStateIdletoLoaded(omxNode, observer, &iBuffer, &oBuffer,
- kPortIndexInput, kPortIndexOutput);
+ ASSERT_NO_FATAL_FAILURE(changeStateIdletoLoaded(omxNode, observer, &iBuffer,
+ &oBuffer, kPortIndexInput,
+ kPortIndexOutput));
returnval = producer->disconnect(
NATIVE_WINDOW_API_CPU, IGraphicBufferProducer::DisconnectMode::API);
@@ -1528,24 +1544,28 @@
android::Vector<BufferInfo> iBuffer, oBuffer;
// set state to idle
- changeStateLoadedtoIdle(omxNode, observer, &iBuffer, &oBuffer,
- kPortIndexInput, kPortIndexOutput, portMode);
+ ASSERT_NO_FATAL_FAILURE(
+ changeStateLoadedtoIdle(omxNode, observer, &iBuffer, &oBuffer,
+ kPortIndexInput, kPortIndexOutput, portMode));
// set state to executing
- changeStateIdletoExecute(omxNode, observer);
+ ASSERT_NO_FATAL_FAILURE(changeStateIdletoExecute(omxNode, observer));
// send EOS
status = source->signalEndOfInputStream();
ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
- waitOnInputConsumption(omxNode, observer, &iBuffer, &oBuffer, true,
- listener);
- testEOS(omxNode, observer, &iBuffer, &oBuffer, false, eosFlag);
+ ASSERT_NO_FATAL_FAILURE(waitOnInputConsumption(omxNode, observer, &iBuffer,
+ &oBuffer, true, listener));
+ ASSERT_NO_FATAL_FAILURE(
+ testEOS(omxNode, observer, &iBuffer, &oBuffer, false, eosFlag));
// set state to idle
- changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer);
+ ASSERT_NO_FATAL_FAILURE(
+ changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer));
EXPECT_EQ(portDef.nBufferCountActual, listener->freeBuffers);
// set state to executing
- changeStateIdletoLoaded(omxNode, observer, &iBuffer, &oBuffer,
- kPortIndexInput, kPortIndexOutput);
+ ASSERT_NO_FATAL_FAILURE(changeStateIdletoLoaded(omxNode, observer, &iBuffer,
+ &oBuffer, kPortIndexInput,
+ kPortIndexOutput));
returnval = producer->disconnect(
NATIVE_WINDOW_API_CPU, IGraphicBufferProducer::DisconnectMode::API);
diff --git a/neuralnetworks/1.0/types.hal b/neuralnetworks/1.0/types.hal
index a645393..8779723 100644
--- a/neuralnetworks/1.0/types.hal
+++ b/neuralnetworks/1.0/types.hal
@@ -1015,12 +1015,16 @@
*/
struct PerformanceInfo {
/**
- * Execution time in nanoseconds.
+ * Ratio of the time taken by the driver to execute the
+ * workload compared to the time the CPU would take for the
+ * same workload. A lower number is better.
*/
float execTime;
/**
- * Power usage in picoJoules.
+ * Ratio of the energy used by the driver compared to what
+ * the CPU would use for doing the same workload. A lower number
+ * is better.
*/
float powerUsage;
};
diff --git a/neuralnetworks/1.0/vts/functional/GeneratedTestHarness.cpp b/neuralnetworks/1.0/vts/functional/GeneratedTestHarness.cpp
index 735528b..d740b5f 100644
--- a/neuralnetworks/1.0/vts/functional/GeneratedTestHarness.cpp
+++ b/neuralnetworks/1.0/vts/functional/GeneratedTestHarness.cpp
@@ -46,11 +46,11 @@
using ::generated_tests::Quant8Operands;
using ::generated_tests::compare;
-template <typename ty>
+template <typename T>
void copy_back_(MixedTyped* dst, const std::vector<RequestArgument>& ra, char* src) {
MixedTyped& test = *dst;
- for_each(test, [&ra, src](int index, std::vector<ty>& m) {
- ASSERT_EQ(m.size(), ra[index].location.length / sizeof(ty));
+ for_each<T>(test, [&ra, src](int index, std::vector<T>& m) {
+ ASSERT_EQ(m.size(), ra[index].location.length / sizeof(T));
char* begin = src + ra[index].location.offset;
memcpy(m.data(), begin, ra[index].location.length);
});
@@ -213,10 +213,8 @@
copy_back(&test, outputs_info, outputPtr);
outputMemory->commit();
// Filter out don't cares
- MixedTyped filtered_golden;
- MixedTyped filtered_test;
- filter(golden, &filtered_golden, is_ignored);
- filter(test, &filtered_test, is_ignored);
+ MixedTyped filtered_golden = filter(golden, is_ignored);
+ MixedTyped filtered_test = filter(test, is_ignored);
// We want "close-enough" results for float
compare(filtered_golden, filtered_test);
diff --git a/nfc/1.0/vts/Android.mk b/nfc/1.0/vts/Android.mk
deleted file mode 100644
index f9e3276..0000000
--- a/nfc/1.0/vts/Android.mk
+++ /dev/null
@@ -1,19 +0,0 @@
-#
-# Copyright (C) 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.
-#
-
-LOCAL_PATH := $(call my-dir)
-
-include $(call all-subdir-makefiles)
diff --git a/power/1.0/vts/Android.mk b/power/1.0/vts/Android.mk
deleted file mode 100644
index df5dac8..0000000
--- a/power/1.0/vts/Android.mk
+++ /dev/null
@@ -1,19 +0,0 @@
-#
-# Copyright (C) 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.
-#
-
-LOCAL_PATH := $(call my-dir)
-
-include $(call all-subdir-makefiles)
\ No newline at end of file
diff --git a/sensors/1.0/default/android.hardware.sensors@1.0-service.rc b/sensors/1.0/default/android.hardware.sensors@1.0-service.rc
index 068e978..b54842d 100644
--- a/sensors/1.0/default/android.hardware.sensors@1.0-service.rc
+++ b/sensors/1.0/default/android.hardware.sensors@1.0-service.rc
@@ -2,4 +2,5 @@
class hal
user system
group system wakelock
- capabilities BLOCK_SUSPEND SYS_NICE
+ capabilities BLOCK_SUSPEND
+ rlimit rtprio 10 10
diff --git a/soundtrigger/2.0/Android.mk b/soundtrigger/2.0/Android.mk
deleted file mode 100644
index f9e3276..0000000
--- a/soundtrigger/2.0/Android.mk
+++ /dev/null
@@ -1,19 +0,0 @@
-#
-# Copyright (C) 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.
-#
-
-LOCAL_PATH := $(call my-dir)
-
-include $(call all-subdir-makefiles)
diff --git a/soundtrigger/2.0/vts/Android.mk b/soundtrigger/2.0/vts/Android.mk
deleted file mode 100644
index f9e3276..0000000
--- a/soundtrigger/2.0/vts/Android.mk
+++ /dev/null
@@ -1,19 +0,0 @@
-#
-# Copyright (C) 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.
-#
-
-LOCAL_PATH := $(call my-dir)
-
-include $(call all-subdir-makefiles)
diff --git a/tests/Android.bp b/tests/Android.bp
index 18fc473..0031637 100644
--- a/tests/Android.bp
+++ b/tests/Android.bp
@@ -6,6 +6,7 @@
"baz/1.0/default",
"expression/1.0",
"extension/light/2.0",
+ "extension/light/2.0/default",
"foo/1.0",
"foo/1.0/default",
"foo/1.0/default/lib",
diff --git a/tests/bar/Android.mk b/tests/bar/Android.mk
deleted file mode 100644
index f9e3276..0000000
--- a/tests/bar/Android.mk
+++ /dev/null
@@ -1,19 +0,0 @@
-#
-# Copyright (C) 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.
-#
-
-LOCAL_PATH := $(call my-dir)
-
-include $(call all-subdir-makefiles)
diff --git a/tests/baz/Android.mk b/tests/baz/Android.mk
deleted file mode 100644
index f9e3276..0000000
--- a/tests/baz/Android.mk
+++ /dev/null
@@ -1,19 +0,0 @@
-#
-# Copyright (C) 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.
-#
-
-LOCAL_PATH := $(call my-dir)
-
-include $(call all-subdir-makefiles)
diff --git a/tests/expression/Android.mk b/tests/expression/Android.mk
deleted file mode 100644
index f9e3276..0000000
--- a/tests/expression/Android.mk
+++ /dev/null
@@ -1,19 +0,0 @@
-#
-# Copyright (C) 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.
-#
-
-LOCAL_PATH := $(call my-dir)
-
-include $(call all-subdir-makefiles)
diff --git a/tests/extension/light/2.0/default/Android.bp b/tests/extension/light/2.0/default/Android.bp
new file mode 100644
index 0000000..365a34a
--- /dev/null
+++ b/tests/extension/light/2.0/default/Android.bp
@@ -0,0 +1,34 @@
+//
+// 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_binary {
+ name: "android.hardware.tests.extension.light@2.0-service",
+ init_rc: ["android.hardware.tests.extension.light@2.0-service.rc"],
+ vendor: true,
+ relative_install_path: "hw",
+ srcs: [
+ "Light.cpp",
+ "service.cpp",
+ ],
+
+ shared_libs: [
+ "libhidlbase",
+ "libhidltransport",
+ "libutils",
+ "android.hardware.light@2.0",
+ "android.hardware.tests.extension.light@2.0",
+ ],
+}
diff --git a/tests/extension/light/2.0/default/Android.mk b/tests/extension/light/2.0/default/Android.mk
deleted file mode 100644
index b30d11c..0000000
--- a/tests/extension/light/2.0/default/Android.mk
+++ /dev/null
@@ -1,19 +0,0 @@
-LOCAL_PATH := $(call my-dir)
-
-include $(CLEAR_VARS)
-LOCAL_MODULE := android.hardware.tests.extension.light@2.0-service
-LOCAL_INIT_RC := android.hardware.tests.extension.light@2.0-service.rc
-LOCAL_PROPRIETARY_MODULE := true
-LOCAL_MODULE_RELATIVE_PATH := hw
-LOCAL_SRC_FILES := \
- Light.cpp \
- service.cpp
-
-LOCAL_SHARED_LIBRARIES := \
- libhidlbase \
- libhidltransport \
- libutils \
- android.hardware.light@2.0 \
- android.hardware.tests.extension.light@2.0 \
-
-include $(BUILD_EXECUTABLE)
diff --git a/tests/foo/Android.mk b/tests/foo/Android.mk
deleted file mode 100644
index f9e3276..0000000
--- a/tests/foo/Android.mk
+++ /dev/null
@@ -1,19 +0,0 @@
-#
-# Copyright (C) 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.
-#
-
-LOCAL_PATH := $(call my-dir)
-
-include $(call all-subdir-makefiles)
diff --git a/tests/inheritance/Android.mk b/tests/inheritance/Android.mk
deleted file mode 100644
index f9e3276..0000000
--- a/tests/inheritance/Android.mk
+++ /dev/null
@@ -1,19 +0,0 @@
-#
-# Copyright (C) 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.
-#
-
-LOCAL_PATH := $(call my-dir)
-
-include $(call all-subdir-makefiles)
diff --git a/tests/libhwbinder/Android.mk b/tests/libhwbinder/Android.mk
deleted file mode 100644
index f9e3276..0000000
--- a/tests/libhwbinder/Android.mk
+++ /dev/null
@@ -1,19 +0,0 @@
-#
-# Copyright (C) 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.
-#
-
-LOCAL_PATH := $(call my-dir)
-
-include $(call all-subdir-makefiles)
diff --git a/tests/msgq/Android.mk b/tests/msgq/Android.mk
deleted file mode 100644
index f9e3276..0000000
--- a/tests/msgq/Android.mk
+++ /dev/null
@@ -1,19 +0,0 @@
-#
-# Copyright (C) 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.
-#
-
-LOCAL_PATH := $(call my-dir)
-
-include $(call all-subdir-makefiles)
diff --git a/tests/pointer/Android.mk b/tests/pointer/Android.mk
deleted file mode 100644
index f9e3276..0000000
--- a/tests/pointer/Android.mk
+++ /dev/null
@@ -1,19 +0,0 @@
-#
-# Copyright (C) 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.
-#
-
-LOCAL_PATH := $(call my-dir)
-
-include $(call all-subdir-makefiles)
diff --git a/thermal/1.0/vts/Android.mk b/thermal/1.0/vts/Android.mk
deleted file mode 100644
index 60cc723..0000000
--- a/thermal/1.0/vts/Android.mk
+++ /dev/null
@@ -1,19 +0,0 @@
-#
-# Copyright (C) 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.
-#
-
-LOCAL_PATH := $(call my-dir)
-
-include $(call all-subdir-makefiles)
diff --git a/tv/cec/Android.mk b/tv/cec/Android.mk
deleted file mode 100644
index f9e3276..0000000
--- a/tv/cec/Android.mk
+++ /dev/null
@@ -1,19 +0,0 @@
-#
-# Copyright (C) 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.
-#
-
-LOCAL_PATH := $(call my-dir)
-
-include $(call all-subdir-makefiles)
diff --git a/tv/input/Android.mk b/tv/input/Android.mk
deleted file mode 100644
index f9e3276..0000000
--- a/tv/input/Android.mk
+++ /dev/null
@@ -1,19 +0,0 @@
-#
-# Copyright (C) 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.
-#
-
-LOCAL_PATH := $(call my-dir)
-
-include $(call all-subdir-makefiles)
diff --git a/usb/1.0/default/Android.bp b/usb/1.0/default/Android.bp
new file mode 100644
index 0000000..2ebe61f
--- /dev/null
+++ b/usb/1.0/default/Android.bp
@@ -0,0 +1,34 @@
+// 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_binary {
+ name: "android.hardware.usb@1.0-service",
+ init_rc: ["android.hardware.usb@1.0-service.rc"],
+ relative_install_path: "hw",
+ vendor: true,
+ srcs: [
+ "service.cpp",
+ "Usb.cpp",
+ ],
+
+ shared_libs: [
+ "libcutils",
+ "libhidlbase",
+ "libhidltransport",
+ "liblog",
+ "libutils",
+ "libhardware",
+ "android.hardware.usb@1.0",
+ ],
+}
diff --git a/usb/1.0/default/Android.mk b/usb/1.0/default/Android.mk
deleted file mode 100644
index afd53cf..0000000
--- a/usb/1.0/default/Android.mk
+++ /dev/null
@@ -1,21 +0,0 @@
-LOCAL_PATH := $(call my-dir)
-
-include $(CLEAR_VARS)
-LOCAL_MODULE_RELATIVE_PATH := hw
-LOCAL_PROPRIETARY_MODULE := true
-LOCAL_MODULE := android.hardware.usb@1.0-service
-LOCAL_INIT_RC := android.hardware.usb@1.0-service.rc
-LOCAL_SRC_FILES := \
- service.cpp \
- Usb.cpp
-
-LOCAL_SHARED_LIBRARIES := \
- libcutils \
- libhidlbase \
- libhidltransport \
- liblog \
- libutils \
- libhardware \
- android.hardware.usb@1.0 \
-
-include $(BUILD_EXECUTABLE)
diff --git a/usb/Android.bp b/usb/Android.bp
index 5cacbf3..a5415df 100644
--- a/usb/Android.bp
+++ b/usb/Android.bp
@@ -1,6 +1,7 @@
// This is an autogenerated file, do not edit.
subdirs = [
"1.0",
+ "1.0/default",
"1.0/vts/functional",
"1.1",
"1.1/vts/functional",
diff --git a/vibrator/1.0/vts/Android.mk b/vibrator/1.0/vts/Android.mk
deleted file mode 100644
index df5dac8..0000000
--- a/vibrator/1.0/vts/Android.mk
+++ /dev/null
@@ -1,19 +0,0 @@
-#
-# Copyright (C) 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.
-#
-
-LOCAL_PATH := $(call my-dir)
-
-include $(call all-subdir-makefiles)
\ No newline at end of file