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

Commit 0d79f81b authored by Haofan Wang's avatar Haofan Wang
Browse files

Fix incorrect codeRates in JTuner JNI conversion

The FrontendStatus.getCodeRate() retrun type is int[], but FrontendInnerFec is long
type. The long term fix requires API changes.(Change the return type of
getCodeRate)

This is a short term fix corrects the issue for values within the int
range but will truncate larger FrontendInnerFec enum values

Bug: 402031649
Test: m
Flag: EXEMPT bug fix
Change-Id: I6e4c6f0ce0877ae53cd6ef5337afe1113ffe8b5f
parent fee75f23
Loading
Loading
Loading
Loading
+7 −3
Original line number Diff line number Diff line
@@ -2602,9 +2602,13 @@ jobject JTuner::getFrontendStatus(jintArray types) {
                jfieldID field = env->GetFieldID(clazz, "mCodeRates", "[I");
                std::vector<FrontendInnerFec> v = s.get<FrontendStatus::Tag::codeRates>();

                ScopedLocalRef valObj(env, env->NewIntArray(v.size()));
                env->SetIntArrayRegion(valObj.get(), 0, v.size(), reinterpret_cast<jint *>(&v[0]));

                //Short-term fix for frontend status coderates not retrieved correctly.
                ScopedLocalRef<jintArray> valObj(env, env->NewIntArray(v.size()));
                std::vector<jint> temp(v.size());
                for (size_t i = 0; i < v.size(); i++) {
                    temp[i] = static_cast<jint>(v[i]);
                }
                env->SetIntArrayRegion(valObj.get(), 0, v.size(), temp.data());
                env->SetObjectField(statusObj, field, valObj.get());
                break;
            }