FileDocCategorySizeDatePackage
CellInfo.javaAPI DocAndroid 5.1 API6293Thu Mar 12 22:22:42 GMT 2015android.telephony

CellInfo

public abstract class CellInfo extends Object implements android.os.Parcelable
Immutable cell information from a point in time.

Fields Summary
protected static final int
TYPE_GSM
protected static final int
TYPE_CDMA
protected static final int
TYPE_LTE
protected static final int
TYPE_WCDMA
public static final int
TIMESTAMP_TYPE_UNKNOWN
public static final int
TIMESTAMP_TYPE_ANTENNA
public static final int
TIMESTAMP_TYPE_MODEM
public static final int
TIMESTAMP_TYPE_OEM_RIL
public static final int
TIMESTAMP_TYPE_JAVA_RIL
private boolean
mRegistered
private long
mTimeStamp
private int
mTimeStampType
public static final Creator
CREATOR
Implement the Parcelable interface
Constructors Summary
protected CellInfo()

hide


      
      
        this.mRegistered = false;
        this.mTimeStampType = TIMESTAMP_TYPE_UNKNOWN;
        this.mTimeStamp = Long.MAX_VALUE;
    
protected CellInfo(android.os.Parcel in)
Used by child classes for parceling

hide

        mRegistered = (in.readInt() == 1) ? true : false;
        mTimeStampType = in.readInt();
        mTimeStamp = in.readLong();
    
protected CellInfo(CellInfo ci)

hide

        this.mRegistered = ci.mRegistered;
        this.mTimeStampType = ci.mTimeStampType;
        this.mTimeStamp = ci.mTimeStamp;
    
Methods Summary
public intdescribeContents()
Implement the Parcelable interface

        return 0;
    
public booleanequals(java.lang.Object other)

        if (other == null) {
            return false;
        }
        if (this == other) {
            return true;
        }
        try {
            CellInfo o = (CellInfo) other;
            return mRegistered == o.mRegistered
                    && mTimeStamp == o.mTimeStamp && mTimeStampType == o.mTimeStampType;
        } catch (ClassCastException e) {
            return false;
        }
    
public longgetTimeStamp()
Approximate time of this cell information in nanos since boot

        return mTimeStamp;
    
public intgetTimeStampType()
Where time stamp gets recorded.

return
one of TIMESTAMP_TYPE_XXXX
hide

        return mTimeStampType;
    
public inthashCode()

        int primeNum = 31;
        return ((mRegistered ? 0 : 1) * primeNum) + ((int)(mTimeStamp / 1000) * primeNum)
                + (mTimeStampType * primeNum);
    
public booleanisRegistered()
True if this cell is registered to the mobile network

        return mRegistered;
    
public voidsetRegistered(boolean registered)

hide

        mRegistered = registered;
    
public voidsetTimeStamp(long timeStamp)

hide

        mTimeStamp = timeStamp;
    
public voidsetTimeStampType(int timeStampType)

hide

        if (timeStampType < TIMESTAMP_TYPE_UNKNOWN || timeStampType > TIMESTAMP_TYPE_JAVA_RIL) {
            mTimeStampType = TIMESTAMP_TYPE_UNKNOWN;
        } else {
            mTimeStampType = timeStampType;
        }
    
private static java.lang.StringtimeStampTypeToString(int type)

        switch (type) {
            case 1:
                return "antenna";
            case 2:
                return "modem";
            case 3:
                return "oem_ril";
            case 4:
                return "java_ril";
            default:
                return "unknown";
        }
    
public java.lang.StringtoString()

        StringBuffer sb = new StringBuffer();
        String timeStampType;

        sb.append("mRegistered=").append(mRegistered ? "YES" : "NO");
        timeStampType = timeStampTypeToString(mTimeStampType);
        sb.append(" mTimeStampType=").append(timeStampType);
        sb.append(" mTimeStamp=").append(mTimeStamp).append("ns");

        return sb.toString();
    
public abstract voidwriteToParcel(android.os.Parcel dest, int flags)
Implement the Parcelable interface

protected voidwriteToParcel(android.os.Parcel dest, int flags, int type)
Used by child classes for parceling.

hide

        dest.writeInt(type);
        dest.writeInt(mRegistered ? 1 : 0);
        dest.writeInt(mTimeStampType);
        dest.writeLong(mTimeStamp);