Skip to content

Commit 2f6d882

Browse files
author
Philip Milne
committed
Fix for bug: #7173350. elapsedRealtimeNano() -> elapsedRealtimeNanos()
Change-Id: I71c24ea10093ece07a0780e97bc641ff548c1a44
1 parent f98db0d commit 2f6d882

File tree

6 files changed

+9
-9
lines changed

6 files changed

+9
-9
lines changed

api/current.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16560,7 +16560,7 @@ package android.os {
1656016560
public final class SystemClock {
1656116561
method public static long currentThreadTimeMillis();
1656216562
method public static long elapsedRealtime();
16563-
method public static long elapsedRealtimeNano();
16563+
method public static long elapsedRealtimeNanos();
1656416564
method public static boolean setCurrentTimeMillis(long);
1656516565
method public static void sleep(long);
1656616566
method public static long uptimeMillis();

core/java/android/os/SystemClock.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
* interval does not span device sleep. Most methods that accept a
5151
* timestamp value currently expect the {@link #uptimeMillis} clock.
5252
*
53-
* <li> <p> {@link #elapsedRealtime} and {@link #elapsedRealtimeNano}
53+
* <li> <p> {@link #elapsedRealtime} and {@link #elapsedRealtimeNanos}
5454
* return the time since the system was booted, and include deep sleep.
5555
* This clock is guaranteed to be monotonic, and continues to tick even
5656
* when the CPU is in power saving modes, so is the recommend basis
@@ -157,7 +157,7 @@ public static void sleep(long ms)
157157
*
158158
* @return elapsed nanoseconds since boot.
159159
*/
160-
public static native long elapsedRealtimeNano();
160+
public static native long elapsedRealtimeNanos();
161161

162162
/**
163163
* Returns milliseconds running in the current thread.

location/java/android/location/Location.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -505,7 +505,7 @@ public void setTime(long time) {
505505
* Return the time of this fix, in elapsed real-time since system boot.
506506
*
507507
* <p>This value can be reliably compared to
508-
* {@link android.os.SystemClock#elapsedRealtimeNano},
508+
* {@link android.os.SystemClock#elapsedRealtimeNanos},
509509
* to calculate the age of a fix and to compare Location fixes. This
510510
* is reliable because elapsed real-time is guaranteed monotonic for
511511
* each system boot and continues to increment even when the system
@@ -782,7 +782,7 @@ public void makeComplete() {
782782
mAccuracy = 100.0f;
783783
}
784784
if (mTime == 0) mTime = System.currentTimeMillis();
785-
if (mElapsedRealtimeNano == 0) mElapsedRealtimeNano = SystemClock.elapsedRealtimeNano();
785+
if (mElapsedRealtimeNano == 0) mElapsedRealtimeNano = SystemClock.elapsedRealtimeNanos();
786786
}
787787

788788
/**

packages/FusedLocation/src/com/android/location/fused/FusionEngine.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ private static double weighAccuracy(Location loc) {
215215
}
216216

217217
private static double weighAge(Location loc) {
218-
long ageSeconds = SystemClock.elapsedRealtimeNano() - loc.getElapsedRealtimeNano();
218+
long ageSeconds = SystemClock.elapsedRealtimeNanos() - loc.getElapsedRealtimeNano();
219219
ageSeconds /= 1000000000L;
220220
if (ageSeconds < 0) ageSeconds = 0;
221221
return Math.exp(-ageSeconds * AGE_DECAY_CONSTANT_S);
@@ -266,7 +266,7 @@ private void updateFusedLocation() {
266266

267267
// fused time - now
268268
fused.setTime(System.currentTimeMillis());
269-
fused.setElapsedRealtimeNano(SystemClock.elapsedRealtimeNano());
269+
fused.setElapsedRealtimeNano(SystemClock.elapsedRealtimeNanos());
270270

271271
// fuse altitude
272272
if (mGpsLocation.hasAltitude() && !mNetworkLocation.hasAltitude() &&

services/java/com/android/server/TwilightService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,7 @@ private void retrieveLocation() {
447447
location.setLatitude(0);
448448
location.setAccuracy(417000.0f);
449449
location.setTime(System.currentTimeMillis());
450-
location.setElapsedRealtimeNano(SystemClock.elapsedRealtimeNano());
450+
location.setElapsedRealtimeNano(SystemClock.elapsedRealtimeNanos());
451451

452452
if (DEBUG) {
453453
Slog.d(TAG, "Estimated location from timezone: " + location);

services/java/com/android/server/location/GpsLocationProvider.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1029,7 +1029,7 @@ private void reportLocation(int flags, double latitude, double longitude, double
10291029
mLocation.setTime(timestamp);
10301030
// It would be nice to push the elapsed real-time timestamp
10311031
// further down the stack, but this is still useful
1032-
mLocation.setElapsedRealtimeNano(SystemClock.elapsedRealtimeNano());
1032+
mLocation.setElapsedRealtimeNano(SystemClock.elapsedRealtimeNanos());
10331033
}
10341034
if ((flags & LOCATION_HAS_ALTITUDE) == LOCATION_HAS_ALTITUDE) {
10351035
mLocation.setAltitude(altitude);

0 commit comments

Comments
 (0)