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

Commit 639c99d4 authored by Vimal Puthanveed's avatar Vimal Puthanveed Committed by Steve Kondik
Browse files

frameworks/base: Fix to remove exception in tonegenerator

- Framework reboot happens, if tonegenerator fails to create
  a track in audioflinger.
- The cause for framework reboot is, an exception thrown by
  tonegenerator if fails to init.
- Fix is to remove the exception and delete the tonegenerator
  instance.
CRs-fixed:466491

Change-Id: Ie7b87f787d8a885cc70be9af4ba9d04ecd691cc2
parent a89a837c
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -44,7 +44,7 @@ static jboolean android_media_ToneGenerator_startTone(JNIEnv *env, jobject thiz,
    ToneGenerator *lpToneGen = (ToneGenerator *)env->GetIntField(thiz,
            fields.context);
    if (lpToneGen == NULL) {
        jniThrowRuntimeException(env, "Method called after release()");
        ALOGE("lpToneGen is NULL");
        return false;
    }

@@ -59,7 +59,7 @@ static void android_media_ToneGenerator_stopTone(JNIEnv *env, jobject thiz) {

    ALOGV("ToneGenerator lpToneGen: %x", (unsigned int)lpToneGen);
    if (lpToneGen == NULL) {
        jniThrowRuntimeException(env, "Method called after release()");
        ALOGE("lpToneGen is NULL");
        return;
    }
    lpToneGen->stopTone();
@@ -97,7 +97,7 @@ static void android_media_ToneGenerator_native_setup(JNIEnv *env, jobject thiz,

    if (!lpToneGen->isInited()) {
        ALOGE("ToneGenerator init failed");
        jniThrowRuntimeException(env, "Init failed");
        if (lpToneGen)
            delete lpToneGen;
        return;
    }