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

Commit 813fcb5f authored by Steve Kondik's avatar Steve Kondik Committed by Ricardo Cerqueira
Browse files

Add ifdefs for QCOM-specific features

Change-Id: I6e140e0dab9f2ce929c356f9c486309bb7e23099
parent a83483e6
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -159,16 +159,20 @@ JNICameraContext::JNICameraContext(JNIEnv* env, jobject weak_this, jclass clazz,
    mCameraJClass = (jclass)env->NewGlobalRef(clazz);
    mCamera = camera;

#ifdef QCOM_BSP
    jclass extendedfaceClazz = env->FindClass("org/codeaurora/camera/ExtendedFace");
    if (NULL != extendedfaceClazz) {
        mFaceClass = (jclass) env->NewGlobalRef(extendedfaceClazz);
        mIsExtendedFace = true;
    } else {
        env->ExceptionClear();
#endif
        jclass faceClazz = env->FindClass("android/hardware/Camera$Face");
        mFaceClass = (jclass) env->NewGlobalRef(faceClazz);
        mIsExtendedFace = false;
#ifdef QCOM_BSP
    }
#endif

    jclass rectClazz = env->FindClass("android/graphics/Rect");
    mRectClass = (jclass) env->NewGlobalRef(rectClazz);
@@ -408,6 +412,7 @@ void JNICameraContext::postMetadata(JNIEnv *env, int32_t msgType, camera_frame_m

        env->SetIntField(face, fields.face_id, metadata->faces[i].id);

#ifdef QCOM_BSP
        if (mIsExtendedFace) {
            env->SetIntField(face, fields.face_sm_degree, metadata->faces[i].smile_degree);
            env->SetIntField(face, fields.face_sm_score, metadata->faces[i].smile_score);
@@ -422,6 +427,7 @@ void JNICameraContext::postMetadata(JNIEnv *env, int32_t msgType, camera_frame_m
            env->SetIntField(face, fields.face_left_right_gaze, metadata->faces[i].left_right_gaze);
            env->SetIntField(face, fields.face_top_bottom_gaze, metadata->faces[i].top_bottom_gaze);
        }
#endif

        env->DeleteLocalRef(face);
        env->DeleteLocalRef(rect);
@@ -1191,6 +1197,7 @@ int register_android_hardware_Camera(JNIEnv *env)
        { "android/hardware/Camera$Face", "faceRecognised", "I", &fields.face_recognised },
    };

#ifdef QCOM_BSP
    field extendedfacefields_to_find[] = {
        { "org/codeaurora/camera/ExtendedFace", "rect", "Landroid/graphics/Rect;", &fields.face_rect },
        { "org/codeaurora/camera/ExtendedFace", "score", "I", &fields.face_score },
@@ -1211,6 +1218,7 @@ int register_android_hardware_Camera(JNIEnv *env)
        { "org/codeaurora/camera/ExtendedFace", "leftrightGaze", "I", &fields.face_left_right_gaze },
        { "org/codeaurora/camera/ExtendedFace", "topbottomGaze", "I", &fields.face_top_bottom_gaze },
    };
#endif

    if (find_fields(env, fields_to_find, NELEM(fields_to_find)) < 0)
        return -1;
@@ -1237,6 +1245,7 @@ int register_android_hardware_Camera(JNIEnv *env)
        return -1;
    }

#ifdef QCOM_BSP
    clazz = env->FindClass("org/codeaurora/camera/ExtendedFace");
    if (NULL != clazz) {
        fields.face_constructor = env->GetMethodID(clazz, "<init>", "()V");
@@ -1246,6 +1255,7 @@ int register_android_hardware_Camera(JNIEnv *env)
        }
    } else {
        env->ExceptionClear();
#endif
        clazz = env->FindClass("android/hardware/Camera$Face");
        fields.face_constructor = env->GetMethodID(clazz, "<init>", "()V");
        if (fields.face_constructor == NULL) {
@@ -1256,7 +1266,9 @@ int register_android_hardware_Camera(JNIEnv *env)
            ALOGE("Can't find_fields() for facefields_to_find");
            return -1;
        }
#ifdef QCOM_BSP
    }
#endif

    // Register native functions
    return AndroidRuntime::registerNativeMethods(env, "android/hardware/Camera",
+4 −0
Original line number Diff line number Diff line
@@ -54,6 +54,7 @@ static inline audio_format_t audioFormatToNative(int audioFormat)
        return AUDIO_FORMAT_AC3;
    case ENCODING_E_AC3:
        return AUDIO_FORMAT_E_AC3;
#ifdef QCOM_HARDWARE
    case ENCODING_AMR_NB:
        return AUDIO_FORMAT_AMR_NB;
    case ENCODING_AMR_WB:
@@ -66,6 +67,7 @@ static inline audio_format_t audioFormatToNative(int audioFormat)
        return AUDIO_FORMAT_EVRCWB;
    case ENCODING_EVRC_NW:
        return AUDIO_FORMAT_EVRCNW;
#endif
    case ENCODING_DEFAULT:
        return AUDIO_FORMAT_DEFAULT;
    default:
@@ -86,6 +88,7 @@ static inline int audioFormatFromNative(audio_format_t nativeFormat)
        return ENCODING_AC3;
    case AUDIO_FORMAT_E_AC3:
        return ENCODING_E_AC3;
#ifdef QCOM_HARDWARE
    case AUDIO_FORMAT_AMR_NB:
        return ENCODING_AMR_NB;
    case AUDIO_FORMAT_AMR_WB:
@@ -98,6 +101,7 @@ static inline int audioFormatFromNative(audio_format_t nativeFormat)
        return ENCODING_EVRC_WB;
    case AUDIO_FORMAT_EVRCNW:
        return ENCODING_EVRC_NW;
#endif
    case AUDIO_FORMAT_DEFAULT:
        return ENCODING_DEFAULT;
    default:
+2 −0
Original line number Diff line number Diff line
@@ -912,7 +912,9 @@ static jint android_media_AudioTrack_get_output_sample_rate(JNIEnv *env, jobjec
    case AUDIO_STREAM_NOTIFICATION:
    case AUDIO_STREAM_BLUETOOTH_SCO:
    case AUDIO_STREAM_DTMF:
#ifdef QCOM_HARDWARE
    case AUDIO_STREAM_INCALL_MUSIC:
#endif
        nativeStreamType = (audio_stream_type_t) javaStreamType;
        break;
    default:
+2 −0
Original line number Diff line number Diff line
@@ -190,6 +190,7 @@ static inline SkColorType convertPixelFormat(PixelFormat format) {
static void nativeSetDirtyRect(JNIEnv* env, jclass clazz,
        jlong nativeObject, jobject dirtyRect) {

#ifdef QCOM_BSP
    sp<Surface> surface(reinterpret_cast<Surface *>(nativeObject));

    if (!isSurfaceValid(surface)) {
@@ -204,6 +205,7 @@ static void nativeSetDirtyRect(JNIEnv* env, jclass clazz,
    rect.bottom = env->GetIntField(dirtyRect, gRectClassInfo.bottom);

    surface->setDirtyRect(&rect);
#endif
}

static jlong nativeLockCanvas(JNIEnv* env, jclass clazz,