Loading services/core/jni/com_android_server_location_GnssLocationProvider.cpp +17 −12 Original line number Diff line number Diff line Loading @@ -1115,15 +1115,16 @@ jobject GnssAntennaInfoCallback::translateSingleGnssAntennaInfo( env->NewObject(class_gnssAntennaInfoBuilder, method_gnssAntennaInfoBuilderCtor); // Set fields env->CallObjectMethod(gnssAntennaInfoBuilderObject, callObjectMethodIgnoringResult(env, gnssAntennaInfoBuilderObject, method_gnssAntennaInfoBuilderSetCarrierFrequencyMHz, gnssAntennaInfo.carrierFrequencyMHz); env->CallObjectMethod(gnssAntennaInfoBuilderObject, method_gnssAntennaInfoBuilderSetPhaseCenterOffset, phaseCenterOffset); env->CallObjectMethod(gnssAntennaInfoBuilderObject, callObjectMethodIgnoringResult(env, gnssAntennaInfoBuilderObject, method_gnssAntennaInfoBuilderSetPhaseCenterOffset, phaseCenterOffset); callObjectMethodIgnoringResult(env, gnssAntennaInfoBuilderObject, method_gnssAntennaInfoBuilderSetPhaseCenterVariationCorrections, phaseCenterVariationCorrections); env->CallObjectMethod(gnssAntennaInfoBuilderObject, callObjectMethodIgnoringResult(env, gnssAntennaInfoBuilderObject, method_gnssAntennaInfoBuilderSetSignalGainCorrections, signalGainCorrections); Loading Loading @@ -2707,7 +2708,7 @@ static SingleSatCorrection_V1_0 getSingleSatCorrection_1_0_withoutConstellation( jfloat eplMeters = env->CallFloatMethod(singleSatCorrectionObj, method_correctionSatEpl); jfloat eplUncMeters = env->CallFloatMethod(singleSatCorrectionObj, method_correctionSatEplUnc); uint16_t corrFlags = static_cast<uint16_t>(correctionFlags); jobject reflectingPlaneObj; jobject reflectingPlaneObj = nullptr; bool has_ref_plane = (corrFlags & GnssSingleSatCorrectionFlags::HAS_REFLECTING_PLANE) != 0; if (has_ref_plane) { reflectingPlaneObj = Loading @@ -2731,6 +2732,7 @@ static SingleSatCorrection_V1_0 getSingleSatCorrection_1_0_withoutConstellation( .azimuthDegrees = azimuthDegreeRefPlane, }; } env->DeleteLocalRef(reflectingPlaneObj); SingleSatCorrection_V1_0 singleSatCorrection = { .singleSatCorrectionFlags = corrFlags, Loading Loading @@ -2762,6 +2764,7 @@ static void getSingleSatCorrectionList_1_1(JNIEnv* env, jobject singleSatCorrect }; list[i] = singleSatCorrection_1_1; env->DeleteLocalRef(singleSatCorrectionObj); } } Loading @@ -2779,6 +2782,7 @@ static void getSingleSatCorrectionList_1_0(JNIEnv* env, jobject singleSatCorrect singleSatCorrection.constellation = static_cast<GnssConstellationType_V1_0>(constType), list[i] = singleSatCorrection; env->DeleteLocalRef(singleSatCorrectionObj); } } Loading Loading @@ -2849,6 +2853,7 @@ static jboolean android_location_gnss_hal_GnssNative_inject_measurement_correcti hidl_vec<SingleSatCorrection_V1_0> list(len); getSingleSatCorrectionList_1_0(env, singleSatCorrectionList, list); env->DeleteLocalRef(singleSatCorrectionList); measurementCorrections_1_0.satCorrections = list; auto result = gnssCorrectionsIface_V1_0->setCorrections(measurementCorrections_1_0); Loading services/core/jni/gnss/GnssMeasurementCallback.cpp +25 −23 Original line number Diff line number Diff line Loading @@ -335,22 +335,22 @@ void GnssMeasurementCallbackAidl::translateSingleGnssMeasurement(JNIEnv* env, satellitePvt.satClockInfo.satHardwareCodeBiasMeters, satellitePvt.satClockInfo.satTimeCorrectionMeters, satellitePvt.satClockInfo.satClkDriftMps); env->CallObjectMethod(satellitePvtBuilderObject, callObjectMethodIgnoringResult(env, satellitePvtBuilderObject, method_satellitePvtBuilderSetPositionEcef, positionEcef); env->CallObjectMethod(satellitePvtBuilderObject, callObjectMethodIgnoringResult(env, satellitePvtBuilderObject, method_satellitePvtBuilderSetVelocityEcef, velocityEcef); env->CallObjectMethod(satellitePvtBuilderObject, method_satellitePvtBuilderSetClockInfo, clockInfo); callObjectMethodIgnoringResult(env, satellitePvtBuilderObject, method_satellitePvtBuilderSetClockInfo, clockInfo); } if (satFlags & SatellitePvt::HAS_IONO) { env->CallObjectMethod(satellitePvtBuilderObject, callObjectMethodIgnoringResult(env, satellitePvtBuilderObject, method_satellitePvtBuilderSetIonoDelayMeters, satellitePvt.ionoDelayMeters); } if (satFlags & SatellitePvt::HAS_TROPO) { env->CallObjectMethod(satellitePvtBuilderObject, callObjectMethodIgnoringResult(env, satellitePvtBuilderObject, method_satellitePvtBuilderSetTropoDelayMeters, satellitePvt.tropoDelayMeters); } Loading Loading @@ -380,15 +380,17 @@ void GnssMeasurementCallbackAidl::translateSingleGnssMeasurement(JNIEnv* env, jobject correlationVectorBuilderObject = env->NewObject(class_correlationVectorBuilder, method_correlationVectorBuilderCtor); env->CallObjectMethod(correlationVectorBuilderObject, method_correlationVectorBuilderSetMagnitude, magnitudeArray); env->CallObjectMethod(correlationVectorBuilderObject, callObjectMethodIgnoringResult(env, correlationVectorBuilderObject, method_correlationVectorBuilderSetMagnitude, magnitudeArray); callObjectMethodIgnoringResult( env, correlationVectorBuilderObject, method_correlationVectorBuilderSetFrequencyOffsetMetersPerSecond, correlationVector.frequencyOffsetMps); env->CallObjectMethod(correlationVectorBuilderObject, callObjectMethodIgnoringResult(env, correlationVectorBuilderObject, method_correlationVectorBuilderSetSamplingStartMeters, correlationVector.samplingStartM); env->CallObjectMethod(correlationVectorBuilderObject, callObjectMethodIgnoringResult(env, correlationVectorBuilderObject, method_correlationVectorBuilderSetSamplingWidthMeters, correlationVector.samplingWidthM); jobject correlationVectorObject = Loading services/core/jni/gnss/Utils.cpp +7 −0 Original line number Diff line number Diff line Loading @@ -82,6 +82,13 @@ void checkAndClearExceptionFromCallback(JNIEnv* env, const char* methodName) { } } void callObjectMethodIgnoringResult(JNIEnv* env, jobject obj, jmethodID mid, ...) { va_list args; va_start(args, mid); env->DeleteLocalRef(env->CallObjectMethodV(obj, mid, args)); va_end(args); } JavaObject::JavaObject(JNIEnv* env, jclass clazz, jmethodID defaultCtor) : env_(env), clazz_(clazz) { object_ = env_->NewObject(clazz_, defaultCtor); Loading services/core/jni/gnss/Utils.h +2 −0 Original line number Diff line number Diff line Loading @@ -48,6 +48,8 @@ jboolean checkAidlStatus(const android::binder::Status& status, const char* erro void checkAndClearExceptionFromCallback(JNIEnv* env, const char* methodName); void callObjectMethodIgnoringResult(JNIEnv* env, jobject obj, jmethodID mid, ...); template <class T> void logHidlError(hardware::Return<T>& result, const char* errorMessage) { ALOGE("%s HIDL transport error: %s", errorMessage, result.description().c_str()); Loading Loading
services/core/jni/com_android_server_location_GnssLocationProvider.cpp +17 −12 Original line number Diff line number Diff line Loading @@ -1115,15 +1115,16 @@ jobject GnssAntennaInfoCallback::translateSingleGnssAntennaInfo( env->NewObject(class_gnssAntennaInfoBuilder, method_gnssAntennaInfoBuilderCtor); // Set fields env->CallObjectMethod(gnssAntennaInfoBuilderObject, callObjectMethodIgnoringResult(env, gnssAntennaInfoBuilderObject, method_gnssAntennaInfoBuilderSetCarrierFrequencyMHz, gnssAntennaInfo.carrierFrequencyMHz); env->CallObjectMethod(gnssAntennaInfoBuilderObject, method_gnssAntennaInfoBuilderSetPhaseCenterOffset, phaseCenterOffset); env->CallObjectMethod(gnssAntennaInfoBuilderObject, callObjectMethodIgnoringResult(env, gnssAntennaInfoBuilderObject, method_gnssAntennaInfoBuilderSetPhaseCenterOffset, phaseCenterOffset); callObjectMethodIgnoringResult(env, gnssAntennaInfoBuilderObject, method_gnssAntennaInfoBuilderSetPhaseCenterVariationCorrections, phaseCenterVariationCorrections); env->CallObjectMethod(gnssAntennaInfoBuilderObject, callObjectMethodIgnoringResult(env, gnssAntennaInfoBuilderObject, method_gnssAntennaInfoBuilderSetSignalGainCorrections, signalGainCorrections); Loading Loading @@ -2707,7 +2708,7 @@ static SingleSatCorrection_V1_0 getSingleSatCorrection_1_0_withoutConstellation( jfloat eplMeters = env->CallFloatMethod(singleSatCorrectionObj, method_correctionSatEpl); jfloat eplUncMeters = env->CallFloatMethod(singleSatCorrectionObj, method_correctionSatEplUnc); uint16_t corrFlags = static_cast<uint16_t>(correctionFlags); jobject reflectingPlaneObj; jobject reflectingPlaneObj = nullptr; bool has_ref_plane = (corrFlags & GnssSingleSatCorrectionFlags::HAS_REFLECTING_PLANE) != 0; if (has_ref_plane) { reflectingPlaneObj = Loading @@ -2731,6 +2732,7 @@ static SingleSatCorrection_V1_0 getSingleSatCorrection_1_0_withoutConstellation( .azimuthDegrees = azimuthDegreeRefPlane, }; } env->DeleteLocalRef(reflectingPlaneObj); SingleSatCorrection_V1_0 singleSatCorrection = { .singleSatCorrectionFlags = corrFlags, Loading Loading @@ -2762,6 +2764,7 @@ static void getSingleSatCorrectionList_1_1(JNIEnv* env, jobject singleSatCorrect }; list[i] = singleSatCorrection_1_1; env->DeleteLocalRef(singleSatCorrectionObj); } } Loading @@ -2779,6 +2782,7 @@ static void getSingleSatCorrectionList_1_0(JNIEnv* env, jobject singleSatCorrect singleSatCorrection.constellation = static_cast<GnssConstellationType_V1_0>(constType), list[i] = singleSatCorrection; env->DeleteLocalRef(singleSatCorrectionObj); } } Loading Loading @@ -2849,6 +2853,7 @@ static jboolean android_location_gnss_hal_GnssNative_inject_measurement_correcti hidl_vec<SingleSatCorrection_V1_0> list(len); getSingleSatCorrectionList_1_0(env, singleSatCorrectionList, list); env->DeleteLocalRef(singleSatCorrectionList); measurementCorrections_1_0.satCorrections = list; auto result = gnssCorrectionsIface_V1_0->setCorrections(measurementCorrections_1_0); Loading
services/core/jni/gnss/GnssMeasurementCallback.cpp +25 −23 Original line number Diff line number Diff line Loading @@ -335,22 +335,22 @@ void GnssMeasurementCallbackAidl::translateSingleGnssMeasurement(JNIEnv* env, satellitePvt.satClockInfo.satHardwareCodeBiasMeters, satellitePvt.satClockInfo.satTimeCorrectionMeters, satellitePvt.satClockInfo.satClkDriftMps); env->CallObjectMethod(satellitePvtBuilderObject, callObjectMethodIgnoringResult(env, satellitePvtBuilderObject, method_satellitePvtBuilderSetPositionEcef, positionEcef); env->CallObjectMethod(satellitePvtBuilderObject, callObjectMethodIgnoringResult(env, satellitePvtBuilderObject, method_satellitePvtBuilderSetVelocityEcef, velocityEcef); env->CallObjectMethod(satellitePvtBuilderObject, method_satellitePvtBuilderSetClockInfo, clockInfo); callObjectMethodIgnoringResult(env, satellitePvtBuilderObject, method_satellitePvtBuilderSetClockInfo, clockInfo); } if (satFlags & SatellitePvt::HAS_IONO) { env->CallObjectMethod(satellitePvtBuilderObject, callObjectMethodIgnoringResult(env, satellitePvtBuilderObject, method_satellitePvtBuilderSetIonoDelayMeters, satellitePvt.ionoDelayMeters); } if (satFlags & SatellitePvt::HAS_TROPO) { env->CallObjectMethod(satellitePvtBuilderObject, callObjectMethodIgnoringResult(env, satellitePvtBuilderObject, method_satellitePvtBuilderSetTropoDelayMeters, satellitePvt.tropoDelayMeters); } Loading Loading @@ -380,15 +380,17 @@ void GnssMeasurementCallbackAidl::translateSingleGnssMeasurement(JNIEnv* env, jobject correlationVectorBuilderObject = env->NewObject(class_correlationVectorBuilder, method_correlationVectorBuilderCtor); env->CallObjectMethod(correlationVectorBuilderObject, method_correlationVectorBuilderSetMagnitude, magnitudeArray); env->CallObjectMethod(correlationVectorBuilderObject, callObjectMethodIgnoringResult(env, correlationVectorBuilderObject, method_correlationVectorBuilderSetMagnitude, magnitudeArray); callObjectMethodIgnoringResult( env, correlationVectorBuilderObject, method_correlationVectorBuilderSetFrequencyOffsetMetersPerSecond, correlationVector.frequencyOffsetMps); env->CallObjectMethod(correlationVectorBuilderObject, callObjectMethodIgnoringResult(env, correlationVectorBuilderObject, method_correlationVectorBuilderSetSamplingStartMeters, correlationVector.samplingStartM); env->CallObjectMethod(correlationVectorBuilderObject, callObjectMethodIgnoringResult(env, correlationVectorBuilderObject, method_correlationVectorBuilderSetSamplingWidthMeters, correlationVector.samplingWidthM); jobject correlationVectorObject = Loading
services/core/jni/gnss/Utils.cpp +7 −0 Original line number Diff line number Diff line Loading @@ -82,6 +82,13 @@ void checkAndClearExceptionFromCallback(JNIEnv* env, const char* methodName) { } } void callObjectMethodIgnoringResult(JNIEnv* env, jobject obj, jmethodID mid, ...) { va_list args; va_start(args, mid); env->DeleteLocalRef(env->CallObjectMethodV(obj, mid, args)); va_end(args); } JavaObject::JavaObject(JNIEnv* env, jclass clazz, jmethodID defaultCtor) : env_(env), clazz_(clazz) { object_ = env_->NewObject(clazz_, defaultCtor); Loading
services/core/jni/gnss/Utils.h +2 −0 Original line number Diff line number Diff line Loading @@ -48,6 +48,8 @@ jboolean checkAidlStatus(const android::binder::Status& status, const char* erro void checkAndClearExceptionFromCallback(JNIEnv* env, const char* methodName); void callObjectMethodIgnoringResult(JNIEnv* env, jobject obj, jmethodID mid, ...); template <class T> void logHidlError(hardware::Return<T>& result, const char* errorMessage) { ALOGE("%s HIDL transport error: %s", errorMessage, result.description().c_str()); Loading