Switch frameworks/base/core/jni from gcc to clang.

Switch from gcc to clang and fix errors detected.

The immediate motivation is that gcc with libc++ stl does not use
'explicit' in the stl, causing issues for use of unique_ptr.
The longer term motivation is to fully move to clang.

BUG=22414716

Change-Id: If77436c1e7601f20289603862be33b85880ab4bd
(cherry picked from commit 60b1c8ef860b8cd5a1fa453a8951d6e8d7c44734)
diff --git a/core/jni/android_hardware_SensorManager.cpp b/core/jni/android_hardware_SensorManager.cpp
index e39bb1c..6812ab4 100644
--- a/core/jni/android_hardware_SensorManager.cpp
+++ b/core/jni/android_hardware_SensorManager.cpp
@@ -248,7 +248,7 @@
 
     mgr->getDynamicSensorList(nativeList);
 
-    ALOGI("DYNS native SensorManager.getDynamicSensorList return %d sensors", nativeList.size());
+    ALOGI("DYNS native SensorManager.getDynamicSensorList return %zu sensors", nativeList.size());
     for (size_t i = 0; i < nativeList.size(); ++i) {
         jobject sensor = translateNativeSensorToJavaSensor(env, NULL, nativeList[i]);
         // add to list
diff --git a/core/jni/android_media_AudioTrack.cpp b/core/jni/android_media_AudioTrack.cpp
index 024c21d..39ea5c0 100644
--- a/core/jni/android_media_AudioTrack.cpp
+++ b/core/jni/android_media_AudioTrack.cpp
@@ -38,6 +38,8 @@
 #include "android_media_PlaybackParams.h"
 #include "android_media_DeviceCallback.h"
 
+#include <cinttypes>
+
 // ----------------------------------------------------------------------------
 
 using namespace android;
@@ -219,7 +221,7 @@
         jlong nativeAudioTrack) {
 
     ALOGV("sampleRates=%p, channel mask=%x, index mask=%x, audioFormat(Java)=%d, buffSize=%d"
-        "nativeAudioTrack=0x%llX",
+        "nativeAudioTrack=0x%" PRIX64,
         jSampleRate, channelPositionMask, channelIndexMask, audioFormat, buffSizeInBytes,
         nativeAudioTrack);
 
@@ -714,8 +716,8 @@
 
     ssize_t result = lpTrack->getBufferSizeInFrames();
     if (result < 0) {
-        jniThrowException(env, "java/lang/IllegalStateException",
-            "Internal error detected in getBufferSizeInFrames() = " + result);
+        jniThrowExceptionFmt(env, "java/lang/IllegalStateException",
+            "Internal error detected in getBufferSizeInFrames() = %zd", result);
         return (jint)AUDIO_JAVA_ERROR;
     }
     return (jint)result;
@@ -738,8 +740,8 @@
     }
     ssize_t result = lpTrack->setBufferSizeInFrames(bufferSizeInFrames);
     if (result < 0) {
-        jniThrowException(env, "java/lang/IllegalStateException",
-            "Internal error detected in setBufferSizeInFrames() = " + result);
+        jniThrowExceptionFmt(env, "java/lang/IllegalStateException",
+            "Internal error detected in setBufferSizeInFrames() = %zd", result);
         return (jint)AUDIO_JAVA_ERROR;
     }
     return (jint)result;
diff --git a/core/jni/android_util_PathParser.cpp b/core/jni/android_util_PathParser.cpp
index 0927120..17e8bd8 100644
--- a/core/jni/android_util_PathParser.cpp
+++ b/core/jni/android_util_PathParser.cpp
@@ -36,7 +36,7 @@
     PathParser::parseStringForSkPath(skPath, &result, pathString, strLength);
     env->ReleaseStringUTFChars(inputPathStr, pathString);
     if (result.failureOccurred) {
-        ALOGE(result.failureMessage.c_str());
+        ALOGE("%s", result.failureMessage.c_str());
     }
     return !result.failureOccurred;
 }
@@ -62,7 +62,7 @@
         return reinterpret_cast<jlong>(pathData);
     } else {
         delete pathData;
-        ALOGE(result.failureMessage.c_str());
+        ALOGE("%s", result.failureMessage.c_str());
         return NULL;
     }
 }
diff --git a/core/jni/android_view_DisplayEventReceiver.cpp b/core/jni/android_view_DisplayEventReceiver.cpp
index f9936ae..8066db3 100644
--- a/core/jni/android_view_DisplayEventReceiver.cpp
+++ b/core/jni/android_view_DisplayEventReceiver.cpp
@@ -36,11 +36,6 @@
 
 namespace android {
 
-// Number of events to read at a time from the DisplayEventReceiver pipe.
-// The value should be large enough that we can quickly drain the pipe
-// using just a few large reads.
-static const size_t EVENT_BUFFER_SIZE = 100;
-
 static struct {
     jclass clazz;
 
@@ -63,7 +58,6 @@
     jobject mReceiverWeakGlobal;
     sp<MessageQueue> mMessageQueue;
     DisplayEventReceiver mReceiver;
-    bool mWaitingForVsync;
 
     virtual void dispatchVsync(nsecs_t timestamp, int32_t id, uint32_t count);
     virtual void dispatchHotplug(nsecs_t timestamp, int32_t id, bool connected);
@@ -74,7 +68,7 @@
         jobject receiverWeak, const sp<MessageQueue>& messageQueue) :
         DisplayEventDispatcher(messageQueue->getLooper()),
         mReceiverWeakGlobal(env->NewGlobalRef(receiverWeak)),
-        mMessageQueue(messageQueue), mWaitingForVsync(false) {
+        mMessageQueue(messageQueue) {
     ALOGV("receiver %p ~ Initializing display event receiver.", this);
 }
 
diff --git a/core/jni/android_view_ThreadedRenderer.cpp b/core/jni/android_view_ThreadedRenderer.cpp
index 07868c5..68e1c96 100644
--- a/core/jni/android_view_ThreadedRenderer.cpp
+++ b/core/jni/android_view_ThreadedRenderer.cpp
@@ -342,7 +342,6 @@
 
     JavaVM* const mVm;
     jweak mObserverWeak;
-    jobject mJavaBufferGlobal;
 
     sp<MessageQueue> mMessageQueue;
     sp<NotifyHandler> mMessageHandler;