Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 85ea32b0 authored by Ben Wagner's avatar Ben Wagner Committed by Stephen Hines
Browse files

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 60b1c8ef)
parent 6b6c7fdf
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -248,7 +248,7 @@ nativeGetDynamicSensors(JNIEnv *env, jclass clazz, jlong sensorManager, jobject

    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
+7 −5
Original line number Diff line number Diff line
@@ -38,6 +38,8 @@
#include "android_media_PlaybackParams.h"
#include "android_media_DeviceCallback.h"

#include <cinttypes>

// ----------------------------------------------------------------------------

using namespace android;
@@ -219,7 +221,7 @@ android_media_AudioTrack_setup(JNIEnv *env, jobject thiz, jobject weak_this, job
        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 @@ static jint android_media_AudioTrack_get_buffer_size_frames(JNIEnv *env, jobjec

    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 @@ static jint android_media_AudioTrack_set_buffer_size_frames(JNIEnv *env,
    }
    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;
+2 −2
Original line number Diff line number Diff line
@@ -36,7 +36,7 @@ static bool parseStringForPath(JNIEnv* env, jobject, jlong skPathHandle, jstring
    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 @@ static long createPathDataFromStringPath(JNIEnv* env, jobject, jstring inputStr,
        return reinterpret_cast<jlong>(pathData);
    } else {
        delete pathData;
        ALOGE(result.failureMessage.c_str());
        ALOGE("%s", result.failureMessage.c_str());
        return NULL;
    }
}
+1 −7
Original line number Diff line number Diff line
@@ -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 @@ private:
    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 @@ NativeDisplayEventReceiver::NativeDisplayEventReceiver(JNIEnv* env,
        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);
}

+0 −1
Original line number Diff line number Diff line
@@ -342,7 +342,6 @@ private:

    JavaVM* const mVm;
    jweak mObserverWeak;
    jobject mJavaBufferGlobal;

    sp<MessageQueue> mMessageQueue;
    sp<NotifyHandler> mMessageHandler;