Don't bootloop if GNSS is unavailable.
Bug: 231740141
Test: build and flash a "car" device without GNSS
Change-Id: I0891812f6c83fb1f000d5aeccf5f6b9d2e197dc3
Merged-In: I0891812f6c83fb1f000d5aeccf5f6b9d2e197dc3
(cherry picked from commit 2886705fa5)
This commit is contained in:
committed by
Gaurav Sarode
parent
ff1b7dc538
commit
eb7af16f4a
@@ -116,6 +116,11 @@ public final class GnssTimeUpdateService extends Binder {
|
|||||||
Log.d(TAG, "requestGnssTimeUpdates()");
|
Log.d(TAG, "requestGnssTimeUpdates()");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!mLocationManager.hasProvider(LocationManager.GPS_PROVIDER)) {
|
||||||
|
Log.e(TAG, "GPS provider does not exist on this device");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Location Listener triggers onLocationChanged() when GNSS data is available, so
|
// Location Listener triggers onLocationChanged() when GNSS data is available, so
|
||||||
// that the getGnssTimeMillis() function doesn't need to be continuously polled.
|
// that the getGnssTimeMillis() function doesn't need to be continuously polled.
|
||||||
mLocationListener = new LocationListener() {
|
mLocationListener = new LocationListener() {
|
||||||
|
|||||||
@@ -85,6 +85,9 @@ public final class GnssTimeUpdateServiceTest {
|
|||||||
when(mMockContext.getSystemService(AlarmManager.class))
|
when(mMockContext.getSystemService(AlarmManager.class))
|
||||||
.thenReturn(mMockAlarmManager);
|
.thenReturn(mMockAlarmManager);
|
||||||
|
|
||||||
|
when(mMockLocationManager.hasProvider(LocationManager.GPS_PROVIDER))
|
||||||
|
.thenReturn(true);
|
||||||
|
|
||||||
LocalServices.addService(LocationManagerInternal.class, mLocationManagerInternal);
|
LocalServices.addService(LocationManagerInternal.class, mLocationManagerInternal);
|
||||||
|
|
||||||
mGnssTimeUpdateService =
|
mGnssTimeUpdateService =
|
||||||
|
|||||||
Reference in New Issue
Block a user