Skip to content

Commit 3fe79df

Browse files
Wink Savilleandroid code review
authored andcommitted
Merge "Adds utility method to convert 0.25 secs to decimal degrees"
2 parents a03696d + 6766276 commit 3fe79df

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

api/current.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19290,6 +19290,7 @@ package android.telephony.cdma {
1929019290
public class CdmaCellLocation extends android.telephony.CellLocation {
1929119291
ctor public CdmaCellLocation();
1929219292
ctor public CdmaCellLocation(android.os.Bundle);
19293+
method public static double convertQuartSecToDecDegrees(int);
1929319294
method public void fillInNotifierBundle(android.os.Bundle);
1929419295
method public int getBaseStationId();
1929519296
method public int getBaseStationLatitude();

telephony/java/android/telephony/cdma/CdmaCellLocation.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,22 @@ public boolean isEmpty() {
227227
this.mNetworkId == -1);
228228
}
229229

230+
/**
231+
* Converts latitude or longitude from 0.25 seconds (as defined in the
232+
* 3GPP2 C.S0005-A v6.0 standard) to decimal degrees
233+
*
234+
* @param quartSec latitude or longitude in 0.25 seconds units
235+
* @return latitude or longitude in decimal degrees units
236+
* @throws IllegalArgumentException if value is less than -2592000,
237+
* greater than 2592000, or is not a number.
238+
*/
239+
public static double convertQuartSecToDecDegrees(int quartSec) {
240+
if(Double.isNaN(quartSec) || quartSec < -2592000 || quartSec > 2592000){
241+
// Invalid value
242+
throw new IllegalArgumentException("Invalid coordiante value:" + quartSec);
243+
}
244+
return ((double)quartSec) / (3600 * 4);
245+
}
230246

231247
}
232248

0 commit comments

Comments
 (0)