diff options
author | Yu-Han Yang <yuhany@google.com> | 2023-03-03 19:02:01 +0000 |
---|---|---|
committer | Cherrypicker Worker <android-build-cherrypicker-worker@system.gserviceaccount.com> | 2023-03-03 19:02:01 +0000 |
commit | e9667e404a654d11f205cf6f4755ed35d98e8386 (patch) | |
tree | d3fe82ca6998f3d8045aad6a88451f6f822c7319 | |
parent | 31a24bfc5d7e8def17afc8776129d77468ac2dd6 (diff) | |
download | base-e9667e404a654d11f205cf6f4755ed35d98e8386.tar.gz |
Always call stopMeasurementCollection before startMeasurementCollection
Bug: 253453668
Test: manual
Merged-In: I9f85c6be7a79540fd5fd8b851695c0de1742853d
(cherry picked from commit d30c1cea07e7de45a3cb4b0a204a08242163d974)
(cherry picked from commit d4ebf016212e6469c519cf1b09a876b86a65223e)
(cherry picked from commit on googleplex-android-review.googlesource.com host: 1b44e1061a6f8fc6c600fa95ac0896473c11953a)
Merged-In: I9f85c6be7a79540fd5fd8b851695c0de1742853d
Change-Id: I73db0c8abd5b3a489f5764563fc7fb1cc76f5f72
-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) { |