Merge "Set correct API level for NNAPI AIDL service discovery." am: f61f789f86

Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/1665884

Change-Id: I2b8234bf1af2917eeca047709cb382229d75d41c
This commit is contained in:
Przemyslaw Szczepaniak 2021-04-12 13:23:49 +00:00 committed by Automerger Merge Worker
commit 3d4bd3ef47

View file

@ -16,6 +16,7 @@
#include "Service.h" #include "Service.h"
#include <AndroidVersionUtil.h>
#include <aidl/android/hardware/neuralnetworks/IDevice.h> #include <aidl/android/hardware/neuralnetworks/IDevice.h>
#include <android-base/logging.h> #include <android-base/logging.h>
#include <android/binder_manager.h> #include <android/binder_manager.h>
@ -82,7 +83,7 @@ void getAidlDevices(std::vector<nn::SharedDevice>* devices,
// Devices with SDK level lower than 31 (Android S) don't have any AIDL drivers available, so // Devices with SDK level lower than 31 (Android S) don't have any AIDL drivers available, so
// there is no need for a workaround supported on lower levels. // there is no need for a workaround supported on lower levels.
if (__builtin_available(android __ANDROID_API_S__, *)) { if (__builtin_available(android __NNAPI_AIDL_MIN_ANDROID_API__, *)) {
AServiceManager_forEachDeclaredInstance(aidl_hal::IDevice::descriptor, AServiceManager_forEachDeclaredInstance(aidl_hal::IDevice::descriptor,
static_cast<void*>(&names), callback); static_cast<void*>(&names), callback);
} }