Merge "Check that network provider exists before use"

This commit is contained in:
TreeHugger Robot
2020-11-21 02:21:13 +00:00
committed by Android (Google) Code Review

View File

@@ -709,8 +709,10 @@ public class GnssLocationProvider extends AbstractLocationProvider implements
"GNSS HAL Requesting location updates from %s provider for %d millis.",
provider, durationMillis));
locationManager.requestLocationUpdates(provider, locationRequest.build(),
DIRECT_EXECUTOR, locationListener);
if (locationManager.getProvider(provider) != null) {
locationManager.requestLocationUpdates(provider, locationRequest.build(),
DIRECT_EXECUTOR, locationListener);
}
}
private void injectBestLocation(Location location) {