DO NOT MERGE: Always return non null from getGpsStatus am: d9df33d1c0 am: e2c8878455 am: 4aa1a3f1c8
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/12160606 Change-Id: I1e818a46bf4aefd2ca694b9a973e10101d5e0535
This commit is contained in:
@@ -151,6 +151,15 @@ public final class GpsStatus {
|
||||
return status;
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds an empty GpsStatus.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
static GpsStatus createEmpty() {
|
||||
return new GpsStatus();
|
||||
}
|
||||
|
||||
private GpsStatus() {
|
||||
}
|
||||
|
||||
|
||||
@@ -1922,12 +1922,17 @@ public class LocationManager {
|
||||
|
||||
GnssStatus gnssStatus = mGnssStatusListenerManager.getGnssStatus();
|
||||
int ttff = mGnssStatusListenerManager.getTtff();
|
||||
|
||||
// even though this method is marked nullable, there are legacy applications that expect
|
||||
// this to never return null, so avoid breaking those apps
|
||||
if (gnssStatus != null) {
|
||||
if (status == null) {
|
||||
status = GpsStatus.create(gnssStatus, ttff);
|
||||
} else {
|
||||
status.setStatus(gnssStatus, ttff);
|
||||
}
|
||||
} else if (status == null) {
|
||||
status = GpsStatus.createEmpty();
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user