Merge "Don't bootloop if GNSS is unavailable." into tm-dev am: 92e6896842
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/18383202 Change-Id: I8c2aeffd0882513246aaf10a2b179bb858e851d6 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -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