summaryrefslogtreecommitdiff
path: root/neuralnetworks/aidl/utils/src
diff options
context:
space:
mode:
authorMichael Butler <butlermichael@google.com>2021-10-26 03:29:13 +0000
committerMichael Butler <butlermichael@google.com>2021-10-25 21:13:15 -0700
commitc42a934ea8b7869afc7b877f1efb6bc30f21c49b (patch)
tree27d24897c0611d9315aa902f037c5c606c9d7a76 /neuralnetworks/aidl/utils/src
parentcb2c37f78f4a54c79d8a60f8e754ef0d3cfc637d (diff)
Revert "Provide explicitly versioned NNAPI AIDL utils libs -- HAL."
Revert "Use explicitly versioned NNAPI HAL util libs in darwinn2." Revert "Add neuralnetworks_utils_hal_aidl_v2 to allowed_deps.txt" Revert "Provide explicitly version NNAPI AIDL utils lib -- runtime." Revert submission 16007539-nnapi-experimental-aidl-feature Reason for revert: The cherry-pick of this CL breaks the build Reverted Changes: Ieb2da3461:Add neuralnetworks_utils_hal_aidl_v2 to allowed_de... I8ae01e3c6:Provide explicitly version NNAPI AIDL utils lib --... I74f1798e8:Provide explicitly versioned NNAPI AIDL utils libs... I2362464e8:Use explicitly versioned NNAPI HAL util libs in da... Test: mma Change-Id: I3d3ac4745fb707cbdceb2019f3c2fc7807183b71 Merged-In: I3d3ac4745fb707cbdceb2019f3c2fc7807183b71 (cherry picked from commit 932e82b0c30fa2078bd421053506ec4e9191f66c)
Diffstat (limited to 'neuralnetworks/aidl/utils/src')
-rw-r--r--neuralnetworks/aidl/utils/src/Device.cpp13
-rw-r--r--neuralnetworks/aidl/utils/src/Service.cpp29
2 files changed, 7 insertions, 35 deletions
diff --git a/neuralnetworks/aidl/utils/src/Device.cpp b/neuralnetworks/aidl/utils/src/Device.cpp
index 5b7ec4ebd7..e80de0be76 100644
--- a/neuralnetworks/aidl/utils/src/Device.cpp
+++ b/neuralnetworks/aidl/utils/src/Device.cpp
@@ -125,7 +125,7 @@ nn::GeneralResult<std::pair<uint32_t, uint32_t>> getNumberOfCacheFilesNeededFrom
} // namespace
nn::GeneralResult<std::shared_ptr<const Device>> Device::create(
- std::string name, std::shared_ptr<aidl_hal::IDevice> device, nn::Version featureLevel) {
+ std::string name, std::shared_ptr<aidl_hal::IDevice> device) {
if (name.empty()) {
return NN_ERROR(nn::ErrorStatus::INVALID_ARGUMENT)
<< "aidl_hal::utils::Device::create must have non-empty name";
@@ -143,19 +143,18 @@ nn::GeneralResult<std::shared_ptr<const Device>> Device::create(
auto deathHandler = NN_TRY(DeathHandler::create(device));
return std::make_shared<const Device>(
- PrivateConstructorTag{}, std::move(name), std::move(versionString), featureLevel,
- deviceType, std::move(extensions), std::move(capabilities), numberOfCacheFilesNeeded,
+ PrivateConstructorTag{}, std::move(name), std::move(versionString), 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::Version featureLevel, nn::DeviceType deviceType,
- std::vector<nn::Extension> extensions, nn::Capabilities capabilities,
+ 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)),
@@ -172,7 +171,7 @@ const std::string& Device::getVersionString() const {
}
nn::Version Device::getFeatureLevel() const {
- return kFeatureLevel;
+ return nn::Version::ANDROID_S;
}
nn::DeviceType Device::getType() const {
diff --git a/neuralnetworks/aidl/utils/src/Service.cpp b/neuralnetworks/aidl/utils/src/Service.cpp
index 01772eed53..ac182a205e 100644
--- a/neuralnetworks/aidl/utils/src/Service.cpp
+++ b/neuralnetworks/aidl/utils/src/Service.cpp
@@ -17,7 +17,6 @@
#include "Service.h"
#include <AndroidVersionUtil.h>
-#include <aidl/android/hardware/neuralnetworks/IDevice.h>
#include <android/binder_auto_utils.h>
#include <android/binder_manager.h>
#include <android/binder_process.h>
@@ -29,33 +28,8 @@
#include <string>
#include "Device.h"
-#include "Utils.h"
namespace aidl::android::hardware::neuralnetworks::utils {
-namespace {
-
-// Map the AIDL version of an IDevice to NNAPI canonical feature level.
-nn::GeneralResult<nn::Version> getAidlServiceFeatureLevel(IDevice* service) {
- CHECK(service != nullptr);
- int aidlVersion;
- const auto ret = service->getInterfaceVersion(&aidlVersion);
- HANDLE_ASTATUS(ret) << "getInterfaceVersion failed";
-
- // For service AIDL versions greater than or equal to the AIDL library version that the runtime
- // was built against, clamp it to the runtime AIDL library version.
- aidlVersion = std::min(aidlVersion, IDevice::version);
-
- // Map stable AIDL versions to canonical versions.
- switch (aidlVersion) {
- case 1:
- return nn::Version::ANDROID_S;
- case 2:
- return nn::Version::FEATURE_LEVEL_6;
- }
- return NN_ERROR() << "Unknown AIDL service version: " << aidlVersion;
-}
-
-} // namespace
nn::GeneralResult<nn::SharedDevice> getDevice(const std::string& instanceName) {
auto fullName = std::string(IDevice::descriptor) + "/" + instanceName;
@@ -81,8 +55,7 @@ nn::GeneralResult<nn::SharedDevice> getDevice(const std::string& instanceName) {
<< " returned nullptr";
}
ABinderProcess_startThreadPool();
- const auto featureLevel = NN_TRY(getAidlServiceFeatureLevel(service.get()));
- return Device::create(instanceName, std::move(service), featureLevel);
+ return Device::create(instanceName, std::move(service));
};
return hal::utils::ResilientDevice::create(std::move(makeDevice));