Add isUpdatable to NNAPI canonical IDevice -- hal

Bug: 177284207
Test: mma
Change-Id: I580d5325be91f566ee1c591736a87a94d0a74315
Merged-In: I580d5325be91f566ee1c591736a87a94d0a74315
(cherry picked from commit 080fbf755c48a944586ecd739f02570b7aa611ee)
diff --git a/neuralnetworks/utils/common/src/InvalidDevice.cpp b/neuralnetworks/utils/common/src/InvalidDevice.cpp
index 535ccb4..81bca7f 100644
--- a/neuralnetworks/utils/common/src/InvalidDevice.cpp
+++ b/neuralnetworks/utils/common/src/InvalidDevice.cpp
@@ -32,13 +32,14 @@
 namespace android::hardware::neuralnetworks::utils {
 
 InvalidDevice::InvalidDevice(std::string name, std::string versionString, nn::Version featureLevel,
-                             nn::DeviceType type, std::vector<nn::Extension> extensions,
-                             nn::Capabilities capabilities,
+                             nn::DeviceType type, bool isUpdatable,
+                             std::vector<nn::Extension> extensions, nn::Capabilities capabilities,
                              std::pair<uint32_t, uint32_t> numberOfCacheFilesNeeded)
     : kName(std::move(name)),
       kVersionString(std::move(versionString)),
       kFeatureLevel(featureLevel),
       kType(type),
+      kIsUpdatable(isUpdatable),
       kExtensions(std::move(extensions)),
       kCapabilities(std::move(capabilities)),
       kNumberOfCacheFilesNeeded(numberOfCacheFilesNeeded) {}
@@ -59,6 +60,10 @@
     return kType;
 }
 
+bool InvalidDevice::isUpdatable() const {
+    return kIsUpdatable;
+}
+
 const std::vector<nn::Extension>& InvalidDevice::getSupportedExtensions() const {
     return kExtensions;
 }
diff --git a/neuralnetworks/utils/common/src/ResilientDevice.cpp b/neuralnetworks/utils/common/src/ResilientDevice.cpp
index 2023c9a..13965af 100644
--- a/neuralnetworks/utils/common/src/ResilientDevice.cpp
+++ b/neuralnetworks/utils/common/src/ResilientDevice.cpp
@@ -122,12 +122,14 @@
     };
     if (compare(&IDevice::getName) || compare(&IDevice::getVersionString) ||
         compare(&IDevice::getFeatureLevel) || compare(&IDevice::getType) ||
-        compare(&IDevice::getSupportedExtensions) || compare(&IDevice::getCapabilities)) {
+        compare(&IDevice::isUpdatable) || compare(&IDevice::getSupportedExtensions) ||
+        compare(&IDevice::getCapabilities)) {
         LOG(ERROR) << "Recovered device has different metadata than what is cached. Marking "
                       "IDevice object as invalid.";
         device = std::make_shared<const InvalidDevice>(
-                kName, kVersionString, mDevice->getFeatureLevel(), mDevice->getType(), kExtensions,
-                kCapabilities, mDevice->getNumberOfCacheFilesNeeded());
+                kName, kVersionString, mDevice->getFeatureLevel(), mDevice->getType(),
+                mDevice->isUpdatable(), kExtensions, kCapabilities,
+                mDevice->getNumberOfCacheFilesNeeded());
         mIsValid = false;
     }
 
@@ -151,6 +153,10 @@
     return getDevice()->getType();
 }
 
+bool ResilientDevice::isUpdatable() const {
+    return getDevice()->isUpdatable();
+}
+
 const std::vector<nn::Extension>& ResilientDevice::getSupportedExtensions() const {
     return kExtensions;
 }