Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4aee28ea authored by Mingming Cai's avatar Mingming Cai Committed by Gerrit Code Review
Browse files

Merge "Change timestamp unit from nanos to millis"

parents 96e15285 385af084
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -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;
+6 −6
Original line number Diff line number Diff line
@@ -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() {
+14 −12
Original line number Diff line number Diff line
@@ -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;
    }

   /**