Merge changes from topic "presubmit-am-3c10be889d714dfab534958ebea00946" into sc-v2-dev-plus-aosp
* changes:
[automerge] DO NOT MERGE: Call DeleteLocalRef on callObjectMethod's returned value 2p: 7a883af438
DO NOT MERGE: Call DeleteLocalRef on callObjectMethod's returned value
This commit is contained in:
committed by
Android (Google) Code Review
commit
59e95f1ba5
@@ -1115,17 +1115,18 @@ jobject GnssAntennaInfoCallback::translateSingleGnssAntennaInfo(
|
|||||||
env->NewObject(class_gnssAntennaInfoBuilder, method_gnssAntennaInfoBuilderCtor);
|
env->NewObject(class_gnssAntennaInfoBuilder, method_gnssAntennaInfoBuilderCtor);
|
||||||
|
|
||||||
// Set fields
|
// Set fields
|
||||||
env->CallObjectMethod(gnssAntennaInfoBuilderObject,
|
callObjectMethodIgnoringResult(env, gnssAntennaInfoBuilderObject,
|
||||||
method_gnssAntennaInfoBuilderSetCarrierFrequencyMHz,
|
method_gnssAntennaInfoBuilderSetCarrierFrequencyMHz,
|
||||||
gnssAntennaInfo.carrierFrequencyMHz);
|
gnssAntennaInfo.carrierFrequencyMHz);
|
||||||
env->CallObjectMethod(gnssAntennaInfoBuilderObject,
|
callObjectMethodIgnoringResult(env, gnssAntennaInfoBuilderObject,
|
||||||
method_gnssAntennaInfoBuilderSetPhaseCenterOffset, phaseCenterOffset);
|
method_gnssAntennaInfoBuilderSetPhaseCenterOffset,
|
||||||
env->CallObjectMethod(gnssAntennaInfoBuilderObject,
|
phaseCenterOffset);
|
||||||
method_gnssAntennaInfoBuilderSetPhaseCenterVariationCorrections,
|
callObjectMethodIgnoringResult(env, gnssAntennaInfoBuilderObject,
|
||||||
phaseCenterVariationCorrections);
|
method_gnssAntennaInfoBuilderSetPhaseCenterVariationCorrections,
|
||||||
env->CallObjectMethod(gnssAntennaInfoBuilderObject,
|
phaseCenterVariationCorrections);
|
||||||
method_gnssAntennaInfoBuilderSetSignalGainCorrections,
|
callObjectMethodIgnoringResult(env, gnssAntennaInfoBuilderObject,
|
||||||
signalGainCorrections);
|
method_gnssAntennaInfoBuilderSetSignalGainCorrections,
|
||||||
|
signalGainCorrections);
|
||||||
|
|
||||||
// build
|
// build
|
||||||
jobject gnssAntennaInfoObject =
|
jobject gnssAntennaInfoObject =
|
||||||
@@ -2707,7 +2708,7 @@ static SingleSatCorrection_V1_0 getSingleSatCorrection_1_0_withoutConstellation(
|
|||||||
jfloat eplMeters = env->CallFloatMethod(singleSatCorrectionObj, method_correctionSatEpl);
|
jfloat eplMeters = env->CallFloatMethod(singleSatCorrectionObj, method_correctionSatEpl);
|
||||||
jfloat eplUncMeters = env->CallFloatMethod(singleSatCorrectionObj, method_correctionSatEplUnc);
|
jfloat eplUncMeters = env->CallFloatMethod(singleSatCorrectionObj, method_correctionSatEplUnc);
|
||||||
uint16_t corrFlags = static_cast<uint16_t>(correctionFlags);
|
uint16_t corrFlags = static_cast<uint16_t>(correctionFlags);
|
||||||
jobject reflectingPlaneObj;
|
jobject reflectingPlaneObj = nullptr;
|
||||||
bool has_ref_plane = (corrFlags & GnssSingleSatCorrectionFlags::HAS_REFLECTING_PLANE) != 0;
|
bool has_ref_plane = (corrFlags & GnssSingleSatCorrectionFlags::HAS_REFLECTING_PLANE) != 0;
|
||||||
if (has_ref_plane) {
|
if (has_ref_plane) {
|
||||||
reflectingPlaneObj =
|
reflectingPlaneObj =
|
||||||
@@ -2731,6 +2732,7 @@ static SingleSatCorrection_V1_0 getSingleSatCorrection_1_0_withoutConstellation(
|
|||||||
.azimuthDegrees = azimuthDegreeRefPlane,
|
.azimuthDegrees = azimuthDegreeRefPlane,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
env->DeleteLocalRef(reflectingPlaneObj);
|
||||||
|
|
||||||
SingleSatCorrection_V1_0 singleSatCorrection = {
|
SingleSatCorrection_V1_0 singleSatCorrection = {
|
||||||
.singleSatCorrectionFlags = corrFlags,
|
.singleSatCorrectionFlags = corrFlags,
|
||||||
@@ -2762,6 +2764,7 @@ static void getSingleSatCorrectionList_1_1(JNIEnv* env, jobject singleSatCorrect
|
|||||||
};
|
};
|
||||||
|
|
||||||
list[i] = singleSatCorrection_1_1;
|
list[i] = singleSatCorrection_1_1;
|
||||||
|
env->DeleteLocalRef(singleSatCorrectionObj);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2779,6 +2782,7 @@ static void getSingleSatCorrectionList_1_0(JNIEnv* env, jobject singleSatCorrect
|
|||||||
singleSatCorrection.constellation = static_cast<GnssConstellationType_V1_0>(constType),
|
singleSatCorrection.constellation = static_cast<GnssConstellationType_V1_0>(constType),
|
||||||
|
|
||||||
list[i] = singleSatCorrection;
|
list[i] = singleSatCorrection;
|
||||||
|
env->DeleteLocalRef(singleSatCorrectionObj);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2849,6 +2853,7 @@ static jboolean android_location_gnss_hal_GnssNative_inject_measurement_correcti
|
|||||||
|
|
||||||
hidl_vec<SingleSatCorrection_V1_0> list(len);
|
hidl_vec<SingleSatCorrection_V1_0> list(len);
|
||||||
getSingleSatCorrectionList_1_0(env, singleSatCorrectionList, list);
|
getSingleSatCorrectionList_1_0(env, singleSatCorrectionList, list);
|
||||||
|
env->DeleteLocalRef(singleSatCorrectionList);
|
||||||
measurementCorrections_1_0.satCorrections = list;
|
measurementCorrections_1_0.satCorrections = list;
|
||||||
|
|
||||||
auto result = gnssCorrectionsIface_V1_0->setCorrections(measurementCorrections_1_0);
|
auto result = gnssCorrectionsIface_V1_0->setCorrections(measurementCorrections_1_0);
|
||||||
|
|||||||
@@ -335,24 +335,24 @@ void GnssMeasurementCallbackAidl::translateSingleGnssMeasurement(JNIEnv* env,
|
|||||||
satellitePvt.satClockInfo.satHardwareCodeBiasMeters,
|
satellitePvt.satClockInfo.satHardwareCodeBiasMeters,
|
||||||
satellitePvt.satClockInfo.satTimeCorrectionMeters,
|
satellitePvt.satClockInfo.satTimeCorrectionMeters,
|
||||||
satellitePvt.satClockInfo.satClkDriftMps);
|
satellitePvt.satClockInfo.satClkDriftMps);
|
||||||
env->CallObjectMethod(satellitePvtBuilderObject,
|
callObjectMethodIgnoringResult(env, satellitePvtBuilderObject,
|
||||||
method_satellitePvtBuilderSetPositionEcef, positionEcef);
|
method_satellitePvtBuilderSetPositionEcef, positionEcef);
|
||||||
env->CallObjectMethod(satellitePvtBuilderObject,
|
callObjectMethodIgnoringResult(env, satellitePvtBuilderObject,
|
||||||
method_satellitePvtBuilderSetVelocityEcef, velocityEcef);
|
method_satellitePvtBuilderSetVelocityEcef, velocityEcef);
|
||||||
env->CallObjectMethod(satellitePvtBuilderObject, method_satellitePvtBuilderSetClockInfo,
|
callObjectMethodIgnoringResult(env, satellitePvtBuilderObject,
|
||||||
clockInfo);
|
method_satellitePvtBuilderSetClockInfo, clockInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (satFlags & SatellitePvt::HAS_IONO) {
|
if (satFlags & SatellitePvt::HAS_IONO) {
|
||||||
env->CallObjectMethod(satellitePvtBuilderObject,
|
callObjectMethodIgnoringResult(env, satellitePvtBuilderObject,
|
||||||
method_satellitePvtBuilderSetIonoDelayMeters,
|
method_satellitePvtBuilderSetIonoDelayMeters,
|
||||||
satellitePvt.ionoDelayMeters);
|
satellitePvt.ionoDelayMeters);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (satFlags & SatellitePvt::HAS_TROPO) {
|
if (satFlags & SatellitePvt::HAS_TROPO) {
|
||||||
env->CallObjectMethod(satellitePvtBuilderObject,
|
callObjectMethodIgnoringResult(env, satellitePvtBuilderObject,
|
||||||
method_satellitePvtBuilderSetTropoDelayMeters,
|
method_satellitePvtBuilderSetTropoDelayMeters,
|
||||||
satellitePvt.tropoDelayMeters);
|
satellitePvt.tropoDelayMeters);
|
||||||
}
|
}
|
||||||
|
|
||||||
jobject satellitePvtObject =
|
jobject satellitePvtObject =
|
||||||
@@ -380,17 +380,19 @@ void GnssMeasurementCallbackAidl::translateSingleGnssMeasurement(JNIEnv* env,
|
|||||||
jobject correlationVectorBuilderObject =
|
jobject correlationVectorBuilderObject =
|
||||||
env->NewObject(class_correlationVectorBuilder,
|
env->NewObject(class_correlationVectorBuilder,
|
||||||
method_correlationVectorBuilderCtor);
|
method_correlationVectorBuilderCtor);
|
||||||
env->CallObjectMethod(correlationVectorBuilderObject,
|
callObjectMethodIgnoringResult(env, correlationVectorBuilderObject,
|
||||||
method_correlationVectorBuilderSetMagnitude, magnitudeArray);
|
method_correlationVectorBuilderSetMagnitude,
|
||||||
env->CallObjectMethod(correlationVectorBuilderObject,
|
magnitudeArray);
|
||||||
method_correlationVectorBuilderSetFrequencyOffsetMetersPerSecond,
|
callObjectMethodIgnoringResult(
|
||||||
correlationVector.frequencyOffsetMps);
|
env, correlationVectorBuilderObject,
|
||||||
env->CallObjectMethod(correlationVectorBuilderObject,
|
method_correlationVectorBuilderSetFrequencyOffsetMetersPerSecond,
|
||||||
method_correlationVectorBuilderSetSamplingStartMeters,
|
correlationVector.frequencyOffsetMps);
|
||||||
correlationVector.samplingStartM);
|
callObjectMethodIgnoringResult(env, correlationVectorBuilderObject,
|
||||||
env->CallObjectMethod(correlationVectorBuilderObject,
|
method_correlationVectorBuilderSetSamplingStartMeters,
|
||||||
method_correlationVectorBuilderSetSamplingWidthMeters,
|
correlationVector.samplingStartM);
|
||||||
correlationVector.samplingWidthM);
|
callObjectMethodIgnoringResult(env, correlationVectorBuilderObject,
|
||||||
|
method_correlationVectorBuilderSetSamplingWidthMeters,
|
||||||
|
correlationVector.samplingWidthM);
|
||||||
jobject correlationVectorObject =
|
jobject correlationVectorObject =
|
||||||
env->CallObjectMethod(correlationVectorBuilderObject,
|
env->CallObjectMethod(correlationVectorBuilderObject,
|
||||||
method_correlationVectorBuilderBuild);
|
method_correlationVectorBuilderBuild);
|
||||||
|
|||||||
@@ -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)
|
JavaObject::JavaObject(JNIEnv* env, jclass clazz, jmethodID defaultCtor)
|
||||||
: env_(env), clazz_(clazz) {
|
: env_(env), clazz_(clazz) {
|
||||||
object_ = env_->NewObject(clazz_, defaultCtor);
|
object_ = env_->NewObject(clazz_, defaultCtor);
|
||||||
|
|||||||
@@ -48,6 +48,8 @@ jboolean checkAidlStatus(const android::binder::Status& status, const char* erro
|
|||||||
|
|
||||||
void checkAndClearExceptionFromCallback(JNIEnv* env, const char* methodName);
|
void checkAndClearExceptionFromCallback(JNIEnv* env, const char* methodName);
|
||||||
|
|
||||||
|
void callObjectMethodIgnoringResult(JNIEnv* env, jobject obj, jmethodID mid, ...);
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
void logHidlError(hardware::Return<T>& result, const char* errorMessage) {
|
void logHidlError(hardware::Return<T>& result, const char* errorMessage) {
|
||||||
ALOGE("%s HIDL transport error: %s", errorMessage, result.description().c_str());
|
ALOGE("%s HIDL transport error: %s", errorMessage, result.description().c_str());
|
||||||
|
|||||||
Reference in New Issue
Block a user