Frameworks/base: Consistency in core/jni

Make consistent use of core_jni_helpers for registration.

Translate some #ifdefs into const bools.

Change-Id: I37639aa053dd50f003a552cbd8550dddecc811c5
diff --git a/core/jni/android_hardware_camera2_CameraMetadata.cpp b/core/jni/android_hardware_camera2_CameraMetadata.cpp
index 9132690..7c8769d 100644
--- a/core/jni/android_hardware_camera2_CameraMetadata.cpp
+++ b/core/jni/android_hardware_camera2_CameraMetadata.cpp
@@ -16,7 +16,6 @@
 */
 
 // #define LOG_NDEBUG 0
-// #define LOG_NNDEBUG 0
 #define LOG_TAG "CameraMetadata-JNI"
 #include <utils/Errors.h>
 #include <utils/Log.h>
@@ -29,7 +28,7 @@
 #include "jni.h"
 #include "JNIHelp.h"
 #include "android_os_Parcel.h"
-#include "android_runtime/AndroidRuntime.h"
+#include "core_jni_helpers.h"
 #include "android_runtime/android_hardware_camera2_CameraMetadata.h"
 
 #include <binder/IServiceManager.h>
@@ -42,13 +41,7 @@
 #include <sys/types.h> // for socketpair
 #include <sys/socket.h> // for socketpair
 
-#if defined(LOG_NNDEBUG)
-#if !LOG_NNDEBUG
-#define ALOGVV ALOGV
-#endif
-#else
-#define ALOGVV(...)
-#endif
+static const bool kIsDebug = false;
 
 // fully-qualified class name
 #define CAMERA_METADATA_CLASS_NAME "android/hardware/camera2/impl/CameraMetadataNative"
@@ -596,7 +589,7 @@
 int register_android_hardware_camera2_CameraMetadata(JNIEnv *env)
 {
     // Register native functions
-    return AndroidRuntime::registerNativeMethods(env,
+    return RegisterMethodsOrDie(env,
             CAMERA_METADATA_CLASS_NAME,
             gCameraMetadataMethods,
             NELEM(gCameraMetadataMethods));
@@ -650,12 +643,15 @@
 
         const char *str = (i < ANDROID_SECTION_COUNT) ? camera_metadata_section_names[i] :
                 vendorSections[i - ANDROID_SECTION_COUNT].string();
-        ALOGVV("%s: Trying to match against section '%s'",
-               __FUNCTION__, str);
+        if (kIsDebug) {
+            ALOGV("%s: Trying to match against section '%s'", __FUNCTION__, str);
+        }
         if (strstr(key, str) == key) { // key begins with the section name
             size_t strLength = strlen(str);
 
-            ALOGVV("%s: Key begins with section name", __FUNCTION__);
+            if (kIsDebug) {
+                ALOGV("%s: Key begins with section name", __FUNCTION__);
+            }
 
             // section name is the longest we've found so far
             if (section == NULL || sectionLength < strLength) {
@@ -663,7 +659,9 @@
                 sectionIndex = i;
                 sectionLength = strLength;
 
-                ALOGVV("%s: Found new best section (%s)", __FUNCTION__, section);
+                if (kIsDebug) {
+                    ALOGV("%s: Found new best section (%s)", __FUNCTION__, section);
+                }
             }
         }
     }