diff options
| author | Bill Yi <byi@google.com> | 2018-11-28 18:45:59 -0800 |
|---|---|---|
| committer | Bill Yi <byi@google.com> | 2018-11-28 18:45:59 -0800 |
| commit | c5193fce6ccf499a527761351d1fb1e76cd62411 (patch) | |
| tree | bc9620559bf9bc1c75987fbbe5928223aa07db1f | |
| parent | ef97157fb52d66de5121427f60e1521874608039 (diff) | |
| parent | d12eece09cd4ea6f72e024fe6ffdff638b105bf7 (diff) | |
| download | android_hardware_interfaces-c5193fce6ccf499a527761351d1fb1e76cd62411.tar.gz android_hardware_interfaces-c5193fce6ccf499a527761351d1fb1e76cd62411.tar.bz2 android_hardware_interfaces-c5193fce6ccf499a527761351d1fb1e76cd62411.zip | |
Merge pi-qpr1-release PQ1A.181105.017.A1 to pi-platform-release
Change-Id: I0777ff28aa01814239b3d53fd4c34f7742459788
49 files changed, 745 insertions, 238 deletions
diff --git a/audio/common/all-versions/default/service/android.hardware.audio@2.0-service.rc b/audio/common/all-versions/default/service/android.hardware.audio@2.0-service.rc index 8217b946d..6e91bccb3 100644 --- a/audio/common/all-versions/default/service/android.hardware.audio@2.0-service.rc +++ b/audio/common/all-versions/default/service/android.hardware.audio@2.0-service.rc @@ -2,7 +2,8 @@ service vendor.audio-hal-2-0 /vendor/bin/hw/android.hardware.audio@2.0-service class hal user audioserver # media gid needed for /dev/fm (radio) and for /data/misc/media (tee) - group audio camera drmrpc inet media mediadrm net_bt net_bt_admin net_bw_acct + group audio camera drmrpc inet media mediadrm net_bt net_bt_admin net_bw_acct wakelock + capabilities BLOCK_SUSPEND ioprio rt 4 writepid /dev/cpuset/foreground/tasks /dev/stune/foreground/tasks # audioflinger restarts itself when it loses connection with the hal diff --git a/audio/common/all-versions/test/utility/include/utility/EnvironmentTearDown.h b/audio/common/all-versions/test/utility/include/utility/EnvironmentTearDown.h index a96d06e04..7a08a54fc 100644 --- a/audio/common/all-versions/test/utility/include/utility/EnvironmentTearDown.h +++ b/audio/common/all-versions/test/utility/include/utility/EnvironmentTearDown.h @@ -37,7 +37,7 @@ namespace utility { class Environment : public ::testing::VtsHalHidlTargetTestEnvBase { public: using TearDownFunc = std::function<void()>; - void registerTearDown(TearDownFunc&& tearDown) { tearDowns.push_back(std::move(tearDown)); } + void registerTearDown(TearDownFunc&& tearDown) { tearDowns.push_front(std::move(tearDown)); } private: void HidlTearDown() override { diff --git a/audio/common/all-versions/test/utility/include/utility/ValidateXml.h b/audio/common/all-versions/test/utility/include/utility/ValidateXml.h index 95080d1c4..91adfc12c 100644 --- a/audio/common/all-versions/test/utility/include/utility/ValidateXml.h +++ b/audio/common/all-versions/test/utility/include/utility/ValidateXml.h @@ -45,29 +45,37 @@ namespace utility { xmlFilePath, xsdFilePath) /** Validate an XML according to an xsd. - * The XML file must be in at least one of the provided locations. - * If multiple are found, all are validated. + * All file named xmlFileName in each xmlFileLocations folder must be valid if present. + * @tparam atLeastOneRequired If true, at least one file has to be found. + * If false, no found file is a success. */ +template <bool atLeastOneRequired = true> ::testing::AssertionResult validateXmlMultipleLocations( const char* xmlFileNameExpr, const char* xmlFileLocationsExpr, const char* xsdFilePathExpr, const char* xmlFileName, std::vector<const char*> xmlFileLocations, const char* xsdFilePath); -/** ASSERT that an XML is valid according to an xsd. - * The XML file must be in at least one of the provided locations. - * If multiple are found, all are validated. - */ -#define ASSERT_ONE_VALID_XML_MULTIPLE_LOCATIONS(xmlFileName, xmlFileLocations, xsdFilePath) \ - ASSERT_PRED_FORMAT3( \ - ::android::hardware::audio::common::test::utility::validateXmlMultipleLocations, \ +/** ASSERT that all found XML are valid according to an xsd. */ +#define ASSERT_VALID_XML_MULTIPLE_LOCATIONS(xmlFileName, xmlFileLocations, xsdFilePath) \ + ASSERT_PRED_FORMAT3( \ + ::android::hardware::audio::common::test::utility::validateXmlMultipleLocations<false>, \ xmlFileName, xmlFileLocations, xsdFilePath) -/** EXPECT an XML to be valid according to an xsd. - * The XML file must be in at least one of the provided locations. - * If multiple are found, all are validated. - */ -#define EXPECT_ONE_VALID_XML_MULTIPLE_LOCATIONS(xmlFileName, xmlFileLocations, xsdFilePath) \ - EXPECT_PRED_FORMAT3( \ - ::android::hardware::audio::common::test::utility::validateXmlMultipleLocations, \ +/** EXPECT that all found XML are valid according to an xsd. */ +#define EXPECT_VALID_XML_MULTIPLE_LOCATIONS(xmlFileName, xmlFileLocations, xsdFilePath) \ + EXPECT_PRED_FORMAT3( \ + ::android::hardware::audio::common::test::utility::validateXmlMultipleLocations<false>, \ + xmlFileName, xmlFileLocations, xsdFilePath) + +/** ASSERT that all found XML are valid according to an xsd. At least one must be found. */ +#define ASSERT_ONE_VALID_XML_MULTIPLE_LOCATIONS(xmlFileName, xmlFileLocations, xsdFilePath) \ + ASSERT_PRED_FORMAT3( \ + ::android::hardware::audio::common::test::utility::validateXmlMultipleLocations<true>, \ + xmlFileName, xmlFileLocations, xsdFilePath) + +/** EXPECT that all found XML are valid according to an xsd. At least one must be found. */ +#define EXPECT_ONE_VALID_XML_MULTIPLE_LOCATIONS(xmlFileName, xmlFileLocations, xsdFilePath) \ + EXPECT_PRED_FORMAT3( \ + ::android::hardware::audio::common::test::utility::validateXmlMultipleLocations<true>, \ xmlFileName, xmlFileLocations, xsdFilePath) } // namespace utility diff --git a/audio/common/all-versions/test/utility/src/ValidateXml.cpp b/audio/common/all-versions/test/utility/src/ValidateXml.cpp index 5030af506..1a906d668 100644 --- a/audio/common/all-versions/test/utility/src/ValidateXml.cpp +++ b/audio/common/all-versions/test/utility/src/ValidateXml.cpp @@ -129,6 +129,7 @@ struct Libxml2Global { return ::testing::AssertionSuccess(); } +template <bool atLeastOneRequired> ::testing::AssertionResult validateXmlMultipleLocations( const char* xmlFileNameExpr, const char* xmlFileLocationsExpr, const char* xsdFilePathExpr, const char* xmlFileName, std::vector<const char*> xmlFileLocations, const char* xsdFilePath) { @@ -150,7 +151,7 @@ struct Libxml2Global { } } - if (foundFiles.empty()) { + if (atLeastOneRequired && foundFiles.empty()) { errors.push_back("No xml file found in provided locations.\n"); } @@ -160,9 +161,20 @@ struct Libxml2Global { << " While validating all: " << xmlFileNameExpr << "\n Which is: " << xmlFileName << "\n In the following folders: " << xmlFileLocationsExpr - << "\n Which is: " << ::testing::PrintToString(xmlFileLocations); + << "\n Which is: " << ::testing::PrintToString(xmlFileLocations) + << (atLeastOneRequired ? "Where at least one file must be found." + : "Where no file might exist."); } +template ::testing::AssertionResult validateXmlMultipleLocations<true>(const char*, const char*, + const char*, const char*, + std::vector<const char*>, + const char*); +template ::testing::AssertionResult validateXmlMultipleLocations<false>(const char*, const char*, + const char*, const char*, + std::vector<const char*>, + const char*); + } // namespace utility } // namespace test } // namespace common diff --git a/audio/core/4.0/vts/functional/AudioPrimaryHidlHalTest.cpp b/audio/core/4.0/vts/functional/AudioPrimaryHidlHalTest.cpp index c764ea625..0f8996fc5 100644 --- a/audio/core/4.0/vts/functional/AudioPrimaryHidlHalTest.cpp +++ b/audio/core/4.0/vts/functional/AudioPrimaryHidlHalTest.cpp @@ -106,7 +106,10 @@ using namespace ::android::hardware::audio::common::test::utility; static auto okOrNotSupported = {Result::OK, Result::NOT_SUPPORTED}; static auto okOrNotSupportedOrInvalidArgs = {Result::OK, Result::NOT_SUPPORTED, Result::INVALID_ARGUMENTS}; +static auto okOrInvalidStateOrNotSupported = {Result::OK, Result::INVALID_STATE, + Result::NOT_SUPPORTED}; static auto invalidArgsOrNotSupported = {Result::INVALID_ARGUMENTS, Result::NOT_SUPPORTED}; +static auto invalidStateOrNotSupported = {Result::INVALID_STATE, Result::NOT_SUPPORTED}; class AudioHidlTestEnvironment : public ::Environment { public: @@ -555,11 +558,11 @@ TEST_F(AudioPrimaryHidlTest, SetConnectedState) { address.device = deviceType; auto ret = device->setConnectedState(address, state); ASSERT_TRUE(ret.isOk()); - if (res == Result::NOT_SUPPORTED) { + if (ret == Result::NOT_SUPPORTED) { doc::partialTest("setConnectedState is not supported"); return; } - ASSERT_OK(res); + ASSERT_OK(ret); } } } @@ -949,8 +952,6 @@ TEST_IO_STREAM(RemoveNonExistingEffect, "Removing a non existing effect should f TEST_IO_STREAM(standby, "Make sure the stream can be put in stanby", ASSERT_OK(stream->standby())) // can not fail -static constexpr auto invalidStateOrNotSupported = {Result::INVALID_STATE, Result::NOT_SUPPORTED}; - TEST_IO_STREAM(startNoMmap, "Starting a mmaped stream before mapping it should fail", ASSERT_RESULT(invalidStateOrNotSupported, stream->start())) @@ -1070,11 +1071,15 @@ TEST_P(InputStreamTest, GetInputFramesLost) { TEST_P(InputStreamTest, getCapturePosition) { doc::test( "The capture position of a non prepared stream should not be " - "retrievable"); + "retrievable or 0"); uint64_t frames; uint64_t time; ASSERT_OK(stream->getCapturePosition(returnIn(res, frames, time))); - ASSERT_RESULT(invalidStateOrNotSupported, res); + ASSERT_RESULT(okOrInvalidStateOrNotSupported, res); + if (res == Result::OK) { + ASSERT_EQ(0U, frames); + ASSERT_LE(0U, time); + } } TEST_P(InputStreamTest, updateSinkMetadata) { diff --git a/audio/effect/2.0/vts/functional/ValidateAudioEffectsConfiguration.cpp b/audio/effect/2.0/vts/functional/ValidateAudioEffectsConfiguration.cpp index d0bc6908d..bf080d3ed 100644 --- a/audio/effect/2.0/vts/functional/ValidateAudioEffectsConfiguration.cpp +++ b/audio/effect/2.0/vts/functional/ValidateAudioEffectsConfiguration.cpp @@ -27,6 +27,6 @@ TEST(CheckConfig, audioEffectsConfigurationValidation) { using namespace android::effectsConfig; std::vector<const char*> locations(std::begin(DEFAULT_LOCATIONS), std::end(DEFAULT_LOCATIONS)); - EXPECT_ONE_VALID_XML_MULTIPLE_LOCATIONS(DEFAULT_NAME, locations, - "/data/local/tmp/audio_effects_conf_V2_0.xsd"); + EXPECT_VALID_XML_MULTIPLE_LOCATIONS(DEFAULT_NAME, locations, + "/data/local/tmp/audio_effects_conf_V2_0.xsd"); } diff --git a/audio/effect/2.0/xml/audio_effects_conf_V2_0.xsd b/audio/effect/2.0/xml/audio_effects_conf_V2_0.xsd index ca6a7dc65..df281b32d 100644 --- a/audio/effect/2.0/xml/audio_effects_conf_V2_0.xsd +++ b/audio/effect/2.0/xml/audio_effects_conf_V2_0.xsd @@ -234,7 +234,7 @@ <xs:field xpath="@library"/> </xs:keyref> <xs:key name="effectName"> - <xs:selector xpath="aec:effects/aec:effect"/> + <xs:selector xpath="aec:effects/aec:effect|aec:effects/aec:effectProxy"/> <xs:field xpath="@name"/> </xs:key> <xs:keyref name="effectNamePreRef" refer="aec:effectName"> diff --git a/camera/device/3.2/default/CameraDeviceSession.cpp b/camera/device/3.2/default/CameraDeviceSession.cpp index 69f853562..fd785df1a 100644 --- a/camera/device/3.2/default/CameraDeviceSession.cpp +++ b/camera/device/3.2/default/CameraDeviceSession.cpp @@ -53,6 +53,7 @@ CameraDeviceSession::CameraDeviceSession( camera3_callback_ops({&sProcessCaptureResult, &sNotify}), mDevice(device), mDeviceVersion(device->common.version), + mFreeBufEarly(shouldFreeBufEarly()), mIsAELockAvailable(false), mDerivePostRawSensKey(false), mNumPartialResults(1), @@ -129,6 +130,10 @@ bool CameraDeviceSession::initialize() { return false; } +bool CameraDeviceSession::shouldFreeBufEarly() { + return property_get_bool("ro.vendor.camera.free_buf_early", 0) == 1; +} + CameraDeviceSession::~CameraDeviceSession() { if (!isClosed()) { ALOGE("CameraDeviceSession deleted before close!"); @@ -887,6 +892,24 @@ bool CameraDeviceSession::preProcessConfigurationLocked( (*streams)[i] = &mStreamMap[id]; } + if (mFreeBufEarly) { + // Remove buffers of deleted streams + for(auto it = mStreamMap.begin(); it != mStreamMap.end(); it++) { + int id = it->first; + bool found = false; + for (const auto& stream : requestedConfiguration.streams) { + if (id == stream.id) { + found = true; + break; + } + } + if (!found) { + // Unmap all buffers of deleted stream + cleanupBuffersLocked(id); + } + } + } + return true; } @@ -908,7 +931,9 @@ void CameraDeviceSession::postProcessConfigurationLocked( // Unmap all buffers of deleted stream // in case the configuration call succeeds and HAL // is able to release the corresponding resources too. - cleanupBuffersLocked(id); + if (!mFreeBufEarly) { + cleanupBuffersLocked(id); + } it = mStreamMap.erase(it); } else { ++it; @@ -927,6 +952,27 @@ void CameraDeviceSession::postProcessConfigurationLocked( mResultBatcher.setBatchedStreams(mVideoStreamIds); } + +void CameraDeviceSession::postProcessConfigurationFailureLocked( + const StreamConfiguration& requestedConfiguration) { + if (mFreeBufEarly) { + // Re-build the buf cache entry for deleted streams + for(auto it = mStreamMap.begin(); it != mStreamMap.end(); it++) { + int id = it->first; + bool found = false; + for (const auto& stream : requestedConfiguration.streams) { + if (id == stream.id) { + found = true; + break; + } + } + if (!found) { + mCirculatingBuffers.emplace(id, CirculatingBuffers{}); + } + } + } +} + Return<void> CameraDeviceSession::configureStreams( const StreamConfiguration& requestedConfiguration, ICameraDeviceSession::configureStreams_cb _hidl_cb) { @@ -979,6 +1025,8 @@ Return<void> CameraDeviceSession::configureStreams( // the corresponding resources of the deleted streams. if (ret == OK) { postProcessConfigurationLocked(requestedConfiguration); + } else { + postProcessConfigurationFailureLocked(requestedConfiguration); } if (ret == -EINVAL) { diff --git a/camera/device/3.2/default/CameraDeviceSession.h b/camera/device/3.2/default/CameraDeviceSession.h index af90e5a00..bcee259fb 100644 --- a/camera/device/3.2/default/CameraDeviceSession.h +++ b/camera/device/3.2/default/CameraDeviceSession.h @@ -120,6 +120,8 @@ protected: hidl_vec<camera3_stream_t*> *streams /*out*/); void postProcessConfigurationLocked(const StreamConfiguration& requestedConfiguration); + void postProcessConfigurationFailureLocked(const StreamConfiguration& requestedConfiguration); + protected: // protecting mClosed/mDisconnected/mInitFail @@ -142,6 +144,7 @@ protected: camera3_device_t* mDevice; const uint32_t mDeviceVersion; + const bool mFreeBufEarly; bool mIsAELockAvailable; bool mDerivePostRawSensKey; uint32_t mNumPartialResults; @@ -293,6 +296,8 @@ protected: bool initialize(); + static bool shouldFreeBufEarly(); + Status initStatus() const; // Validate and import request's input buffer and acquire fence diff --git a/camera/device/3.3/default/CameraDeviceSession.cpp b/camera/device/3.3/default/CameraDeviceSession.cpp index d36e9ed4a..60174fb92 100644 --- a/camera/device/3.3/default/CameraDeviceSession.cpp +++ b/camera/device/3.3/default/CameraDeviceSession.cpp @@ -92,6 +92,8 @@ Return<void> CameraDeviceSession::configureStreams_3_3( // the corresponding resources of the deleted streams. if (ret == OK) { postProcessConfigurationLocked(requestedConfiguration); + } else { + postProcessConfigurationFailureLocked(requestedConfiguration); } if (ret == -EINVAL) { diff --git a/camera/device/3.4/default/CameraDeviceSession.cpp b/camera/device/3.4/default/CameraDeviceSession.cpp index 6a18161f2..f2e031c67 100644 --- a/camera/device/3.4/default/CameraDeviceSession.cpp +++ b/camera/device/3.4/default/CameraDeviceSession.cpp @@ -154,6 +154,8 @@ Return<void> CameraDeviceSession::configureStreams_3_4( // the corresponding resources of the deleted streams. if (ret == OK) { postProcessConfigurationLocked_3_4(requestedConfiguration); + } else { + postProcessConfigurationFailureLocked_3_4(requestedConfiguration); } if (ret == -EINVAL) { @@ -215,6 +217,23 @@ bool CameraDeviceSession::preProcessConfigurationLocked_3_4( (*streams)[i] = &mStreamMap[id]; } + if (mFreeBufEarly) { + // Remove buffers of deleted streams + for(auto it = mStreamMap.begin(); it != mStreamMap.end(); it++) { + int id = it->first; + bool found = false; + for (const auto& stream : requestedConfiguration.streams) { + if (id == stream.v3_2.id) { + found = true; + break; + } + } + if (!found) { + // Unmap all buffers of deleted stream + cleanupBuffersLocked(id); + } + } + } return true; } @@ -236,7 +255,9 @@ void CameraDeviceSession::postProcessConfigurationLocked_3_4( // Unmap all buffers of deleted stream // in case the configuration call succeeds and HAL // is able to release the corresponding resources too. - cleanupBuffersLocked(id); + if (!mFreeBufEarly) { + cleanupBuffersLocked(id); + } it = mStreamMap.erase(it); } else { ++it; @@ -255,6 +276,26 @@ void CameraDeviceSession::postProcessConfigurationLocked_3_4( mResultBatcher_3_4.setBatchedStreams(mVideoStreamIds); } +void CameraDeviceSession::postProcessConfigurationFailureLocked_3_4( + const StreamConfiguration& requestedConfiguration) { + if (mFreeBufEarly) { + // Re-build the buf cache entry for deleted streams + for(auto it = mStreamMap.begin(); it != mStreamMap.end(); it++) { + int id = it->first; + bool found = false; + for (const auto& stream : requestedConfiguration.streams) { + if (id == stream.v3_2.id) { + found = true; + break; + } + } + if (!found) { + mCirculatingBuffers.emplace(id, CirculatingBuffers{}); + } + } + } +} + Return<void> CameraDeviceSession::processCaptureRequest_3_4( const hidl_vec<V3_4::CaptureRequest>& requests, const hidl_vec<V3_2::BufferCache>& cachesToRemove, diff --git a/camera/device/3.4/default/include/device_v3_4_impl/CameraDeviceSession.h b/camera/device/3.4/default/include/device_v3_4_impl/CameraDeviceSession.h index 5d6a112e3..fdc8a5afd 100644 --- a/camera/device/3.4/default/include/device_v3_4_impl/CameraDeviceSession.h +++ b/camera/device/3.4/default/include/device_v3_4_impl/CameraDeviceSession.h @@ -84,6 +84,8 @@ protected: camera3_stream_configuration_t *stream_list /*out*/, hidl_vec<camera3_stream_t*> *streams /*out*/); void postProcessConfigurationLocked_3_4(const StreamConfiguration& requestedConfiguration); + void postProcessConfigurationFailureLocked_3_4( + const StreamConfiguration& requestedConfiguration); Return<void> processCaptureRequest_3_4( const hidl_vec<V3_4::CaptureRequest>& requests, diff --git a/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp b/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp index 95c7167c3..439333d9c 100644 --- a/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp +++ b/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp @@ -87,7 +87,6 @@ using ::android::hardware::camera::device::V3_2::ICameraDevice; using ::android::hardware::camera::device::V3_2::BufferCache; using ::android::hardware::camera::device::V3_2::CaptureRequest; using ::android::hardware::camera::device::V3_2::CaptureResult; -using ::android::hardware::camera::device::V3_2::ICameraDeviceCallback; using ::android::hardware::camera::device::V3_2::ICameraDeviceSession; using ::android::hardware::camera::device::V3_2::NotifyMsg; using ::android::hardware::camera::device::V3_2::RequestTemplate; @@ -532,7 +531,7 @@ public: hidl_vec<hidl_string> getCameraDeviceNames(sp<ICameraProvider> provider); - struct EmptyDeviceCb : public ICameraDeviceCallback { + struct EmptyDeviceCb : public V3_4::ICameraDeviceCallback { virtual Return<void> processCaptureResult( const hidl_vec<CaptureResult>& /*results*/) override { ALOGI("processCaptureResult callback"); @@ -540,6 +539,13 @@ public: return Void(); } + virtual Return<void> processCaptureResult_3_4( + const hidl_vec<V3_4::CaptureResult>& /*results*/) override { + ALOGI("processCaptureResult_3_4 callback"); + ADD_FAILURE(); // Empty callback should not reach here + return Void(); + } + virtual Return<void> notify(const hidl_vec<NotifyMsg>& /*msgs*/) override { ALOGI("notify callback"); ADD_FAILURE(); // Empty callback should not reach here @@ -3643,6 +3649,7 @@ TEST_F(CameraHidlTest, processCaptureRequestBurstISO) { static_cast<int32_t>(PixelFormat::IMPLEMENTATION_DEFINED)}; uint64_t bufferId = 1; uint32_t frameNumber = 1; + float isoTol = .03f; ::android::hardware::hidl_vec<uint8_t> settings; for (const auto& name : cameraDeviceNames) { @@ -3772,7 +3779,8 @@ TEST_F(CameraHidlTest, processCaptureRequestBurstISO) { ASSERT_TRUE(inflightReqs[i].collectedResult.exists(ANDROID_SENSOR_SENSITIVITY)); camera_metadata_entry_t isoResult = inflightReqs[i].collectedResult.find( ANDROID_SENSOR_SENSITIVITY); - ASSERT_TRUE(isoResult.data.i32[0] == isoValues[i]); + ASSERT_TRUE(std::abs(isoResult.data.i32[0] - isoValues[i]) <= + std::round(isoValues[i]*isoTol)); } ret = session->close(); @@ -4038,10 +4046,10 @@ TEST_F(CameraHidlTest, flushPreviewRequest) { << static_cast<uint32_t>(inflightReq.errorCode); } } - - ret = session->close(); - ASSERT_TRUE(ret.isOk()); } + + ret = session->close(); + ASSERT_TRUE(ret.isOk()); } } diff --git a/compatibility_matrices/compatibility_matrix.3.xml b/compatibility_matrices/compatibility_matrix.3.xml index f271642fd..9c6b12ad1 100644 --- a/compatibility_matrices/compatibility_matrix.3.xml +++ b/compatibility_matrices/compatibility_matrix.3.xml @@ -290,7 +290,7 @@ </hal> <hal format="hidl" optional="true"> <name>android.hardware.power</name> - <version>1.0-2</version> + <version>1.0-3</version> <interface> <name>IPower</name> <instance>default</instance> diff --git a/current.txt b/current.txt index cc15322b8..4f574e9ed 100644 --- a/current.txt +++ b/current.txt @@ -335,7 +335,8 @@ dd83be076b6b3f10ed62ab34d8c8b95f2415961fb785200eb842e7bfb2b0ee92 android.hardwar 675682dd3007805c985eaaec91612abc88f4c25b3431fb84070b7584a1a741fb android.hardware.health@2.0::IHealth 434c4c32c00b0e54bb05e40c79503208b40f786a318029a2a4f66e34f10f2a76 android.hardware.health@2.0::IHealthInfoCallback c9e498f1ade5e26f00d290b4763a9671ec6720f915e7d592844b62e8cb1f9b5c android.hardware.health@2.0::types -201f9723353fdbd40bf3705537fb7e015e4c399879425e68688fe0f43606ea4d android.hardware.keymaster@4.0::IKeymasterDevice +201f9723353fdbd40bf3705537fb7e015e4c399879425e68688fe0f43606ea4d android.hardware.keymaster@4.0::IKeymasterDevice # b/112688384 +6122abe9bc2e7868463d3787db2991c1e47cc01fe3e4cfb7293c5ba421ff8ad9 android.hardware.keymaster@4.0::IKeymasterDevice # b/78104779 1b7d2090c0a28b229d37c4b96160796b1f0d703950ac6ccc163fccd280830503 android.hardware.keymaster@4.0::types 6d5c646a83538f0f9d8438c259932509f4353410c6c76e56db0d6ca98b69c3bb android.hardware.media.bufferpool@1.0::IAccessor b8c7ed58aa8740361e63d0ce9e7c94227572a629f356958840b34809d2393a7c android.hardware.media.bufferpool@1.0::IClientManager @@ -348,6 +349,8 @@ e85f566698d2a2c28100e264fcf2c691a066756ddf8dd341d009ff50cfe10614 android.hardwar 5e278fcaa3287d397d8eebe1c22aaa28150f5caae1cf9381cd6dc32cb37899c5 android.hardware.nfc@1.1::types 163e115e833fc1d77cdd4a8cf0c833bb8b8d74fe35c880fe693101d17774926f android.hardware.power@1.2::IPower 7899b9305587b2d5cd74a3cc87e9090f58bf4ae74256ce3ee36e7ec011822840 android.hardware.power@1.2::types +5a464e6db53fad223986d655028a18185b73db8e2bfa9663f9042c9623eb0aa0 android.hardware.power@1.3::IPower +a54a28d39b892d27a3cb06829181c038edcdd9e8eef359543b01e4313ae59aa0 android.hardware.power@1.3::types ab132c990a62f0aca35871c092c22fb9c85d478e22124ef6a4d0a2302da76a9f android.hardware.radio@1.2::IRadio cda752aeabaabc20486a82ac57a3dd107785c006094a349bc5e224e8aa22a17c android.hardware.radio@1.2::IRadioIndication da8c6ae991c6a4b284cc6e445332e064e28ee8a09482ed5afff9d159ec6694b7 android.hardware.radio@1.2::IRadioResponse @@ -380,3 +383,7 @@ e362203b941f18bd4cba29a62adfa02453ed00d6be5b72cdb6c4d7e0bf394a40 android.hardwar 21757d0e5dd4b7e4bd981a4a20531bca3c32271ad9777b17b74eb5a1ea508384 android.hardware.wifi.supplicant@1.1::ISupplicantStaIface cd4330c3196bda1d642a32abfe23a7d64ebfbda721940643af6867af3b3f0aa9 android.hardware.wifi.supplicant@1.1::ISupplicantStaIfaceCallback 10ff2fae516346b86121368ce5790d5accdfcb73983246b813f3d488b66db45a android.hardware.wifi.supplicant@1.1::ISupplicantStaNetwork + +# ABI preserving changes to HALs after Android P +1d19720d4fd38b1095f0f555a4bd92b3b12c9b1d0f560b0e9a474cd6dcc20db6 android.hardware.radio@1.2::IRadio +1d4a5776614c08b5d794a5ec5ab04697260cbd4b3441d5935cd53ee71d19da02 android.hardware.radio@1.0::IRadioResponse diff --git a/drm/1.0/default/DrmFactory.cpp b/drm/1.0/default/DrmFactory.cpp index 7e5d998e4..05951d7c0 100644 --- a/drm/1.0/default/DrmFactory.cpp +++ b/drm/1.0/default/DrmFactory.cpp @@ -1,6 +1,6 @@ /* * 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 diff --git a/drm/1.0/default/LegacyPluginPath.cpp b/drm/1.0/default/LegacyPluginPath.cpp index 369059d2c..d0a8f90a7 100644 --- a/drm/1.0/default/LegacyPluginPath.cpp +++ b/drm/1.0/default/LegacyPluginPath.cpp @@ -16,6 +16,8 @@ #include "LegacyPluginPath.h" +#include <unistd.h> + #include <cutils/properties.h> namespace android { @@ -24,12 +26,16 @@ namespace drm { namespace V1_0 { namespace implementation { +// 64-bit DRM depends on OEM libraries that aren't +// provided for all devices. If the drm hal service +// is running as 64-bit use the 64-bit libs, otherwise +// use the 32-bit libs. const char* getDrmPluginPath() { - if (property_get_bool("drm.64bit.enabled", false)) { - return "/vendor/lib64/mediadrm"; - } else { - return "/vendor/lib/mediadrm"; - } +#if defined(__LP64__) + return "/vendor/lib64/mediadrm"; +#else + return "/vendor/lib/mediadrm"; +#endif } } // namespace implementation diff --git a/drm/1.0/default/include/PluginLoader.h b/drm/1.0/default/include/PluginLoader.h index f387b3cbc..0c45fb3ef 100644 --- a/drm/1.0/default/include/PluginLoader.h +++ b/drm/1.0/default/include/PluginLoader.h @@ -85,7 +85,10 @@ class PluginLoader { libraries.push(library); T* result = createFactoryFunc(); return result; - } + } else { + ALOGE("Failed to lookup symbol %s in library %s: %s", + entry, path, library->lastError()); + } } return NULL; } diff --git a/gnss/1.0/vts/functional/VtsHalGnssV1_0TargetTest.cpp b/gnss/1.0/vts/functional/VtsHalGnssV1_0TargetTest.cpp index 010a46dbc..c26f60a70 100644 --- a/gnss/1.0/vts/functional/VtsHalGnssV1_0TargetTest.cpp +++ b/gnss/1.0/vts/functional/VtsHalGnssV1_0TargetTest.cpp @@ -404,7 +404,11 @@ TEST_F(GnssHalTest, InjectDelete) { ASSERT_TRUE(result.isOk()); EXPECT_TRUE(result); - auto resultVoid = gnss_hal_->deleteAidingData(IGnss::GnssAidingData::DELETE_ALL); + auto resultVoid = gnss_hal_->deleteAidingData(IGnss::GnssAidingData::DELETE_POSITION); + + ASSERT_TRUE(resultVoid.isOk()); + + resultVoid = gnss_hal_->deleteAidingData(IGnss::GnssAidingData::DELETE_TIME); ASSERT_TRUE(resultVoid.isOk()); @@ -472,6 +476,16 @@ TEST_F(GnssHalTest, MeasurementCapabilites) { } } +/* + * SchedulingCapabilities: + * Verifies that 2018+ hardware supports Scheduling capabilities. + */ +TEST_F(GnssHalTest, SchedulingCapabilities) { + if (info_called_count_ > 0 && last_info_.yearOfHw >= 2018) { + EXPECT_TRUE(last_capabilities_ & IGnssCallback::Capabilities::SCHEDULING); + } +} + int main(int argc, char** argv) { ::testing::AddGlobalTestEnvironment(GnssHidlEnvironment::Instance()); ::testing::InitGoogleTest(&argc, argv); diff --git a/gnss/1.1/vts/functional/gnss_hal_test.cpp b/gnss/1.1/vts/functional/gnss_hal_test.cpp index 46d61e54e..433f5cb4e 100644 --- a/gnss/1.1/vts/functional/gnss_hal_test.cpp +++ b/gnss/1.1/vts/functional/gnss_hal_test.cpp @@ -83,6 +83,7 @@ void GnssHalTest::StopAndClearLocations() { */ while (wait(TIMEOUT_SEC) == std::cv_status::no_timeout) { } + location_called_count_ = 0; } void GnssHalTest::SetPositionMode(const int min_interval_msec, const bool low_power_mode) { @@ -97,17 +98,17 @@ void GnssHalTest::SetPositionMode(const int min_interval_msec, const bool low_po EXPECT_TRUE(result); } -bool GnssHalTest::StartAndGetSingleLocation() { +bool GnssHalTest::StartAndCheckFirstLocation() { auto result = gnss_hal_->start(); EXPECT_TRUE(result.isOk()); EXPECT_TRUE(result); /* - * GPS signals initially optional for this test, so don't expect fast fix, - * or no timeout, unless signal is present + * GnssLocationProvider support of AGPS SUPL & XtraDownloader is not available in VTS, + * so allow time to demodulate ephemeris over the air. */ - const int kFirstGnssLocationTimeoutSeconds = 15; + const int kFirstGnssLocationTimeoutSeconds = 75; wait(kFirstGnssLocationTimeoutSeconds); EXPECT_EQ(location_called_count_, 1); @@ -195,7 +196,7 @@ void GnssHalTest::StartAndCheckLocations(int count) { SetPositionMode(kMinIntervalMsec, kLowPowerMode); - EXPECT_TRUE(StartAndGetSingleLocation()); + EXPECT_TRUE(StartAndCheckFirstLocation()); for (int i = 1; i < count; i++) { EXPECT_EQ(std::cv_status::no_timeout, wait(kLocationTimeoutSubsequentSec)); diff --git a/gnss/1.1/vts/functional/gnss_hal_test.h b/gnss/1.1/vts/functional/gnss_hal_test.h index 269366a9b..64478b5b1 100644 --- a/gnss/1.1/vts/functional/gnss_hal_test.h +++ b/gnss/1.1/vts/functional/gnss_hal_test.h @@ -107,12 +107,15 @@ class GnssHalTest : public ::testing::VtsHalHidlTargetTestBase { void SetUpGnssCallback(); /* - * StartAndGetSingleLocation: - * Helper function to get one Location and check fields + * StartAndCheckFirstLocation: + * Helper function to start location, and check the first one. + * + * <p> Note this leaves the Location request active, to enable Stop call vs. other call + * reordering tests. * * returns true if a location was successfully generated */ - bool StartAndGetSingleLocation(); + bool StartAndCheckFirstLocation(); /* * CheckLocation: diff --git a/gnss/1.1/vts/functional/gnss_hal_test_cases.cpp b/gnss/1.1/vts/functional/gnss_hal_test_cases.cpp index cce46f18e..c9f840e37 100644 --- a/gnss/1.1/vts/functional/gnss_hal_test_cases.cpp +++ b/gnss/1.1/vts/functional/gnss_hal_test_cases.cpp @@ -60,24 +60,46 @@ TEST_F(GnssHalTest, TestGnssMeasurementCallback) { */ TEST_F(GnssHalTest, GetLocationLowPower) { const int kMinIntervalMsec = 5000; - const int kLocationTimeoutSubsequentSec = (kMinIntervalMsec / 1000) + 1; - const int kNoLocationPeriodSec = 2; + const int kLocationTimeoutSubsequentSec = (kMinIntervalMsec / 1000) * 2; + const int kNoLocationPeriodSec = (kMinIntervalMsec / 1000) / 2; const int kLocationsToCheck = 5; const bool kLowPowerMode = true; + // Warmup period - VTS doesn't have AGPS access via GnssLocationProvider + StartAndCheckLocations(5); + StopAndClearLocations(); + + // Start of Low Power Mode test SetPositionMode(kMinIntervalMsec, kLowPowerMode); - EXPECT_TRUE(StartAndGetSingleLocation()); + // Don't expect true - as without AGPS access + if (!StartAndCheckFirstLocation()) { + ALOGW("GetLocationLowPower test - no first low power location received."); + } for (int i = 1; i < kLocationsToCheck; i++) { // Verify that kMinIntervalMsec is respected by waiting kNoLocationPeriodSec and // ensure that no location is received yet + wait(kNoLocationPeriodSec); - EXPECT_EQ(location_called_count_, i); - EXPECT_EQ(std::cv_status::no_timeout, - wait(kLocationTimeoutSubsequentSec - kNoLocationPeriodSec)); - EXPECT_EQ(location_called_count_, i + 1); - CheckLocation(last_location_, true); + // Tolerate (ignore) one extra location right after the first one + // to handle startup edge case scheduling limitations in some implementations + if ((i == 1) && (location_called_count_ == 2)) { + CheckLocation(last_location_, true); + continue; // restart the quiet wait period after this too-fast location + } + EXPECT_LE(location_called_count_, i); + if (location_called_count_ != i) { + ALOGW("GetLocationLowPower test - not enough locations received. %d vs. %d expected ", + location_called_count_, i); + } + + if (std::cv_status::no_timeout != + wait(kLocationTimeoutSubsequentSec - kNoLocationPeriodSec)) { + ALOGW("GetLocationLowPower test - timeout awaiting location %d", i); + } else { + CheckLocation(last_location_, true); + } } StopAndClearLocations(); @@ -177,7 +199,8 @@ TEST_F(GnssHalTest, BlacklistIndividualSatellites) { StartAndCheckLocations(kLocationsToAwait); - EXPECT_GE((int)list_gnss_sv_status_.size(), kLocationsToAwait); + // Tolerate 1 less sv status to handle edge cases in reporting. + EXPECT_GE((int)list_gnss_sv_status_.size() + 1, kLocationsToAwait); ALOGD("Observed %d GnssSvStatus, while awaiting %d Locations", (int)list_gnss_sv_status_.size(), kLocationsToAwait); @@ -217,7 +240,8 @@ TEST_F(GnssHalTest, BlacklistIndividualSatellites) { location_called_count_ = 0; StartAndCheckLocations(kLocationsToAwait); - EXPECT_GE((int)list_gnss_sv_status_.size(), kLocationsToAwait); + // Tolerate 1 less sv status to handle edge cases in reporting. + EXPECT_GE((int)list_gnss_sv_status_.size() + 1, kLocationsToAwait); ALOGD("Observed %d GnssSvStatus, while awaiting %d Locations", (int)list_gnss_sv_status_.size(), kLocationsToAwait); for (const auto& gnss_sv_status : list_gnss_sv_status_) { @@ -236,13 +260,13 @@ TEST_F(GnssHalTest, BlacklistIndividualSatellites) { ASSERT_TRUE(result.isOk()); EXPECT_TRUE(result); - location_called_count_ = 0; StopAndClearLocations(); list_gnss_sv_status_.clear(); StartAndCheckLocations(kLocationsToAwait); - EXPECT_GE((int)list_gnss_sv_status_.size(), kLocationsToAwait); + // Tolerate 1 less sv status to handle edge cases in reporting. + EXPECT_GE((int)list_gnss_sv_status_.size() + 1, kLocationsToAwait); ALOGD("Observed %d GnssSvStatus, while awaiting %d Locations", (int)list_gnss_sv_status_.size(), kLocationsToAwait); @@ -278,7 +302,8 @@ TEST_F(GnssHalTest, BlacklistConstellation) { StartAndCheckLocations(kLocationsToAwait); - EXPECT_GE((int)list_gnss_sv_status_.size(), kLocationsToAwait); + // Tolerate 1 less sv status to handle edge cases in reporting. + EXPECT_GE((int)list_gnss_sv_status_.size() + 1, kLocationsToAwait); ALOGD("Observed %d GnssSvStatus, while awaiting %d Locations", (int)list_gnss_sv_status_.size(), kLocationsToAwait); @@ -328,7 +353,8 @@ TEST_F(GnssHalTest, BlacklistConstellation) { location_called_count_ = 0; StartAndCheckLocations(kLocationsToAwait); - EXPECT_GE((int)list_gnss_sv_status_.size(), kLocationsToAwait); + // Tolerate 1 less sv status to handle edge cases in reporting. + EXPECT_GE((int)list_gnss_sv_status_.size() + 1, kLocationsToAwait); ALOGD("Observed %d GnssSvStatus, while awaiting %d Locations", (int)list_gnss_sv_status_.size(), kLocationsToAwait); for (const auto& gnss_sv_status : list_gnss_sv_status_) { @@ -353,23 +379,8 @@ TEST_F(GnssHalTest, BlacklistConstellation) { * Ensure successfully injecting a location. */ TEST_F(GnssHalTest, InjectBestLocation) { - GnssLocation gnssLocation = {.gnssLocationFlags = 0, // set below - .latitudeDegrees = 43.0, - .longitudeDegrees = -180, - .altitudeMeters = 1000, - .speedMetersPerSec = 0, - .bearingDegrees = 0, - .horizontalAccuracyMeters = 0.1, - .verticalAccuracyMeters = 0.1, - .speedAccuracyMetersPerSecond = 0.1, - .bearingAccuracyDegrees = 0.1, - .timestamp = 1534567890123L}; - gnssLocation.gnssLocationFlags |= - GnssLocationFlags::HAS_LAT_LONG | GnssLocationFlags::HAS_ALTITUDE | - GnssLocationFlags::HAS_SPEED | GnssLocationFlags::HAS_HORIZONTAL_ACCURACY | - GnssLocationFlags::HAS_VERTICAL_ACCURACY | GnssLocationFlags::HAS_SPEED_ACCURACY | - GnssLocationFlags::HAS_BEARING | GnssLocationFlags::HAS_BEARING_ACCURACY; - + StartAndCheckLocations(1); + GnssLocation gnssLocation = last_location_; CheckLocation(gnssLocation, true); auto result = gnss_hal_->injectBestLocation(gnssLocation); @@ -377,7 +388,7 @@ TEST_F(GnssHalTest, InjectBestLocation) { ASSERT_TRUE(result.isOk()); EXPECT_TRUE(result); - auto resultVoid = gnss_hal_->deleteAidingData(IGnss::GnssAidingData::DELETE_ALL); + auto resultVoid = gnss_hal_->deleteAidingData(IGnss::GnssAidingData::DELETE_POSITION); ASSERT_TRUE(resultVoid.isOk()); } @@ -428,7 +439,7 @@ TEST_F(GnssHalTest, GnssDebugValuesSanityTest) { EXPECT_GE(data.position.ageSeconds, 0); } - EXPECT_GE(data.time.timeEstimate, 1514764800000); // Jan 01 2018 00:00:00 + EXPECT_GE(data.time.timeEstimate, 1483228800000); // Jan 01 2017 00:00:00 GMT. EXPECT_GT(data.time.timeUncertaintyNs, 0); diff --git a/graphics/composer/2.1/utils/hwc2onfbadapter/HWC2OnFbAdapter.cpp b/graphics/composer/2.1/utils/hwc2onfbadapter/HWC2OnFbAdapter.cpp index 7c9e6518b..0f5057756 100644 --- a/graphics/composer/2.1/utils/hwc2onfbadapter/HWC2OnFbAdapter.cpp +++ b/graphics/composer/2.1/utils/hwc2onfbadapter/HWC2OnFbAdapter.cpp @@ -32,6 +32,8 @@ #include <log/log.h> #include <sync/sync.h> +using namespace HWC2; + namespace android { namespace { @@ -629,9 +631,10 @@ hwc2_function_pointer_t getFunctionHook(hwc2_device_t* /*device*/, int32_t descr } } -void getCapabilitiesHook(hwc2_device_t* /*device*/, uint32_t* outCount, - int32_t* /*outCapabilities*/) { - *outCount = 0; +void getCapabilitiesHook(hwc2_device_t* device, uint32_t* outCount, + int32_t* outCapabilities) { + auto& adapter = HWC2OnFbAdapter::cast(device); + adapter.getCapabilities(outCount, outCapabilities); } int closeHook(hw_device_t* device) { @@ -656,6 +659,10 @@ HWC2OnFbAdapter::HWC2OnFbAdapter(framebuffer_device_t* fbDevice) mFbInfo.xdpi_scaled = int(mFbDevice->xdpi * 1000.0f); mFbInfo.ydpi_scaled = int(mFbDevice->ydpi * 1000.0f); + // Present fences aren't supported, always indicate PresentFenceIsNotReliable + // for FB devices + mCapabilities.insert(Capability::PresentFenceIsNotReliable); + mVsyncThread.start(0, mFbInfo.vsync_period_ns); } @@ -791,6 +798,23 @@ void HWC2OnFbAdapter::enableVsync(bool enable) { mVsyncThread.enableCallback(enable); } +void HWC2OnFbAdapter::getCapabilities(uint32_t* outCount, + int32_t* outCapabilities) { + if (outCapabilities == nullptr) { + *outCount = mCapabilities.size(); + return; + } + + auto capabilityIter = mCapabilities.cbegin(); + for (size_t written = 0; written < *outCount; ++written) { + if (capabilityIter == mCapabilities.cend()) { + return; + } + outCapabilities[written] = static_cast<int32_t>(*capabilityIter); + ++capabilityIter; + } +} + int64_t HWC2OnFbAdapter::VsyncThread::now() { struct timespec ts; clock_gettime(CLOCK_MONOTONIC, &ts); diff --git a/graphics/composer/2.1/utils/hwc2onfbadapter/include/hwc2onfbadapter/HWC2OnFbAdapter.h b/graphics/composer/2.1/utils/hwc2onfbadapter/include/hwc2onfbadapter/HWC2OnFbAdapter.h index d6272fdb1..f1f11ef2b 100644 --- a/graphics/composer/2.1/utils/hwc2onfbadapter/include/hwc2onfbadapter/HWC2OnFbAdapter.h +++ b/graphics/composer/2.1/utils/hwc2onfbadapter/include/hwc2onfbadapter/HWC2OnFbAdapter.h @@ -23,7 +23,11 @@ #include <thread> #include <unordered_set> +#define HWC2_INCLUDE_STRINGIFICATION +#define HWC2_USE_CPP11 #include <hardware/hwcomposer2.h> +#undef HWC2_INCLUDE_STRINGIFICATION +#undef HWC2_USE_CPP11 struct framebuffer_device_t; @@ -75,6 +79,7 @@ public: void setVsyncCallback(HWC2_PFN_VSYNC callback, hwc2_callback_data_t data); void enableVsync(bool enable); + void getCapabilities(uint32_t* outCount, int32_t* outCapabilities); private: framebuffer_device_t* mFbDevice{nullptr}; @@ -90,6 +95,8 @@ private: buffer_handle_t mBuffer{nullptr}; + std::unordered_set<HWC2::Capability> mCapabilities; + class VsyncThread { public: static int64_t now(); diff --git a/graphics/composer/2.2/default/android.hardware.graphics.composer@2.2-service.rc b/graphics/composer/2.2/default/android.hardware.graphics.composer@2.2-service.rc index a41d902cc..efe6dadbc 100644 --- a/graphics/composer/2.2/default/android.hardware.graphics.composer@2.2-service.rc +++ b/graphics/composer/2.2/default/android.hardware.graphics.composer@2.2-service.rc @@ -4,3 +4,4 @@ service vendor.hwcomposer-2-2 /vendor/bin/hw/android.hardware.graphics.composer@ group graphics drmrpc capabilities SYS_NICE onrestart restart surfaceflinger + writepid /dev/cpuset/system-background/tasks diff --git a/health/2.0/README b/health/2.0/README index 11e6a7aaf..dfd965aa5 100644 --- a/health/2.0/README +++ b/health/2.0/README @@ -6,12 +6,7 @@ Upgrading from health@1.0 HAL 1. If the device does not have a vendor-specific libhealthd AND does not implement storage-related APIs, just do the following: - 1.1 (recommended) To remove healthd from the build, - PRODUCT_PACKAGES += android.hardware.health@2.0-service.override - DEVICE_FRAMEWORK_MANIFEST_FILE += \ - system/libhidl/vintfdata/manifest_healthd_exclude.xml - 1.2 To keep healthd in the build, - PRODUCT_PACKAGES += android.hardware.health@2.0-service + PRODUCT_PACKAGES += android.hardware.health@2.0-service Otherwise, continue to Step 2. diff --git a/keymaster/4.0/IKeymasterDevice.hal b/keymaster/4.0/IKeymasterDevice.hal index 74d13d8b0..85a25c6d3 100644 --- a/keymaster/4.0/IKeymasterDevice.hal +++ b/keymaster/4.0/IKeymasterDevice.hal @@ -753,7 +753,7 @@ interface IKeymasterDevice { * attestationIdManufacturer [716] EXPLICIT OCTET_STRING OPTIONAL, * attestationIdModel [717] EXPLICIT OCTET_STRING OPTIONAL, * vendorPatchLevel [718] EXPLICIT INTEGER OPTIONAL, - * bootPatchLevel [718] EXPLICIT INTEGER OPTIONAL, + * bootPatchLevel [719] EXPLICIT INTEGER OPTIONAL, * } * * The above schema is mostly a straightforward translation of the IKeymasterDevice tag/value diff --git a/keymaster/4.0/support/Keymaster.cpp b/keymaster/4.0/support/Keymaster.cpp index 444298b5b..9325cc069 100644 --- a/keymaster/4.0/support/Keymaster.cpp +++ b/keymaster/4.0/support/Keymaster.cpp @@ -164,10 +164,10 @@ static void computeHmac(const Keymaster::KeymasterSet& keymasters, sharingCheck = curSharingCheck; firstKeymaster = false; } - CHECK(curSharingCheck == sharingCheck) - << "HMAC computation failed for " << *keymaster // - << " Expected: " << sharingCheck // - << " got: " << curSharingCheck; + if (curSharingCheck != sharingCheck) + LOG(WARNING) << "HMAC computation failed for " << *keymaster // + << " Expected: " << sharingCheck // + << " got: " << curSharingCheck; }); CHECK(rc.isOk()) << "Failed to communicate with " << *keymaster << " error: " << rc.description(); diff --git a/keymaster/4.0/support/attestation_record.cpp b/keymaster/4.0/support/attestation_record.cpp index 8f37d9c86..6de0c1c62 100644 --- a/keymaster/4.0/support/attestation_record.cpp +++ b/keymaster/4.0/support/attestation_record.cpp @@ -49,12 +49,14 @@ typedef struct km_root_of_trust { ASN1_OCTET_STRING* verified_boot_key; ASN1_BOOLEAN* device_locked; ASN1_ENUMERATED* verified_boot_state; + ASN1_OCTET_STRING* verified_boot_hash; } KM_ROOT_OF_TRUST; ASN1_SEQUENCE(KM_ROOT_OF_TRUST) = { ASN1_SIMPLE(KM_ROOT_OF_TRUST, verified_boot_key, ASN1_OCTET_STRING), ASN1_SIMPLE(KM_ROOT_OF_TRUST, device_locked, ASN1_BOOLEAN), ASN1_SIMPLE(KM_ROOT_OF_TRUST, verified_boot_state, ASN1_ENUMERATED), + ASN1_SIMPLE(KM_ROOT_OF_TRUST, verified_boot_hash, ASN1_OCTET_STRING), } ASN1_SEQUENCE_END(KM_ROOT_OF_TRUST); IMPLEMENT_ASN1_FUNCTIONS(KM_ROOT_OF_TRUST); @@ -77,11 +79,16 @@ typedef struct km_auth_list { ASN1_OCTET_STRING* application_id; ASN1_INTEGER* creation_date_time; ASN1_INTEGER* origin; - ASN1_NULL* rollback_resistant; + ASN1_NULL* rollback_resistance; KM_ROOT_OF_TRUST* root_of_trust; ASN1_INTEGER* os_version; ASN1_INTEGER* os_patchlevel; ASN1_OCTET_STRING* attestation_application_id; + ASN1_NULL* trusted_user_presence_required; + ASN1_NULL* trusted_confirmation_required; + ASN1_NULL* unlocked_device_required; + ASN1_INTEGER* vendor_patchlevel; + ASN1_INTEGER* boot_patchlevel; } KM_AUTH_LIST; ASN1_SEQUENCE(KM_AUTH_LIST) = { @@ -93,6 +100,7 @@ ASN1_SEQUENCE(KM_AUTH_LIST) = { ASN1_EXP_OPT(KM_AUTH_LIST, ec_curve, ASN1_INTEGER, TAG_EC_CURVE.maskedTag()), ASN1_EXP_OPT(KM_AUTH_LIST, rsa_public_exponent, ASN1_INTEGER, TAG_RSA_PUBLIC_EXPONENT.maskedTag()), + ASN1_EXP_OPT(KM_AUTH_LIST, rollback_resistance, ASN1_NULL, TAG_ROLLBACK_RESISTANCE.maskedTag()), ASN1_EXP_OPT(KM_AUTH_LIST, active_date_time, ASN1_INTEGER, TAG_ACTIVE_DATETIME.maskedTag()), ASN1_EXP_OPT(KM_AUTH_LIST, origination_expire_date_time, ASN1_INTEGER, TAG_ORIGINATION_EXPIRE_DATETIME.maskedTag()), @@ -102,13 +110,19 @@ ASN1_SEQUENCE(KM_AUTH_LIST) = { ASN1_EXP_OPT(KM_AUTH_LIST, user_auth_type, ASN1_INTEGER, TAG_USER_AUTH_TYPE.maskedTag()), ASN1_EXP_OPT(KM_AUTH_LIST, auth_timeout, ASN1_INTEGER, TAG_AUTH_TIMEOUT.maskedTag()), ASN1_EXP_OPT(KM_AUTH_LIST, allow_while_on_body, ASN1_NULL, TAG_ALLOW_WHILE_ON_BODY.maskedTag()), - ASN1_EXP_OPT(KM_AUTH_LIST, application_id, ASN1_OCTET_STRING, TAG_APPLICATION_ID.maskedTag()), + ASN1_EXP_OPT(KM_AUTH_LIST, trusted_user_presence_required, ASN1_NULL, + TAG_TRUSTED_USER_PRESENCE_REQUIRED.maskedTag()), + ASN1_EXP_OPT(KM_AUTH_LIST, trusted_confirmation_required, ASN1_NULL, + TAG_TRUSTED_CONFIRMATION_REQUIRED.maskedTag()), + ASN1_EXP_OPT(KM_AUTH_LIST, unlocked_device_required, ASN1_NULL, + TAG_UNLOCKED_DEVICE_REQUIRED.maskedTag()), ASN1_EXP_OPT(KM_AUTH_LIST, creation_date_time, ASN1_INTEGER, TAG_CREATION_DATETIME.maskedTag()), ASN1_EXP_OPT(KM_AUTH_LIST, origin, ASN1_INTEGER, TAG_ORIGIN.maskedTag()), - ASN1_EXP_OPT(KM_AUTH_LIST, rollback_resistant, ASN1_NULL, TAG_ROLLBACK_RESISTANCE.maskedTag()), ASN1_EXP_OPT(KM_AUTH_LIST, root_of_trust, KM_ROOT_OF_TRUST, TAG_ROOT_OF_TRUST.maskedTag()), ASN1_EXP_OPT(KM_AUTH_LIST, os_version, ASN1_INTEGER, TAG_OS_VERSION.maskedTag()), ASN1_EXP_OPT(KM_AUTH_LIST, os_patchlevel, ASN1_INTEGER, TAG_OS_PATCHLEVEL.maskedTag()), + ASN1_EXP_OPT(KM_AUTH_LIST, vendor_patchlevel, ASN1_INTEGER, TAG_VENDOR_PATCHLEVEL.maskedTag()), + ASN1_EXP_OPT(KM_AUTH_LIST, boot_patchlevel, ASN1_INTEGER, TAG_BOOT_PATCHLEVEL.maskedTag()), ASN1_EXP_OPT(KM_AUTH_LIST, attestation_application_id, ASN1_OCTET_STRING, TAG_ATTESTATION_APPLICATION_ID.maskedTag()), } ASN1_SEQUENCE_END(KM_AUTH_LIST); @@ -237,11 +251,18 @@ static ErrorCode extract_auth_list(const KM_AUTH_LIST* record, AuthorizationSet* copyAuthTag(record->os_version, TAG_OS_VERSION, auth_list); copyAuthTag(record->padding, TAG_PADDING, auth_list); copyAuthTag(record->purpose, TAG_PURPOSE, auth_list); - copyAuthTag(record->rollback_resistant, TAG_ROLLBACK_RESISTANCE, auth_list); + copyAuthTag(record->rollback_resistance, TAG_ROLLBACK_RESISTANCE, auth_list); copyAuthTag(record->rsa_public_exponent, TAG_RSA_PUBLIC_EXPONENT, auth_list); copyAuthTag(record->usage_expire_date_time, TAG_USAGE_EXPIRE_DATETIME, auth_list); copyAuthTag(record->user_auth_type, TAG_USER_AUTH_TYPE, auth_list); copyAuthTag(record->attestation_application_id, TAG_ATTESTATION_APPLICATION_ID, auth_list); + copyAuthTag(record->vendor_patchlevel, TAG_VENDOR_PATCHLEVEL, auth_list); + copyAuthTag(record->boot_patchlevel, TAG_BOOT_PATCHLEVEL, auth_list); + copyAuthTag(record->trusted_user_presence_required, TAG_TRUSTED_USER_PRESENCE_REQUIRED, + auth_list); + copyAuthTag(record->trusted_confirmation_required, TAG_TRUSTED_CONFIRMATION_REQUIRED, + auth_list); + copyAuthTag(record->unlocked_device_required, TAG_UNLOCKED_DEVICE_REQUIRED, auth_list); return ErrorCode::OK; } diff --git a/keymaster/4.0/support/include/keymasterV4_0/key_param_output.h b/keymaster/4.0/support/include/keymasterV4_0/key_param_output.h index 74be34360..6e2b691c3 100644 --- a/keymaster/4.0/support/include/keymasterV4_0/key_param_output.h +++ b/keymaster/4.0/support/include/keymasterV4_0/key_param_output.h @@ -53,6 +53,10 @@ inline ::std::ostream& operator<<(::std::ostream& os, PaddingMode value) { return os << toString(value); } +inline ::std::ostream& operator<<(::std::ostream& os, SecurityLevel value) { + return os << toString(value); +} + template <typename ValueT> ::std::ostream& operator<<(::std::ostream& os, const NullOr<ValueT>& value) { if (!value.isOk()) { diff --git a/keymaster/4.0/support/include/keymasterV4_0/keymaster_tags.h b/keymaster/4.0/support/include/keymasterV4_0/keymaster_tags.h index ce213bc12..9e7d25222 100644 --- a/keymaster/4.0/support/include/keymasterV4_0/keymaster_tags.h +++ b/keymaster/4.0/support/include/keymasterV4_0/keymaster_tags.h @@ -116,6 +116,7 @@ DECLARE_TYPED_TAG(AUTH_TIMEOUT); DECLARE_TYPED_TAG(BLOB_USAGE_REQUIREMENTS); DECLARE_TYPED_TAG(BLOCK_MODE); DECLARE_TYPED_TAG(BOOTLOADER_ONLY); +DECLARE_TYPED_TAG(BOOT_PATCHLEVEL); DECLARE_TYPED_TAG(CALLER_NONCE); DECLARE_TYPED_TAG(CONFIRMATION_TOKEN); DECLARE_TYPED_TAG(CREATION_DATETIME); @@ -141,12 +142,14 @@ DECLARE_TYPED_TAG(ROLLBACK_RESISTANCE); DECLARE_TYPED_TAG(ROOT_OF_TRUST); DECLARE_TYPED_TAG(RSA_PUBLIC_EXPONENT); DECLARE_TYPED_TAG(TRUSTED_CONFIRMATION_REQUIRED); +DECLARE_TYPED_TAG(TRUSTED_USER_PRESENCE_REQUIRED); DECLARE_TYPED_TAG(UNIQUE_ID); DECLARE_TYPED_TAG(UNLOCKED_DEVICE_REQUIRED); DECLARE_TYPED_TAG(USAGE_EXPIRE_DATETIME); DECLARE_TYPED_TAG(USER_AUTH_TYPE); DECLARE_TYPED_TAG(USER_ID); DECLARE_TYPED_TAG(USER_SECURE_ID); +DECLARE_TYPED_TAG(VENDOR_PATCHLEVEL); template <typename... Elems> struct MetaList {}; @@ -163,7 +166,8 @@ using all_tags_t = TAG_OS_VERSION_t, TAG_OS_PATCHLEVEL_t, TAG_UNIQUE_ID_t, TAG_ATTESTATION_CHALLENGE_t, TAG_ATTESTATION_APPLICATION_ID_t, TAG_RESET_SINCE_ID_ROTATION_t, TAG_PURPOSE_t, TAG_ALGORITHM_t, TAG_BLOCK_MODE_t, TAG_DIGEST_t, TAG_PADDING_t, - TAG_BLOB_USAGE_REQUIREMENTS_t, TAG_ORIGIN_t, TAG_USER_AUTH_TYPE_t, TAG_EC_CURVE_t>; + TAG_BLOB_USAGE_REQUIREMENTS_t, TAG_ORIGIN_t, TAG_USER_AUTH_TYPE_t, TAG_EC_CURVE_t, + TAG_BOOT_PATCHLEVEL_t, TAG_VENDOR_PATCHLEVEL_t, TAG_TRUSTED_USER_PRESENCE_REQUIRED_t>; template <typename TypedTagType> struct TypedTag2ValueType; diff --git a/keymaster/4.0/vts/functional/VerificationTokenTest.cpp b/keymaster/4.0/vts/functional/VerificationTokenTest.cpp index 6afba0c4c..3876b16f3 100644 --- a/keymaster/4.0/vts/functional/VerificationTokenTest.cpp +++ b/keymaster/4.0/vts/functional/VerificationTokenTest.cpp @@ -111,8 +111,9 @@ TEST_F(VerificationTokenTest, TestCreation) { EXPECT_GE(host_time_delta, time_to_sleep) << "We slept for " << time_to_sleep << " ms, the clock must have advanced by that much"; - EXPECT_LE(host_time_delta, time_to_sleep + 10) - << "The verifyAuthorization call took more than 10 ms? That's awful!"; + EXPECT_LE(host_time_delta, time_to_sleep + 20) + << "The verifyAuthorization call took " << (host_time_delta - time_to_sleep) + << " ms? That's awful!"; auto km_time_delta = result2.token.timestamp - result1.token.timestamp; diff --git a/keymaster/4.0/vts/functional/keymaster_hidl_hal_test.cpp b/keymaster/4.0/vts/functional/keymaster_hidl_hal_test.cpp index 450b3eb4e..3919a69db 100644 --- a/keymaster/4.0/vts/functional/keymaster_hidl_hal_test.cpp +++ b/keymaster/4.0/vts/functional/keymaster_hidl_hal_test.cpp @@ -182,7 +182,7 @@ X509* parse_cert_blob(const hidl_vec<uint8_t>& blob) { } bool verify_chain(const hidl_vec<hidl_vec<uint8_t>>& chain) { - for (size_t i = 0; i < chain.size() - 1; ++i) { + for (size_t i = 0; i < chain.size(); ++i) { X509_Ptr key_cert(parse_cert_blob(chain[i])); X509_Ptr signing_cert; if (i < chain.size() - 1) { @@ -198,7 +198,8 @@ bool verify_chain(const hidl_vec<hidl_vec<uint8_t>>& chain) { if (!signing_pubkey.get()) return false; EXPECT_EQ(1, X509_verify(key_cert.get(), signing_pubkey.get())) - << "Verification of certificate " << i << " failed"; + << "Verification of certificate " << i << " failed " + << "OpenSSL error string: " << ERR_error_string(ERR_get_error(), NULL); char* cert_issuer = // X509_NAME_oneline(X509_get_issuer_name(key_cert.get()), nullptr, 0); @@ -246,8 +247,7 @@ bool tag_in_list(const KeyParameter& entry) { // Attestations don't contain everything in key authorization lists, so we need to filter // the key lists to produce the lists that we expect to match the attestations. auto tag_list = { - Tag::INCLUDE_UNIQUE_ID, Tag::BLOB_USAGE_REQUIREMENTS, - Tag::EC_CURVE /* Tag::EC_CURVE will be included by KM2 implementations */, + Tag::INCLUDE_UNIQUE_ID, Tag::BLOB_USAGE_REQUIREMENTS, Tag::EC_CURVE, Tag::HARDWARE_TYPE, }; return std::find(tag_list.begin(), tag_list.end(), entry.tag) != tag_list.end(); } @@ -271,7 +271,7 @@ std::string make_string(const uint8_t (&a)[N]) { bool verify_attestation_record(const string& challenge, const string& app_id, AuthorizationSet expected_sw_enforced, - AuthorizationSet expected_tee_enforced, + AuthorizationSet expected_tee_enforced, SecurityLevel security_level, const hidl_vec<uint8_t>& attestation_cert) { X509_Ptr cert(parse_cert_blob(attestation_cert)); EXPECT_TRUE(!!cert.get()); @@ -290,29 +290,27 @@ bool verify_attestation_record(const string& challenge, const string& app_id, HidlBuf att_challenge; HidlBuf att_unique_id; HidlBuf att_app_id; - EXPECT_EQ(ErrorCode::OK, - parse_attestation_record(attest_rec->data, // - attest_rec->length, // - &att_attestation_version, // - &att_attestation_security_level, // - &att_keymaster_version, // - &att_keymaster_security_level, // - &att_challenge, // - &att_sw_enforced, // - &att_tee_enforced, // - &att_unique_id)); - - EXPECT_TRUE(att_attestation_version == 1 || att_attestation_version == 2); + + auto error = parse_attestation_record(attest_rec->data, // + attest_rec->length, // + &att_attestation_version, // + &att_attestation_security_level, // + &att_keymaster_version, // + &att_keymaster_security_level, // + &att_challenge, // + &att_sw_enforced, // + &att_tee_enforced, // + &att_unique_id); + EXPECT_EQ(ErrorCode::OK, error); + if (error != ErrorCode::OK) return false; + + EXPECT_TRUE(att_attestation_version == 3); expected_sw_enforced.push_back(TAG_ATTESTATION_APPLICATION_ID, HidlBuf(app_id)); - EXPECT_GE(att_keymaster_version, 3U); - EXPECT_EQ(KeymasterHidlTest::IsSecure() ? SecurityLevel::TRUSTED_ENVIRONMENT - : SecurityLevel::SOFTWARE, - att_keymaster_security_level); - EXPECT_EQ(KeymasterHidlTest::IsSecure() ? SecurityLevel::TRUSTED_ENVIRONMENT - : SecurityLevel::SOFTWARE, - att_attestation_security_level); + EXPECT_EQ(att_keymaster_version, 4U); + EXPECT_EQ(security_level, att_keymaster_security_level); + EXPECT_EQ(security_level, att_attestation_security_level); EXPECT_EQ(challenge.length(), att_challenge.size()); EXPECT_EQ(0, memcmp(challenge.data(), att_challenge.data(), challenge.length())); @@ -538,10 +536,16 @@ TEST_F(NewKeyGenerationTest, EcdsaAllValidSizes) { * Verifies that keymaster does not support any curve designated as unsupported. */ TEST_F(NewKeyGenerationTest, EcdsaAllValidCurves) { + Digest digest; + if (SecLevel() == SecurityLevel::STRONGBOX) { + digest = Digest::SHA_2_256; + } else { + digest = Digest::SHA_2_512; + } for (auto curve : ValidCurves()) { EXPECT_EQ( ErrorCode::OK, - GenerateKey(AuthorizationSetBuilder().EcdsaSigningKey(curve).Digest(Digest::SHA_2_512))) + GenerateKey(AuthorizationSetBuilder().EcdsaSigningKey(curve).Digest(digest))) << "Failed to generate key on curve: " << curve; CheckCharacteristics(key_blob_, key_characteristics_); CheckedDeleteKey(); @@ -831,6 +835,7 @@ TEST_F(SigningOperationsTest, RsaPkcs1NoDigestTooLong) { * 1024-bit key. */ TEST_F(SigningOperationsTest, RsaPssSha512TooSmallKey) { + if (SecLevel() == SecurityLevel::STRONGBOX) return; ASSERT_EQ(ErrorCode::OK, GenerateKey(AuthorizationSetBuilder() .RsaSigningKey(1024, 65537) .Digest(Digest::SHA_2_512) @@ -1188,10 +1193,12 @@ TEST_F(SigningOperationsTest, HmacRfc4231TestCase3) { 0xbe, 0xe8, 0x94, 0x26, 0x74, 0x27, 0x88, 0x59, 0xe1, 0x32, 0x92, 0xfb, }; - CheckHmacTestVector(key, message, Digest::SHA_2_224, make_string(sha_224_expected)); CheckHmacTestVector(key, message, Digest::SHA_2_256, make_string(sha_256_expected)); - CheckHmacTestVector(key, message, Digest::SHA_2_384, make_string(sha_384_expected)); - CheckHmacTestVector(key, message, Digest::SHA_2_512, make_string(sha_512_expected)); + if (SecLevel() != SecurityLevel::STRONGBOX) { + CheckHmacTestVector(key, message, Digest::SHA_2_224, make_string(sha_224_expected)); + CheckHmacTestVector(key, message, Digest::SHA_2_384, make_string(sha_384_expected)); + CheckHmacTestVector(key, message, Digest::SHA_2_512, make_string(sha_512_expected)); + } } /* @@ -1220,10 +1227,12 @@ TEST_F(SigningOperationsTest, HmacRfc4231TestCase5) { 0x1d, 0x41, 0x79, 0xbc, 0x89, 0x1d, 0x87, 0xa6, }; - CheckHmacTestVector(key, message, Digest::SHA_2_224, make_string(sha_224_expected)); CheckHmacTestVector(key, message, Digest::SHA_2_256, make_string(sha_256_expected)); - CheckHmacTestVector(key, message, Digest::SHA_2_384, make_string(sha_384_expected)); - CheckHmacTestVector(key, message, Digest::SHA_2_512, make_string(sha_512_expected)); + if (SecLevel() != SecurityLevel::STRONGBOX) { + CheckHmacTestVector(key, message, Digest::SHA_2_224, make_string(sha_224_expected)); + CheckHmacTestVector(key, message, Digest::SHA_2_384, make_string(sha_384_expected)); + CheckHmacTestVector(key, message, Digest::SHA_2_512, make_string(sha_512_expected)); + } } /* @@ -1258,10 +1267,12 @@ TEST_F(SigningOperationsTest, HmacRfc4231TestCase6) { 0xf6, 0x3f, 0x0a, 0xec, 0x8b, 0x91, 0x5a, 0x98, 0x5d, 0x78, 0x65, 0x98, }; - CheckHmacTestVector(key, message, Digest::SHA_2_224, make_string(sha_224_expected)); CheckHmacTestVector(key, message, Digest::SHA_2_256, make_string(sha_256_expected)); - CheckHmacTestVector(key, message, Digest::SHA_2_384, make_string(sha_384_expected)); - CheckHmacTestVector(key, message, Digest::SHA_2_512, make_string(sha_512_expected)); + if (SecLevel() != SecurityLevel::STRONGBOX) { + CheckHmacTestVector(key, message, Digest::SHA_2_224, make_string(sha_224_expected)); + CheckHmacTestVector(key, message, Digest::SHA_2_384, make_string(sha_384_expected)); + CheckHmacTestVector(key, message, Digest::SHA_2_512, make_string(sha_512_expected)); + } } /* @@ -1299,10 +1310,12 @@ TEST_F(SigningOperationsTest, HmacRfc4231TestCase7) { 0x6d, 0xe0, 0x44, 0x60, 0x65, 0xc9, 0x74, 0x40, 0xfa, 0x8c, 0x6a, 0x58, }; - CheckHmacTestVector(key, message, Digest::SHA_2_224, make_string(sha_224_expected)); CheckHmacTestVector(key, message, Digest::SHA_2_256, make_string(sha_256_expected)); - CheckHmacTestVector(key, message, Digest::SHA_2_384, make_string(sha_384_expected)); - CheckHmacTestVector(key, message, Digest::SHA_2_512, make_string(sha_512_expected)); + if (SecLevel() != SecurityLevel::STRONGBOX) { + CheckHmacTestVector(key, message, Digest::SHA_2_224, make_string(sha_224_expected)); + CheckHmacTestVector(key, message, Digest::SHA_2_384, make_string(sha_384_expected)); + CheckHmacTestVector(key, message, Digest::SHA_2_512, make_string(sha_512_expected)); + } } typedef KeymasterHidlTest VerificationOperationsTest; @@ -1514,7 +1527,7 @@ TEST_F(VerificationOperationsTest, HmacSigningKeyCannotVerify) { .Authorization(TAG_NO_AUTH_REQUIRED) .Authorization(TAG_ALGORITHM, Algorithm::HMAC) .Authorization(TAG_PURPOSE, KeyPurpose::SIGN) - .Digest(Digest::SHA1) + .Digest(Digest::SHA_2_256) .Authorization(TAG_MIN_MAC_LENGTH, 160), KeyFormat::RAW, key_material, &signing_key, &signing_key_chars)); EXPECT_EQ(ErrorCode::OK, @@ -1522,24 +1535,24 @@ TEST_F(VerificationOperationsTest, HmacSigningKeyCannotVerify) { .Authorization(TAG_NO_AUTH_REQUIRED) .Authorization(TAG_ALGORITHM, Algorithm::HMAC) .Authorization(TAG_PURPOSE, KeyPurpose::VERIFY) - .Digest(Digest::SHA1) + .Digest(Digest::SHA_2_256) .Authorization(TAG_MIN_MAC_LENGTH, 160), KeyFormat::RAW, key_material, &verification_key, &verification_key_chars)); string message = "This is a message."; string signature = SignMessage( signing_key, message, - AuthorizationSetBuilder().Digest(Digest::SHA1).Authorization(TAG_MAC_LENGTH, 160)); + AuthorizationSetBuilder().Digest(Digest::SHA_2_256).Authorization(TAG_MAC_LENGTH, 160)); // Signing key should not work. AuthorizationSet out_params; EXPECT_EQ(ErrorCode::INCOMPATIBLE_PURPOSE, - Begin(KeyPurpose::VERIFY, signing_key, AuthorizationSetBuilder().Digest(Digest::SHA1), + Begin(KeyPurpose::VERIFY, signing_key, AuthorizationSetBuilder().Digest(Digest::SHA_2_256), &out_params, &op_handle_)); // Verification key should work. VerifyMessage(verification_key, message, signature, - AuthorizationSetBuilder().Digest(Digest::SHA1)); + AuthorizationSetBuilder().Digest(Digest::SHA_2_256)); CheckedDeleteKey(&signing_key); CheckedDeleteKey(&verification_key); @@ -2143,11 +2156,13 @@ TEST_F(EncryptionOperationsTest, RsaOaepInvalidDigest) { * different digest than was used to encrypt. */ TEST_F(EncryptionOperationsTest, RsaOaepDecryptWithWrongDigest) { + if (SecLevel() == SecurityLevel::STRONGBOX) return; + ASSERT_EQ(ErrorCode::OK, GenerateKey(AuthorizationSetBuilder() .Authorization(TAG_NO_AUTH_REQUIRED) .RsaEncryptionKey(1024, 65537) .Padding(PaddingMode::RSA_OAEP) - .Digest(Digest::SHA_2_256, Digest::SHA_2_224))); + .Digest(Digest::SHA_2_224, Digest::SHA_2_256))); string message = "Hello World!"; string ciphertext = EncryptMessage( message, @@ -2173,13 +2188,13 @@ TEST_F(EncryptionOperationsTest, RsaOaepTooLarge) { .Authorization(TAG_NO_AUTH_REQUIRED) .RsaEncryptionKey(1024, 65537) .Padding(PaddingMode::RSA_OAEP) - .Digest(Digest::SHA1))); - constexpr size_t digest_size = 160 /* SHA1 */ / 8; + .Digest(Digest::SHA_2_256))); + constexpr size_t digest_size = 256 /* SHA_2_256 */ / 8; constexpr size_t oaep_overhead = 2 * digest_size + 2; string message(1024 / 8 - oaep_overhead + 1, 'a'); EXPECT_EQ(ErrorCode::OK, Begin(KeyPurpose::ENCRYPT, - AuthorizationSetBuilder().Padding(PaddingMode::RSA_OAEP).Digest(Digest::SHA1))); + AuthorizationSetBuilder().Padding(PaddingMode::RSA_OAEP).Digest(Digest::SHA_2_256))); string result; EXPECT_EQ(ErrorCode::INVALID_ARGUMENT, Finish(message, &result)); EXPECT_EQ(0U, result.size()); @@ -3008,6 +3023,7 @@ TEST_F(EncryptionOperationsTest, AesGcmAadNoData) { * Verifies that AES GCM mode works when provided additional authenticated data in multiple chunks. */ TEST_F(EncryptionOperationsTest, AesGcmMultiPartAad) { + const size_t tag_bits = 128; ASSERT_EQ(ErrorCode::OK, GenerateKey(AuthorizationSetBuilder() .Authorization(TAG_NO_AUTH_REQUIRED) .AesEncryptionKey(128) @@ -3019,7 +3035,7 @@ TEST_F(EncryptionOperationsTest, AesGcmMultiPartAad) { auto begin_params = AuthorizationSetBuilder() .BlockMode(BlockMode::GCM) .Padding(PaddingMode::NONE) - .Authorization(TAG_MAC_LENGTH, 128); + .Authorization(TAG_MAC_LENGTH, tag_bits); AuthorizationSet begin_out_params; auto update_params = @@ -3041,10 +3057,11 @@ TEST_F(EncryptionOperationsTest, AesGcmMultiPartAad) { EXPECT_EQ(ErrorCode::OK, Update(op_handle_, update_params, message, &update_out_params, &ciphertext, &input_consumed)); EXPECT_EQ(message.size(), input_consumed); - EXPECT_EQ(message.size(), ciphertext.size()); EXPECT_TRUE(update_out_params.empty()); EXPECT_EQ(ErrorCode::OK, Finish("" /* input */, &ciphertext)); + // Expect 128-bit (16-byte) tag appended to ciphertext. + EXPECT_EQ(message.size() + (tag_bits >> 3), ciphertext.size()); // Grab nonce. begin_params.push_back(begin_out_params); @@ -3100,7 +3117,6 @@ TEST_F(EncryptionOperationsTest, AesGcmAadOutOfOrder) { EXPECT_EQ(ErrorCode::OK, Update(op_handle_, update_params, message, &update_out_params, &ciphertext, &input_consumed)); EXPECT_EQ(message.size(), input_consumed); - EXPECT_EQ(message.size(), ciphertext.size()); EXPECT_TRUE(update_out_params.empty()); // More AAD @@ -3827,7 +3843,7 @@ TEST_F(AttestationTest, RsaAttestation) { EXPECT_TRUE(verify_attestation_record("challenge", "foo", // key_characteristics_.softwareEnforced, // key_characteristics_.hardwareEnforced, // - cert_chain[0])); + SecLevel(), cert_chain[0])); } /* @@ -3874,7 +3890,7 @@ TEST_F(AttestationTest, EcAttestation) { EXPECT_TRUE(verify_attestation_record("challenge", "foo", // key_characteristics_.softwareEnforced, // key_characteristics_.hardwareEnforced, // - cert_chain[0])); + SecLevel(), cert_chain[0])); } /* 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 725e2904e..e851a7c1e 100644 --- a/media/omx/1.0/vts/functional/audio/VtsHalMediaOmxV1_0TargetAudioDecTest.cpp +++ b/media/omx/1.0/vts/functional/audio/VtsHalMediaOmxV1_0TargetAudioDecTest.cpp @@ -151,6 +151,15 @@ class AudioDecHidlTest : public ::testing::VtsHalHidlTargetTestBase { framesReceived = 0; timestampUs = 0; timestampDevTest = false; + isSecure = false; + size_t suffixLen = strlen(".secure"); + if (strlen(gEnv->getComponent().c_str()) >= suffixLen) { + isSecure = + !strcmp(gEnv->getComponent().c_str() + + strlen(gEnv->getComponent().c_str()) - suffixLen, + ".secure"); + } + if (isSecure) disableTest = true; if (disableTest) std::cout << "[ WARN ] Test Disabled \n"; } @@ -247,6 +256,7 @@ class AudioDecHidlTest : public ::testing::VtsHalHidlTargetTestBase { OMX_AUDIO_CODINGTYPE eEncoding; bool disableTest; bool eosFlag; + bool isSecure; uint32_t framesReceived; uint64_t timestampUs; ::android::List<uint64_t> timestampUslist; diff --git a/power/1.3/Android.bp b/power/1.3/Android.bp new file mode 100644 index 000000000..65b75977f --- /dev/null +++ b/power/1.3/Android.bp @@ -0,0 +1,21 @@ +// This file is autogenerated by hidl-gen -Landroidbp. + +hidl_interface { + name: "android.hardware.power@1.3", + root: "android.hardware", + srcs: [ + "types.hal", + "IPower.hal", + ], + interfaces: [ + "android.hardware.power@1.0", + "android.hardware.power@1.1", + "android.hardware.power@1.2", + "android.hidl.base@1.0", + ], + types: [ + "PowerHint", + ], + gen_java: true, +} + diff --git a/power/1.3/IPower.hal b/power/1.3/IPower.hal new file mode 100644 index 000000000..18b00a30c --- /dev/null +++ b/power/1.3/IPower.hal @@ -0,0 +1,33 @@ +/* + * Copyright (C) 2018 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package android.hardware.power@1.3; + +import @1.2::IPower; + +interface IPower extends @1.2::IPower { + /** + * Called to pass hints on power requirements which + * may result in adjustment of power/performance parameters of the + * cpufreq governor and other controls. + * + * A particular platform may choose to ignore any hint. + * + * @param hint PowerHint which is passed + * @param data contains additional information about the hint + * and is described along with the comments for each of the hints. + */ + oneway powerHintAsync_1_3(PowerHint hint, int32_t data); +}; diff --git a/power/1.3/types.hal b/power/1.3/types.hal new file mode 100644 index 000000000..658495cf6 --- /dev/null +++ b/power/1.3/types.hal @@ -0,0 +1,28 @@ +/* + * Copyright (C) 2018 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package android.hardware.power@1.3; + +import @1.2::PowerHint; + +/** Power hint identifiers passed to powerHintAsync_1_3() */ +enum PowerHint : @1.2::PowerHint { + /** + * This hint indicates that the device is about to enter a period of expensive rendering, and + * the GPU should be configured accordingly. The data parameter is always 1 when entering this + * state and 0 when leaving it. + */ + EXPENSIVE_RENDERING, +}; diff --git a/power/1.3/vts/functional/Android.bp b/power/1.3/vts/functional/Android.bp new file mode 100644 index 000000000..34cdb6079 --- /dev/null +++ b/power/1.3/vts/functional/Android.bp @@ -0,0 +1,27 @@ +// +// Copyright (C) 2018 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: "VtsHalPowerV1_3TargetTest", + defaults: ["VtsHalTargetTestDefaults"], + srcs: ["VtsHalPowerV1_3TargetTest.cpp"], + static_libs: [ + "android.hardware.power@1.0", + "android.hardware.power@1.1", + "android.hardware.power@1.2", + "android.hardware.power@1.3", + ], +} diff --git a/power/1.3/vts/functional/VtsHalPowerV1_3TargetTest.cpp b/power/1.3/vts/functional/VtsHalPowerV1_3TargetTest.cpp new file mode 100644 index 000000000..af1a1d86a --- /dev/null +++ b/power/1.3/vts/functional/VtsHalPowerV1_3TargetTest.cpp @@ -0,0 +1,64 @@ +/* + * Copyright (C) 2018 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 "power_hidl_hal_test" +#include <android-base/logging.h> +#include <android/hardware/power/1.3/IPower.h> + +#include <VtsHalHidlTargetTestBase.h> +#include <VtsHalHidlTargetTestEnvBase.h> + +using ::android::sp; +using ::android::hardware::hidl_vec; +using ::android::hardware::Return; +using ::android::hardware::power::V1_3::IPower; +using ::android::hardware::power::V1_3::PowerHint; + +// Test environment for Power HIDL HAL. +class PowerHidlEnvironment : public ::testing::VtsHalHidlTargetTestEnvBase { + public: + // get the test environment singleton + static PowerHidlEnvironment* Instance() { + static PowerHidlEnvironment* instance = new PowerHidlEnvironment; + return instance; + } + + virtual void registerTestServices() override { registerTestService<IPower>(); } +}; + +class PowerHidlTest : public ::testing::VtsHalHidlTargetTestBase { + public: + virtual void SetUp() override { + power = ::testing::VtsHalHidlTargetTestBase::getService<IPower>( + PowerHidlEnvironment::Instance()->getServiceName<IPower>()); + ASSERT_NE(power, nullptr); + } + + sp<IPower> power; +}; + +TEST_F(PowerHidlTest, PowerHintAsync_1_3) { + ASSERT_TRUE(power->powerHintAsync_1_3(PowerHint::EXPENSIVE_RENDERING, 0).isOk()); +} + +int main(int argc, char** argv) { + ::testing::AddGlobalTestEnvironment(PowerHidlEnvironment::Instance()); + ::testing::InitGoogleTest(&argc, argv); + PowerHidlEnvironment::Instance()->init(&argc, argv); + int status = RUN_ALL_TESTS(); + LOG(INFO) << "Test result = " << status; + return status; +} diff --git a/radio/1.0/IRadioResponse.hal b/radio/1.0/IRadioResponse.hal index 27945cb07..c1b16b7b8 100644 --- a/radio/1.0/IRadioResponse.hal +++ b/radio/1.0/IRadioResponse.hal @@ -88,6 +88,7 @@ interface IRadioResponse { * RadioError:INVALID_ARGUMENTS * RadioError:INVALID_SIM_STATE * RadioError:REQUEST_NOT_SUPPORTED + * RadioError:SIM_PUK2 */ oneway supplyIccPin2ForAppResponse(RadioResponseInfo info, int32_t remainingRetries); @@ -141,6 +142,7 @@ interface IRadioResponse { * RadioError:INVALID_ARGUMENTS * RadioError:INVALID_SIM_STATE * RadioError:REQUEST_NOT_SUPPORTED + * RadioError:SIM_PUK2 */ oneway changeIccPin2ForAppResponse(RadioResponseInfo info, int32_t remainingRetries); diff --git a/radio/1.0/vts/functional/radio_hidl_hal_icc.cpp b/radio/1.0/vts/functional/radio_hidl_hal_icc.cpp index 73e26d2d9..2670d96cf 100644 --- a/radio/1.0/vts/functional/radio_hidl_hal_icc.cpp +++ b/radio/1.0/vts/functional/radio_hidl_hal_icc.cpp @@ -44,7 +44,9 @@ TEST_F(RadioHidlTest, supplyIccPinForApp) { EXPECT_EQ(std::cv_status::no_timeout, wait()); EXPECT_EQ(serial, radioRsp->rspInfo.serial); EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type); - EXPECT_EQ(RadioError::PASSWORD_INCORRECT, radioRsp->rspInfo.error); + ASSERT_TRUE(CheckAnyOfErrors( + radioRsp->rspInfo.error, + {RadioError::PASSWORD_INCORRECT, RadioError::REQUEST_NOT_SUPPORTED})); } } } @@ -67,7 +69,8 @@ TEST_F(RadioHidlTest, supplyIccPukForApp) { EXPECT_EQ(std::cv_status::no_timeout, wait()); EXPECT_EQ(serial, radioRsp->rspInfo.serial); EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type); - EXPECT_EQ(RadioError::PASSWORD_INCORRECT, radioRsp->rspInfo.error); + ASSERT_TRUE(CheckAnyOfErrors(radioRsp->rspInfo.error, {RadioError::PASSWORD_INCORRECT, + RadioError::INVALID_SIM_STATE})); } } } @@ -90,7 +93,10 @@ TEST_F(RadioHidlTest, supplyIccPin2ForApp) { EXPECT_EQ(std::cv_status::no_timeout, wait()); EXPECT_EQ(serial, radioRsp->rspInfo.serial); EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type); - EXPECT_EQ(RadioError::PASSWORD_INCORRECT, radioRsp->rspInfo.error); + ASSERT_TRUE( + CheckAnyOfErrors(radioRsp->rspInfo.error, + {RadioError::PASSWORD_INCORRECT, RadioError::REQUEST_NOT_SUPPORTED, + RadioError::SIM_PUK2})); } } } @@ -113,7 +119,8 @@ TEST_F(RadioHidlTest, supplyIccPuk2ForApp) { EXPECT_EQ(std::cv_status::no_timeout, wait()); EXPECT_EQ(serial, radioRsp->rspInfo.serial); EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type); - EXPECT_EQ(RadioError::PASSWORD_INCORRECT, radioRsp->rspInfo.error); + ASSERT_TRUE(CheckAnyOfErrors(radioRsp->rspInfo.error, {RadioError::PASSWORD_INCORRECT, + RadioError::INVALID_SIM_STATE})); } } } @@ -161,9 +168,10 @@ TEST_F(RadioHidlTest, changeIccPin2ForApp) { EXPECT_EQ(std::cv_status::no_timeout, wait()); EXPECT_EQ(serial, radioRsp->rspInfo.serial); EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type); - ASSERT_TRUE(CheckAnyOfErrors( - radioRsp->rspInfo.error, - {RadioError::PASSWORD_INCORRECT, RadioError::REQUEST_NOT_SUPPORTED})); + ASSERT_TRUE( + CheckAnyOfErrors(radioRsp->rspInfo.error, + {RadioError::PASSWORD_INCORRECT, RadioError::REQUEST_NOT_SUPPORTED, + RadioError::SIM_PUK2})); } } } @@ -184,7 +192,8 @@ TEST_F(RadioHidlTest, getImsiForApp) { EXPECT_EQ(std::cv_status::no_timeout, wait()); EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type); EXPECT_EQ(serial, radioRsp->rspInfo.serial); - EXPECT_EQ(RadioError::NONE, radioRsp->rspInfo.error); + ASSERT_TRUE( + CheckAnyOfErrors(radioRsp->rspInfo.error, {RadioError::NONE}, CHECK_GENERAL_ERROR)); // IMSI (MCC+MNC+MSIN) is at least 6 digits, but not more than 15 if (radioRsp->rspInfo.error == RadioError::NONE) { diff --git a/radio/1.0/vts/functional/radio_hidl_hal_misc.cpp b/radio/1.0/vts/functional/radio_hidl_hal_misc.cpp index bc03cf192..34997625b 100644 --- a/radio/1.0/vts/functional/radio_hidl_hal_misc.cpp +++ b/radio/1.0/vts/functional/radio_hidl_hal_misc.cpp @@ -694,9 +694,10 @@ TEST_F(RadioHidlTest, startLceService) { EXPECT_EQ(serial, radioRsp->rspInfo.serial); if (cardStatus.cardState == CardState::ABSENT) { - ASSERT_TRUE(CheckAnyOfErrors(radioRsp->rspInfo.error, - {RadioError::INTERNAL_ERR, RadioError::LCE_NOT_SUPPORTED, - RadioError::RADIO_NOT_AVAILABLE, RadioError::SIM_ABSENT})); + ASSERT_TRUE(CheckAnyOfErrors( + radioRsp->rspInfo.error, + {RadioError::INTERNAL_ERR, RadioError::LCE_NOT_SUPPORTED, + RadioError::RADIO_NOT_AVAILABLE, RadioError::SIM_ABSENT, RadioError::NONE})); } } @@ -730,10 +731,10 @@ TEST_F(RadioHidlTest, pullLceData) { EXPECT_EQ(serial, radioRsp->rspInfo.serial); if (cardStatus.cardState == CardState::ABSENT) { - ASSERT_TRUE(CheckAnyOfErrors( - radioRsp->rspInfo.error, - {RadioError::NONE, RadioError::INTERNAL_ERR, RadioError::RADIO_NOT_AVAILABLE}, - CHECK_OEM_ERROR)); + ASSERT_TRUE(CheckAnyOfErrors(radioRsp->rspInfo.error, + {RadioError::NONE, RadioError::INTERNAL_ERR, + RadioError::RADIO_NOT_AVAILABLE, RadioError::SIM_ABSENT}, + CHECK_OEM_ERROR)); } } @@ -778,20 +779,27 @@ TEST_F(RadioHidlTest, setAllowedCarriers) { {RadioError::NONE, RadioError::REQUEST_NOT_SUPPORTED})); } - /* Setting to carrier restriction needs some time */ - updateSimCardStatus(); - auto startTime = std::chrono::system_clock::now(); - while (cardStatus.cardState != CardState::RESTRICTED && - std::chrono::duration_cast<chrono::seconds>(std::chrono::system_clock::now() - startTime) - .count() < 10) { - /* Set 2 seconds as interval to check card status */ - sleep(2); + if (radioRsp->rspInfo.error == RadioError::NONE) { + /* Setting to carrier restriction needs some time */ updateSimCardStatus(); + auto startTime = std::chrono::system_clock::now(); + while (cardStatus.cardState != CardState::RESTRICTED && + std::chrono::duration_cast<chrono::seconds>(std::chrono::system_clock::now() - + startTime) + .count() < 10) { + /* Set 2 seconds as interval to check card status */ + sleep(2); + updateSimCardStatus(); + } + EXPECT_EQ(CardState::RESTRICTED, cardStatus.cardState); } - EXPECT_EQ(CardState::RESTRICTED, cardStatus.cardState); sleep(10); - /* Reset back to no carrier restriction */ + /** + * Another test case of the API to cover to allow carrier. + * If the API is supported, this is also used to reset to no carrier restriction + * status for cardStatus. + */ memset(&carriers, 0, sizeof(carriers)); carriers.allowedCarriers.resize(0); carriers.excludedCarriers.resize(0); @@ -807,18 +815,21 @@ TEST_F(RadioHidlTest, setAllowedCarriers) { {RadioError::NONE, RadioError::REQUEST_NOT_SUPPORTED})); } - /* Resetting back to no carrier restriction needs some time */ - updateSimCardStatus(); - startTime = std::chrono::system_clock::now(); - while (cardStatus.cardState == CardState::RESTRICTED && - std::chrono::duration_cast<chrono::seconds>(std::chrono::system_clock::now() - startTime) - .count() < 10) { - /* Set 2 seconds as interval to check card status */ - sleep(2); + if (radioRsp->rspInfo.error == RadioError::NONE) { + /* Resetting back to no carrier restriction needs some time */ updateSimCardStatus(); + auto startTime = std::chrono::system_clock::now(); + while (cardStatus.cardState == CardState::RESTRICTED && + std::chrono::duration_cast<chrono::seconds>(std::chrono::system_clock::now() - + startTime) + .count() < 10) { + /* Set 2 seconds as interval to check card status */ + sleep(2); + updateSimCardStatus(); + } + EXPECT_NE(CardState::RESTRICTED, cardStatus.cardState); + sleep(10); } - EXPECT_NE(CardState::RESTRICTED, cardStatus.cardState); - sleep(10); } /* diff --git a/radio/1.1/vts/functional/radio_hidl_hal_api.cpp b/radio/1.1/vts/functional/radio_hidl_hal_api.cpp index 90077dcf6..33347c5d7 100644 --- a/radio/1.1/vts/functional/radio_hidl_hal_api.cpp +++ b/radio/1.1/vts/functional/radio_hidl_hal_api.cpp @@ -33,17 +33,19 @@ TEST_F(RadioHidlTest_v1_1, setSimCardPower_1_1) { ASSERT_TRUE(CheckAnyOfErrors(radioRsp_v1_1->rspInfo.error, {RadioError::NONE, RadioError::REQUEST_NOT_SUPPORTED, RadioError::INVALID_ARGUMENTS, RadioError::RADIO_NOT_AVAILABLE})); - /* Wait some time for setting sim power down and then verify it */ - updateSimCardStatus(); - auto startTime = std::chrono::system_clock::now(); - while (cardStatus.cardState != CardState::ABSENT && + if (radioRsp_v1_1->rspInfo.error == RadioError::NONE) { + /* Wait some time for setting sim power down and then verify it */ + updateSimCardStatus(); + auto startTime = std::chrono::system_clock::now(); + while (cardStatus.cardState != CardState::ABSENT && std::chrono::duration_cast<chrono::seconds>(std::chrono::system_clock::now() - startTime) .count() < 80) { - /* Set 2 seconds as interval to check card status */ - sleep(2); - updateSimCardStatus(); + /* Set 2 seconds as interval to check card status */ + sleep(2); + updateSimCardStatus(); + } + EXPECT_EQ(CardState::ABSENT, cardStatus.cardState); } - EXPECT_EQ(CardState::ABSENT, cardStatus.cardState); /* Test setSimCardPower power up */ serial = GetRandomSerialNumber(); @@ -59,10 +61,11 @@ TEST_F(RadioHidlTest_v1_1, setSimCardPower_1_1) { * If the sim card status for the testing environment is PRESENT, * verify if sim status is reset back. */ - if (cardStateForTest == CardState::PRESENT) { + if (cardStateForTest == CardState::PRESENT && + radioRsp_v1_1->rspInfo.error == RadioError::NONE) { /* Wait some time for resetting back to sim power on and then verify it */ updateSimCardStatus(); - startTime = std::chrono::system_clock::now(); + auto startTime = std::chrono::system_clock::now(); while (cardStatus.cardState != CardState::PRESENT && std::chrono::duration_cast<chrono::seconds>(std::chrono::system_clock::now() - startTime) diff --git a/radio/1.2/IRadio.hal b/radio/1.2/IRadio.hal index 6463b0fcc..87b0add5d 100644 --- a/radio/1.2/IRadio.hal +++ b/radio/1.2/IRadio.hal @@ -59,19 +59,30 @@ interface IRadio extends @1.1::IRadio { /** * Sets the signal strength reporting criteria. * - * The resulting reporting criteria are the AND of all the supplied criteria. + * The resulting reporting rules are the AND of all the supplied criteria. For each RAN + * The thresholdsDbm and hysteresisDb apply to only the following measured quantities: + * -GERAN - RSSI + * -CDMA2000 - RSSI + * -UTRAN - RSCP + * -EUTRAN - RSRP * - * Note: Reporting criteria must be individually set for each RAN. If unset, reporting criteria - * for that RAN are implementation-defined. + * Note: Reporting criteria must be individually set for each RAN. For any unset reporting + * criteria, the value is implementation-defined. * - * Response callback is IRadioResponse.setSignalStrengthReportingCriteriaResponse(). + * Note: As this mechanism generally only constrains reports based on one measured quantity per + * RAN, if multiple measured quantities must be used to trigger a report for a given RAN, the + * only valid field may be hysteresisMs: hysteresisDb and thresholdsDbm must be set to zero and + * length zero respectively. If either hysteresisDb or thresholdsDbm is set, then reports shall + * only be triggered by the respective measured quantity, subject to the applied constraints. + * + * Response callback is IRadioResponse.setSignalStrengthReportingCriteriaResponse() * * @param serial Serial number of request. * @param hysteresisMs A hysteresis time in milliseconds to prevent flapping. A value of 0 * disables hysteresis. * @param hysteresisDb An interval in dB defining the required magnitude change between reports. - * hysteresisDb must be smaller than the smallest threshold delta. An - * interval value of 0 disables hysteresis. + * hysteresisDb must be smaller than the smallest threshold delta. An interval value of 0 + * disables hysteresis. * @param thresholdsDbm A vector of trigger thresholds in dBm. A vector size of 0 disables the * use of thresholds for reporting. * @param accessNetwork The type of network for which to apply these thresholds. diff --git a/radio/1.2/vts/functional/radio_hidl_hal_api.cpp b/radio/1.2/vts/functional/radio_hidl_hal_api.cpp index 9284fd8fa..35101637d 100644 --- a/radio/1.2/vts/functional/radio_hidl_hal_api.cpp +++ b/radio/1.2/vts/functional/radio_hidl_hal_api.cpp @@ -43,7 +43,16 @@ TEST_F(RadioHidlTest_v1_2, startNetworkScan) { if (cardStatus.base.cardState == CardState::ABSENT) { ASSERT_TRUE(CheckAnyOfErrors(radioRsp_v1_2->rspInfo.error, {RadioError::SIM_ABSENT})); } else if (cardStatus.base.cardState == CardState::PRESENT) { - ASSERT_TRUE(CheckAnyOfErrors(radioRsp_v1_2->rspInfo.error, {RadioError::NONE})); + // REQUEST_NOT_SUPPORTED should not be allowed as it is not an optional API. However, the + // comments in the hal were not updated to indicate that, hence allowing it as a valid + // error for now. This should be fixed correctly, possibly in a future version of the hal + // (b/110421924). This is being allowed because some vendors do not support + // this request on dual sim devices. + // OPERATION_NOT_ALLOWED should not be allowed; however, some vendors do not support the + // required manual GSM search functionality. This is tracked in b/112206766. + ASSERT_TRUE(CheckAnyOfErrors(radioRsp_v1_2->rspInfo.error, + {RadioError::NONE, RadioError::REQUEST_NOT_SUPPORTED, + RadioError::OPERATION_NOT_ALLOWED})); } } @@ -69,7 +78,8 @@ TEST_F(RadioHidlTest_v1_2, startNetworkScan_InvalidArgument) { {RadioError::SIM_ABSENT, RadioError::INVALID_ARGUMENTS})); } else if (cardStatus.base.cardState == CardState::PRESENT) { ASSERT_TRUE( - CheckAnyOfErrors(radioRsp_v1_2->rspInfo.error, {RadioError::INVALID_ARGUMENTS})); + CheckAnyOfErrors(radioRsp_v1_2->rspInfo.error, + {RadioError::INVALID_ARGUMENTS, RadioError::REQUEST_NOT_SUPPORTED})); } } @@ -105,7 +115,8 @@ TEST_F(RadioHidlTest_v1_2, startNetworkScan_InvalidInterval1) { {RadioError::SIM_ABSENT, RadioError::INVALID_ARGUMENTS})); } else if (cardStatus.base.cardState == CardState::PRESENT) { ASSERT_TRUE( - CheckAnyOfErrors(radioRsp_v1_2->rspInfo.error, {RadioError::INVALID_ARGUMENTS})); + CheckAnyOfErrors(radioRsp_v1_2->rspInfo.error, + {RadioError::INVALID_ARGUMENTS, RadioError::REQUEST_NOT_SUPPORTED})); } } @@ -141,7 +152,8 @@ TEST_F(RadioHidlTest_v1_2, startNetworkScan_InvalidInterval2) { {RadioError::SIM_ABSENT, RadioError::INVALID_ARGUMENTS})); } else if (cardStatus.base.cardState == CardState::PRESENT) { ASSERT_TRUE( - CheckAnyOfErrors(radioRsp_v1_2->rspInfo.error, {RadioError::INVALID_ARGUMENTS})); + CheckAnyOfErrors(radioRsp_v1_2->rspInfo.error, + {RadioError::INVALID_ARGUMENTS, RadioError::REQUEST_NOT_SUPPORTED})); } } @@ -177,7 +189,8 @@ TEST_F(RadioHidlTest_v1_2, startNetworkScan_InvalidMaxSearchTime1) { {RadioError::SIM_ABSENT, RadioError::INVALID_ARGUMENTS})); } else if (cardStatus.base.cardState == CardState::PRESENT) { ASSERT_TRUE( - CheckAnyOfErrors(radioRsp_v1_2->rspInfo.error, {RadioError::INVALID_ARGUMENTS})); + CheckAnyOfErrors(radioRsp_v1_2->rspInfo.error, + {RadioError::INVALID_ARGUMENTS, RadioError::REQUEST_NOT_SUPPORTED})); } } @@ -213,7 +226,8 @@ TEST_F(RadioHidlTest_v1_2, startNetworkScan_InvalidMaxSearchTime2) { {RadioError::SIM_ABSENT, RadioError::INVALID_ARGUMENTS})); } else if (cardStatus.base.cardState == CardState::PRESENT) { ASSERT_TRUE( - CheckAnyOfErrors(radioRsp_v1_2->rspInfo.error, {RadioError::INVALID_ARGUMENTS})); + CheckAnyOfErrors(radioRsp_v1_2->rspInfo.error, + {RadioError::INVALID_ARGUMENTS, RadioError::REQUEST_NOT_SUPPORTED})); } } @@ -249,7 +263,8 @@ TEST_F(RadioHidlTest_v1_2, startNetworkScan_InvalidPeriodicity1) { {RadioError::SIM_ABSENT, RadioError::INVALID_ARGUMENTS})); } else if (cardStatus.base.cardState == CardState::PRESENT) { ASSERT_TRUE( - CheckAnyOfErrors(radioRsp_v1_2->rspInfo.error, {RadioError::INVALID_ARGUMENTS})); + CheckAnyOfErrors(radioRsp_v1_2->rspInfo.error, + {RadioError::INVALID_ARGUMENTS, RadioError::REQUEST_NOT_SUPPORTED})); } } @@ -285,7 +300,8 @@ TEST_F(RadioHidlTest_v1_2, startNetworkScan_InvalidPeriodicity2) { {RadioError::SIM_ABSENT, RadioError::INVALID_ARGUMENTS})); } else if (cardStatus.base.cardState == CardState::PRESENT) { ASSERT_TRUE( - CheckAnyOfErrors(radioRsp_v1_2->rspInfo.error, {RadioError::INVALID_ARGUMENTS})); + CheckAnyOfErrors(radioRsp_v1_2->rspInfo.error, + {RadioError::INVALID_ARGUMENTS, RadioError::REQUEST_NOT_SUPPORTED})); } } @@ -304,7 +320,9 @@ TEST_F(RadioHidlTest_v1_2, startNetworkScan_GoodRequest1) { .type = ScanType::ONE_SHOT, .interval = 60, .specifiers = {specifier}, - .maxSearchTime = 600, + // Some vendor may not support max search time of 360s. + // This issue is tracked in b/112205669. + .maxSearchTime = 300, .incrementalResults = false, .incrementalResultsPeriodicity = 10}; @@ -320,7 +338,9 @@ TEST_F(RadioHidlTest_v1_2, startNetworkScan_GoodRequest1) { ASSERT_TRUE(CheckAnyOfErrors(radioRsp_v1_2->rspInfo.error, {RadioError::NONE, RadioError::SIM_ABSENT})); } else if (cardStatus.base.cardState == CardState::PRESENT) { - ASSERT_TRUE(CheckAnyOfErrors(radioRsp_v1_2->rspInfo.error, {RadioError::NONE})); + ASSERT_TRUE(CheckAnyOfErrors( + radioRsp_v1_2->rspInfo.error, + {RadioError::NONE, RadioError::REQUEST_NOT_SUPPORTED})); } } @@ -339,7 +359,9 @@ TEST_F(RadioHidlTest_v1_2, startNetworkScan_GoodRequest2) { .type = ScanType::ONE_SHOT, .interval = 60, .specifiers = {specifier}, - .maxSearchTime = 600, + // Some vendor may not support max search time of 360s. + // This issue is tracked in b/112205669. + .maxSearchTime = 300, .incrementalResults = false, .incrementalResultsPeriodicity = 10, .mccMncs = {"310410"}}; @@ -356,7 +378,9 @@ TEST_F(RadioHidlTest_v1_2, startNetworkScan_GoodRequest2) { ASSERT_TRUE(CheckAnyOfErrors(radioRsp_v1_2->rspInfo.error, {RadioError::NONE, RadioError::SIM_ABSENT})); } else if (cardStatus.base.cardState == CardState::PRESENT) { - ASSERT_TRUE(CheckAnyOfErrors(radioRsp_v1_2->rspInfo.error, {RadioError::NONE})); + ASSERT_TRUE(CheckAnyOfErrors( + radioRsp_v1_2->rspInfo.error, + {RadioError::NONE, RadioError::REQUEST_NOT_SUPPORTED})); } } @@ -510,7 +534,11 @@ TEST_F(RadioHidlTest_v1_2, setLinkCapacityReportingCriteria_invalidHysteresisDlK ALOGI("setLinkCapacityReportingCriteria_invalidHysteresisDlKbps, rspInfo.error = %s\n", toString(radioRsp_v1_2->rspInfo.error).c_str()); - ASSERT_TRUE(CheckAnyOfErrors(radioRsp_v1_2->rspInfo.error, {RadioError::INVALID_ARGUMENTS})); + // Allow REQUEST_NOT_SUPPORTED as setLinkCapacityReportingCriteria() may not be supported for + // GERAN + ASSERT_TRUE( + CheckAnyOfErrors(radioRsp_v1_2->rspInfo.error, + {RadioError::INVALID_ARGUMENTS, RadioError::REQUEST_NOT_SUPPORTED})); } /* @@ -531,7 +559,11 @@ TEST_F(RadioHidlTest_v1_2, setLinkCapacityReportingCriteria_invalidHysteresisUlK ALOGI("setLinkCapacityReportingCriteria_invalidHysteresisUlKbps, rspInfo.error = %s\n", toString(radioRsp_v1_2->rspInfo.error).c_str()); - ASSERT_TRUE(CheckAnyOfErrors(radioRsp_v1_2->rspInfo.error, {RadioError::INVALID_ARGUMENTS})); + // Allow REQUEST_NOT_SUPPORTED as setLinkCapacityReportingCriteria() may not be supported for + // GERAN + ASSERT_TRUE( + CheckAnyOfErrors(radioRsp_v1_2->rspInfo.error, + {RadioError::INVALID_ARGUMENTS, RadioError::REQUEST_NOT_SUPPORTED})); } /* @@ -549,7 +581,10 @@ TEST_F(RadioHidlTest_v1_2, setLinkCapacityReportingCriteria_emptyParams) { ALOGI("setLinkCapacityReportingCriteria_emptyParams, rspInfo.error = %s\n", toString(radioRsp_v1_2->rspInfo.error).c_str()); - ASSERT_TRUE(CheckAnyOfErrors(radioRsp_v1_2->rspInfo.error, {RadioError::NONE})); + // Allow REQUEST_NOT_SUPPORTED as setLinkCapacityReportingCriteria() may not be supported for + // GERAN + ASSERT_TRUE(CheckAnyOfErrors(radioRsp_v1_2->rspInfo.error, + {RadioError::NONE, RadioError::REQUEST_NOT_SUPPORTED})); } /* @@ -568,7 +603,10 @@ TEST_F(RadioHidlTest_v1_2, setLinkCapacityReportingCriteria_Geran) { ALOGI("setLinkCapacityReportingCriteria_invalidHysteresisUlKbps, rspInfo.error = %s\n", toString(radioRsp_v1_2->rspInfo.error).c_str()); - ASSERT_TRUE(CheckAnyOfErrors(radioRsp_v1_2->rspInfo.error, {RadioError::NONE})); + // Allow REQUEST_NOT_SUPPORTED as setLinkCapacityReportingCriteria() may not be supported for + // GERAN + ASSERT_TRUE(CheckAnyOfErrors(radioRsp_v1_2->rspInfo.error, + {RadioError::NONE, RadioError::REQUEST_NOT_SUPPORTED})); } /* @@ -666,7 +704,7 @@ TEST_F(RadioHidlTest_v1_2, deactivateDataCall_1_2) { * Test IRadio.getCellInfoList() for the response returned. */ TEST_F(RadioHidlTest_v1_2, getCellInfoList_1_2) { - int serial = GetRandomSerialNumber(); + serial = GetRandomSerialNumber(); Return<void> res = radio_v1_2->getCellInfoList(serial); ASSERT_OK(res); @@ -684,7 +722,7 @@ TEST_F(RadioHidlTest_v1_2, getCellInfoList_1_2) { * Test IRadio.getVoiceRegistrationState() for the response returned. */ TEST_F(RadioHidlTest_v1_2, getVoiceRegistrationState) { - int serial = GetRandomSerialNumber(); + serial = GetRandomSerialNumber(); Return<void> res = radio_v1_2->getVoiceRegistrationState(serial); ASSERT_OK(res); @@ -702,7 +740,7 @@ TEST_F(RadioHidlTest_v1_2, getVoiceRegistrationState) { * Test IRadio.getDataRegistrationState() for the response returned. */ TEST_F(RadioHidlTest_v1_2, getDataRegistrationState) { - int serial = GetRandomSerialNumber(); + serial = GetRandomSerialNumber(); Return<void> res = radio_v1_2->getDataRegistrationState(serial); ASSERT_OK(res); @@ -721,7 +759,7 @@ TEST_F(RadioHidlTest_v1_2, getDataRegistrationState) { * Test IRadio.getAvailableBandModes() for the response returned. */ TEST_F(RadioHidlTest_v1_2, getAvailableBandModes) { - int serial = GetRandomSerialNumber(); + serial = GetRandomSerialNumber(); Return<void> res = radio_v1_2->getAvailableBandModes(serial); ASSERT_OK(res); diff --git a/radio/1.2/vts/functional/radio_response.cpp b/radio/1.2/vts/functional/radio_response.cpp index dab63a359..c5c7b14f5 100644 --- a/radio/1.2/vts/functional/radio_response.cpp +++ b/radio/1.2/vts/functional/radio_response.cpp @@ -653,7 +653,9 @@ Return<void> RadioResponse_v1_2::sendDeviceStateResponse(const RadioResponseInfo return Void(); } -Return<void> RadioResponse_v1_2::setIndicationFilterResponse(const RadioResponseInfo& /*info*/) { +Return<void> RadioResponse_v1_2::setIndicationFilterResponse(const RadioResponseInfo& info) { + rspInfo = info; + parent_v1_2.notify(info.serial); return Void(); } diff --git a/secure_element/1.0/vts/functional/VtsHalSecureElementV1_0TargetTest.cpp b/secure_element/1.0/vts/functional/VtsHalSecureElementV1_0TargetTest.cpp index 3ea3e8dca..671923a61 100644 --- a/secure_element/1.0/vts/functional/VtsHalSecureElementV1_0TargetTest.cpp +++ b/secure_element/1.0/vts/functional/VtsHalSecureElementV1_0TargetTest.cpp @@ -173,7 +173,7 @@ TEST_F(SecureElementHidlTest, openBasicChannel) { se_->closeChannel(0); return; } - EXPECT_EQ(SecureElementStatus::UNSUPPORTED_OPERATION, statusReturned); + EXPECT_EQ(SecureElementStatus::CHANNEL_NOT_AVAILABLE, statusReturned); } /* diff --git a/usb/1.1/vts/functional/VtsHalUsbV1_1TargetTest.cpp b/usb/1.1/vts/functional/VtsHalUsbV1_1TargetTest.cpp index c990b237f..caf9c695b 100644 --- a/usb/1.1/vts/functional/VtsHalUsbV1_1TargetTest.cpp +++ b/usb/1.1/vts/functional/VtsHalUsbV1_1TargetTest.cpp @@ -31,8 +31,8 @@ #include <condition_variable> #include <mutex> +using ::android::hardware::usb::V1_1::IUsb; using ::android::hardware::usb::V1_1::IUsbCallback; -using ::android::hardware::usb::V1_0::IUsb; using ::android::hardware::usb::V1_0::PortDataRole; using ::android::hardware::usb::V1_0::PortMode; using ::android::hardware::usb::V1_1::PortMode_1_1; diff --git a/wifi/1.2/vts/functional/VtsHalWifiV1_2TargetTest.cpp b/wifi/1.2/vts/functional/VtsHalWifiV1_2TargetTest.cpp index cfad20828..c765cdcc3 100644 --- a/wifi/1.2/vts/functional/VtsHalWifiV1_2TargetTest.cpp +++ b/wifi/1.2/vts/functional/VtsHalWifiV1_2TargetTest.cpp @@ -17,14 +17,12 @@ #include <android-base/logging.h> #include <android/hardware/wifi/1.2/IWifi.h> -#include <VtsHalHidlTargetTestEnvBase.h> - #include "wifi_hidl_test_utils.h" using ::android::hardware::wifi::V1_2::IWifi; // Test environment for Wifi HIDL HAL. -class WifiHidlEnvironment_1_2 : public ::testing::VtsHalHidlTargetTestEnvBase { +class WifiHidlEnvironment_1_2 : public WifiHidlEnvironment { public: // get the test environment singleton static WifiHidlEnvironment_1_2* Instance() { |
