Merge "Change timestamp unit from nanos to millis" am: 4aee28ea31 am: 3a63fa76ed

Change-Id: I50f8f739eaf93050cc3f282aca273af5dc6a8e3c
This commit is contained in:
Automerger Merge Worker
2020-02-13 08:51:40 +00:00
3 changed files with 22 additions and 20 deletions

View File

@@ -45043,7 +45043,7 @@ package android.telephony {
method @NonNull public abstract android.telephony.CellIdentity getCellIdentity();
method @NonNull public abstract android.telephony.CellSignalStrength getCellSignalStrength();
method @Deprecated public long getTimeStamp();
method public long getTimestampNanos();
method public long getTimestampMillis();
method public boolean isRegistered();
field public static final int CONNECTION_NONE = 0; // 0x0
field public static final int CONNECTION_PRIMARY_SERVING = 1; // 0x1
@@ -45549,7 +45549,7 @@ package android.telephony {
method @Deprecated public int getGsmBitErrorRate();
method @Deprecated public int getGsmSignalStrength();
method public int getLevel();
method public long getTimestampNanos();
method public long getTimestampMillis();
method @Deprecated public boolean isGsm();
method public void writeToParcel(android.os.Parcel, int);
field @NonNull public static final android.os.Parcelable.Creator<android.telephony.SignalStrength> CREATOR;

View File

@@ -16,9 +16,9 @@
package android.telephony;
import android.annotation.ElapsedRealtimeLong;
import android.annotation.IntDef;
import android.annotation.NonNull;
import android.annotation.SuppressLint;
import android.compat.annotation.UnsupportedAppUsage;
import android.hardware.radio.V1_4.CellInfo.Info;
import android.os.Parcel;
@@ -178,18 +178,18 @@ public abstract class CellInfo implements Parcelable {
/**
* Approximate time this cell information was received from the modem.
*
* @return a time stamp in nanos since boot.
* @return a time stamp in millis since boot.
*/
@SuppressLint("MethodNameUnits")
public long getTimestampNanos() {
return mTimeStamp;
@ElapsedRealtimeLong
public long getTimestampMillis() {
return mTimeStamp / 1000000;
}
/**
* Approximate time this cell information was received from the modem.
*
* @return a time stamp in nanos since boot.
* @deprecated Use {@link #getTimestampNanos} instead.
* @deprecated Use {@link #getTimestampMillis} instead.
*/
@Deprecated
public long getTimeStamp() {

View File

@@ -16,8 +16,8 @@
package android.telephony;
import android.annotation.ElapsedRealtimeLong;
import android.annotation.NonNull;
import android.annotation.SuppressLint;
import android.annotation.SystemApi;
import android.compat.annotation.UnsupportedAppUsage;
import android.os.Build;
@@ -79,8 +79,9 @@ public class SignalStrength implements Parcelable {
/* The type of signal measurement */
private static final String MEASUREMENT_TYPE_RSCP = "rscp";
// timeStamp of signalStrength in nanoseconds since boot
private long mTimestamp = Long.MAX_VALUE;
// Timestamp of SignalStrength since boot
// Effectively final. Timestamp is set during construction of SignalStrength
private long mTimestampMillis;
CellSignalStrengthCdma mCdma;
CellSignalStrengthGsm mGsm;
@@ -140,7 +141,7 @@ public class SignalStrength implements Parcelable {
mTdscdma = tdscdma;
mLte = lte;
mNr = nr;
mTimestamp = SystemClock.elapsedRealtimeNanos();
mTimestampMillis = SystemClock.elapsedRealtime();
}
/**
@@ -275,7 +276,6 @@ public class SignalStrength implements Parcelable {
mTdscdma.updateLevel(cc, ss);
mLte.updateLevel(cc, ss);
mNr.updateLevel(cc, ss);
mTimestamp = SystemClock.elapsedRealtimeNanos();
}
/**
@@ -301,7 +301,7 @@ public class SignalStrength implements Parcelable {
mTdscdma = new CellSignalStrengthTdscdma(s.mTdscdma);
mLte = new CellSignalStrengthLte(s.mLte);
mNr = new CellSignalStrengthNr(s.mNr);
mTimestamp = s.getTimestampNanos();
mTimestampMillis = s.getTimestampMillis();
}
/**
@@ -319,7 +319,7 @@ public class SignalStrength implements Parcelable {
mTdscdma = in.readParcelable(CellSignalStrengthTdscdma.class.getClassLoader());
mLte = in.readParcelable(CellSignalStrengthLte.class.getClassLoader());
mNr = in.readParcelable(CellSignalStrengthLte.class.getClassLoader());
mTimestamp = in.readLong();
mTimestampMillis = in.readLong();
}
/**
@@ -332,15 +332,17 @@ public class SignalStrength implements Parcelable {
out.writeParcelable(mTdscdma, flags);
out.writeParcelable(mLte, flags);
out.writeParcelable(mNr, flags);
out.writeLong(mTimestamp);
out.writeLong(mTimestampMillis);
}
/**
* @return mTimestamp in nanoseconds
* @return timestamp in milliseconds since boot for {@link SignalStrength}.
* This timestamp reports the approximate time that the signal was measured and reported
* by the modem. It can be used to compare the recency of {@link SignalStrength} instances.
*/
@SuppressLint("MethodNameUnits")
public long getTimestampNanos() {
return mTimestamp;
@ElapsedRealtimeLong
public long getTimestampMillis() {
return mTimestampMillis;
}
/**