Provide explicitly versioned NNAPI AIDL utils libs -- HAL.
This CL modifies the AIDL utils libraries to be explicitly
versioned. Currently, we only have two versions: v1 and "current".
Specifically, the following changes are made:
- Remove AIDL dependencies from neuralnetworks_utils_hal_common
- Create explicitly versioned libs of neuralnetworks_utils_hal_aidl_*
This is needed because it is not allowed for a build target to
link against multiple versions of the same AIDL lirary.
The canonical driver will report ANDROID_S for AIDL v1, and FL6 for v2.
Bug: 202405342
Test: NNT_static
Test: CtsNNAPITestCases
Test: VtsHalNeuralnetworksTargetTest
Change-Id: I74f1798e80a059949e43e0567d23e884a7f7c92d
diff --git a/neuralnetworks/aidl/utils/src/Device.cpp b/neuralnetworks/aidl/utils/src/Device.cpp
index e80de0b..5b7ec4e 100644
--- a/neuralnetworks/aidl/utils/src/Device.cpp
+++ b/neuralnetworks/aidl/utils/src/Device.cpp
@@ -125,7 +125,7 @@
} // namespace
nn::GeneralResult<std::shared_ptr<const Device>> Device::create(
- std::string name, std::shared_ptr<aidl_hal::IDevice> device) {
+ std::string name, std::shared_ptr<aidl_hal::IDevice> device, nn::Version featureLevel) {
if (name.empty()) {
return NN_ERROR(nn::ErrorStatus::INVALID_ARGUMENT)
<< "aidl_hal::utils::Device::create must have non-empty name";
@@ -143,18 +143,19 @@
auto deathHandler = NN_TRY(DeathHandler::create(device));
return std::make_shared<const Device>(
- PrivateConstructorTag{}, std::move(name), std::move(versionString), deviceType,
- std::move(extensions), std::move(capabilities), numberOfCacheFilesNeeded,
+ PrivateConstructorTag{}, std::move(name), std::move(versionString), featureLevel,
+ deviceType, std::move(extensions), std::move(capabilities), numberOfCacheFilesNeeded,
std::move(device), std::move(deathHandler));
}
Device::Device(PrivateConstructorTag /*tag*/, std::string name, std::string versionString,
- nn::DeviceType deviceType, std::vector<nn::Extension> extensions,
- nn::Capabilities capabilities,
+ nn::Version featureLevel, nn::DeviceType deviceType,
+ std::vector<nn::Extension> extensions, nn::Capabilities capabilities,
std::pair<uint32_t, uint32_t> numberOfCacheFilesNeeded,
std::shared_ptr<aidl_hal::IDevice> device, DeathHandler deathHandler)
: kName(std::move(name)),
kVersionString(std::move(versionString)),
+ kFeatureLevel(featureLevel),
kDeviceType(deviceType),
kExtensions(std::move(extensions)),
kCapabilities(std::move(capabilities)),
@@ -171,7 +172,7 @@
}
nn::Version Device::getFeatureLevel() const {
- return nn::Version::ANDROID_S;
+ return kFeatureLevel;
}
nn::DeviceType Device::getType() const {