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

Commit 2ac4249f authored by Nathan Harold's avatar Nathan Harold Committed by Android (Google) Code Review
Browse files

Merge "Update Wcdma and Tdscdma CellInfo for HAL 1.2" into pi-dev-plus-aosp

parents c47c718a 88f44024
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -175,7 +175,10 @@ public abstract class CellIdentity implements Parcelable {
        }

        CellIdentity o = (CellIdentity) other;
        return TextUtils.equals(mAlphaLong, o.mAlphaLong)
        return mType == o.mType
                && TextUtils.equals(mMccStr, o.mMccStr)
                && TextUtils.equals(mMncStr, o.mMncStr)
                && TextUtils.equals(mAlphaLong, o.mAlphaLong)
                && TextUtils.equals(mAlphaShort, o.mAlphaShort);
    }

+47 −30
Original line number Diff line number Diff line
@@ -18,7 +18,6 @@ package android.telephony;

import android.annotation.Nullable;
import android.os.Parcel;
import android.text.TextUtils;

import java.util.Objects;

@@ -35,6 +34,8 @@ public final class CellIdentityTdscdma extends CellIdentity {
    private final int mCid;
    // 8-bit Cell Parameters ID described in TS 25.331, 0..127, INT_MAX if unknown.
    private final int mCpid;
    // 16-bit UMTS Absolute RF Channel Number described in TS 25.101 sec. 5.4.3
    private final int mUarfcn;

    /**
     * @hide
@@ -44,6 +45,7 @@ public final class CellIdentityTdscdma extends CellIdentity {
        mLac = Integer.MAX_VALUE;
        mCid = Integer.MAX_VALUE;
        mCpid = Integer.MAX_VALUE;
        mUarfcn = Integer.MAX_VALUE;
    }

    /**
@@ -52,28 +54,12 @@ public final class CellIdentityTdscdma extends CellIdentity {
     * @param lac 16-bit Location Area Code, 0..65535, INT_MAX if unknown
     * @param cid 28-bit UMTS Cell Identity described in TS 25.331, 0..268435455, INT_MAX if unknown
     * @param cpid 8-bit Cell Parameters ID described in TS 25.331, 0..127, INT_MAX if unknown
     * @param uarfcn 16-bit UMTS Absolute RF Channel Number described in TS 25.101 sec. 5.4.3
     *
     * @hide
     */
    public CellIdentityTdscdma(int mcc, int mnc, int lac, int cid, int cpid) {
        this(String.valueOf(mcc), String.valueOf(mnc), lac, cid, cpid, null, null);
    }

    /**
     * @param mcc 3-digit Mobile Country Code in string format
     * @param mnc 2 or 3-digit Mobile Network Code in string format
     * @param lac 16-bit Location Area Code, 0..65535, INT_MAX if unknown
     * @param cid 28-bit UMTS Cell Identity described in TS 25.331, 0..268435455, INT_MAX if unknown
     * @param cpid 8-bit Cell Parameters ID described in TS 25.331, 0..127, INT_MAX if unknown
     *
     * FIXME: This is a temporary constructor to facilitate migration.
     * @hide
     */
    public CellIdentityTdscdma(String mcc, String mnc, int lac, int cid, int cpid) {
        super(TAG, TYPE_TDSCDMA, mcc, mnc, null, null);
        mLac = lac;
        mCid = cid;
        mCpid = cpid;
    public CellIdentityTdscdma(int mcc, int mnc, int lac, int cid, int cpid, int uarfcn) {
        this(String.valueOf(mcc), String.valueOf(mnc), lac, cid, cpid, uarfcn, null, null);
    }

    /**
@@ -82,22 +68,24 @@ public final class CellIdentityTdscdma extends CellIdentity {
     * @param lac 16-bit Location Area Code, 0..65535, INT_MAX if unknown
     * @param cid 28-bit UMTS Cell Identity described in TS 25.331, 0..268435455, INT_MAX if unknown
     * @param cpid 8-bit Cell Parameters ID described in TS 25.331, 0..127, INT_MAX if unknown
     * @param uarfcn 16-bit UMTS Absolute RF Channel Number described in TS 25.101 sec. 5.4.3
     * @param alphal long alpha Operator Name String or Enhanced Operator Name String
     * @param alphas short alpha Operator Name String or Enhanced Operator Name String
     *
     * @hide
     */
    public CellIdentityTdscdma(String mcc, String mnc, int lac, int cid, int cpid,
    public CellIdentityTdscdma(String mcc, String mnc, int lac, int cid, int cpid, int uarfcn,
            String alphal, String alphas) {
        super(TAG, TYPE_TDSCDMA, mcc, mnc, alphal, alphas);
        mLac = lac;
        mCid = cid;
        mCpid = cpid;
        mUarfcn = uarfcn;
    }

    private CellIdentityTdscdma(CellIdentityTdscdma cid) {
        this(cid.mMccStr, cid.mMncStr, cid.mLac, cid.mCid,
                cid.mCpid, cid.mAlphaLong, cid.mAlphaShort);
                cid.mCpid, cid.mUarfcn, cid.mAlphaLong, cid.mAlphaShort);
    }

    CellIdentityTdscdma copy() {
@@ -141,9 +129,32 @@ public final class CellIdentityTdscdma extends CellIdentity {
        return mCpid;
    }

    /** @hide */
    @Override
    public int hashCode() {
        return Objects.hash(mLac, mCid, mCpid, super.hashCode());
    public int getChannelNumber() {
        return mUarfcn;
    }

    /**
     * @return The long alpha tag associated with the current scan result (may be the operator
     * name string or extended operator name string). May be null if unknown.
     *
     * @hide
     */
    @Nullable
    public CharSequence getOperatorAlphaLong() {
        return mAlphaLong;
    }

    /**
     * @return The short alpha tag associated with the current scan result (may be the operator
     * name string or extended operator name string).  May be null if unknown.
     *
     * @hide
     */
    @Nullable
    public CharSequence getOperatorAlphaShort() {
        return mAlphaShort;
    }

    @Override
@@ -157,24 +168,29 @@ public final class CellIdentityTdscdma extends CellIdentity {
        }

        CellIdentityTdscdma o = (CellIdentityTdscdma) other;
        return TextUtils.equals(mMccStr, o.mMccStr)
                && TextUtils.equals(mMncStr, o.mMncStr)
                && mLac == o.mLac
        return  mLac == o.mLac
                && mCid == o.mCid
                && mCpid == o.mCpid
                && mUarfcn == o.mUarfcn
                && super.equals(other);
    }

    @Override
    public int hashCode() {
        return Objects.hash(mLac, mCid, mCpid, mUarfcn, super.hashCode());
    }

    @Override
    public String toString() {
        return new StringBuilder(TAG)
        .append(":{ mMcc=").append(mMccStr)
        .append(" mMnc=").append(mMncStr)
        .append(" mAlphaLong=").append(mAlphaLong)
        .append(" mAlphaShort=").append(mAlphaShort)
        .append(" mLac=").append(mLac)
        .append(" mCid=").append(mCid)
        .append(" mCpid=").append(mCpid)
        .append(" mAlphaLong=").append(mAlphaLong)
        .append(" mAlphaShort=").append(mAlphaShort)
        .append(" mUarfcn=").append(mUarfcn)
        .append("}").toString();
    }

@@ -186,6 +202,7 @@ public final class CellIdentityTdscdma extends CellIdentity {
        dest.writeInt(mLac);
        dest.writeInt(mCid);
        dest.writeInt(mCpid);
        dest.writeInt(mUarfcn);
    }

    /** Construct from Parcel, type has already been processed */
@@ -194,7 +211,7 @@ public final class CellIdentityTdscdma extends CellIdentity {
        mLac = in.readInt();
        mCid = in.readInt();
        mCpid = in.readInt();

        mUarfcn = in.readInt();
        if (DBG) log(toString());
    }

+3 −3
Original line number Diff line number Diff line
@@ -35,7 +35,7 @@ public final class CellIdentityWcdma extends CellIdentity {
    private final int mCid;
    // 9-bit UMTS Primary Scrambling Code described in TS 25.331, 0..511
    private final int mPsc;
    // 16-bit UMTS Absolute RF Channel Number
    // 16-bit UMTS Absolute RF Channel Number described in TS 25.101 sec. 5.4.4
    private final int mUarfcn;

    /**
@@ -70,7 +70,7 @@ public final class CellIdentityWcdma extends CellIdentity {
     * @param lac 16-bit Location Area Code, 0..65535
     * @param cid 28-bit UMTS Cell Identity
     * @param psc 9-bit UMTS Primary Scrambling Code
     * @param uarfcn 16-bit UMTS Absolute RF Channel Number
     * @param uarfcn 16-bit UMTS Absolute RF Channel Number described in TS 25.101 sec. 5.4.3
     *
     * @hide
     */
@@ -83,7 +83,7 @@ public final class CellIdentityWcdma extends CellIdentity {
     * @param lac 16-bit Location Area Code, 0..65535
     * @param cid 28-bit UMTS Cell Identity
     * @param psc 9-bit UMTS Primary Scrambling Code
     * @param uarfcn 16-bit UMTS Absolute RF Channel Number
     * @param uarfcn 16-bit UMTS Absolute RF Channel Number described in TS 25.101 sec. 5.4.3
     * @param mccStr 3-digit Mobile Country Code in string format
     * @param mncStr 2 or 3-digit Mobile Network Code in string format
     * @param alphal long alpha Operator Name String or Enhanced Operator Name String
+4 −0
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ package android.telephony;
import android.annotation.IntDef;
import android.os.Parcel;
import android.os.Parcelable;

import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;

@@ -36,6 +37,8 @@ public abstract class CellInfo implements Parcelable {
    protected static final int TYPE_LTE = 3;
    /** @hide */
    protected static final int TYPE_WCDMA = 4;
    /** @hide */
    protected static final int TYPE_TDCDMA = 5;

    // Type to distinguish where time stamp gets recorded.

@@ -260,6 +263,7 @@ public abstract class CellInfo implements Parcelable {
                    case TYPE_CDMA: return CellInfoCdma.createFromParcelBody(in);
                    case TYPE_LTE: return CellInfoLte.createFromParcelBody(in);
                    case TYPE_WCDMA: return CellInfoWcdma.createFromParcelBody(in);
                    case TYPE_TDCDMA: return CellInfoTdscdma.createFromParcelBody(in);
                    default: throw new RuntimeException("Bad CellInfo Parcel");
                }
        }
+1 −1
Original line number Diff line number Diff line
@@ -21,7 +21,7 @@ import android.os.Parcelable;
import android.telephony.Rlog;

/**
 * Immutable cell information from a point in time.
 * A {@link CellInfo} representing a CDMA cell that provides identity and measurement info.
 */
public final class CellInfoCdma extends CellInfo implements Parcelable {

Loading