Merge "Restore kernel requirements for frozen matrices." into pi-dev
diff --git a/audio/4.0/config/audio_policy_configuration.xsd b/audio/4.0/config/audio_policy_configuration.xsd
index 14e4fd6..ee17fc9 100644
--- a/audio/4.0/config/audio_policy_configuration.xsd
+++ b/audio/4.0/config/audio_policy_configuration.xsd
@@ -525,6 +525,7 @@
<xs:enumeration value="DEVICE_CATEGORY_SPEAKER"/>
<xs:enumeration value="DEVICE_CATEGORY_EARPIECE"/>
<xs:enumeration value="DEVICE_CATEGORY_EXT_MEDIA"/>
+ <xs:enumeration value="DEVICE_CATEGORY_HEARING_AID"/>
</xs:restriction>
</xs:simpleType>
<xs:complexType name="volume">
diff --git a/audio/common/all-versions/test/utility/include/utility/PrettyPrintAudioTypes.h b/audio/common/all-versions/test/utility/include/utility/PrettyPrintAudioTypes.h
index 88a67e0..05239ac 100644
--- a/audio/common/all-versions/test/utility/include/utility/PrettyPrintAudioTypes.h
+++ b/audio/common/all-versions/test/utility/include/utility/PrettyPrintAudioTypes.h
@@ -47,7 +47,9 @@
namespace common {
namespace AUDIO_HAL_VERSION {
DEFINE_GTEST_PRINT_TO(AudioConfig)
+DEFINE_GTEST_PRINT_TO(AudioMode)
DEFINE_GTEST_PRINT_TO(AudioDevice)
+DEFINE_GTEST_PRINT_TO(AudioFormat)
DEFINE_GTEST_PRINT_TO(AudioChannelMask)
} // namespace AUDIO_HAL_VERSION
} // namespace common
diff --git a/audio/core/4.0/vts/functional/AudioPrimaryHidlHalTest.cpp b/audio/core/4.0/vts/functional/AudioPrimaryHidlHalTest.cpp
index 9484ddd..0bf32b5 100644
--- a/audio/core/4.0/vts/functional/AudioPrimaryHidlHalTest.cpp
+++ b/audio/core/4.0/vts/functional/AudioPrimaryHidlHalTest.cpp
@@ -55,6 +55,7 @@
using ::android::sp;
using ::android::hardware::Return;
using ::android::hardware::hidl_bitfield;
+using ::android::hardware::hidl_enum_iterator;
using ::android::hardware::hidl_handle;
using ::android::hardware::hidl_string;
using ::android::hardware::hidl_vec;
@@ -73,6 +74,7 @@
using ReadStatus = ::android::hardware::audio::V4_0::IStreamIn::ReadStatus;
using ::android::hardware::audio::V4_0::IStreamOut;
using ::android::hardware::audio::V4_0::IStreamOutCallback;
+using ::android::hardware::audio::V4_0::MicrophoneInfo;
using ::android::hardware::audio::V4_0::MmapBufferInfo;
using ::android::hardware::audio::V4_0::MmapPosition;
using ::android::hardware::audio::V4_0::ParameterValue;
@@ -81,6 +83,7 @@
using ::android::hardware::audio::V4_0::SinkMetadata;
using ::android::hardware::audio::common::V4_0::AudioChannelMask;
using ::android::hardware::audio::common::V4_0::AudioConfig;
+using ::android::hardware::audio::common::V4_0::AudioContentType;
using ::android::hardware::audio::common::V4_0::AudioDevice;
using ::android::hardware::audio::common::V4_0::AudioFormat;
using ::android::hardware::audio::common::V4_0::AudioHandleConsts;
@@ -91,6 +94,7 @@
using ::android::hardware::audio::common::V4_0::AudioOffloadInfo;
using ::android::hardware::audio::common::V4_0::AudioOutputFlag;
using ::android::hardware::audio::common::V4_0::AudioSource;
+using ::android::hardware::audio::common::V4_0::AudioUsage;
using ::android::hardware::audio::common::V4_0::ThreadInfo;
using ::android::hardware::audio::common::utils::mkBitfield;
@@ -140,11 +144,11 @@
sp<IDevicesFactory> AudioHidlTest::devicesFactory;
TEST_F(AudioHidlTest, GetAudioDevicesFactoryService) {
- doc::test("test the getService (called in SetUp)");
+ doc::test("Test the getService (called in SetUp)");
}
TEST_F(AudioHidlTest, OpenDeviceInvalidParameter) {
- doc::test("test passing an invalid parameter to openDevice");
+ doc::test("Test passing an invalid parameter to openDevice");
Result result;
sp<IDevice> device;
ASSERT_OK(devicesFactory->openDevice("Non existing device", returnIn(result, device)));
@@ -152,6 +156,19 @@
ASSERT_TRUE(device == nullptr);
}
+TEST_F(AudioHidlTest, OpenPrimaryDeviceUsingGetDevice) {
+ doc::test("Calling openDevice(\"primary\") should return the primary device.");
+ Result result;
+ sp<IDevice> baseDevice;
+ ASSERT_OK(devicesFactory->openDevice("primary", returnIn(result, baseDevice)));
+ ASSERT_OK(result);
+ ASSERT_TRUE(baseDevice != nullptr);
+
+ Return<sp<IPrimaryDevice>> primaryDevice = IPrimaryDevice::castFrom(baseDevice);
+ ASSERT_TRUE(primaryDevice.isOk());
+ ASSERT_TRUE(sp<IPrimaryDevice>(primaryDevice) != nullptr);
+}
+
//////////////////////////////////////////////////////////////////////////////
/////////////////////////////// openDevice primary ///////////////////////////
//////////////////////////////////////////////////////////////////////////////
@@ -165,14 +182,11 @@
if (device == nullptr) {
Result result;
- sp<IDevice> baseDevice;
- ASSERT_OK(devicesFactory->openDevice("primary", returnIn(result, baseDevice)));
+ ASSERT_OK(devicesFactory->openPrimaryDevice(returnIn(result, device)));
ASSERT_OK(result);
- ASSERT_TRUE(baseDevice != nullptr);
+ ASSERT_TRUE(device != nullptr);
environment->registerTearDown([] { device.clear(); });
- device = IPrimaryDevice::castFrom(baseDevice);
- ASSERT_TRUE(device != nullptr);
}
}
@@ -465,6 +479,17 @@
}
//////////////////////////////////////////////////////////////////////////////
+/////////////////////////////// getMicrophones ///////////////////////////////
+//////////////////////////////////////////////////////////////////////////////
+
+TEST_F(AudioPrimaryHidlTest, GetMicrophonesTest) {
+ doc::test("Make sure getMicrophones always succeeds");
+ hidl_vec<MicrophoneInfo> microphones;
+ ASSERT_OK(device->getMicrophones(returnIn(res, microphones)));
+ ASSERT_OK(res);
+}
+
+//////////////////////////////////////////////////////////////////////////////
//////////////////////////////// debugDebug //////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
@@ -600,13 +625,17 @@
const AudioConfig& config = GetParam();
// TODO: test all flag combination
auto flags = hidl_bitfield<AudioOutputFlag>(AudioOutputFlag::NONE);
- SourceMetadata metadata = {{{}}}; // create on track metadata
testOpen(
[&](AudioIoHandle handle, AudioConfig config, auto cb) {
- return device->openOutputStream(handle, address, config, flags, metadata, cb);
+ return device->openOutputStream(handle, address, config, flags, initialMetadata,
+ cb);
},
config);
}
+
+ protected:
+ const SourceMetadata initialMetadata = {
+ {{AudioUsage::MEDIA, AudioContentType::MUSIC, 1 /* gain */}}};
};
TEST_P(OutputStreamTest, OpenOutputStreamTest) {
doc::test(
@@ -637,13 +666,15 @@
const AudioConfig& config = GetParam();
// TODO: test all supported flags and source
auto flags = hidl_bitfield<AudioInputFlag>(AudioInputFlag::NONE);
- SinkMetadata metadata = {{{AudioSource::DEFAULT, 1}}};
testOpen(
[&](AudioIoHandle handle, AudioConfig config, auto cb) {
- return device->openInputStream(handle, address, config, flags, metadata, cb);
+ return device->openInputStream(handle, address, config, flags, initialMetadata, cb);
},
config);
}
+
+ protected:
+ const SinkMetadata initialMetadata = {{{AudioSource::DEFAULT, 1 /* gain */}}};
};
TEST_P(InputStreamTest, OpenInputStreamTest) {
@@ -727,11 +758,12 @@
ASSERT_OK(ret);
if (currentMustBeSupported) {
+ ASSERT_NE(0U, capabilities.size()) << name << " must not return an empty list";
Property currentValue = extract((stream->*getter)());
- EXPECT_NE(std::find(capabilities.begin(), capabilities.end(), currentValue),
- capabilities.end())
- << "current " << name << " is not in the list of the supported ones "
- << toString(capabilities);
+ EXPECT_TRUE(std::find(capabilities.begin(), capabilities.end(), currentValue) !=
+ capabilities.end())
+ << "value returned by " << name << "() = " << testing::PrintToString(currentValue)
+ << " is not in the list of the supported ones " << toString(capabilities);
}
// Check that all declared supported values are indeed supported
@@ -757,7 +789,7 @@
hidl_vec<hidl_bitfield<AudioChannelMask>>& channels) {
Result res;
EXPECT_OK(
- stream->getSupportedSampleRates(extract(stream->getFormat()), returnIn(res, channels)));
+ stream->getSupportedChannelMasks(extract(stream->getFormat()), returnIn(res, channels)));
return res;
}
@@ -1039,8 +1071,38 @@
ASSERT_RESULT(invalidStateOrNotSupported, res);
}
+TEST_P(InputStreamTest, updateSinkMetadata) {
+ doc::test("The HAL should not crash on metadata change");
+
+ hidl_enum_iterator<AudioSource> range;
+ // Test all possible track configuration
+ for (AudioSource source : range) {
+ for (float volume : {0.0, 0.5, 1.0}) {
+ const SinkMetadata metadata = {{{source, volume}}};
+ ASSERT_OK(stream->updateSinkMetadata(metadata))
+ << "source=" << toString(source) << ", volume=" << volume;
+ }
+ }
+
+ // Do not test concurrent capture as this is not officially supported
+
+ // Set no metadata as if all stream track had stopped
+ ASSERT_OK(stream->updateSinkMetadata({}));
+
+ // Restore initial
+ ASSERT_OK(stream->updateSinkMetadata(initialMetadata));
+}
+
+TEST_P(InputStreamTest, getActiveMicrophones) {
+ doc::test("Getting active microphones should always succeed");
+ hidl_vec<MicrophoneInfo> microphones;
+ ASSERT_OK(device->getMicrophones(returnIn(res, microphones)));
+ ASSERT_OK(res);
+ ASSERT_TRUE(microphones.size() > 0);
+}
+
//////////////////////////////////////////////////////////////////////////////
-///////////////////////////////// StreamIn ///////////////////////////////////
+///////////////////////////////// StreamOut //////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
TEST_P(OutputStreamTest, getLatency) {
@@ -1195,7 +1257,7 @@
doc::partialTest("The output stream does not support pause");
return;
}
- ASSERT_RESULT(Result::INVALID_STATE, stream->resume());
+ ASSERT_RESULT(Result::INVALID_STATE, stream->pause());
}
static void testDrain(IStreamOut* stream, AudioDrain type) {
@@ -1261,6 +1323,37 @@
ASSERT_RESULT(okOrNotSupported, stream->selectPresentation(0, 0));
}
+TEST_P(OutputStreamTest, updateSourceMetadata) {
+ doc::test("The HAL should not crash on metadata change");
+
+ hidl_enum_iterator<AudioUsage> usageRange;
+ hidl_enum_iterator<AudioContentType> contentRange;
+ // Test all possible track configuration
+ for (auto usage : usageRange) {
+ for (auto content : contentRange) {
+ for (float volume : {0.0, 0.5, 1.0}) {
+ const SourceMetadata metadata = {{{usage, content, volume}}};
+ ASSERT_OK(stream->updateSourceMetadata(metadata))
+ << "usage=" << toString(usage) << ", content=" << toString(content)
+ << ", volume=" << volume;
+ }
+ }
+ }
+
+ // Set many track of different configuration
+ ASSERT_OK(stream->updateSourceMetadata(
+ {{{AudioUsage::MEDIA, AudioContentType::MUSIC, 0.1},
+ {AudioUsage::VOICE_COMMUNICATION, AudioContentType::SPEECH, 1.0},
+ {AudioUsage::ALARM, AudioContentType::SONIFICATION, 0.0},
+ {AudioUsage::ASSISTANT, AudioContentType::UNKNOWN, 0.3}}}));
+
+ // Set no metadata as if all stream track had stopped
+ ASSERT_OK(stream->updateSourceMetadata({}));
+
+ // Restore initial
+ ASSERT_OK(stream->updateSourceMetadata(initialMetadata));
+}
+
//////////////////////////////////////////////////////////////////////////////
/////////////////////////////// PrimaryDevice ////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
@@ -1271,19 +1364,16 @@
}
TEST_F(AudioPrimaryHidlTest, setMode) {
- doc::test(
- "Make sure setMode always succeeds if mode is valid "
- "and fails otherwise");
+ doc::test("Make sure setMode always succeeds if mode is valid and fails otherwise");
// Test Invalid values
- for (int mode : {-1, 0, int(AudioMode::IN_COMMUNICATION) + 1}) {
- SCOPED_TRACE("mode=" + to_string(mode));
- ASSERT_RESULT(Result::INVALID_ARGUMENTS, device->setMode(AudioMode(mode)));
+ for (int mode : {-2, -1, int(AudioMode::IN_COMMUNICATION) + 1}) {
+ ASSERT_RESULT(Result::INVALID_ARGUMENTS, device->setMode(AudioMode(mode)))
+ << "mode=" << mode;
}
// Test valid values
for (AudioMode mode : {AudioMode::IN_CALL, AudioMode::IN_COMMUNICATION, AudioMode::RINGTONE,
AudioMode::NORMAL /* Make sure to leave the test in normal mode */}) {
- SCOPED_TRACE("mode=" + toString(mode));
- ASSERT_OK(device->setMode(mode));
+ ASSERT_OK(device->setMode(mode)) << "mode=" << toString(mode);
}
}
diff --git a/audio/core/all-versions/default/include/core/all-versions/default/Device.impl.h b/audio/core/all-versions/default/include/core/all-versions/default/Device.impl.h
index 37b7124..230b8de 100644
--- a/audio/core/all-versions/default/include/core/all-versions/default/Device.impl.h
+++ b/audio/core/all-versions/default/include/core/all-versions/default/Device.impl.h
@@ -41,23 +41,7 @@
}
Result Device::analyzeStatus(const char* funcName, int status) {
- if (status != 0) {
- ALOGW("Device %p %s: %s", mDevice, funcName, strerror(-status));
- }
- switch (status) {
- case 0:
- return Result::OK;
- case -EINVAL:
- return Result::INVALID_ARGUMENTS;
- case -ENODATA:
- return Result::INVALID_STATE;
- case -ENODEV:
- return Result::NOT_INITIALIZED;
- case -ENOSYS:
- return Result::NOT_SUPPORTED;
- default:
- return Result::INVALID_STATE;
- }
+ return util::analyzeStatus("Device", funcName, status);
}
void Device::closeInputStream(audio_stream_in_t* stream) {
diff --git a/audio/core/all-versions/default/include/core/all-versions/default/Stream.impl.h b/audio/core/all-versions/default/include/core/all-versions/default/Stream.impl.h
index 7415112..72d7a37 100644
--- a/audio/core/all-versions/default/include/core/all-versions/default/Stream.impl.h
+++ b/audio/core/all-versions/default/include/core/all-versions/default/Stream.impl.h
@@ -101,11 +101,15 @@
halSampleRates =
samplingRatesFromString(halListValue.string(), AudioParameter::valueListSeparator);
sampleRates.setToExternal(halSampleRates.editArray(), halSampleRates.size());
+ // Legacy get_parameter does not return a status_t, thus can not advertise of failure.
+ // Note that this method must succeed (non empty list) if the format is supported.
+ if (sampleRates.size() == 0) {
+ result = Result::NOT_SUPPORTED;
+ }
}
#ifdef AUDIO_HAL_VERSION_2_0
_hidl_cb(sampleRates);
-#endif
-#ifdef AUDIO_HAL_VERSION_4_0
+#elif AUDIO_HAL_VERSION_4_0
_hidl_cb(result, sampleRates);
#endif
return Void();
@@ -126,6 +130,11 @@
for (size_t i = 0; i < halChannelMasks.size(); ++i) {
channelMasks[i] = AudioChannelBitfield(halChannelMasks[i]);
}
+ // Legacy get_parameter does not return a status_t, thus can not advertise of failure.
+ // Note that this method must succeed (non empty list) if the format is supported.
+ if (channelMasks.size() == 0) {
+ result = Result::NOT_SUPPORTED;
+ }
}
#ifdef AUDIO_HAL_VERSION_2_0
_hidl_cb(channelMasks);
diff --git a/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultConfig.h b/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultConfig.h
index 56813ce..48ee1bb 100644
--- a/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultConfig.h
+++ b/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultConfig.h
@@ -242,17 +242,18 @@
},
.initialValue = {.int32Values = {0, 0, 0}}},
- {.config =
- {
- .prop = toInt(VehicleProperty::HVAC_POWER_ON),
- .access = VehiclePropertyAccess::READ_WRITE,
- .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
- .areaConfigs = {VehicleAreaConfig{
- .areaId = (VehicleAreaSeat::ROW_1_LEFT | VehicleAreaSeat::ROW_1_RIGHT)}},
- // TODO(bryaneyler): Ideally, this is generated dynamically from
- // kHvacPowerProperties.
- .configString = "0x12400500,0x12400501" // HVAC_FAN_SPEED,HVAC_FAN_DIRECTION
- },
+ {.config = {.prop = toInt(VehicleProperty::HVAC_POWER_ON),
+ .access = VehiclePropertyAccess::READ_WRITE,
+ .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
+ .areaConfigs = {VehicleAreaConfig{
+ .areaId = (VehicleAreaSeat::ROW_1_LEFT | VehicleAreaSeat::ROW_1_RIGHT)}},
+ // TODO(bryaneyler): Ideally, this is generated dynamically from
+ // kHvacPowerProperties.
+ .configArray =
+ {
+ 0x12400500, // HVAC_FAN_SPEED
+ 0x12400501 // HVAC_FAN_DIRECTION
+ }},
.initialValue = {.int32Values = {1}}},
{
diff --git a/automotive/vehicle/2.0/types.hal b/automotive/vehicle/2.0/types.hal
index 12e2257..d4e4d46 100644
--- a/automotive/vehicle/2.0/types.hal
+++ b/automotive/vehicle/2.0/types.hal
@@ -2003,30 +2003,32 @@
/**
* Used by INFO_EV_CONNECTOR_TYPE to enumerate the type of connectors
- * available to charge the vehicle. Consistent with projection protocol.
+ * available to charge the vehicle.
*/
enum EvConnectorType : int32_t {
/**
* Default type if the vehicle does not know or report the EV connector
* type.
*/
- EV_CONNECTOR_TYPE_UNKNOWN = 0,
- EV_CONNECTOR_TYPE_J1772 = 1,
- EV_CONNECTOR_TYPE_MENNEKES = 2,
- EV_CONNECTOR_TYPE_CHADEMO = 3,
- EV_CONNECTOR_TYPE_COMBO_1 = 4,
- EV_CONNECTOR_TYPE_COMBO_2 = 5,
- EV_CONNECTOR_TYPE_TESLA_ROADSTER = 6,
- EV_CONNECTOR_TYPE_TESLA_HPWC = 7,
- EV_CONNECTOR_TYPE_TESLA_SUPERCHARGER = 8,
- EV_CONNECTOR_TYPE_GBT = 9,
+ UNKNOWN = 0,
+ IEC_TYPE_1_AC = 1, // aka Yazaki
+ IEC_TYPE_2_AC = 2, // aka Mennekes
+ IEC_TYPE_3_AC = 3, // aka Scame
+ IEC_TYPE_4_DC = 4, // aka CHAdeMO
+ IEC_TYPE_1_CCS_DC = 5, // aka Combo 1
+ IEC_TYPE_2_CCS_DC = 6, // aka Combo 2
+ TESLA_ROADSTER = 7,
+ TESLA_HPWC = 8,
+ TESLA_SUPERCHARGER = 9,
+ GBT_AC = 10,
+ GBT_DC = 11,
/**
* Connector type to use when no other types apply. Before using this
* value, work with Google to see if the EvConnectorType enum can be
* extended with an appropriate value.
*/
- EV_CONNECTOR_TYPE_OTHER = 101,
+ OTHER = 101,
};
/**
diff --git a/camera/device/3.2/default/CameraDeviceSession.cpp b/camera/device/3.2/default/CameraDeviceSession.cpp
index 60a57cd..1cef882 100644
--- a/camera/device/3.2/default/CameraDeviceSession.cpp
+++ b/camera/device/3.2/default/CameraDeviceSession.cpp
@@ -393,7 +393,11 @@
return;
}
- mCallback->notify(batch->mShutterMsgs);
+ auto ret = mCallback->notify(batch->mShutterMsgs);
+ if (!ret.isOk()) {
+ ALOGE("%s: notify shutter transaction failed: %s",
+ __FUNCTION__, ret.description().c_str());
+ }
batch->mShutterDelivered = true;
batch->mShutterMsgs.clear();
}
@@ -563,7 +567,11 @@
}
void CameraDeviceSession::ResultBatcher::notifySingleMsg(NotifyMsg& msg) {
- mCallback->notify({msg});
+ auto ret = mCallback->notify({msg});
+ if (!ret.isOk()) {
+ ALOGE("%s: notify transaction failed: %s",
+ __FUNCTION__, ret.description().c_str());
+ }
return;
}
@@ -654,7 +662,11 @@
}
}
}
- mCallback->processCaptureResult(results);
+ auto ret = mCallback->processCaptureResult(results);
+ if (!ret.isOk()) {
+ ALOGE("%s: processCaptureResult transaction failed: %s",
+ __FUNCTION__, ret.description().c_str());
+ }
mProcessCaptureResultLock.unlock();
}
diff --git a/confirmationui/1.0/default/PlatformSpecifics.cpp b/confirmationui/1.0/default/PlatformSpecifics.cpp
index dd039e2..03d6165 100644
--- a/confirmationui/1.0/default/PlatformSpecifics.cpp
+++ b/confirmationui/1.0/default/PlatformSpecifics.cpp
@@ -36,11 +36,11 @@
}
}
-support::NullOr<support::array<uint8_t, 32>> HMacImplementation::hmac256(
- const uint8_t key[32], std::initializer_list<support::ByteBufferProxy> buffers) {
+support::NullOr<support::hmac_t> HMacImplementation::hmac256(
+ const support::auth_token_key_t& key, std::initializer_list<support::ByteBufferProxy> buffers) {
HMAC_CTX hmacCtx;
HMAC_CTX_init(&hmacCtx);
- if (!HMAC_Init_ex(&hmacCtx, key, 32, EVP_sha256(), nullptr)) {
+ if (!HMAC_Init_ex(&hmacCtx, key.data(), key.size(), EVP_sha256(), nullptr)) {
return {};
}
for (auto& buffer : buffers) {
@@ -48,7 +48,7 @@
return {};
}
}
- support::array<uint8_t, 32> result;
+ support::hmac_t result;
if (!HMAC_Final(&hmacCtx, result.data(), nullptr)) {
return {};
}
diff --git a/confirmationui/1.0/default/PlatformSpecifics.h b/confirmationui/1.0/default/PlatformSpecifics.h
index 488da6d..29f299c 100644
--- a/confirmationui/1.0/default/PlatformSpecifics.h
+++ b/confirmationui/1.0/default/PlatformSpecifics.h
@@ -48,8 +48,9 @@
class HMacImplementation {
public:
- static support::NullOr<support::array<uint8_t, 32>> hmac256(
- const uint8_t key[32], std::initializer_list<support::ByteBufferProxy> buffers);
+ static support::NullOr<support::hmac_t> hmac256(
+ const support::auth_token_key_t& key,
+ std::initializer_list<support::ByteBufferProxy> buffers);
};
class MyOperation : public generic::Operation<sp<IConfirmationResultCallback>,
diff --git a/confirmationui/1.0/vts/functional/VtsHalConfirmationUIV1_0TargetTest.cpp b/confirmationui/1.0/vts/functional/VtsHalConfirmationUIV1_0TargetTest.cpp
index 463bb40..278d1f4 100644
--- a/confirmationui/1.0/vts/functional/VtsHalConfirmationUIV1_0TargetTest.cpp
+++ b/confirmationui/1.0/vts/functional/VtsHalConfirmationUIV1_0TargetTest.cpp
@@ -46,13 +46,16 @@
namespace test {
namespace {
+const support::auth_token_key_t testKey(static_cast<uint8_t>(TestKeyBits::BYTE));
+
class HMacImplementation {
public:
- static support::NullOr<support::array<uint8_t, 32>> hmac256(
- const uint8_t key[32], std::initializer_list<support::ByteBufferProxy> buffers) {
+ static support::NullOr<support::hmac_t> hmac256(
+ const support::auth_token_key_t& key,
+ std::initializer_list<support::ByteBufferProxy> buffers) {
HMAC_CTX hmacCtx;
HMAC_CTX_init(&hmacCtx);
- if (!HMAC_Init_ex(&hmacCtx, key, 32, EVP_sha256(), nullptr)) {
+ if (!HMAC_Init_ex(&hmacCtx, key.data(), key.size(), EVP_sha256(), nullptr)) {
return {};
}
for (auto& buffer : buffers) {
@@ -60,7 +63,7 @@
return {};
}
}
- support::array<uint8_t, 32> result;
+ support::hmac_t result;
if (!HMAC_Final(&hmacCtx, result.data(), nullptr)) {
return {};
}
@@ -70,23 +73,15 @@
using HMacer = support::HMac<HMacImplementation>;
-constexpr uint8_t testKeyByte = static_cast<uint8_t>(TestKeyBits::BYTE);
-
template <typename... Data>
hidl_vec<uint8_t> testHMAC(const Data&... data) {
- constexpr uint8_t testKey[32] = {testKeyByte, testKeyByte, testKeyByte, testKeyByte,
- testKeyByte, testKeyByte, testKeyByte, testKeyByte,
- testKeyByte, testKeyByte, testKeyByte, testKeyByte,
- testKeyByte, testKeyByte, testKeyByte, testKeyByte};
- constexpr uint8_t hmac_size_bytes = sizeof testKey;
-
auto hmac = HMacer::hmac256(testKey, data...);
if (!hmac.isOk()) {
EXPECT_TRUE(false) << "Failed to compute test hmac. This is a self-test error.";
return {};
}
- hidl_vec<uint8_t> result(hmac_size_bytes);
- copy(hmac.value().data(), hmac.value().data() + hmac_size_bytes, result.data());
+ hidl_vec<uint8_t> result(hmac.value().size());
+ copy(hmac.value().data(), hmac.value().data() + hmac.value().size(), result.data());
return result;
}
diff --git a/confirmationui/support/include/android/hardware/confirmationui/1.0/generic/GenericOperation.h b/confirmationui/support/include/android/hardware/confirmationui/1.0/generic/GenericOperation.h
index b480942..b1c322c 100644
--- a/confirmationui/support/include/android/hardware/confirmationui/1.0/generic/GenericOperation.h
+++ b/confirmationui/support/include/android/hardware/confirmationui/1.0/generic/GenericOperation.h
@@ -99,7 +99,8 @@
void setPending() { error_ = ResponseCode::OK; }
- void setHmacKey(const uint8_t (&key)[32]) { hmacKey_ = {key}; }
+ void setHmacKey(const auth_token_key_t& key) { hmacKey_ = key; }
+ NullOr<auth_token_key_t> hmacKey() const { return hmacKey_; }
void abort() {
if (isPending()) {
@@ -112,7 +113,7 @@
if (isPending()) error_ = ResponseCode::Canceled;
}
- void finalize(const uint8_t key[32]) {
+ void finalize(const auth_token_key_t& key) {
if (error_ == ResponseCode::Ignored) return;
resultCB_->result(error_, getMessage(), userConfirm(key));
error_ = ResponseCode::Ignored;
@@ -127,11 +128,7 @@
}
ResponseCode deliverSecureInputEvent(const HardwareAuthToken& secureInputToken) {
- constexpr uint8_t testKeyByte = static_cast<uint8_t>(TestKeyBits::BYTE);
- constexpr uint8_t testKey[32] = {testKeyByte, testKeyByte, testKeyByte, testKeyByte,
- testKeyByte, testKeyByte, testKeyByte, testKeyByte,
- testKeyByte, testKeyByte, testKeyByte, testKeyByte,
- testKeyByte, testKeyByte, testKeyByte, testKeyByte};
+ const auth_token_key_t testKey(static_cast<uint8_t>(TestKeyBits::BYTE));
auto hmac = HMacer::hmac256(testKey, "\0", bytes_cast(secureInputToken.challenge),
bytes_cast(secureInputToken.userId),
@@ -171,7 +168,7 @@
result.setToExternal(formattedMessageBuffer_, formattedMessageLength_);
return result;
}
- hidl_vec<uint8_t> userConfirm(const uint8_t key[32]) {
+ hidl_vec<uint8_t> userConfirm(const auth_token_key_t& key) {
if (error_ != ResponseCode::OK) return {};
confirmationTokenScratchpad_ = HMacer::hmac256(key, "confirmation token", getMessage());
if (!confirmationTokenScratchpad_.isOk()) {
@@ -188,10 +185,10 @@
uint8_t formattedMessageBuffer_[uint32_t(MessageSize::MAX)];
char promptStringBuffer_[uint32_t(MessageSize::MAX)];
size_t formattedMessageLength_ = 0;
- NullOr<array<uint8_t, 32>> confirmationTokenScratchpad_;
+ NullOr<hmac_t> confirmationTokenScratchpad_;
Callback resultCB_;
typename TimeStamper::TimeStamp startTime_;
- NullOr<array<uint8_t, 32>> hmacKey_;
+ NullOr<auth_token_key_t> hmacKey_;
};
} // namespace
diff --git a/confirmationui/support/include/android/hardware/confirmationui/support/confirmationui_utils.h b/confirmationui/support/include/android/hardware/confirmationui/support/confirmationui_utils.h
index d551433..a01b5e3 100644
--- a/confirmationui/support/include/android/hardware/confirmationui/support/confirmationui_utils.h
+++ b/confirmationui/support/include/android/hardware/confirmationui/support/confirmationui_utils.h
@@ -58,7 +58,8 @@
public:
NullOr() : value_(initializer_t<ValueT>::init()), null_(true) {}
- NullOr(ValueT&& value) : value_(std::forward<ValueT>(value)), null_(false) {}
+ template <typename T>
+ NullOr(T&& value) : value_(std::forward<T>(value)), null_(false) {}
bool isOk() const { return !null_; }
@@ -81,17 +82,23 @@
public:
array() : data_{} {}
array(const T (&data)[elements]) { std::copy(data, data + elements, data_); }
+ explicit array(const T& v) { fill(v); }
T* data() { return data_; }
const T* data() const { return data_; }
constexpr size_t size() const { return elements; }
- operator const array_type&() const { return data_; }
T* begin() { return data_; }
T* end() { return data_ + elements; }
const T* begin() const { return data_; }
const T* end() const { return data_ + elements; }
+ void fill(const T& v) {
+ for (size_t i = 0; i < elements; ++i) {
+ data_[i] = v;
+ }
+ }
+
private:
array_type data_;
};
@@ -157,6 +164,11 @@
size_t size_;
};
+constexpr uint8_t auth_token_key_size = 32;
+constexpr uint8_t hmac_size_bytes = support::auth_token_key_size;
+using auth_token_key_t = array<uint8_t, auth_token_key_size>;
+using hmac_t = auth_token_key_t;
+
/**
* Implementer are expected to provide an implementation with the following prototype:
* static NullOr<array<uint8_t, 32>> hmac256(const uint8_t key[32],
@@ -166,7 +178,7 @@
class HMac {
public:
template <typename... Data>
- static NullOr<array<uint8_t, 32>> hmac256(const uint8_t key[32], const Data&... data) {
+ static NullOr<hmac_t> hmac256(const auth_token_key_t& key, const Data&... data) {
return Impl::hmac256(key, {data...});
}
};
diff --git a/current.txt b/current.txt
index 75b1a06..12cc6ff 100644
--- a/current.txt
+++ b/current.txt
@@ -260,7 +260,7 @@
4e7169919d24fbe5573e5bcd683d0bd7abf553a4e6c34c41f9dfc1e12050db07 android.hardware.gnss@1.0::IGnssNavigationMessageCallback
5804ca86611d72e5481f022b3a0c1b334217f2e4988dad25730c42af2d1f4d1c android.hardware.neuralnetworks@1.0::IDevice
12e8dca4ab7d8aadd0ef8f1b438021938e2396139e85db2ed65783b08800aa52 android.hardware.neuralnetworks@1.0::IExecutionCallback
-702f9a4cd3b7486a4b04f7155b737757ac2ca4b3548976d5782ad3cae9ff9780 android.hardware.neuralnetworks@1.0::types
+934b9a0627080bca5dee83126d23ace31bdf1ed36fe192a2a7694f81b4f0c2af android.hardware.neuralnetworks@1.0::types
d4840db8efabdf1e4b344fc981cd36e5fe81a39aff6e199f6d06c1c8da413efd android.hardware.radio@1.0::types
b280c4704dfcc548a9bf127b59b7c3578f460c50cce70a06b66fe0df8b27cff0 android.hardware.wifi@1.0::types
@@ -299,7 +299,7 @@
3b17c1fdfc389e0abe626c37054954b07201127d890c2bc05d47613ec1f4de4f android.hardware.automotive.evs@1.0::types
b3caf524c46a47d67e6453a34419e1881942d059e146cda740502670e9a752c3 android.hardware.automotive.vehicle@2.0::IVehicle
7ce8728b27600e840cacf0a832f6942819fe535f9d3797ae052d5eef5065921c android.hardware.automotive.vehicle@2.0::IVehicleCallback
-2e1815967a3e3278a7f304ed7efc04fbc56d0bb65b3126248c3a0d515b93f63d android.hardware.automotive.vehicle@2.0::types
+962b18e414231b5f3930d63daba116347241b3606242b0606b3699ba25b14315 android.hardware.automotive.vehicle@2.0::types
32cc50cc2a7658ec613c0c2dd2accbf6a05113b749852879e818b8b7b438db19 android.hardware.bluetooth.a2dp@1.0::IBluetoothAudioHost
ff4be64d7992f8bec97dff37f35450e79b3430c61f85f54322ce45bef229dc3b android.hardware.bluetooth.a2dp@1.0::IBluetoothAudioOffload
27f22d2e873e6201f9620cf4d8e2facb25bd0dd30a2b911e441b4600d560fa62 android.hardware.bluetooth.a2dp@1.0::types
@@ -327,7 +327,7 @@
83e7a10ff3702147bd7ffa04567b20d407a3b16bbb7705644af44d919afe9103 android.hardware.gnss@1.1::IGnssMeasurementCallback
0b96e0254e2168cfecb30c1ed5fb42681652cc00faa68c6e07568fafe64d1d50 android.hardware.graphics.common@1.1::types
d9b40a5b09962a5a0780b10fe33a4e607e69e2e088fc83de88a584115b7cb1c0 android.hardware.graphics.composer@2.2::IComposer
-c3cd2a3e245ffefae859c9a3d31382a9421be95cfa6bc1231571eb3533049b54 android.hardware.graphics.composer@2.2::IComposerClient
+18eff12102db47b03a5fa906f8d4fd9018f0fb9236c663d457b8eac8d57c2937 android.hardware.graphics.composer@2.2::IComposerClient
dd83be076b6b3f10ed62ab34d8c8b95f2415961fb785200eb842e7bfb2b0ee92 android.hardware.graphics.mapper@2.1::IMapper
675682dd3007805c985eaaec91612abc88f4c25b3431fb84070b7584a1a741fb android.hardware.health@2.0::IHealth
434c4c32c00b0e54bb05e40c79503208b40f786a318029a2a4f66e34f10f2a76 android.hardware.health@2.0::IHealthInfoCallback
@@ -339,7 +339,7 @@
4a2c0dc82780e6c90731725a103feab8ab6ecf85a64e049b9cbd2b2c61620fe1 android.hardware.media.bufferpool@1.0::IConnection
6aef1218e5949f867b0104752ac536c1b707222a403341720de90141df129e3e android.hardware.media.bufferpool@1.0::types
7698dc2382a2eeb43541840e3ee624f34108efdfb976b2bfa7c13ef15fb8c4c4 android.hardware.neuralnetworks@1.1::IDevice
-5604001029a255648a9e955de0a822a48d9ba7cc259b106fb8be0cd43dc8eece android.hardware.neuralnetworks@1.1::types
+ce5dab4b2dd828bcff09acfb93fcd4846f847868b9e914d214095532c28dc0cf android.hardware.neuralnetworks@1.1::types
8d3d86da0bfa4bf070970d8303c659f67f35d670c287d45a3f542e4fedadd578 android.hardware.nfc@1.1::INfc
e85f566698d2a2c28100e264fcf2c691a066756ddf8dd341d009ff50cfe10614 android.hardware.nfc@1.1::INfcClientCallback
5e278fcaa3287d397d8eebe1c22aaa28150f5caae1cf9381cd6dc32cb37899c5 android.hardware.nfc@1.1::types
diff --git a/graphics/composer/2.2/IComposerClient.hal b/graphics/composer/2.2/IComposerClient.hal
index b7ba6a6..a6665a1 100644
--- a/graphics/composer/2.2/IComposerClient.hal
+++ b/graphics/composer/2.2/IComposerClient.hal
@@ -383,9 +383,8 @@
* By default, layer dataspaces are mapped to the current color mode
* colorimetrically with a few exceptions.
*
- * When the layer dataspace is a legacy sRGB dataspace
- * (Dataspace::SRGB_LINEAR, Dataspace::SRGB, or Dataspace::UNKNOWN when
- * treated as such) and the display render intent is
+ * When the layer dataspace is a legacy dataspace (see
+ * common@1.1::Dataspace) and the display render intent is
* RenderIntent::ENHANCE, the pixel values can go through an
* implementation-defined saturation transform before being mapped to the
* current color mode colorimetrically.
@@ -402,7 +401,7 @@
* this:
*
* (in GLSL)
- * linearSrgb = clamp(saturationMatrix * linearSrgb, 0.0, 1.0);
+ * linearSrgb = saturationMatrix * linearSrgb;
*
* @param dataspace must be Dataspace::SRGB_LINEAR.
* @return error is NONE upon success. Otherwise,
diff --git a/neuralnetworks/1.0/types.hal b/neuralnetworks/1.0/types.hal
index 8c07fcc..802f6cb 100644
--- a/neuralnetworks/1.0/types.hal
+++ b/neuralnetworks/1.0/types.hal
@@ -444,10 +444,11 @@
* Supported tensor rank: up to 4.
*
* Inputs:
- * * 0: A tensor, specifying the input. If rank is greater than 2, then it gets flattened to
- * a 2-D Tensor. The 2-D Tensor is handled as if dimensions corresponded to shape
- * [batch_size, input_size], where “batch_size” corresponds to the batching dimension,
- * and “input_size” is the size of the input.
+ * * 0: A tensor of at least rank 2, specifying the input. If rank is greater than 2,
+ * then it gets flattened to a 2-D Tensor. The (flattened) 2-D Tensor is reshaped
+ * (if necessary) to [batch_size, input_size], where "input_size" corresponds to
+ * the number of inputs to the layer, matching the second dimension of weights, and
+ * "batch_size" is calculated by dividing the number of elements by "input_size".
* * 1: A 2-D tensor, specifying the weights, of shape [num_units, input_size], where
* "num_units" corresponds to the number of output nodes.
* * 2: A 1-D tensor, of shape [num_units], specifying the bias.
@@ -728,9 +729,11 @@
* \f{eqnarray*}{
* i_t = 1 - f_t
* \f}
- * * The cell-to-input weights (\f$W_{ci}\f$), cell-to-forget weights (\f$W_{cf}\f$), and cell-to-output
- * weights (\f$W_{co}\f$) either all have values or none of them have values.
- * If they have values, the peephole optimization is used.
+ * * The cell-to-forget weights (\f$W_{cf}\f$) and cell-to-output
+ * weights (\f$W_{co}\f$) either both have values or neither of them have values.
+ * If they have values, the peephole optimization is used. Additionally,
+ * if CIFG is not used, cell-to-input weights (\f$W_{ci}\f$) is also
+ * required to have values for peephole optimization.
* * The projection weights (\f$W_{proj}\f$) is required only for the recurrent projection
* layer, and should otherwise have no value.
* * The projection bias (\f$b_{proj}\f$) may (but not required to) have a value if the
@@ -1008,7 +1011,8 @@
* Resizes images to given size using the bilinear interpretation.
*
* Resized images must be distorted if their output aspect ratio is not the same as
- * input aspect ratio.
+ * input aspect ratio. The corner pixels of output may not be the same as
+ * corner pixels of input.
*
* Supported tensor types:
* * {@link OperandType::TENSOR_FLOAT32}
diff --git a/neuralnetworks/1.0/vts/functional/GeneratedTestHarness.cpp b/neuralnetworks/1.0/vts/functional/GeneratedTestHarness.cpp
index ed1fb94..0682ab9 100644
--- a/neuralnetworks/1.0/vts/functional/GeneratedTestHarness.cpp
+++ b/neuralnetworks/1.0/vts/functional/GeneratedTestHarness.cpp
@@ -36,16 +36,16 @@
namespace generated_tests {
using ::android::hardware::neuralnetworks::V1_0::implementation::ExecutionCallback;
using ::android::hardware::neuralnetworks::V1_0::implementation::PreparedModelCallback;
-using ::generated_tests::filter;
-using ::generated_tests::for_all;
-using ::generated_tests::for_each;
-using ::generated_tests::resize_accordingly;
-using ::generated_tests::MixedTyped;
-using ::generated_tests::MixedTypedExampleType;
-using ::generated_tests::Float32Operands;
-using ::generated_tests::Int32Operands;
-using ::generated_tests::Quant8Operands;
-using ::generated_tests::compare;
+using ::test_helper::filter;
+using ::test_helper::for_all;
+using ::test_helper::for_each;
+using ::test_helper::resize_accordingly;
+using ::test_helper::MixedTyped;
+using ::test_helper::MixedTypedExampleType;
+using ::test_helper::Float32Operands;
+using ::test_helper::Int32Operands;
+using ::test_helper::Quant8Operands;
+using ::test_helper::compare;
template <typename T>
void copy_back_(MixedTyped* dst, const std::vector<RequestArgument>& ra, char* src) {
diff --git a/neuralnetworks/1.0/vts/functional/GeneratedTests.cpp b/neuralnetworks/1.0/vts/functional/GeneratedTests.cpp
index 2107333..d84479c 100644
--- a/neuralnetworks/1.0/vts/functional/GeneratedTests.cpp
+++ b/neuralnetworks/1.0/vts/functional/GeneratedTests.cpp
@@ -31,7 +31,7 @@
namespace neuralnetworks {
namespace generated_tests {
-using ::generated_tests::MixedTypedExampleType;
+using ::test_helper::MixedTypedExampleType;
extern void Execute(const sp<V1_0::IDevice>&, std::function<V1_0::Model(void)>,
std::function<bool(int)>, const std::vector<MixedTypedExampleType>&);
} // namespace generated_tests
@@ -45,7 +45,7 @@
using ::android::nn::allocateSharedMemory;
// Mixed-typed examples
-typedef generated_tests::MixedTypedExampleType MixedTypedExample;
+typedef test_helper::MixedTypedExampleType MixedTypedExample;
// in frameworks/ml/nn/runtime/tests/generated/
#include "all_generated_V1_0_vts_tests.cpp"
diff --git a/neuralnetworks/1.0/vts/functional/Models.h b/neuralnetworks/1.0/vts/functional/Models.h
index a1fbe92..751ab32 100644
--- a/neuralnetworks/1.0/vts/functional/Models.h
+++ b/neuralnetworks/1.0/vts/functional/Models.h
@@ -30,7 +30,7 @@
namespace vts {
namespace functional {
-using MixedTypedExample = generated_tests::MixedTypedExampleType;
+using MixedTypedExample = test_helper::MixedTypedExampleType;
#define FOR_EACH_TEST_MODEL(FN) \
FN(add_broadcast_quant8) \
diff --git a/neuralnetworks/1.0/vts/functional/ValidateRequest.cpp b/neuralnetworks/1.0/vts/functional/ValidateRequest.cpp
index 08f2613..09c1878 100644
--- a/neuralnetworks/1.0/vts/functional/ValidateRequest.cpp
+++ b/neuralnetworks/1.0/vts/functional/ValidateRequest.cpp
@@ -36,9 +36,9 @@
using ::android::hardware::neuralnetworks::V1_0::implementation::ExecutionCallback;
using ::android::hardware::neuralnetworks::V1_0::implementation::PreparedModelCallback;
using ::android::hidl::memory::V1_0::IMemory;
-using generated_tests::MixedTyped;
-using generated_tests::MixedTypedExampleType;
-using generated_tests::for_all;
+using test_helper::MixedTyped;
+using test_helper::MixedTypedExampleType;
+using test_helper::for_all;
///////////////////////// UTILITY FUNCTIONS /////////////////////////
diff --git a/neuralnetworks/1.1/types.hal b/neuralnetworks/1.1/types.hal
index 8290fbb..3fa47a6 100644
--- a/neuralnetworks/1.1/types.hal
+++ b/neuralnetworks/1.1/types.hal
@@ -214,6 +214,13 @@
* tensor to be sliced. The length must be of rank(input0).
* 3: A 1-D Tensor of type TENSOR_INT32, the strides of the dimensions of the input
* tensor to be sliced. The length must be of rank(input0).
+ * 4: An INT32 value, begin_mask. If the ith bit of begin_mask is set, begin[i] is ignored
+ * and the fullest possible range in that dimension is used instead.
+ * 5: An INT32 value, end_mask. If the ith bit of end_mask is set, end[i] is ignored and
+ * the fullest possible range in that dimension is used instead.
+ * 6: An INT32 value, shrink_axis_mask. An int32 mask. If the ith bit of shrink_axis_mask is
+ * set, it implies that the ith specification shrinks the dimensionality by 1. A slice of
+ * size 1 starting from begin[i] in the dimension must be preserved.
*
* Outputs:
* 0: A tensor of the same type as input0.
diff --git a/neuralnetworks/1.1/vts/functional/GeneratedTests.cpp b/neuralnetworks/1.1/vts/functional/GeneratedTests.cpp
index 1f1cc7a..95c2b1a 100644
--- a/neuralnetworks/1.1/vts/functional/GeneratedTests.cpp
+++ b/neuralnetworks/1.1/vts/functional/GeneratedTests.cpp
@@ -31,7 +31,7 @@
namespace neuralnetworks {
namespace generated_tests {
-using ::generated_tests::MixedTypedExampleType;
+using ::test_helper::MixedTypedExampleType;
extern void Execute(const sp<V1_1::IDevice>&, std::function<V1_1::Model(void)>,
std::function<bool(int)>, const std::vector<MixedTypedExampleType>&);
} // namespace generated_tests
diff --git a/neuralnetworks/1.1/vts/functional/Models.h b/neuralnetworks/1.1/vts/functional/Models.h
index 7fb2696..cc0fac1 100644
--- a/neuralnetworks/1.1/vts/functional/Models.h
+++ b/neuralnetworks/1.1/vts/functional/Models.h
@@ -31,7 +31,7 @@
namespace vts {
namespace functional {
-using MixedTypedExample = generated_tests::MixedTypedExampleType;
+using MixedTypedExample = test_helper::MixedTypedExampleType;
#define FOR_EACH_TEST_MODEL(FN) \
FN(add) \
diff --git a/neuralnetworks/1.1/vts/functional/ValidateRequest.cpp b/neuralnetworks/1.1/vts/functional/ValidateRequest.cpp
index b42f561..687b760 100644
--- a/neuralnetworks/1.1/vts/functional/ValidateRequest.cpp
+++ b/neuralnetworks/1.1/vts/functional/ValidateRequest.cpp
@@ -36,9 +36,9 @@
using ::android::hardware::neuralnetworks::V1_0::implementation::ExecutionCallback;
using ::android::hardware::neuralnetworks::V1_0::implementation::PreparedModelCallback;
using ::android::hidl::memory::V1_0::IMemory;
-using generated_tests::MixedTyped;
-using generated_tests::MixedTypedExampleType;
-using generated_tests::for_all;
+using test_helper::MixedTyped;
+using test_helper::MixedTypedExampleType;
+using test_helper::for_all;
///////////////////////// UTILITY FUNCTIONS /////////////////////////