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

Commit df8f970f authored by Nathan Harold's avatar Nathan Harold Committed by android-build-merger
Browse files

Allocate CallbacksObj Before Initializing A2DP JNI Interface

am: a10f02c1

Change-Id: I534e7fcdd9a2d681e517f89e513c428084523214
parents 3cfad07b a10f02c1
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -131,6 +131,11 @@ static void initNative(JNIEnv *env, jobject object) {
         mCallbacksObj = NULL;
    }

    if ((mCallbacksObj = env->NewGlobalRef(object)) == NULL) {
        ALOGE("Failed to allocate Global Ref for A2DP Callbacks");
        return;
    }

    if ( (sBluetoothA2dpInterface = (btav_interface_t *)
          btInf->get_profile_interface(BT_PROFILE_ADVANCED_AUDIO_ID)) == NULL) {
        ALOGE("Failed to get Bluetooth A2DP Interface");
@@ -142,8 +147,6 @@ static void initNative(JNIEnv *env, jobject object) {
        sBluetoothA2dpInterface = NULL;
        return;
    }

    mCallbacksObj = env->NewGlobalRef(object);
}

static void cleanupNative(JNIEnv *env, jobject object) {