Fix for bug: #7173350. elapsedRealtimeNano() -> elapsedRealtimeNanos()
Change-Id: I71c24ea10093ece07a0780e97bc641ff548c1a44
This commit is contained in:
@@ -16560,7 +16560,7 @@ package android.os {
|
||||
public final class SystemClock {
|
||||
method public static long currentThreadTimeMillis();
|
||||
method public static long elapsedRealtime();
|
||||
method public static long elapsedRealtimeNano();
|
||||
method public static long elapsedRealtimeNanos();
|
||||
method public static boolean setCurrentTimeMillis(long);
|
||||
method public static void sleep(long);
|
||||
method public static long uptimeMillis();
|
||||
|
||||
@@ -50,7 +50,7 @@ package android.os;
|
||||
* interval does not span device sleep. Most methods that accept a
|
||||
* timestamp value currently expect the {@link #uptimeMillis} clock.
|
||||
*
|
||||
* <li> <p> {@link #elapsedRealtime} and {@link #elapsedRealtimeNano}
|
||||
* <li> <p> {@link #elapsedRealtime} and {@link #elapsedRealtimeNanos}
|
||||
* return the time since the system was booted, and include deep sleep.
|
||||
* This clock is guaranteed to be monotonic, and continues to tick even
|
||||
* when the CPU is in power saving modes, so is the recommend basis
|
||||
@@ -157,7 +157,7 @@ public final class SystemClock {
|
||||
*
|
||||
* @return elapsed nanoseconds since boot.
|
||||
*/
|
||||
public static native long elapsedRealtimeNano();
|
||||
public static native long elapsedRealtimeNanos();
|
||||
|
||||
/**
|
||||
* Returns milliseconds running in the current thread.
|
||||
|
||||
@@ -505,7 +505,7 @@ public class Location implements Parcelable {
|
||||
* Return the time of this fix, in elapsed real-time since system boot.
|
||||
*
|
||||
* <p>This value can be reliably compared to
|
||||
* {@link android.os.SystemClock#elapsedRealtimeNano},
|
||||
* {@link android.os.SystemClock#elapsedRealtimeNanos},
|
||||
* to calculate the age of a fix and to compare Location fixes. This
|
||||
* is reliable because elapsed real-time is guaranteed monotonic for
|
||||
* each system boot and continues to increment even when the system
|
||||
@@ -782,7 +782,7 @@ public class Location implements Parcelable {
|
||||
mAccuracy = 100.0f;
|
||||
}
|
||||
if (mTime == 0) mTime = System.currentTimeMillis();
|
||||
if (mElapsedRealtimeNano == 0) mElapsedRealtimeNano = SystemClock.elapsedRealtimeNano();
|
||||
if (mElapsedRealtimeNano == 0) mElapsedRealtimeNano = SystemClock.elapsedRealtimeNanos();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -215,7 +215,7 @@ public class FusionEngine implements LocationListener {
|
||||
}
|
||||
|
||||
private static double weighAge(Location loc) {
|
||||
long ageSeconds = SystemClock.elapsedRealtimeNano() - loc.getElapsedRealtimeNano();
|
||||
long ageSeconds = SystemClock.elapsedRealtimeNanos() - loc.getElapsedRealtimeNano();
|
||||
ageSeconds /= 1000000000L;
|
||||
if (ageSeconds < 0) ageSeconds = 0;
|
||||
return Math.exp(-ageSeconds * AGE_DECAY_CONSTANT_S);
|
||||
@@ -266,7 +266,7 @@ public class FusionEngine implements LocationListener {
|
||||
|
||||
// fused time - now
|
||||
fused.setTime(System.currentTimeMillis());
|
||||
fused.setElapsedRealtimeNano(SystemClock.elapsedRealtimeNano());
|
||||
fused.setElapsedRealtimeNano(SystemClock.elapsedRealtimeNanos());
|
||||
|
||||
// fuse altitude
|
||||
if (mGpsLocation.hasAltitude() && !mNetworkLocation.hasAltitude() &&
|
||||
|
||||
@@ -447,7 +447,7 @@ public final class TwilightService {
|
||||
location.setLatitude(0);
|
||||
location.setAccuracy(417000.0f);
|
||||
location.setTime(System.currentTimeMillis());
|
||||
location.setElapsedRealtimeNano(SystemClock.elapsedRealtimeNano());
|
||||
location.setElapsedRealtimeNano(SystemClock.elapsedRealtimeNanos());
|
||||
|
||||
if (DEBUG) {
|
||||
Slog.d(TAG, "Estimated location from timezone: " + location);
|
||||
|
||||
@@ -1029,7 +1029,7 @@ public class GpsLocationProvider implements LocationProviderInterface {
|
||||
mLocation.setTime(timestamp);
|
||||
// It would be nice to push the elapsed real-time timestamp
|
||||
// further down the stack, but this is still useful
|
||||
mLocation.setElapsedRealtimeNano(SystemClock.elapsedRealtimeNano());
|
||||
mLocation.setElapsedRealtimeNano(SystemClock.elapsedRealtimeNanos());
|
||||
}
|
||||
if ((flags & LOCATION_HAS_ALTITUDE) == LOCATION_HAS_ALTITUDE) {
|
||||
mLocation.setAltitude(altitude);
|
||||
|
||||
Reference in New Issue
Block a user