diff options
author | Robert Chou <robertchou@google.com> | 2023-03-14 08:21:23 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2023-03-14 08:21:23 +0000 |
commit | 18232c027ea49a36865a7ab33a514a457747e467 (patch) | |
tree | d3fe82ca6998f3d8045aad6a88451f6f822c7319 | |
parent | 31a24bfc5d7e8def17afc8776129d77468ac2dd6 (diff) | |
parent | e9667e404a654d11f205cf6f4755ed35d98e8386 (diff) | |
download | base-18232c027ea49a36865a7ab33a514a457747e467.tar.gz |
Merge "Always call stopMeasurementCollection before startMeasurementCollection" into android12-gsi
-rw-r--r-- | services/core/java/com/android/server/location/gnss/GnssMeasurementsProvider.java | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/services/core/java/com/android/server/location/gnss/GnssMeasurementsProvider.java b/services/core/java/com/android/server/location/gnss/GnssMeasurementsProvider.java index 8460d6797543..7963f054899e 100644 --- a/services/core/java/com/android/server/location/gnss/GnssMeasurementsProvider.java +++ b/services/core/java/com/android/server/location/gnss/GnssMeasurementsProvider.java @@ -118,6 +118,16 @@ public final class GnssMeasurementsProvider extends @Override protected boolean registerWithService(GnssMeasurementRequest request, Collection<GnssListenerRegistration> registrations) { + // The HAL doc does not specify if consecutive start() calls will be allowed. + // Some vendors may ignore the 2nd start() call if stop() is not called. + // Thus, here we always call stop() before calling start() to avoid being ignored. + if (mGnssNative.stopMeasurementCollection()) { + if (D) { + Log.d(TAG, "stopping gnss measurements"); + } + } else { + Log.e(TAG, "error stopping gnss measurements"); + } if (mGnssNative.startMeasurementCollection(request.isFullTracking(), request.isCorrelationVectorOutputsEnabled())) { if (D) { |