From ffc058ccea6deb6af920f0a3a7c1f4dcaf62944a Mon Sep 17 00:00:00 2001 From: Yu-Han Yang Date: Wed, 2 Feb 2022 16:28:58 -0800 Subject: [PATCH] Update getInterfaceVersion checks to include -1 getInterfaceVersion() returns -1 if it is unknown. V1 of the HAL doesn't implement getInterfaceVersion due to ABI reasons for regular, unversioned, AIDL interfaces. Bug: 206670536 Test: on device Change-Id: I358fe2748b4a8450b68d0954dee0814fe246eb18 --- .../jni/com_android_server_location_GnssLocationProvider.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/services/core/jni/com_android_server_location_GnssLocationProvider.cpp b/services/core/jni/com_android_server_location_GnssLocationProvider.cpp index 166a0f5272cf8..0584604ac7b9b 100644 --- a/services/core/jni/com_android_server_location_GnssLocationProvider.cpp +++ b/services/core/jni/com_android_server_location_GnssLocationProvider.cpp @@ -509,7 +509,7 @@ uint32_t GnssCallback::getConstellationType( template Return GnssCallback::gnssSvStatusCbImpl(const T_list& svStatus) { // In HIDL or AIDL v1, if no listener is registered, do not report svInfoList to the framework. - if (gnssHalAidl == nullptr || gnssHalAidl->getInterfaceVersion() == 1) { + if (gnssHalAidl == nullptr || gnssHalAidl->getInterfaceVersion() <= 1) { if (!isSvStatusRegistered) { return Void(); } @@ -695,7 +695,7 @@ Status GnssCallbackAidl::gnssLocationCb(const GnssLocationAidl& location) { Status GnssCallbackAidl::gnssNmeaCb(const int64_t timestamp, const std::string& nmea) { // In AIDL v1, if no listener is registered, do not report nmea to the framework. - if (gnssHalAidl != nullptr && gnssHalAidl->getInterfaceVersion() == 1) { + if (gnssHalAidl != nullptr && gnssHalAidl->getInterfaceVersion() <= 1) { if (!isNmeaRegistered) { return Status::ok(); }