diff options
25 files changed, 254 insertions, 313 deletions
diff --git a/CleanSpec.mk b/CleanSpec.mk index 01b5e7b7f9..14616e4b76 100644 --- a/CleanSpec.mk +++ b/CleanSpec.mk @@ -55,4 +55,5 @@ $(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/etc/init/android.hardware.bl $(call add-clean-step, rm -rf $(OUT)/soong/.intermediates/) $(call add-clean-step, rm -rf $(OUT_DIR)/soong/.intermediates/hardware/interfaces/) $(call add-clean-step, rm -rf $(OUT_DIR)/soong/.intermediates/hardware/interfaces/) -$(call add-clean-step, find $(PRODUCT_OUT)/system $(PRODUCT_OUT)/vendor -type f -name "android\.hardware\.configstore*" -print0 | xargs -0 rm -f)
\ No newline at end of file +$(call add-clean-step, find $(PRODUCT_OUT)/system $(PRODUCT_OUT)/vendor -type f -name "android\.hardware\.configstore*" -print0 | xargs -0 rm -f) +$(call add-clean-step, find $(PRODUCT_OUT)/system $(PRODUCT_OUT)/vendor -type f -name "android\.hardware\.configstore\@1\.1*" -print0 | xargs -0 rm -f) diff --git a/audio/2.0/config/audio_policy_configuration.xsd b/audio/2.0/config/audio_policy_configuration.xsd index c94da80bfa..eb59152c91 100644 --- a/audio/2.0/config/audio_policy_configuration.xsd +++ b/audio/2.0/config/audio_policy_configuration.xsd @@ -365,10 +365,10 @@ </xs:restriction> </xs:simpleType> <xs:complexType name="profile"> - <xs:attribute name="name" type="xs:token" use="required"/> - <xs:attribute name="format" type="audioFormat" use="required"/> - <xs:attribute name="samplingRates" type="samplingRates" use="required"/> - <xs:attribute name="channelMasks" type="channelMask" use="required"/> + <xs:attribute name="name" type="xs:token" use="optional"/> + <xs:attribute name="format" type="audioFormat" use="optional"/> + <xs:attribute name="samplingRates" type="samplingRates" use="optional"/> + <xs:attribute name="channelMasks" type="channelMask" use="optional"/> </xs:complexType> <xs:simpleType name="gainMode"> <xs:restriction base="xs:string"> diff --git a/audio/2.0/vts/functional/ValidateAudioConfiguration.cpp b/audio/2.0/vts/functional/ValidateAudioConfiguration.cpp index 01324c87d3..ec3259a1e3 100644 --- a/audio/2.0/vts/functional/ValidateAudioConfiguration.cpp +++ b/audio/2.0/vts/functional/ValidateAudioConfiguration.cpp @@ -14,9 +14,21 @@ * limitations under the License. */ +#include <string> +#include <unistd.h> + #include "utility/ValidateXml.h" TEST(CheckConfig, audioPolicyConfigurationValidation) { - ASSERT_VALID_XML("/vendor/etc/audio_policy_configuration.xml", - "/data/local/tmp/audio_policy_configuration.xsd"); + const char* configName = "audio_policy_configuration.xml"; + const char* possibleConfigLocations[] = {"/odm/etc", "/vendor/etc", "/system/etc"}; + const char* configSchemaPath = "/data/local/tmp/audio_policy_configuration.xsd"; + + for (std::string folder : possibleConfigLocations) { + const auto configPath = folder + '/' + configName; + if (access(configPath.c_str(), R_OK) == 0) { + ASSERT_VALID_XML(configPath.c_str(), configSchemaPath); + return; // The framework does not read past the first config file found + } + } } diff --git a/compatibility_matrix.26.xml b/compatibility_matrix.26.xml index 9aa54188ad..8c715dd12a 100644 --- a/compatibility_matrix.26.xml +++ b/compatibility_matrix.26.xml @@ -73,7 +73,7 @@ </hal> <hal format="hidl" optional="false"> <name>android.hardware.configstore</name> - <version>1.0-1</version> + <version>1.0</version> <interface> <name>ISurfaceFlingerConfigs</name> <instance>default</instance> diff --git a/compatibility_matrix.current.xml b/compatibility_matrix.current.xml index 9603bd6e15..e3c4e152b9 100644 --- a/compatibility_matrix.current.xml +++ b/compatibility_matrix.current.xml @@ -73,7 +73,7 @@ </hal> <hal format="hidl" optional="false"> <name>android.hardware.configstore</name> - <version>1.0-1</version> + <version>1.0</version> <interface> <name>ISurfaceFlingerConfigs</name> <instance>default</instance> diff --git a/compatibility_matrix.legacy.xml b/compatibility_matrix.legacy.xml index 6167f25eb6..1dbbb0593d 100644 --- a/compatibility_matrix.legacy.xml +++ b/compatibility_matrix.legacy.xml @@ -73,7 +73,7 @@ </hal> <hal format="hidl" optional="false"> <name>android.hardware.configstore</name> - <version>1.0-1</version> + <version>1.0</version> <interface> <name>ISurfaceFlingerConfigs</name> <instance>default</instance> diff --git a/configstore/1.1/default/Android.mk b/configstore/1.0/default/Android.mk index ac3d8b039d..e017cfd284 100644 --- a/configstore/1.1/default/Android.mk +++ b/configstore/1.0/default/Android.mk @@ -2,18 +2,17 @@ LOCAL_PATH := $(call my-dir) ################################################################################ include $(CLEAR_VARS) -LOCAL_MODULE := android.hardware.configstore@1.1-service +LOCAL_MODULE := android.hardware.configstore@1.0-service LOCAL_PROPRIETARY_MODULE := true LOCAL_MODULE_CLASS := EXECUTABLES LOCAL_MODULE_RELATIVE_PATH := hw -LOCAL_INIT_RC := android.hardware.configstore@1.1-service.rc +LOCAL_INIT_RC := android.hardware.configstore@1.0-service.rc LOCAL_SRC_FILES:= service.cpp include $(LOCAL_PATH)/surfaceflinger.mk LOCAL_SHARED_LIBRARIES := \ android.hardware.configstore@1.0 \ - android.hardware.configstore@1.1 \ libhidlbase \ libhidltransport \ libbase \ diff --git a/configstore/1.1/default/SurfaceFlingerConfigs.cpp b/configstore/1.0/default/SurfaceFlingerConfigs.cpp index 5a040f2a89..3239274f9f 100644 --- a/configstore/1.1/default/SurfaceFlingerConfigs.cpp +++ b/configstore/1.0/default/SurfaceFlingerConfigs.cpp @@ -19,7 +19,7 @@ namespace android { namespace hardware { namespace configstore { -namespace V1_1 { +namespace V1_0 { namespace implementation { // Methods from ::android::hardware::configstore::V1_0::ISurfaceFlingerConfigs @@ -139,13 +139,10 @@ Return<void> SurfaceFlingerConfigs::startGraphicsAllocatorService( return Void(); } -// Methods from ::android::hardware::configstore::V1_1::ISurfaceFlingerConfigs -// follow. - // Methods from ::android::hidl::base::V1_0::IBase follow. } // namespace implementation -} // namespace V1_1 +} // namespace V1_0 } // namespace configstore } // namespace hardware } // namespace android diff --git a/configstore/1.1/default/SurfaceFlingerConfigs.h b/configstore/1.0/default/SurfaceFlingerConfigs.h index 53e8ae8714..32e5fc3928 100644 --- a/configstore/1.1/default/SurfaceFlingerConfigs.h +++ b/configstore/1.0/default/SurfaceFlingerConfigs.h @@ -1,17 +1,17 @@ -#ifndef ANDROID_HARDWARE_CONFIGSTORE_V1_1_SURFACEFLINGERCONFIGS_H -#define ANDROID_HARDWARE_CONFIGSTORE_V1_1_SURFACEFLINGERCONFIGS_H +#ifndef ANDROID_HARDWARE_CONFIGSTORE_V1_0_SURFACEFLINGERCONFIGS_H +#define ANDROID_HARDWARE_CONFIGSTORE_V1_0_SURFACEFLINGERCONFIGS_H -#include <android/hardware/configstore/1.1/ISurfaceFlingerConfigs.h> +#include <android/hardware/configstore/1.0/ISurfaceFlingerConfigs.h> #include <hidl/MQDescriptor.h> #include <hidl/Status.h> namespace android { namespace hardware { namespace configstore { -namespace V1_1 { +namespace V1_0 { namespace implementation { -using ::android::hardware::configstore::V1_1::ISurfaceFlingerConfigs; +using ::android::hardware::configstore::V1_0::ISurfaceFlingerConfigs; using ::android::hardware::Return; using ::android::hardware::Void; using ::android::sp; @@ -32,16 +32,13 @@ struct SurfaceFlingerConfigs : public ISurfaceFlingerConfigs { Return<void> maxFrameBufferAcquiredBuffers(maxFrameBufferAcquiredBuffers_cb _hidl_cb) override; Return<void> startGraphicsAllocatorService(startGraphicsAllocatorService_cb _hidl_cb) override; - // Methods from - // ::android::hardware::configstore::V1_1::ISurfaceFlingerConfigs follow. - // Methods from ::android::hidl::base::V1_0::IBase follow. }; } // namespace implementation -} // namespace V1_1 +} // namespace V1_0 } // namespace configstore } // namespace hardware } // namespace android -#endif // ANDROID_HARDWARE_CONFIGSTORE_V1_1_SURFACEFLINGERCONFIGS_H +#endif // ANDROID_HARDWARE_CONFIGSTORE_V1_0_SURFACEFLINGERCONFIGS_H diff --git a/configstore/1.0/default/android.hardware.configstore@1.0-service.rc b/configstore/1.0/default/android.hardware.configstore@1.0-service.rc new file mode 100644 index 0000000000..563d8541c3 --- /dev/null +++ b/configstore/1.0/default/android.hardware.configstore@1.0-service.rc @@ -0,0 +1,4 @@ +service configstore-hal-1-0 /vendor/bin/hw/android.hardware.configstore@1.0-service + class hal animation + user system + group system diff --git a/configstore/1.1/default/service.cpp b/configstore/1.0/default/service.cpp index 3a4cd3fd67..3dca73938d 100644 --- a/configstore/1.1/default/service.cpp +++ b/configstore/1.0/default/service.cpp @@ -14,17 +14,17 @@ * limitations under the License. */ -#define LOG_TAG "android.hardware.configstore@1.1-service" +#define LOG_TAG "android.hardware.configstore@1.0-service" -#include <android/hardware/configstore/1.1/ISurfaceFlingerConfigs.h> +#include <android/hardware/configstore/1.0/ISurfaceFlingerConfigs.h> #include <hidl/HidlTransportSupport.h> #include "SurfaceFlingerConfigs.h" using android::hardware::configureRpcThreadpool; using android::hardware::joinRpcThreadpool; -using android::hardware::configstore::V1_1::ISurfaceFlingerConfigs; -using android::hardware::configstore::V1_1::implementation::SurfaceFlingerConfigs; +using android::hardware::configstore::V1_0::ISurfaceFlingerConfigs; +using android::hardware::configstore::V1_0::implementation::SurfaceFlingerConfigs; using android::sp; using android::status_t; using android::OK; diff --git a/configstore/1.1/default/surfaceflinger.mk b/configstore/1.0/default/surfaceflinger.mk index 3ce768a63e..3ce768a63e 100644 --- a/configstore/1.1/default/surfaceflinger.mk +++ b/configstore/1.0/default/surfaceflinger.mk diff --git a/configstore/1.1/Android.bp b/configstore/1.1/Android.bp deleted file mode 100644 index 92fb7c1399..0000000000 --- a/configstore/1.1/Android.bp +++ /dev/null @@ -1,64 +0,0 @@ -// This file is autogenerated by hidl-gen. Do not edit manually. - -filegroup { - name: "android.hardware.configstore@1.1_hal", - srcs: [ - "ISurfaceFlingerConfigs.hal", - ], -} - -genrule { - name: "android.hardware.configstore@1.1_genc++", - tools: ["hidl-gen"], - cmd: "$(location hidl-gen) -o $(genDir) -Lc++-sources -randroid.hardware:hardware/interfaces -randroid.hidl:system/libhidl/transport android.hardware.configstore@1.1", - srcs: [ - ":android.hardware.configstore@1.1_hal", - ], - out: [ - "android/hardware/configstore/1.1/SurfaceFlingerConfigsAll.cpp", - ], -} - -genrule { - name: "android.hardware.configstore@1.1_genc++_headers", - tools: ["hidl-gen"], - cmd: "$(location hidl-gen) -o $(genDir) -Lc++-headers -randroid.hardware:hardware/interfaces -randroid.hidl:system/libhidl/transport android.hardware.configstore@1.1", - srcs: [ - ":android.hardware.configstore@1.1_hal", - ], - out: [ - "android/hardware/configstore/1.1/ISurfaceFlingerConfigs.h", - "android/hardware/configstore/1.1/IHwSurfaceFlingerConfigs.h", - "android/hardware/configstore/1.1/BnHwSurfaceFlingerConfigs.h", - "android/hardware/configstore/1.1/BpHwSurfaceFlingerConfigs.h", - "android/hardware/configstore/1.1/BsSurfaceFlingerConfigs.h", - ], -} - -cc_library { - name: "android.hardware.configstore@1.1", - defaults: ["hidl-module-defaults"], - generated_sources: ["android.hardware.configstore@1.1_genc++"], - generated_headers: ["android.hardware.configstore@1.1_genc++_headers"], - export_generated_headers: ["android.hardware.configstore@1.1_genc++_headers"], - vendor_available: true, - vndk: { - enabled: true, - }, - shared_libs: [ - "libhidlbase", - "libhidltransport", - "libhwbinder", - "liblog", - "libutils", - "libcutils", - "android.hardware.configstore@1.0", - ], - export_shared_lib_headers: [ - "libhidlbase", - "libhidltransport", - "libhwbinder", - "libutils", - "android.hardware.configstore@1.0", - ], -} diff --git a/configstore/1.1/Android.mk b/configstore/1.1/Android.mk deleted file mode 100644 index b3f7053cd9..0000000000 --- a/configstore/1.1/Android.mk +++ /dev/null @@ -1,44 +0,0 @@ -# This file is autogenerated by hidl-gen. Do not edit manually. - -LOCAL_PATH := $(call my-dir) - -################################################################################ - -include $(CLEAR_VARS) -LOCAL_MODULE := android.hardware.configstore-V1.1-java -LOCAL_MODULE_CLASS := JAVA_LIBRARIES - -intermediates := $(call local-generated-sources-dir, COMMON) - -HIDL := $(HOST_OUT_EXECUTABLES)/hidl-gen$(HOST_EXECUTABLE_SUFFIX) - -LOCAL_JAVA_LIBRARIES := \ - android.hardware.configstore-V1.0-java \ - android.hidl.base-V1.0-java \ - -LOCAL_NO_STANDARD_LIBRARIES := true -LOCAL_JAVA_LIBRARIES += core-oj hwbinder - -# -# Build ISurfaceFlingerConfigs.hal -# -GEN := $(intermediates)/android/hardware/configstore/V1_1/ISurfaceFlingerConfigs.java -$(GEN): $(HIDL) -$(GEN): PRIVATE_HIDL := $(HIDL) -$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/ISurfaceFlingerConfigs.hal -$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates) -$(GEN): PRIVATE_CUSTOM_TOOL = \ - $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \ - -Ljava \ - -randroid.hardware:hardware/interfaces \ - -randroid.hidl:system/libhidl/transport \ - android.hardware.configstore@1.1::ISurfaceFlingerConfigs - -$(GEN): $(LOCAL_PATH)/ISurfaceFlingerConfigs.hal - $(transform-generated-source) -LOCAL_GENERATED_SOURCES += $(GEN) -include $(BUILD_JAVA_LIBRARY) - - - -include $(call all-makefiles-under,$(LOCAL_PATH)) diff --git a/configstore/1.1/ISurfaceFlingerConfigs.hal b/configstore/1.1/ISurfaceFlingerConfigs.hal deleted file mode 100644 index 5eacbe00ac..0000000000 --- a/configstore/1.1/ISurfaceFlingerConfigs.hal +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright (C) 2017 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.1 (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.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package android.hardware.configstore@1.1; - -import @1.0::ISurfaceFlingerConfigs; - -/** - * New revision of ISurfaceFlingerConfigs - */ - -interface ISurfaceFlingerConfigs extends @1.0::ISurfaceFlingerConfigs { -}; diff --git a/configstore/1.1/default/android.hardware.configstore@1.1-service.rc b/configstore/1.1/default/android.hardware.configstore@1.1-service.rc deleted file mode 100644 index 018ef102d0..0000000000 --- a/configstore/1.1/default/android.hardware.configstore@1.1-service.rc +++ /dev/null @@ -1,4 +0,0 @@ -service configstore-hal /vendor/bin/hw/android.hardware.configstore@1.1-service - class hal animation - user system - group system diff --git a/configstore/1.1/vts/functional/Android.bp b/configstore/1.1/vts/functional/Android.bp deleted file mode 100644 index 5cfa4839d9..0000000000 --- a/configstore/1.1/vts/functional/Android.bp +++ /dev/null @@ -1,34 +0,0 @@ -// -// 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: "VtsHalConfigstoreV1_1TargetTest", - defaults: ["hidl_defaults"], - srcs: ["VtsHalConfigstoreV1_1TargetTest.cpp"], - shared_libs: [ - "libbase", - "libhidlbase", - "liblog", - "libutils", - "android.hardware.configstore@1.1", - ], - static_libs: ["VtsHalHidlTargetTestBase"], - cflags: [ - "-O0", - "-g", - ] -} - diff --git a/configstore/1.1/vts/functional/VtsHalConfigstoreV1_1TargetTest.cpp b/configstore/1.1/vts/functional/VtsHalConfigstoreV1_1TargetTest.cpp deleted file mode 100644 index bd3da4c433..0000000000 --- a/configstore/1.1/vts/functional/VtsHalConfigstoreV1_1TargetTest.cpp +++ /dev/null @@ -1,55 +0,0 @@ -/* - * 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 "ConfigstoreHidlHalTest" - -#include <VtsHalHidlTargetTestBase.h> -#include <android-base/logging.h> -#include <android/hardware/configstore/1.0/types.h> -#include <android/hardware/configstore/1.1/ISurfaceFlingerConfigs.h> -#include <unistd.h> - -using ::android::hardware::configstore::V1_1::ISurfaceFlingerConfigs; -using ::android::sp; - -#define ASSERT_OK(ret) ASSERT_TRUE(ret.isOk()) -#define EXPECT_OK(ret) EXPECT_TRUE(ret.isOk()) - -class ConfigstoreHidlTest : public ::testing::VtsHalHidlTargetTestBase { - public: - sp<ISurfaceFlingerConfigs> sfConfigs; - - virtual void SetUp() override { - sfConfigs = ::testing::VtsHalHidlTargetTestBase::getService<ISurfaceFlingerConfigs>(); - ASSERT_NE(sfConfigs, nullptr); - } - - virtual void TearDown() override {} -}; - -/** - * Placeholder testcase. - */ -TEST_F(ConfigstoreHidlTest, Test) { - ASSERT_TRUE(true); -} - -int main(int argc, char** argv) { - ::testing::InitGoogleTest(&argc, argv); - int status = RUN_ALL_TESTS(); - LOG(INFO) << "Test result = " << status; - return status; -} diff --git a/configstore/Android.bp b/configstore/Android.bp index 4a783c3d7e..ba3e62e29b 100644 --- a/configstore/Android.bp +++ b/configstore/Android.bp @@ -2,7 +2,5 @@ subdirs = [ "1.0", "1.0/vts/functional", - "1.1", - "1.1/vts/functional", "utils", ] diff --git a/keymaster/3.0/vts/functional/keymaster_hidl_hal_test.cpp b/keymaster/3.0/vts/functional/keymaster_hidl_hal_test.cpp index 78353eaf25..3d78f45069 100644 --- a/keymaster/3.0/vts/functional/keymaster_hidl_hal_test.cpp +++ b/keymaster/3.0/vts/functional/keymaster_hidl_hal_test.cpp @@ -1774,7 +1774,7 @@ TEST_F(SigningOperationsTest, EcdsaNoDigestHugeData) { .Authorization(TAG_NO_AUTH_REQUIRED) .EcdsaSigningKey(224) .Digest(Digest::NONE))); - string message(64 * 1024, 'a'); + string message(2 * 1024, 'a'); SignMessage(message, AuthorizationSetBuilder().Digest(Digest::NONE)); } @@ -2607,7 +2607,7 @@ TEST_F(EncryptionOperationsTest, RsaNoPaddingTooLong) { } /* - * EncryptionOperationsTest.RsaNoPaddingTooLong + * EncryptionOperationsTest.RsaNoPaddingTooLarge * * Verifies that raw RSA encryption of too-large (numerically) messages fails in the expected way. */ @@ -3907,7 +3907,7 @@ TEST_F(AddEntropyTest, AddEmptyEntropy) { * Verifies that the addRngEntropy method doesn't blow up when given a largish amount of data. */ TEST_F(AddEntropyTest, AddLargeEntropy) { - EXPECT_EQ(ErrorCode::OK, keymaster().addRngEntropy(HidlBuf(string(16 * 1024, 'a')))); + EXPECT_EQ(ErrorCode::OK, keymaster().addRngEntropy(HidlBuf(string(2 * 1024, 'a')))); } typedef KeymasterHidlTest AttestationTest; 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 336cab4832..1aae7bc3bc 100644 --- a/media/omx/1.0/vts/functional/audio/VtsHalMediaOmxV1_0TargetAudioDecTest.cpp +++ b/media/omx/1.0/vts/functional/audio/VtsHalMediaOmxV1_0TargetAudioDecTest.cpp @@ -766,13 +766,13 @@ TEST_F(AudioDecHidlTest, DecodeTest) { int bytesCount = 0; uint32_t flags = 0; uint32_t timestamp = 0; - timestampDevTest = true; + timestampDevTest = false; while (1) { if (!(eleInfo >> bytesCount)) break; eleInfo >> flags; eleInfo >> timestamp; Info.push_back({bytesCount, flags, timestamp}); - if (flags != OMX_BUFFERFLAG_CODECCONFIG) + if (timestampDevTest && (flags != OMX_BUFFERFLAG_CODECCONFIG)) timestampUslist.push_back(timestamp); } eleInfo.close(); @@ -814,7 +814,7 @@ TEST_F(AudioDecHidlTest, DecodeTest) { packedArgs audioArgs = {eEncoding, compName}; testEOS(omxNode, observer, &iBuffer, &oBuffer, false, eosFlag, nullptr, portReconfiguration, kPortIndexInput, kPortIndexOutput, &audioArgs); - EXPECT_EQ(timestampUslist.empty(), true); + if (timestampDevTest) EXPECT_EQ(timestampUslist.empty(), true); // set state to idle changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer); // set state to executing diff --git a/media/omx/1.0/vts/functional/common/Android.bp b/media/omx/1.0/vts/functional/common/Android.bp index 93251fe89b..93251fe89b 100755..100644 --- a/media/omx/1.0/vts/functional/common/Android.bp +++ b/media/omx/1.0/vts/functional/common/Android.bp 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 1f67e2b6a5..1f67e2b6a5 100755..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 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 438dd7071e..ff031dde3c 100644 --- a/media/omx/1.0/vts/functional/video/VtsHalMediaOmxV1_0TargetVideoDecTest.cpp +++ b/media/omx/1.0/vts/functional/video/VtsHalMediaOmxV1_0TargetVideoDecTest.cpp @@ -27,6 +27,7 @@ #include <android/hidl/allocator/1.0/IAllocator.h> #include <android/hidl/memory/1.0/IMapper.h> #include <android/hidl/memory/1.0/IMemory.h> +#include <cutils/atomic.h> using ::android::hardware::graphics::common::V1_0::BufferUsage; using ::android::hardware::graphics::common::V1_0::PixelFormat; @@ -47,6 +48,7 @@ using ::android::sp; #include <VtsHalHidlTargetTestBase.h> #include <getopt.h> +#include <media/hardware/HardwareAPI.h> #include <media_hidl_test_common.h> #include <media_video_hidl_test_common.h> #include <fstream> @@ -410,7 +412,7 @@ void GetURLForComponent(VideoDecHidlTest::standardComp comp, char* mURL, void allocateGraphicBuffers(sp<IOmxNode> omxNode, OMX_U32 portIndex, android::Vector<BufferInfo>* buffArray, uint32_t nFrameWidth, uint32_t nFrameHeight, - int32_t* nStride, uint32_t count) { + int32_t* nStride, int format, uint32_t count) { android::hardware::media::omx::V1_0::Status status; sp<android::hardware::graphics::allocator::V2_0::IAllocator> allocator = android::hardware::graphics::allocator::V2_0::IAllocator::getService(); @@ -427,7 +429,7 @@ void allocateGraphicBuffers(sp<IOmxNode> omxNode, OMX_U32 portIndex, descriptorInfo.width = nFrameWidth; descriptorInfo.height = nFrameHeight; descriptorInfo.layerCount = 1; - descriptorInfo.format = PixelFormat::RGBA_8888; + descriptorInfo.format = static_cast<PixelFormat>(format); descriptorInfo.usage = static_cast<uint64_t>(BufferUsage::CPU_READ_OFTEN); omxNode->getGraphicBufferUsage( portIndex, @@ -452,6 +454,9 @@ void allocateGraphicBuffers(sp<IOmxNode> omxNode, OMX_U32 portIndex, EXPECT_EQ(error, android::hardware::graphics::mapper::V2_0::Error::NONE); EXPECT_EQ(buffArray->size(), count); + + static volatile int32_t nextId = 0; + uint64_t id = static_cast<uint64_t>(getpid()) << 32; allocator->allocate( descriptor, count, [&](android::hardware::graphics::mapper::V2_0::Error _s, uint32_t _n1, @@ -475,7 +480,7 @@ void allocateGraphicBuffers(sp<IOmxNode> omxNode, OMX_U32 portIndex, buffArray->editItemAt(i).omxBuffer.attr.anwBuffer.layerCount = descriptorInfo.layerCount; buffArray->editItemAt(i).omxBuffer.attr.anwBuffer.id = - (*buffArray)[i].id; + id | static_cast<uint32_t>(android_atomic_inc(&nextId)); } }); } @@ -493,6 +498,21 @@ void portReconfiguration(sp<IOmxNode> omxNode, sp<CodecObserver> observer, ASSERT_EQ(msg.data.eventData.data1, kPortIndexOutput); if (msg.data.eventData.data2 == OMX_IndexParamPortDefinition || msg.data.eventData.data2 == 0) { + // Components can send various kinds of port settings changed events + // all at once. Before committing to a full port reconfiguration, + // defer any events waiting in the queue to be addressed to a later + // point. + android::List<Message> msgQueueDefer; + while (1) { + status = observer->dequeueMessage(&msg, DEFAULT_TIMEOUT, + iBuffer, oBuffer); + if (status != + android::hardware::media::omx::V1_0::Status::TIMED_OUT) { + msgQueueDefer.push_back(msg); + continue; + } else + break; + } status = omxNode->sendCommand( toRawCommandType(OMX_CommandPortDisable), kPortIndexOutput); ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK); @@ -521,12 +541,15 @@ void portReconfiguration(sp<IOmxNode> omxNode, sp<CodecObserver> observer, // set Port Params uint32_t nFrameWidth, nFrameHeight, xFramerate; - OMX_COLOR_FORMATTYPE eColorFormat = - OMX_COLOR_FormatYUV420Planar; getInputChannelInfo(omxNode, kPortIndexInput, &nFrameWidth, &nFrameHeight, &xFramerate); + // get configured color format + OMX_PARAM_PORTDEFINITIONTYPE portDef; + status = getPortParam(omxNode, OMX_IndexParamPortDefinition, + kPortIndexOutput, &portDef); setDefaultPortParam(omxNode, kPortIndexOutput, - OMX_VIDEO_CodingUnused, eColorFormat, + OMX_VIDEO_CodingUnused, + portDef.format.video.eColorFormat, nFrameWidth, nFrameHeight, 0, xFramerate); // If you can disable a port, then you should be able to @@ -558,6 +581,7 @@ void portReconfiguration(sp<IOmxNode> omxNode, sp<CodecObserver> observer, portDef.format.video.nFrameWidth, portDef.format.video.nFrameHeight, &portDef.format.video.nStride, + portDef.format.video.eColorFormat, portDef.nBufferCountActual); } status = observer->dequeueMessage(&msg, DEFAULT_TIMEOUT, @@ -568,6 +592,16 @@ void portReconfiguration(sp<IOmxNode> omxNode, sp<CodecObserver> observer, ASSERT_EQ(msg.data.eventData.data1, OMX_CommandPortEnable); ASSERT_EQ(msg.data.eventData.data2, kPortIndexOutput); + // Push back deferred messages to the list + android::List<Message>::iterator it = msgQueueDefer.begin(); + while (it != msgQueueDefer.end()) { + status = omxNode->dispatchMessage(*it); + ASSERT_EQ( + status, + ::android::hardware::media::omx::V1_0::Status::OK); + it++; + } + // dispatch output buffers for (size_t i = 0; i < oBuffer->size(); i++) { dispatchOutputBuffer(omxNode, oBuffer, i, oPortMode); @@ -718,6 +752,116 @@ void decodeNFrames(sp<IOmxNode> omxNode, sp<CodecObserver> observer, } } +// DescribeColorFormatParams Copy Constructor (Borrowed from OMXUtils.cpp) +android::DescribeColorFormatParams::DescribeColorFormatParams( + const android::DescribeColorFormat2Params& params) { + eColorFormat = params.eColorFormat; + nFrameWidth = params.nFrameWidth; + nFrameHeight = params.nFrameHeight; + nStride = params.nStride; + nSliceHeight = params.nSliceHeight; + bUsingNativeBuffers = params.bUsingNativeBuffers; +}; + +bool isColorFormatFlexibleYUV(sp<IOmxNode> omxNode, + OMX_COLOR_FORMATTYPE eColorFormat) { + android::hardware::media::omx::V1_0::Status status; + unsigned int index = OMX_IndexMax, index2 = OMX_IndexMax; + omxNode->getExtensionIndex( + "OMX.google.android.index.describeColorFormat", + [&index](android::hardware::media::omx::V1_0::Status _s, + unsigned int _nl) { + if (_s == ::android::hardware::media::omx::V1_0::Status::OK) + index = _nl; + }); + omxNode->getExtensionIndex( + "OMX.google.android.index.describeColorFormat2", + [&index2](android::hardware::media::omx::V1_0::Status _s, + unsigned int _nl) { + if (_s == ::android::hardware::media::omx::V1_0::Status::OK) + index2 = _nl; + }); + + android::DescribeColorFormat2Params describeParams; + describeParams.eColorFormat = eColorFormat; + describeParams.nFrameWidth = 128; + describeParams.nFrameHeight = 128; + describeParams.nStride = 128; + describeParams.nSliceHeight = 128; + describeParams.bUsingNativeBuffers = OMX_FALSE; + if (index != OMX_IndexMax) { + android::DescribeColorFormatParams describeParamsV1(describeParams); + status = getParam(omxNode, static_cast<OMX_INDEXTYPE>(index), + &describeParamsV1); + if (status == ::android::hardware::media::omx::V1_0::Status::OK) { + android::MediaImage& img = describeParamsV1.sMediaImage; + if (img.mType == android::MediaImage::MEDIA_IMAGE_TYPE_YUV) { + if (img.mNumPlanes == 3 && + img.mPlane[img.Y].mHorizSubsampling == 1 && + img.mPlane[img.Y].mVertSubsampling == 1) { + if (img.mPlane[img.U].mHorizSubsampling == 2 && + img.mPlane[img.U].mVertSubsampling == 2 && + img.mPlane[img.V].mHorizSubsampling == 2 && + img.mPlane[img.V].mVertSubsampling == 2) { + if (img.mBitDepth <= 8) { + return true; + } + } + } + } + } + } else if (index2 != OMX_IndexMax) { + status = getParam(omxNode, static_cast<OMX_INDEXTYPE>(index2), + &describeParams); + android::MediaImage2& img = describeParams.sMediaImage; + if (img.mType == android::MediaImage2::MEDIA_IMAGE_TYPE_YUV) { + if (img.mNumPlanes == 3 && + img.mPlane[img.Y].mHorizSubsampling == 1 && + img.mPlane[img.Y].mVertSubsampling == 1) { + if (img.mPlane[img.U].mHorizSubsampling == 2 && + img.mPlane[img.U].mVertSubsampling == 2 && + img.mPlane[img.V].mHorizSubsampling == 2 && + img.mPlane[img.V].mVertSubsampling == 2) { + if (img.mBitDepth <= 8) { + return true; + } + } + } + } + } + return false; +} + +// get default color format for output port +void getDefaultColorFormat(sp<IOmxNode> omxNode, OMX_U32 kPortIndexOutput, + PortMode oPortMode, + OMX_COLOR_FORMATTYPE* eColorFormat) { + android::hardware::media::omx::V1_0::Status status; + OMX_VIDEO_PARAM_PORTFORMATTYPE portFormat; + *eColorFormat = OMX_COLOR_FormatUnused; + portFormat.nIndex = 0; + while (1) { + status = getPortParam(omxNode, OMX_IndexParamVideoPortFormat, + kPortIndexOutput, &portFormat); + if (status != ::android::hardware::media::omx::V1_0::Status::OK) break; + EXPECT_EQ(portFormat.eCompressionFormat, OMX_VIDEO_CodingUnused); + if (oPortMode != PortMode::PRESET_BYTE_BUFFER) { + *eColorFormat = portFormat.eColorFormat; + break; + } + if (isColorFormatFlexibleYUV(omxNode, portFormat.eColorFormat)) { + *eColorFormat = portFormat.eColorFormat; + break; + } + if (OMX_COLOR_FormatYUV420SemiPlanar == portFormat.eColorFormat || + OMX_COLOR_FormatYUV420Planar == portFormat.eColorFormat) { + *eColorFormat = portFormat.eColorFormat; + break; + } + portFormat.nIndex++; + } +} + // set component role TEST_F(VideoDecHidlTest, SetRole) { description("Test Set Component Role"); @@ -788,7 +932,7 @@ TEST_F(VideoDecHidlTest, DecodeTest) { eleInfo >> flags; eleInfo >> timestamp; Info.push_back({bytesCount, flags, timestamp}); - if (flags != OMX_BUFFERFLAG_CODECCONFIG) + if (timestampDevTest && (flags != OMX_BUFFERFLAG_CODECCONFIG)) timestampUslist.push_back(timestamp); if (maxBytesCount < bytesCount) maxBytesCount = bytesCount; } @@ -813,9 +957,17 @@ TEST_F(VideoDecHidlTest, DecodeTest) { // set Port Params uint32_t nFrameWidth, nFrameHeight, xFramerate; - OMX_COLOR_FORMATTYPE eColorFormat = OMX_COLOR_FormatYUV420Planar; getInputChannelInfo(omxNode, kPortIndexInput, &nFrameWidth, &nFrameHeight, &xFramerate); + // get default color format + OMX_COLOR_FORMATTYPE eColorFormat = OMX_COLOR_FormatUnused; + getDefaultColorFormat(omxNode, kPortIndexOutput, portMode[1], + &eColorFormat); + ASSERT_NE(eColorFormat, OMX_COLOR_FormatUnused); + status = + setVideoPortFormat(omxNode, kPortIndexOutput, OMX_VIDEO_CodingUnused, + eColorFormat, xFramerate); + EXPECT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK); setDefaultPortParam(omxNode, kPortIndexOutput, OMX_VIDEO_CodingUnused, eColorFormat, nFrameWidth, nFrameHeight, 0, xFramerate); @@ -839,7 +991,8 @@ TEST_F(VideoDecHidlTest, DecodeTest) { allocateGraphicBuffers( omxNode, kPortIndexOutput, &oBuffer, portDef.format.video.nFrameWidth, portDef.format.video.nFrameHeight, - &portDef.format.video.nStride, portDef.nBufferCountActual); + &portDef.format.video.nStride, portDef.format.video.eColorFormat, + portDef.nBufferCountActual); } // Port Reconfiguration @@ -853,7 +1006,7 @@ TEST_F(VideoDecHidlTest, DecodeTest) { kPortIndexInput, kPortIndexOutput, portMode[1]); testEOS(omxNode, observer, &iBuffer, &oBuffer, false, eosFlag, portMode, portReconfiguration, kPortIndexInput, kPortIndexOutput, nullptr); - EXPECT_EQ(timestampUslist.empty(), true); + if (timestampDevTest) EXPECT_EQ(timestampUslist.empty(), true); // set state to idle changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer); // set state to executing @@ -877,22 +1030,28 @@ TEST_F(VideoDecHidlTest, EOSTest_M) { kPortIndexOutput = kPortIndexInput + 1; } + // set port mode + status = omxNode->setPortMode(kPortIndexInput, portMode[0]); + ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK); + status = omxNode->setPortMode(kPortIndexOutput, portMode[1]); + ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK); + // set Port Params uint32_t nFrameWidth, nFrameHeight, xFramerate; - OMX_COLOR_FORMATTYPE eColorFormat = OMX_COLOR_FormatYUV420Planar; getInputChannelInfo(omxNode, kPortIndexInput, &nFrameWidth, &nFrameHeight, &xFramerate); + // get default color format + OMX_COLOR_FORMATTYPE eColorFormat = OMX_COLOR_FormatUnused; + getDefaultColorFormat(omxNode, kPortIndexOutput, portMode[1], + &eColorFormat); + ASSERT_NE(eColorFormat, OMX_COLOR_FormatUnused); + status = + setVideoPortFormat(omxNode, kPortIndexOutput, OMX_VIDEO_CodingUnused, + eColorFormat, xFramerate); + EXPECT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK); setDefaultPortParam(omxNode, kPortIndexOutput, OMX_VIDEO_CodingUnused, eColorFormat, nFrameWidth, nFrameHeight, 0, xFramerate); - // set port mode - PortMode portMode[2]; - portMode[0] = portMode[1] = PortMode::PRESET_BYTE_BUFFER; - status = omxNode->setPortMode(kPortIndexInput, portMode[0]); - ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK); - status = omxNode->setPortMode(kPortIndexOutput, portMode[1]); - ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK); - android::Vector<BufferInfo> iBuffer, oBuffer; // set state to idle @@ -967,20 +1126,20 @@ TEST_F(VideoDecHidlTest, ThumbnailTest) { // set Port Params uint32_t nFrameWidth, nFrameHeight, xFramerate; - OMX_COLOR_FORMATTYPE eColorFormat = OMX_COLOR_FormatYUV420Planar; getInputChannelInfo(omxNode, kPortIndexInput, &nFrameWidth, &nFrameHeight, &xFramerate); + // get default color format + OMX_COLOR_FORMATTYPE eColorFormat = OMX_COLOR_FormatUnused; + getDefaultColorFormat(omxNode, kPortIndexOutput, portMode[1], + &eColorFormat); + ASSERT_NE(eColorFormat, OMX_COLOR_FormatUnused); + status = + setVideoPortFormat(omxNode, kPortIndexOutput, OMX_VIDEO_CodingUnused, + eColorFormat, xFramerate); + EXPECT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK); setDefaultPortParam(omxNode, kPortIndexOutput, OMX_VIDEO_CodingUnused, eColorFormat, nFrameWidth, nFrameHeight, 0, xFramerate); - // set port mode - PortMode portMode[2]; - portMode[0] = portMode[1] = PortMode::PRESET_BYTE_BUFFER; - status = omxNode->setPortMode(kPortIndexInput, portMode[0]); - ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK); - status = omxNode->setPortMode(kPortIndexOutput, portMode[1]); - ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK); - android::Vector<BufferInfo> iBuffer, oBuffer; // set state to idle @@ -1080,20 +1239,20 @@ TEST_F(VideoDecHidlTest, SimpleEOSTest) { // set Port Params uint32_t nFrameWidth, nFrameHeight, xFramerate; - OMX_COLOR_FORMATTYPE eColorFormat = OMX_COLOR_FormatYUV420Planar; getInputChannelInfo(omxNode, kPortIndexInput, &nFrameWidth, &nFrameHeight, &xFramerate); + // get default color format + OMX_COLOR_FORMATTYPE eColorFormat = OMX_COLOR_FormatUnused; + getDefaultColorFormat(omxNode, kPortIndexOutput, portMode[1], + &eColorFormat); + ASSERT_NE(eColorFormat, OMX_COLOR_FormatUnused); + status = + setVideoPortFormat(omxNode, kPortIndexOutput, OMX_VIDEO_CodingUnused, + eColorFormat, xFramerate); + EXPECT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK); setDefaultPortParam(omxNode, kPortIndexOutput, OMX_VIDEO_CodingUnused, eColorFormat, nFrameWidth, nFrameHeight, 0, xFramerate); - // set port mode - PortMode portMode[2]; - portMode[0] = portMode[1] = PortMode::PRESET_BYTE_BUFFER; - status = omxNode->setPortMode(kPortIndexInput, portMode[0]); - ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK); - status = omxNode->setPortMode(kPortIndexOutput, portMode[1]); - ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK); - android::Vector<BufferInfo> iBuffer, oBuffer; // set state to idle @@ -1175,20 +1334,20 @@ TEST_F(VideoDecHidlTest, FlushTest) { // set Port Params uint32_t nFrameWidth, nFrameHeight, xFramerate; - OMX_COLOR_FORMATTYPE eColorFormat = OMX_COLOR_FormatYUV420Planar; getInputChannelInfo(omxNode, kPortIndexInput, &nFrameWidth, &nFrameHeight, &xFramerate); + // get default color format + OMX_COLOR_FORMATTYPE eColorFormat = OMX_COLOR_FormatUnused; + getDefaultColorFormat(omxNode, kPortIndexOutput, portMode[1], + &eColorFormat); + ASSERT_NE(eColorFormat, OMX_COLOR_FormatUnused); + status = + setVideoPortFormat(omxNode, kPortIndexOutput, OMX_VIDEO_CodingUnused, + eColorFormat, xFramerate); + EXPECT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK); setDefaultPortParam(omxNode, kPortIndexOutput, OMX_VIDEO_CodingUnused, eColorFormat, nFrameWidth, nFrameHeight, 0, xFramerate); - // set port mode - PortMode portMode[2]; - portMode[0] = portMode[1] = PortMode::PRESET_BYTE_BUFFER; - status = omxNode->setPortMode(kPortIndexInput, portMode[0]); - ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK); - status = omxNode->setPortMode(kPortIndexOutput, portMode[1]); - ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK); - android::Vector<BufferInfo> iBuffer, oBuffer; // set state to idle 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 7f9486d953..c6d688f483 100644 --- a/media/omx/1.0/vts/functional/video/VtsHalMediaOmxV1_0TargetVideoEncTest.cpp +++ b/media/omx/1.0/vts/functional/video/VtsHalMediaOmxV1_0TargetVideoEncTest.cpp @@ -1297,7 +1297,7 @@ TEST_F(VideoEncHidlTest, EncodeTest) { eleStream.close(); waitOnInputConsumption(omxNode, observer, &iBuffer, &oBuffer); testEOS(omxNode, observer, &iBuffer, &oBuffer, false, eosFlag); - EXPECT_EQ(timestampUslist.empty(), true); + if (timestampDevTest) EXPECT_EQ(timestampUslist.empty(), true); // set state to idle changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer); |