Move some debugging capabilities under #ifdef NN_DEBUGGABLE.

This makes them available under eng and userdebug but not user.

Bug: 63905942
Test: mm (userdebug and user)

Change-Id: I196c5df77290ed44a040e935adbf567f818e979d
diff --git a/Android.bp b/Android.bp
index 5a6c263..50849f5 100644
--- a/Android.bp
+++ b/Android.bp
@@ -27,6 +27,11 @@
         "-Wextra",
         "-Werror",
     ],
+    product_variables: {
+        debuggable: {  // eng and userdebug builds
+            cflags: ["-DNN_DEBUGGABLE"],
+        },
+    },
 }
 
 cc_library_headers {
diff --git a/runtime/Manager.cpp b/runtime/Manager.cpp
index aca9484..70dc433 100644
--- a/runtime/Manager.cpp
+++ b/runtime/Manager.cpp
@@ -27,22 +27,26 @@
 
 #include <functional>
 
+#ifdef NN_DEBUGGABLE
 static uint32_t getProp(const char *str) {
     char buf[PROPERTY_VALUE_MAX];
     property_get(str, buf, "0");
     return atoi(buf);
 }
+#endif  // NN_DEBUGGABLE
 
 namespace android {
 namespace nn {
 
 // TODO: handle errors from initialize correctly
 void Device::initialize() {
+#ifdef NN_DEBUGGABLE
     static const char samplePrefix[] = "sample";
 
     mSupported =
             (mName.substr(0, sizeof(samplePrefix) - 1)  == samplePrefix)
             ? getProp("debug.nn.sample.supported") : 0;
+#endif  // NN_DEBUGGABLE
 
     mInterface->getCapabilities([&](ErrorStatus status, const Capabilities& capabilities) {
         if (status != ErrorStatus::NONE) {
@@ -68,6 +72,7 @@
             *outSupportedOperations = supportedOperations;
         });
 
+#ifdef NN_DEBUGGABLE
     if (mSupported != 1) {
         return;
     }
@@ -102,6 +107,7 @@
             (*outSupportedOperations)[operationIndex] = false;
         }
     }
+#endif  // NN_DEBUGGABLE
 }
 
 DeviceManager* DeviceManager::get() {
diff --git a/runtime/Manager.h b/runtime/Manager.h
index 727b40d..f38649a 100644
--- a/runtime/Manager.h
+++ b/runtime/Manager.h
@@ -46,10 +46,12 @@
     PerformanceInfo mFloat32Performance;
     PerformanceInfo mQuantized8Performance;
 
+#ifdef NN_DEBUGGABLE
     // For debugging: behavior of IDevice::getSupportedOperations for SampleDriver.
     // 0 - all operations reported by IDevice::getSupportedOperations() supported
     // 1 - some operations reported by IDevice::getSupportedOperations() supported
-    uint32_t mSupported;
+    uint32_t mSupported = 0;
+#endif  // NN_DEBUGGABLE
 };
 
 // Manages the NN HAL devices.  Only one instance of this class will exist.