Merge "Add IRadioResponse/Indication 1.3 and Emergency Function HAL"
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 95080d1..91adfc1 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 @@
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 5030af5..1a906d6 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 @@
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 @@
}
}
- if (foundFiles.empty()) {
+ if (atLeastOneRequired && foundFiles.empty()) {
errors.push_back("No xml file found in provided locations.\n");
}
@@ -160,9 +161,20 @@
<< " 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 dab9f7c..9c9b749 100644
--- a/audio/core/4.0/vts/functional/AudioPrimaryHidlHalTest.cpp
+++ b/audio/core/4.0/vts/functional/AudioPrimaryHidlHalTest.cpp
@@ -106,7 +106,10 @@
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 @@
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(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, 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/core/all-versions/default/include/core/all-versions/default/Stream.h b/audio/core/all-versions/default/include/core/all-versions/default/Stream.h
index 6f79429..7cf12dd 100644
--- a/audio/core/all-versions/default/include/core/all-versions/default/Stream.h
+++ b/audio/core/all-versions/default/include/core/all-versions/default/Stream.h
@@ -163,8 +163,23 @@
if (retval == Result::OK) {
hidlHandle = native_handle_create(1, 0);
hidlHandle->data[0] = halInfo.shared_memory_fd;
- info.sharedMemory =
+
+ // Negative buffer size frame is a legacy hack to indicate that the buffer
+ // is shareable to applications before the relevant flag was introduced
+ bool applicationShareable =
+ halInfo.flags & AUDIO_MMAP_APPLICATION_SHAREABLE || halInfo.buffer_size_frames < 0;
+ halInfo.buffer_size_frames = abs(halInfo.buffer_size_frames);
+ info.sharedMemory = // hidl_memory size must always be positive
hidl_memory("audio_buffer", hidlHandle, frameSize * halInfo.buffer_size_frames);
+#ifdef AUDIO_HAL_VERSION_2_0
+ if (applicationShareable) {
+ halInfo.buffer_size_frames *= -1;
+ }
+#else
+ info.flags =
+ halInfo.flags | (applicationShareable ? MmapBufferFlag::APPLICATION_SHAREABLE
+ : MmapBufferFlag::NONE);
+#endif
info.bufferSizeFrames = halInfo.buffer_size_frames;
info.burstSizeFrames = halInfo.burst_size_frames;
}
diff --git a/audio/effect/2.0/vts/functional/ValidateAudioEffectsConfiguration.cpp b/audio/effect/2.0/vts/functional/ValidateAudioEffectsConfiguration.cpp
index d0bc690..bf080d3 100644
--- a/audio/effect/2.0/vts/functional/ValidateAudioEffectsConfiguration.cpp
+++ b/audio/effect/2.0/vts/functional/ValidateAudioEffectsConfiguration.cpp
@@ -27,6 +27,6 @@
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 ca6a7dc..df281b3 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/automotive/evs/1.0/Android.bp b/automotive/evs/1.0/Android.bp
index 4bc4068..f620eb5 100644
--- a/automotive/evs/1.0/Android.bp
+++ b/automotive/evs/1.0/Android.bp
@@ -23,6 +23,6 @@
"DisplayState",
"EvsResult",
],
- gen_java: false,
+ gen_java: true,
}
diff --git a/camera/device/1.0/Android.bp b/camera/device/1.0/Android.bp
index dbf2a10..b08f873 100644
--- a/camera/device/1.0/Android.bp
+++ b/camera/device/1.0/Android.bp
@@ -29,6 +29,6 @@
"NotifyCallbackMsg",
"VideoFrameMessage",
],
- gen_java: false,
+ gen_java: true,
}
diff --git a/camera/device/3.4/default/ExternalCameraDevice.cpp b/camera/device/3.4/default/ExternalCameraDevice.cpp
index e093822..e7361dd 100644
--- a/camera/device/3.4/default/ExternalCameraDevice.cpp
+++ b/camera/device/3.4/default/ExternalCameraDevice.cpp
@@ -90,7 +90,7 @@
}
Return<Status> ExternalCameraDevice::setTorchMode(TorchMode) {
- return Status::METHOD_NOT_SUPPORTED;
+ return Status::OPERATION_NOT_SUPPORTED;
}
Return<void> ExternalCameraDevice::open(
diff --git a/camera/provider/2.4/default/ExternalCameraProvider.cpp b/camera/provider/2.4/default/ExternalCameraProvider.cpp
index a4046d0..1cec0e5 100644
--- a/camera/provider/2.4/default/ExternalCameraProvider.cpp
+++ b/camera/provider/2.4/default/ExternalCameraProvider.cpp
@@ -105,8 +105,9 @@
Return<void> ExternalCameraProvider::isSetTorchModeSupported(
isSetTorchModeSupported_cb _hidl_cb) {
- // No torch mode support for USB camera
- _hidl_cb (Status::OK, false);
+ // setTorchMode API is supported, though right now no external camera device
+ // has a flash unit.
+ _hidl_cb (Status::OK, true);
return Void();
}
diff --git a/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp b/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp
index 95c7167..439333d 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::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 @@
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 @@
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 @@
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 @@
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 @@
<< 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.mk b/compatibility_matrices/compatibility_matrix.mk
index 2d1f7f4..bafc84b 100644
--- a/compatibility_matrices/compatibility_matrix.mk
+++ b/compatibility_matrices/compatibility_matrix.mk
@@ -86,7 +86,7 @@
ifneq (,$(strip $(LOCAL_KERNEL_CONFIG_DATA_PATHS)))
$(GEN): PRIVATE_KERNEL_CONFIG_DATA_PATHS := $(LOCAL_KERNEL_CONFIG_DATA_PATHS)
-$(GEN): $(foreach pair,$(PRIVATE_KERNEL_CONFIG_DATA_PATHS),\
+$(GEN): $(foreach pair,$(LOCAL_KERNEL_CONFIG_DATA_PATHS),\
$(wildcard $(call word-colon,2,$(pair))/android-base*.config))
$(GEN): PRIVATE_FLAGS += $(foreach pair,$(PRIVATE_KERNEL_CONFIG_DATA_PATHS),\
--kernel=$(call word-colon,1,$(pair)):$(call normalize-path-list,\
diff --git a/configstore/1.0/ISurfaceFlingerConfigs.hal b/configstore/1.0/ISurfaceFlingerConfigs.hal
index 5f975bd..1de7570 100644
--- a/configstore/1.0/ISurfaceFlingerConfigs.hal
+++ b/configstore/1.0/ISurfaceFlingerConfigs.hal
@@ -61,11 +61,16 @@
hasWideColorDisplay() generates (OptionalBool value);
/**
- * hwHdrDisplay indicates that the device has
- * or can support an HDR (High Dynamic Range) display.
- * Typically an HDR display is also wide-color.
+ * hwHDRDisplay indicates that the device has an High Dynamic Range display.
+ * A display is considered High Dynamic Range if it
+ *
+ * 1. is a wide color gamut display, typically DCI-P3 or lager
+ * 2. has high luminance capability, typically 540 nits or higher at 10% OPR
+ *
* Indicate support for this feature by setting
* TARGET_HAS_HDR_DISPLAY to true in BoardConfig.mk
+ * TARGET_HAS_WIDE_COLOR_DISPLAY must be set to true when
+ * TARGET_HAS_HDR_DISPLAY is true.
*/
hasHDRDisplay() generates (OptionalBool value);
diff --git a/current.txt b/current.txt
index b1d11a5..b8457f8 100644
--- a/current.txt
+++ b/current.txt
@@ -335,7 +335,8 @@
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
@@ -384,8 +385,10 @@
10ff2fae516346b86121368ce5790d5accdfcb73983246b813f3d488b66db45a android.hardware.wifi.supplicant@1.1::ISupplicantStaNetwork
# ABI preserving changes to HALs during Android Q
+da33234403ff5d60f3473711917b9948e6484a4260b5247acdafb111193a9de2 android.hardware.configstore@1.0::ISurfaceFlingerConfigs
574e8f1499436fb4075894dcae0b36682427956ecb114f17f1fe22d116a83c6b android.hardware.neuralnetworks@1.0::IPreparedModel
1a5ae9793223658174258b523763c557abad6fb917df0b8e3cc097fc89035811 android.hardware.neuralnetworks@1.0::types
4310eb8272f085914952f3bfb73a8f8bb477a80e8b93596f0ea5acb58546b66d android.hardware.neuralnetworks@1.1::types
-1d19720d4fd38b1095f0f555a4bd92b3b12c9b1d0f560b0e9a474cd6dcc20db6 android.hardware.radio@1.2::IRadio
1d4a5776614c08b5d794a5ec5ab04697260cbd4b3441d5935cd53ee71d19da02 android.hardware.radio@1.0::IRadioResponse
+271187e261b30c01a33011aea257c07a2d2f05b72943ebee89e973e997849973 android.hardware.radio@1.0::types
+1d19720d4fd38b1095f0f555a4bd92b3b12c9b1d0f560b0e9a474cd6dcc20db6 android.hardware.radio@1.2::IRadio
diff --git a/dumpstate/1.0/Android.bp b/dumpstate/1.0/Android.bp
index bc704f1..29be116 100644
--- a/dumpstate/1.0/Android.bp
+++ b/dumpstate/1.0/Android.bp
@@ -12,6 +12,6 @@
interfaces: [
"android.hidl.base@1.0",
],
- gen_java: false,
+ gen_java: true,
}
diff --git a/gnss/1.0/vts/functional/VtsHalGnssV1_0TargetTest.cpp b/gnss/1.0/vts/functional/VtsHalGnssV1_0TargetTest.cpp
index 010a46d..c26f60a 100644
--- a/gnss/1.0/vts/functional/VtsHalGnssV1_0TargetTest.cpp
+++ b/gnss/1.0/vts/functional/VtsHalGnssV1_0TargetTest.cpp
@@ -404,7 +404,11 @@
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 @@
}
}
+/*
+ * 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 46d61e5..433f5cb 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 @@
*/
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 @@
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 @@
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 269366a..64478b5 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 @@
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 cce46f1..c9f840e 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, 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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
* 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 @@
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 @@
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/bufferqueue/1.0/Android.bp b/graphics/bufferqueue/1.0/Android.bp
index 0333a42..e23ca59 100644
--- a/graphics/bufferqueue/1.0/Android.bp
+++ b/graphics/bufferqueue/1.0/Android.bp
@@ -15,6 +15,6 @@
"android.hardware.media@1.0",
"android.hidl.base@1.0",
],
- gen_java: false,
+ gen_java: true,
}
diff --git a/health/2.0/utils/libhealthhalutils/Android.bp b/health/2.0/utils/libhealthhalutils/Android.bp
index 5686520..449ef16 100644
--- a/health/2.0/utils/libhealthhalutils/Android.bp
+++ b/health/2.0/utils/libhealthhalutils/Android.bp
@@ -21,6 +21,7 @@
srcs: ["HealthHalUtils.cpp"],
cflags: ["-Wall", "-Werror"],
vendor_available: true,
+ recovery_available: true,
export_include_dirs: ["include"],
shared_libs: [
"android.hardware.health@2.0",
diff --git a/keymaster/3.0/vts/functional/keymaster_hidl_hal_test.cpp b/keymaster/3.0/vts/functional/keymaster_hidl_hal_test.cpp
index 70a5205..ccb5622 100644
--- a/keymaster/3.0/vts/functional/keymaster_hidl_hal_test.cpp
+++ b/keymaster/3.0/vts/functional/keymaster_hidl_hal_test.cpp
@@ -1083,7 +1083,7 @@
AuthorizationSet auths(keyCharacteristics.teeEnforced);
auths.push_back(AuthorizationSet(keyCharacteristics.softwareEnforced));
- if (!SupportsSymmetric() && asymmetric) {
+ if (IsSecure() && !SupportsSymmetric() && asymmetric) {
EXPECT_TRUE(auths.Contains(TAG_ORIGIN, KeyOrigin::UNKNOWN));
} else {
EXPECT_TRUE(auths.Contains(TAG_ORIGIN, KeyOrigin::GENERATED));
diff --git a/keymaster/4.0/IKeymasterDevice.hal b/keymaster/4.0/IKeymasterDevice.hal
index 74d13d8..85a25c6 100644
--- a/keymaster/4.0/IKeymasterDevice.hal
+++ b/keymaster/4.0/IKeymasterDevice.hal
@@ -753,7 +753,7 @@
* 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/attestation_record.cpp b/keymaster/4.0/support/attestation_record.cpp
index 8f37d9c..6de0c1c 100644
--- a/keymaster/4.0/support/attestation_record.cpp
+++ b/keymaster/4.0/support/attestation_record.cpp
@@ -49,12 +49,14 @@
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 @@
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_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_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 @@
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 74be343..6e2b691 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 @@
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 ce213bc..9e7d252 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(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(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 @@
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/KeymasterHidlTest.cpp b/keymaster/4.0/vts/functional/KeymasterHidlTest.cpp
index c89abd9..6ed61da 100644
--- a/keymaster/4.0/vts/functional/KeymasterHidlTest.cpp
+++ b/keymaster/4.0/vts/functional/KeymasterHidlTest.cpp
@@ -651,6 +651,8 @@
return {3072, 4096};
case Algorithm::EC:
return {224, 384, 521};
+ case Algorithm::AES:
+ return {192};
default:
return {};
}
diff --git a/keymaster/4.0/vts/functional/VerificationTokenTest.cpp b/keymaster/4.0/vts/functional/VerificationTokenTest.cpp
index 6afba0c..3876b16 100644
--- a/keymaster/4.0/vts/functional/VerificationTokenTest.cpp
+++ b/keymaster/4.0/vts/functional/VerificationTokenTest.cpp
@@ -111,8 +111,9 @@
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 450b3eb..89bcca6 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 @@
}
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 @@
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 @@
// 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 @@
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 @@
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 @@
* 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();
@@ -769,7 +773,7 @@
*/
TEST_F(SigningOperationsTest, RsaPkcs1Sha256Success) {
ASSERT_EQ(ErrorCode::OK, GenerateKey(AuthorizationSetBuilder()
- .RsaSigningKey(1024, 65537)
+ .RsaSigningKey(2048, 65537)
.Digest(Digest::SHA_2_256)
.Authorization(TAG_NO_AUTH_REQUIRED)
.Padding(PaddingMode::RSA_PKCS1_1_5_SIGN)));
@@ -786,7 +790,7 @@
*/
TEST_F(SigningOperationsTest, RsaPkcs1NoDigestSuccess) {
ASSERT_EQ(ErrorCode::OK, GenerateKey(AuthorizationSetBuilder()
- .RsaSigningKey(1024, 65537)
+ .RsaSigningKey(2048, 65537)
.Digest(Digest::NONE)
.Authorization(TAG_NO_AUTH_REQUIRED)
.Padding(PaddingMode::RSA_PKCS1_1_5_SIGN)));
@@ -804,11 +808,11 @@
*/
TEST_F(SigningOperationsTest, RsaPkcs1NoDigestTooLong) {
ASSERT_EQ(ErrorCode::OK, GenerateKey(AuthorizationSetBuilder()
- .RsaSigningKey(1024, 65537)
+ .RsaSigningKey(2048, 65537)
.Digest(Digest::NONE)
.Authorization(TAG_NO_AUTH_REQUIRED)
.Padding(PaddingMode::RSA_PKCS1_1_5_SIGN)));
- string message(129, 'a');
+ string message(257, 'a');
EXPECT_EQ(ErrorCode::OK,
Begin(KeyPurpose::SIGN, AuthorizationSetBuilder()
@@ -831,6 +835,7 @@
* 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)
@@ -850,12 +855,12 @@
*/
TEST_F(SigningOperationsTest, RsaNoPaddingTooLong) {
ASSERT_EQ(ErrorCode::OK, GenerateKey(AuthorizationSetBuilder()
- .RsaSigningKey(1024, 65537)
+ .RsaSigningKey(2048, 65537)
.Digest(Digest::NONE)
.Authorization(TAG_NO_AUTH_REQUIRED)
.Padding(PaddingMode::RSA_PKCS1_1_5_SIGN)));
// One byte too long
- string message(1024 / 8 + 1, 'a');
+ string message(2048 / 8 + 1, 'a');
ASSERT_EQ(ErrorCode::OK,
Begin(KeyPurpose::SIGN, AuthorizationSetBuilder()
.Digest(Digest::NONE)
@@ -884,7 +889,7 @@
*/
TEST_F(SigningOperationsTest, RsaAbort) {
ASSERT_EQ(ErrorCode::OK, GenerateKey(AuthorizationSetBuilder()
- .RsaSigningKey(1024, 65537)
+ .RsaSigningKey(2048, 65537)
.Digest(Digest::NONE)
.Authorization(TAG_NO_AUTH_REQUIRED)
.Padding(PaddingMode::NONE)));
@@ -909,7 +914,7 @@
*/
TEST_F(SigningOperationsTest, RsaUnsupportedPadding) {
ASSERT_EQ(ErrorCode::OK, GenerateKey(AuthorizationSetBuilder()
- .RsaSigningKey(1024, 65537)
+ .RsaSigningKey(2048, 65537)
.Authorization(TAG_NO_AUTH_REQUIRED)
.Digest(Digest::SHA_2_256 /* supported digest */)
.Padding(PaddingMode::PKCS7)));
@@ -926,7 +931,7 @@
*/
TEST_F(SigningOperationsTest, RsaNoDigest) {
ASSERT_EQ(ErrorCode::OK, GenerateKey(AuthorizationSetBuilder()
- .RsaSigningKey(1024, 65537)
+ .RsaSigningKey(2048, 65537)
.Authorization(TAG_NO_AUTH_REQUIRED)
.Digest(Digest::NONE)
.Padding(PaddingMode::RSA_PSS)));
@@ -947,7 +952,7 @@
TEST_F(SigningOperationsTest, RsaNoPadding) {
// Padding must be specified
ASSERT_EQ(ErrorCode::OK, GenerateKey(AuthorizationSetBuilder()
- .RsaKey(1024, 65537)
+ .RsaKey(2048, 65537)
.Authorization(TAG_NO_AUTH_REQUIRED)
.SigningKey()
.Digest(Digest::NONE)));
@@ -963,12 +968,12 @@
TEST_F(SigningOperationsTest, RsaTooShortMessage) {
ASSERT_EQ(ErrorCode::OK, GenerateKey(AuthorizationSetBuilder()
.Authorization(TAG_NO_AUTH_REQUIRED)
- .RsaSigningKey(1024, 65537)
+ .RsaSigningKey(2048, 65537)
.Digest(Digest::NONE)
.Padding(PaddingMode::NONE)));
// Barely shorter
- string message(1024 / 8 - 1, 'a');
+ string message(2048 / 8 - 1, 'a');
SignMessage(message, AuthorizationSetBuilder().Digest(Digest::NONE).Padding(PaddingMode::NONE));
// Much shorter
@@ -984,7 +989,7 @@
TEST_F(SigningOperationsTest, RsaSignWithEncryptionKey) {
ASSERT_EQ(ErrorCode::OK, GenerateKey(AuthorizationSetBuilder()
.Authorization(TAG_NO_AUTH_REQUIRED)
- .RsaEncryptionKey(1024, 65537)
+ .RsaEncryptionKey(2048, 65537)
.Digest(Digest::NONE)
.Padding(PaddingMode::NONE)));
ASSERT_EQ(ErrorCode::INCOMPATIBLE_PURPOSE,
@@ -1001,12 +1006,12 @@
TEST_F(SigningOperationsTest, RsaSignTooLargeMessage) {
ASSERT_EQ(ErrorCode::OK, GenerateKey(AuthorizationSetBuilder()
.Authorization(TAG_NO_AUTH_REQUIRED)
- .RsaSigningKey(1024, 65537)
+ .RsaSigningKey(2048, 65537)
.Digest(Digest::NONE)
.Padding(PaddingMode::NONE)));
// Largest possible message will always be larger than the public modulus.
- string message(1024 / 8, static_cast<char>(0xff));
+ string message(2048 / 8, static_cast<char>(0xff));
ASSERT_EQ(ErrorCode::OK, Begin(KeyPurpose::SIGN, AuthorizationSetBuilder()
.Authorization(TAG_NO_AUTH_REQUIRED)
.Digest(Digest::NONE)
@@ -1188,10 +1193,12 @@
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 @@
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 @@
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 @@
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;
@@ -1315,7 +1328,7 @@
TEST_F(VerificationOperationsTest, RsaSuccess) {
ASSERT_EQ(ErrorCode::OK, GenerateKey(AuthorizationSetBuilder()
.Authorization(TAG_NO_AUTH_REQUIRED)
- .RsaSigningKey(1024, 65537)
+ .RsaSigningKey(2048, 65537)
.Digest(Digest::NONE)
.Padding(PaddingMode::NONE)));
string message = "12345678901234567890123456789012";
@@ -1514,7 +1527,7 @@
.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 @@
.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);
@@ -1554,7 +1567,7 @@
*/
TEST_F(ExportKeyTest, RsaUnsupportedKeyFormat) {
ASSERT_EQ(ErrorCode::OK, GenerateKey(AuthorizationSetBuilder()
- .RsaSigningKey(1024, 65537)
+ .RsaSigningKey(2048, 65537)
.Digest(Digest::NONE)
.Padding(PaddingMode::NONE)));
HidlBuf export_data;
@@ -1570,7 +1583,7 @@
TEST_F(ExportKeyTest, RsaCorruptedKeyBlob) {
ASSERT_EQ(ErrorCode::OK, GenerateKey(AuthorizationSetBuilder()
.Authorization(TAG_NO_AUTH_REQUIRED)
- .RsaSigningKey(1024, 65537)
+ .RsaSigningKey(2048, 65537)
.Digest(Digest::NONE)
.Padding(PaddingMode::NONE)));
for (size_t i = 0; i < key_blob_.size(); ++i) {
@@ -1962,16 +1975,16 @@
TEST_F(EncryptionOperationsTest, RsaNoPaddingSuccess) {
ASSERT_EQ(ErrorCode::OK, GenerateKey(AuthorizationSetBuilder()
.Authorization(TAG_NO_AUTH_REQUIRED)
- .RsaEncryptionKey(1024, 65537)
+ .RsaEncryptionKey(2048, 65537)
.Padding(PaddingMode::NONE)));
- string message = string(1024 / 8, 'a');
+ string message = string(2048 / 8, 'a');
auto params = AuthorizationSetBuilder().Padding(PaddingMode::NONE);
string ciphertext1 = EncryptMessage(message, params);
- EXPECT_EQ(1024U / 8, ciphertext1.size());
+ EXPECT_EQ(2048U / 8, ciphertext1.size());
string ciphertext2 = EncryptMessage(message, params);
- EXPECT_EQ(1024U / 8, ciphertext2.size());
+ EXPECT_EQ(2048U / 8, ciphertext2.size());
// Unpadded RSA is deterministic
EXPECT_EQ(ciphertext1, ciphertext2);
@@ -1985,16 +1998,16 @@
TEST_F(EncryptionOperationsTest, RsaNoPaddingShortMessage) {
ASSERT_EQ(ErrorCode::OK, GenerateKey(AuthorizationSetBuilder()
.Authorization(TAG_NO_AUTH_REQUIRED)
- .RsaEncryptionKey(1024, 65537)
+ .RsaEncryptionKey(2048, 65537)
.Padding(PaddingMode::NONE)));
string message = "1";
auto params = AuthorizationSetBuilder().Padding(PaddingMode::NONE);
string ciphertext = EncryptMessage(message, params);
- EXPECT_EQ(1024U / 8, ciphertext.size());
+ EXPECT_EQ(2048U / 8, ciphertext.size());
- string expected_plaintext = string(1024 / 8 - 1, 0) + message;
+ string expected_plaintext = string(2048U / 8 - 1, 0) + message;
string plaintext = DecryptMessage(ciphertext, params);
EXPECT_EQ(expected_plaintext, plaintext);
@@ -2002,8 +2015,8 @@
// Degenerate case, encrypting a numeric 1 yields 0x00..01 as the ciphertext.
message = static_cast<char>(1);
ciphertext = EncryptMessage(message, params);
- EXPECT_EQ(1024U / 8, ciphertext.size());
- EXPECT_EQ(ciphertext, string(1024 / 8 - 1, 0) + message);
+ EXPECT_EQ(2048U / 8, ciphertext.size());
+ EXPECT_EQ(ciphertext, string(2048U / 8 - 1, 0) + message);
}
/*
@@ -2014,10 +2027,10 @@
TEST_F(EncryptionOperationsTest, RsaNoPaddingTooLong) {
ASSERT_EQ(ErrorCode::OK, GenerateKey(AuthorizationSetBuilder()
.Authorization(TAG_NO_AUTH_REQUIRED)
- .RsaEncryptionKey(1024, 65537)
+ .RsaEncryptionKey(2048, 65537)
.Padding(PaddingMode::NONE)));
- string message(1024 / 8 + 1, 'a');
+ string message(2048 / 8 + 1, 'a');
auto params = AuthorizationSetBuilder().Padding(PaddingMode::NONE);
EXPECT_EQ(ErrorCode::OK, Begin(KeyPurpose::ENCRYPT, params));
@@ -2034,7 +2047,7 @@
TEST_F(EncryptionOperationsTest, RsaNoPaddingTooLarge) {
ASSERT_EQ(ErrorCode::OK, GenerateKey(AuthorizationSetBuilder()
.Authorization(TAG_NO_AUTH_REQUIRED)
- .RsaEncryptionKey(1024, 65537)
+ .RsaEncryptionKey(2048, 65537)
.Padding(PaddingMode::NONE)));
HidlBuf exported;
@@ -2045,7 +2058,7 @@
RSA_Ptr rsa(EVP_PKEY_get1_RSA(pkey.get()));
size_t modulus_len = BN_num_bytes(rsa->n);
- ASSERT_EQ(1024U / 8, modulus_len);
+ ASSERT_EQ(2048U / 8, modulus_len);
std::unique_ptr<uint8_t[]> modulus_buf(new uint8_t[modulus_len]);
BN_bn2bin(rsa->n, modulus_buf.get());
@@ -2061,7 +2074,7 @@
// One smaller than the modulus is okay.
BN_sub(rsa->n, rsa->n, BN_value_one());
modulus_len = BN_num_bytes(rsa->n);
- ASSERT_EQ(1024U / 8, modulus_len);
+ ASSERT_EQ(2048U / 8, modulus_len);
BN_bn2bin(rsa->n, modulus_buf.get());
message = string(reinterpret_cast<const char*>(modulus_buf.get()), modulus_len);
EXPECT_EQ(ErrorCode::OK, Begin(KeyPurpose::ENCRYPT, params));
@@ -2127,7 +2140,7 @@
TEST_F(EncryptionOperationsTest, RsaOaepInvalidDigest) {
ASSERT_EQ(ErrorCode::OK, GenerateKey(AuthorizationSetBuilder()
.Authorization(TAG_NO_AUTH_REQUIRED)
- .RsaEncryptionKey(1024, 65537)
+ .RsaEncryptionKey(2048, 65537)
.Padding(PaddingMode::RSA_OAEP)
.Digest(Digest::NONE)));
string message = "Hello World!";
@@ -2143,11 +2156,13 @@
* 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,
@@ -2171,15 +2186,15 @@
TEST_F(EncryptionOperationsTest, RsaOaepTooLarge) {
ASSERT_EQ(ErrorCode::OK, GenerateKey(AuthorizationSetBuilder()
.Authorization(TAG_NO_AUTH_REQUIRED)
- .RsaEncryptionKey(1024, 65537)
+ .RsaEncryptionKey(2048, 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');
+ string message(2048 / 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());
@@ -2193,16 +2208,16 @@
TEST_F(EncryptionOperationsTest, RsaPkcs1Success) {
ASSERT_EQ(ErrorCode::OK, GenerateKey(AuthorizationSetBuilder()
.Authorization(TAG_NO_AUTH_REQUIRED)
- .RsaEncryptionKey(1024, 65537)
+ .RsaEncryptionKey(2048, 65537)
.Padding(PaddingMode::RSA_PKCS1_1_5_ENCRYPT)));
string message = "Hello World!";
auto params = AuthorizationSetBuilder().Padding(PaddingMode::RSA_PKCS1_1_5_ENCRYPT);
string ciphertext1 = EncryptMessage(message, params);
- EXPECT_EQ(1024U / 8, ciphertext1.size());
+ EXPECT_EQ(2048U / 8, ciphertext1.size());
string ciphertext2 = EncryptMessage(message, params);
- EXPECT_EQ(1024U / 8, ciphertext2.size());
+ EXPECT_EQ(2048U / 8, ciphertext2.size());
// PKCS1 v1.5 randomizes padding so every result should be different.
EXPECT_NE(ciphertext1, ciphertext2);
@@ -2232,9 +2247,9 @@
TEST_F(EncryptionOperationsTest, RsaPkcs1TooLarge) {
ASSERT_EQ(ErrorCode::OK, GenerateKey(AuthorizationSetBuilder()
.Authorization(TAG_NO_AUTH_REQUIRED)
- .RsaEncryptionKey(1024, 65537)
+ .RsaEncryptionKey(2048, 65537)
.Padding(PaddingMode::RSA_PKCS1_1_5_ENCRYPT)));
- string message(1024 / 8 - 10, 'a');
+ string message(2048 / 8 - 10, 'a');
auto params = AuthorizationSetBuilder().Padding(PaddingMode::RSA_PKCS1_1_5_ENCRYPT);
EXPECT_EQ(ErrorCode::OK, Begin(KeyPurpose::ENCRYPT, params));
@@ -2617,9 +2632,13 @@
* Verifies AES CTR implementation against SP800-38A test vectors.
*/
TEST_F(EncryptionOperationsTest, AesCtrSp80038aTestVector) {
+ std::vector<uint32_t> InvalidSizes = InvalidKeySizes(Algorithm::AES);
for (size_t i = 0; i < 3; i++) {
const AesCtrSp80038aTestVector& test(kAesCtrSp80038aTestVectors[i]);
const string key = hex2str(test.key);
+ if (std::find(InvalidSizes.begin(), InvalidSizes.end(), (key.size() * 8)) !=
+ InvalidSizes.end())
+ continue;
const string nonce = hex2str(test.nonce);
const string plaintext = hex2str(test.plaintext);
const string ciphertext = hex2str(test.ciphertext);
@@ -3008,6 +3027,7 @@
* 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 +3039,7 @@
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 +3061,11 @@
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 +3121,6 @@
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
@@ -3811,7 +3831,7 @@
TEST_F(AttestationTest, RsaAttestation) {
ASSERT_EQ(ErrorCode::OK, GenerateKey(AuthorizationSetBuilder()
.Authorization(TAG_NO_AUTH_REQUIRED)
- .RsaSigningKey(1024, 65537)
+ .RsaSigningKey(2048, 65537)
.Digest(Digest::NONE)
.Padding(PaddingMode::NONE)
.Authorization(TAG_INCLUDE_UNIQUE_ID)));
@@ -3827,7 +3847,7 @@
EXPECT_TRUE(verify_attestation_record("challenge", "foo", //
key_characteristics_.softwareEnforced, //
key_characteristics_.hardwareEnforced, //
- cert_chain[0]));
+ SecLevel(), cert_chain[0]));
}
/*
@@ -3838,7 +3858,7 @@
TEST_F(AttestationTest, RsaAttestationRequiresAppId) {
ASSERT_EQ(ErrorCode::OK, GenerateKey(AuthorizationSetBuilder()
.Authorization(TAG_NO_AUTH_REQUIRED)
- .RsaSigningKey(1024, 65537)
+ .RsaSigningKey(2048, 65537)
.Digest(Digest::NONE)
.Padding(PaddingMode::NONE)
.Authorization(TAG_INCLUDE_UNIQUE_ID)));
@@ -3874,7 +3894,7 @@
EXPECT_TRUE(verify_attestation_record("challenge", "foo", //
key_characteristics_.softwareEnforced, //
key_characteristics_.hardwareEnforced, //
- cert_chain[0]));
+ SecLevel(), cert_chain[0]));
}
/*
@@ -3949,7 +3969,7 @@
*/
TEST_F(KeyDeletionTest, DeleteKey) {
ASSERT_EQ(ErrorCode::OK, GenerateKey(AuthorizationSetBuilder()
- .RsaSigningKey(1024, 65537)
+ .RsaSigningKey(2048, 65537)
.Digest(Digest::NONE)
.Padding(PaddingMode::NONE)
.Authorization(TAG_NO_AUTH_REQUIRED)));
@@ -3993,7 +4013,7 @@
TEST_F(KeyDeletionTest, DeleteInvalidKey) {
// Generate key just to check if rollback protection is implemented
ASSERT_EQ(ErrorCode::OK, GenerateKey(AuthorizationSetBuilder()
- .RsaSigningKey(1024, 65537)
+ .RsaSigningKey(2048, 65537)
.Digest(Digest::NONE)
.Padding(PaddingMode::NONE)
.Authorization(TAG_NO_AUTH_REQUIRED)));
@@ -4032,7 +4052,7 @@
TEST_F(KeyDeletionTest, DeleteAllKeys) {
if (!arm_deleteAllKeys) return;
ASSERT_EQ(ErrorCode::OK, GenerateKey(AuthorizationSetBuilder()
- .RsaSigningKey(1024, 65537)
+ .RsaSigningKey(2048, 65537)
.Digest(Digest::NONE)
.Padding(PaddingMode::NONE)
.Authorization(TAG_NO_AUTH_REQUIRED)));
diff --git a/media/1.0/Android.bp b/media/1.0/Android.bp
index c5d49b6..45fedb9 100644
--- a/media/1.0/Android.bp
+++ b/media/1.0/Android.bp
@@ -17,6 +17,6 @@
"AnwBufferAttributes",
"Rect",
],
- gen_java: false,
+ gen_java: true,
}
diff --git a/power/1.3/Android.bp b/power/1.3/Android.bp
index 65b7597..1869b56 100644
--- a/power/1.3/Android.bp
+++ b/power/1.3/Android.bp
@@ -3,6 +3,9 @@
hidl_interface {
name: "android.hardware.power@1.3",
root: "android.hardware",
+ vndk: {
+ enabled: true,
+ },
srcs: [
"types.hal",
"IPower.hal",
diff --git a/radio/1.0/types.hal b/radio/1.0/types.hal
index ab1834b..17718e0 100644
--- a/radio/1.0/types.hal
+++ b/radio/1.0/types.hal
@@ -1500,9 +1500,10 @@
};
struct CellIdentityGsm {
- string mcc; // 3-digit Mobile Country Code, 0..999, INT_MAX if unknown
- string mnc; // 2 or 3-digit Mobile Network Code, 0..999, INT_MAX if
+ string mcc; // 3-digit Mobile Country Code, 0..999, empty string if
// unknown
+ string mnc; // 2 or 3-digit Mobile Network Code, 0..999, empty string
+ // if unknown
int32_t lac; // 16-bit Location Area Code, 0..65535, INT_MAX if unknown
int32_t cid; // 16-bit GSM Cell Identity described in
// TS 27.007, 0..65535, INT_MAX if unknown
@@ -1512,8 +1513,9 @@
};
struct CellIdentityWcdma {
- string mcc; // 3-digit Mobile Country Code, 0..999, INT_MAX if unknown
- string mnc; // 2 or 3-digit Mobile Network Code, 0..999, INT_MAX
+ string mcc; // 3-digit Mobile Country Code, 0..999, empty string if
+ // unknown
+ string mnc; // 2 or 3-digit Mobile Network Code, 0..999, empty string
// if unknown
int32_t lac; // 16-bit Location Area Code, 0..65535, INT_MAX if unknown
int32_t cid; // 28-bit UMTS Cell Identity described in
@@ -1541,9 +1543,10 @@
};
struct CellIdentityLte {
- string mcc; // 3-digit Mobile Country Code, 0..999, INT_MAX if unknown
- string mnc; // 2 or 3-digit Mobile Network Code, 0..999, INT_MAX if
+ string mcc; // 3-digit Mobile Country Code, 0..999, empty string if
// unknown
+ string mnc; // 2 or 3-digit Mobile Network Code, 0..999, empty string
+ // if unknown
int32_t ci; // 28-bit Cell Identity described in TS TS 27.007, INT_MAX
// if unknown
int32_t pci; // physical cell id 0..503; this value must be valid
@@ -1553,9 +1556,10 @@
};
struct CellIdentityTdscdma {
- string mcc; // 3-digit Mobile Country Code, 0..999, INT_MAX if unknown
- string mnc; // 2 or 3-digit Mobile Network Code, 0..999, INT_MAX if
+ string mcc; // 3-digit Mobile Country Code, 0..999, empty string if
// unknown
+ string mnc; // 2 or 3-digit Mobile Network Code, 0..999, empty string
+ // if unknown
int32_t lac; // 16-bit Location Area Code, 0..65535, INT_MAX if
// unknown
int32_t cid; // 28-bit UMTS Cell Identity described in
diff --git a/radio/1.0/vts/functional/radio_hidl_hal_data.cpp b/radio/1.0/vts/functional/radio_hidl_hal_data.cpp
index 4f10f11..eaef3ed 100644
--- a/radio/1.0/vts/functional/radio_hidl_hal_data.cpp
+++ b/radio/1.0/vts/functional/radio_hidl_hal_data.cpp
@@ -32,6 +32,67 @@
if (cardStatus.cardState == CardState::ABSENT) {
EXPECT_EQ(RadioError::NONE, radioRsp->rspInfo.error);
+ } else if (cardStatus.cardState == CardState::PRESENT) {
+ ASSERT_TRUE(CheckAnyOfErrors(
+ radioRsp->rspInfo.error,
+ {RadioError::NONE, RadioError::NOT_PROVISIONED, RadioError::CANCELLED}));
+
+ // Check the mcc [0, 999] and mnc [0, 999].
+ string hidl_mcc;
+ string hidl_mnc;
+ bool checkMccMnc = true;
+ int totalIdentitySizeExpected = 1;
+ CellIdentity cellIdentities = radioRsp->dataRegResp.cellIdentity;
+ CellInfoType cellInfoType = cellIdentities.cellInfoType;
+
+ if (cellInfoType == CellInfoType::NONE) {
+ // All the fields are 0
+ totalIdentitySizeExpected = 0;
+ checkMccMnc = false;
+ } else if (cellInfoType == CellInfoType::GSM) {
+ EXPECT_EQ(1, cellIdentities.cellIdentityGsm.size());
+ CellIdentityGsm cig = cellIdentities.cellIdentityGsm[0];
+ hidl_mcc = cig.mcc;
+ hidl_mnc = cig.mnc;
+ } else if (cellInfoType == CellInfoType::LTE) {
+ EXPECT_EQ(1, cellIdentities.cellIdentityLte.size());
+ CellIdentityLte cil = cellIdentities.cellIdentityLte[0];
+ hidl_mcc = cil.mcc;
+ hidl_mnc = cil.mnc;
+ } else if (cellInfoType == CellInfoType::WCDMA) {
+ EXPECT_EQ(1, cellIdentities.cellIdentityWcdma.size());
+ CellIdentityWcdma ciw = cellIdentities.cellIdentityWcdma[0];
+ hidl_mcc = ciw.mcc;
+ hidl_mnc = ciw.mnc;
+ } else if (cellInfoType == CellInfoType::TD_SCDMA) {
+ EXPECT_EQ(1, cellIdentities.cellIdentityTdscdma.size());
+ CellIdentityTdscdma cit = cellIdentities.cellIdentityTdscdma[0];
+ hidl_mcc = cit.mcc;
+ hidl_mnc = cit.mnc;
+ } else {
+ // CellIndentityCdma has no mcc and mnc.
+ EXPECT_EQ(CellInfoType::CDMA, cellInfoType);
+ EXPECT_EQ(1, cellIdentities.cellIdentityCdma.size());
+ checkMccMnc = false;
+ }
+
+ // Check only one CellIdentity is size 1, and others must be 0.
+ EXPECT_EQ(totalIdentitySizeExpected, cellIdentities.cellIdentityGsm.size() +
+ cellIdentities.cellIdentityCdma.size() +
+ cellIdentities.cellIdentityLte.size() +
+ cellIdentities.cellIdentityWcdma.size() +
+ cellIdentities.cellIdentityTdscdma.size());
+
+ if (checkMccMnc) {
+ // 32 bit system gets result: "\xff\xff\xff..." from RIL, which is not testable. Only
+ // test for 64 bit here. TODO: remove this limit after b/113181277 being fixed.
+ if (hidl_mcc.size() < 4 && hidl_mnc.size() < 4) {
+ int mcc = stoi(hidl_mcc);
+ int mnc = stoi(hidl_mnc);
+ EXPECT_TRUE(mcc >= 0 && mcc <= 999);
+ EXPECT_TRUE(mnc >= 0 && mnc <= 999);
+ }
+ }
}
}
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 10d45b6..3499762 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 @@
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 @@
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));
}
}
diff --git a/radio/1.0/vts/functional/radio_hidl_hal_utils_v1_0.h b/radio/1.0/vts/functional/radio_hidl_hal_utils_v1_0.h
index f5ce072..23bc434 100644
--- a/radio/1.0/vts/functional/radio_hidl_hal_utils_v1_0.h
+++ b/radio/1.0/vts/functional/radio_hidl_hal_utils_v1_0.h
@@ -60,6 +60,9 @@
uint32_t writeSmsToSimIndex;
uint32_t writeSmsToRuimIndex;
+ // Data
+ DataRegStateResult dataRegResp;
+
RadioResponse(RadioHidlTest& parent);
virtual ~RadioResponse() = default;
diff --git a/radio/1.0/vts/functional/radio_response.cpp b/radio/1.0/vts/functional/radio_response.cpp
index 93d5557..f3938a9 100644
--- a/radio/1.0/vts/functional/radio_response.cpp
+++ b/radio/1.0/vts/functional/radio_response.cpp
@@ -157,8 +157,9 @@
}
Return<void> RadioResponse::getDataRegistrationStateResponse(
- const RadioResponseInfo& info, const DataRegStateResult& /*dataRegResponse*/) {
+ const RadioResponseInfo& info, const DataRegStateResult& dataRegResponse) {
rspInfo = info;
+ dataRegResp = dataRegResponse;
parent.notify(info.serial);
return Void();
}
diff --git a/radio/1.0/vts/functional/vts_test_util.cpp b/radio/1.0/vts/functional/vts_test_util.cpp
index 7d15f35..ec96e5f 100644
--- a/radio/1.0/vts/functional/vts_test_util.cpp
+++ b/radio/1.0/vts/functional/vts_test_util.cpp
@@ -53,4 +53,4 @@
}
}
return testing::AssertionFailure() << "SapError:" + toString(err) + " is returned";
-}
+}
\ No newline at end of file
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 40759a6..33347c5 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,17 @@
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();
- }
- if (radioRsp_v1_1->rspInfo.error == RadioError::NONE) {
+ /* Set 2 seconds as interval to check card status */
+ sleep(2);
+ updateSimCardStatus();
+ }
EXPECT_EQ(CardState::ABSENT, cardStatus.cardState);
}
@@ -65,7 +65,7 @@
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/vts/functional/radio_hidl_hal_api.cpp b/radio/1.2/vts/functional/radio_hidl_hal_api.cpp
index 3510163..730d969 100644
--- a/radio/1.2/vts/functional/radio_hidl_hal_api.cpp
+++ b/radio/1.2/vts/functional/radio_hidl_hal_api.cpp
@@ -753,6 +753,56 @@
ASSERT_TRUE(CheckAnyOfErrors(
radioRsp_v1_2->rspInfo.error,
{RadioError::NONE, RadioError::RADIO_NOT_AVAILABLE, RadioError::NOT_PROVISIONED}));
+
+ // Check the mcc [0, 999] and mnc [0, 999].
+ string hidl_mcc;
+ string hidl_mnc;
+ int totalIdentitySizeExpected = 1;
+ ::android::hardware::radio::V1_2::CellIdentity cellIdentities =
+ radioRsp_v1_2->dataRegResp.cellIdentity;
+ CellInfoType cellInfoType = cellIdentities.cellInfoType;
+
+ if (cellInfoType == CellInfoType::NONE) {
+ // All the fields are 0
+ totalIdentitySizeExpected = 0;
+ } else if (cellInfoType == CellInfoType::GSM) {
+ EXPECT_EQ(1, cellIdentities.cellIdentityGsm.size());
+ ::android::hardware::radio::V1_2::CellIdentityGsm cig = cellIdentities.cellIdentityGsm[0];
+ hidl_mcc = cig.base.mcc;
+ hidl_mnc = cig.base.mnc;
+ } else if (cellInfoType == CellInfoType::LTE) {
+ EXPECT_EQ(1, cellIdentities.cellIdentityLte.size());
+ ::android::hardware::radio::V1_2::CellIdentityLte cil = cellIdentities.cellIdentityLte[0];
+ hidl_mcc = cil.base.mcc;
+ hidl_mnc = cil.base.mnc;
+ } else if (cellInfoType == CellInfoType::WCDMA) {
+ EXPECT_EQ(1, cellIdentities.cellIdentityWcdma.size());
+ ::android::hardware::radio::V1_2::CellIdentityWcdma ciw =
+ cellIdentities.cellIdentityWcdma[0];
+ hidl_mcc = ciw.base.mcc;
+ hidl_mnc = ciw.base.mnc;
+ } else if (cellInfoType == CellInfoType::TD_SCDMA) {
+ EXPECT_EQ(1, cellIdentities.cellIdentityTdscdma.size());
+ ::android::hardware::radio::V1_2::CellIdentityTdscdma cit =
+ cellIdentities.cellIdentityTdscdma[0];
+ hidl_mcc = cit.base.mcc;
+ hidl_mnc = cit.base.mnc;
+ } else {
+ // CellIndentityCdma has no mcc and mnc.
+ EXPECT_EQ(CellInfoType::CDMA, cellInfoType);
+ EXPECT_EQ(1, cellIdentities.cellIdentityCdma.size());
+ }
+
+ // Check only one CellIdentity is size 1, and others must be 0.
+ EXPECT_EQ(totalIdentitySizeExpected,
+ cellIdentities.cellIdentityGsm.size() + cellIdentities.cellIdentityCdma.size() +
+ cellIdentities.cellIdentityLte.size() + cellIdentities.cellIdentityWcdma.size() +
+ cellIdentities.cellIdentityTdscdma.size());
+
+ int mcc = stoi(hidl_mcc);
+ int mnc = stoi(hidl_mnc);
+ EXPECT_TRUE(mcc >= 0 && mcc <= 999);
+ EXPECT_TRUE(mnc >= 0 && mnc <= 999);
}
/*
diff --git a/radio/1.2/vts/functional/radio_hidl_hal_utils_v1_2.h b/radio/1.2/vts/functional/radio_hidl_hal_utils_v1_2.h
index 4712202..2e65bfb 100644
--- a/radio/1.2/vts/functional/radio_hidl_hal_utils_v1_2.h
+++ b/radio/1.2/vts/functional/radio_hidl_hal_utils_v1_2.h
@@ -56,6 +56,9 @@
RadioResponseInfo rspInfo;
+ // Data
+ ::android::hardware::radio::V1_2::DataRegStateResult dataRegResp;
+
RadioResponse_v1_2(RadioHidlTest_v1_2& parent_v1_2);
virtual ~RadioResponse_v1_2() = default;
diff --git a/radio/1.2/vts/functional/radio_response.cpp b/radio/1.2/vts/functional/radio_response.cpp
index c5c7b14..e91a557 100644
--- a/radio/1.2/vts/functional/radio_response.cpp
+++ b/radio/1.2/vts/functional/radio_response.cpp
@@ -756,8 +756,9 @@
Return<void> RadioResponse_v1_2::getDataRegistrationStateResponse_1_2(
const RadioResponseInfo& info,
- const ::android::hardware::radio::V1_2::DataRegStateResult& /*dataRegResponse*/) {
+ const ::android::hardware::radio::V1_2::DataRegStateResult& dataRegResponse) {
rspInfo = info;
+ dataRegResp = dataRegResponse;
parent_v1_2.notify(info.serial);
return Void();
}
diff --git a/tetheroffload/config/1.0/Android.bp b/tetheroffload/config/1.0/Android.bp
index 9d0dc5f..f20d77c 100644
--- a/tetheroffload/config/1.0/Android.bp
+++ b/tetheroffload/config/1.0/Android.bp
@@ -12,6 +12,6 @@
interfaces: [
"android.hidl.base@1.0",
],
- gen_java: false,
+ gen_java: true,
}
diff --git a/wifi/1.2/vts/functional/VtsHalWifiV1_2TargetTest.cpp b/wifi/1.2/vts/functional/VtsHalWifiV1_2TargetTest.cpp
index cfad208..c765cdc 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() {