Skip to content
Snippets Groups Projects
Commit da9b1cbd authored by Brian Julian's avatar Brian Julian
Browse files

Modifies getMslAltitudeMeters and getMslAltitudeAccuracyMeters in...

Modifies getMslAltitudeMeters and getMslAltitudeAccuracyMeters in android.location.Location to no longer throw IllegalStateExceptions when corresponding values are not set.

Bug: 278389778
Test: CTS tests already compatible.
Change-Id: I5fcdb8238eb6d77a7b2c60dc8544f5be1bcccce2
parent 580b0290
No related branches found
No related tags found
No related merge requests found
......@@ -709,11 +709,9 @@ public class Location implements Parcelable {
/**
* Returns the Mean Sea Level altitude of this location in meters.
*
* @throws IllegalStateException if {@link #hasMslAltitude()} is false.
* <p>This is only valid if {@link #hasMslAltitude()} is true.
*/
public @FloatRange double getMslAltitudeMeters() {
Preconditions.checkState(hasMslAltitude(),
"The Mean Sea Level altitude of this location is not set.");
return mMslAltitudeMeters;
}
......@@ -744,11 +742,9 @@ public class Location implements Parcelable {
* percentile confidence level. This means that there is 68% chance that the true Mean Sea Level
* altitude of this location falls within {@link #getMslAltitudeMeters()} +/- this uncertainty.
*
* @throws IllegalStateException if {@link #hasMslAltitudeAccuracy()} is false.
* <p>This is only valid if {@link #hasMslAltitudeAccuracy()} is true.
*/
public @FloatRange(from = 0.0) float getMslAltitudeAccuracyMeters() {
Preconditions.checkState(hasMslAltitudeAccuracy(),
"The Mean Sea Level altitude accuracy of this location is not set.");
return mMslAltitudeAccuracyMeters;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment