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

Commit c33377b0 authored by Jack Yu's avatar Jack Yu Committed by Gerrit Code Review
Browse files

Merge changes from topic "lte_bands"

* changes:
  Added bands from HAL 1.5
  Convert getAdditionalPlmns to return a Set
parents ab7bf327 49a35718
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -44997,7 +44997,7 @@ package android.telephony {
  }
  public final class CellIdentityGsm extends android.telephony.CellIdentity {
    method @NonNull public java.util.List<java.lang.String> getAdditionalPlmns();
    method @NonNull public java.util.Set<java.lang.String> getAdditionalPlmns();
    method public int getArfcn();
    method public int getBsic();
    method public int getCid();
@@ -45013,7 +45013,7 @@ package android.telephony {
  }
  public final class CellIdentityLte extends android.telephony.CellIdentity {
    method @NonNull public java.util.List<java.lang.String> getAdditionalPlmns();
    method @NonNull public java.util.Set<java.lang.String> getAdditionalPlmns();
    method @NonNull public java.util.List<java.lang.Integer> getBands();
    method public int getBandwidth();
    method public int getCi();
@@ -45031,7 +45031,7 @@ package android.telephony {
  }
  public final class CellIdentityNr extends android.telephony.CellIdentity {
    method @NonNull public java.util.List<java.lang.String> getAdditionalPlmns();
    method @NonNull public java.util.Set<java.lang.String> getAdditionalPlmns();
    method @NonNull public java.util.List<java.lang.Integer> getBands();
    method @Nullable public String getMccString();
    method @Nullable public String getMncString();
@@ -45044,7 +45044,7 @@ package android.telephony {
  }
  public final class CellIdentityTdscdma extends android.telephony.CellIdentity {
    method @NonNull public java.util.List<java.lang.String> getAdditionalPlmns();
    method @NonNull public java.util.Set<java.lang.String> getAdditionalPlmns();
    method public int getCid();
    method @Nullable public android.telephony.ClosedSubscriberGroupInfo getClosedSubscriberGroupInfo();
    method public int getCpid();
@@ -45058,7 +45058,7 @@ package android.telephony {
  }
  public final class CellIdentityWcdma extends android.telephony.CellIdentity {
    method @NonNull public java.util.List<java.lang.String> getAdditionalPlmns();
    method @NonNull public java.util.Set<java.lang.String> getAdditionalPlmns();
    method public int getCid();
    method @Nullable public android.telephony.ClosedSubscriberGroupInfo getClosedSubscriberGroupInfo();
    method public int getLac();
+13 −12
Original line number Diff line number Diff line
@@ -22,11 +22,12 @@ import android.compat.annotation.UnsupportedAppUsage;
import android.os.Parcel;
import android.telephony.gsm.GsmCellLocation;
import android.text.TextUtils;
import android.util.ArraySet;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.Set;

/**
 * CellIdentity to represent a unique GSM cell
@@ -50,7 +51,7 @@ public final class CellIdentityGsm extends CellIdentity {
    private final int mBsic;

    // a list of additional PLMN-IDs reported for this cell
    private final List<String> mAdditionalPlmns;
    private final ArraySet<String> mAdditionalPlmns;

    /**
     * @hide
@@ -62,7 +63,7 @@ public final class CellIdentityGsm extends CellIdentity {
        mCid = CellInfo.UNAVAILABLE;
        mArfcn = CellInfo.UNAVAILABLE;
        mBsic = CellInfo.UNAVAILABLE;
        mAdditionalPlmns = Collections.emptyList();
        mAdditionalPlmns = new ArraySet<>();
    }

    /**
@@ -81,13 +82,13 @@ public final class CellIdentityGsm extends CellIdentity {
     */
    public CellIdentityGsm(int lac, int cid, int arfcn, int bsic, @Nullable String mccStr,
            @Nullable String mncStr, @Nullable String alphal, @Nullable String alphas,
            @NonNull List<String> additionalPlmns) {
            @NonNull Collection<String> additionalPlmns) {
        super(TAG, CellInfo.TYPE_GSM, mccStr, mncStr, alphal, alphas);
        mLac = inRangeOrUnavailable(lac, 0, MAX_LAC);
        mCid = inRangeOrUnavailable(cid, 0, MAX_CID);
        mArfcn = inRangeOrUnavailable(arfcn, 0, MAX_ARFCN);
        mBsic = inRangeOrUnavailable(bsic, 0, MAX_BSIC);
        mAdditionalPlmns = new ArrayList<>(additionalPlmns.size());
        mAdditionalPlmns = new ArraySet<>(additionalPlmns.size());
        for (String plmn : additionalPlmns) {
            if (isValidPlmn(plmn)) {
                mAdditionalPlmns.add(plmn);
@@ -99,7 +100,7 @@ public final class CellIdentityGsm extends CellIdentity {
    public CellIdentityGsm(@NonNull android.hardware.radio.V1_0.CellIdentityGsm cid) {
        this(cid.lac, cid.cid, cid.arfcn,
                cid.bsic == (byte) 0xFF ? CellInfo.UNAVAILABLE : cid.bsic,
                cid.mcc, cid.mnc, "", "", Collections.emptyList());
                cid.mcc, cid.mnc, "", "", new ArraySet<>());
    }

    /** @hide */
@@ -107,7 +108,7 @@ public final class CellIdentityGsm extends CellIdentity {
        this(cid.base.lac, cid.base.cid, cid.base.arfcn,
                cid.base.bsic == (byte) 0xFF ? CellInfo.UNAVAILABLE : cid.base.bsic, cid.base.mcc,
                cid.base.mnc, cid.operatorNames.alphaLong, cid.operatorNames.alphaShort,
                Collections.emptyList());
                new ArraySet<>());
    }

    /** @hide */
@@ -221,8 +222,8 @@ public final class CellIdentityGsm extends CellIdentity {
     * @return a list of additional PLMN IDs supported by this cell.
     */
    @NonNull
    public List<String> getAdditionalPlmns() {
        return mAdditionalPlmns;
    public Set<String> getAdditionalPlmns() {
        return Collections.unmodifiableSet(mAdditionalPlmns);
    }

    /**
@@ -296,7 +297,7 @@ public final class CellIdentityGsm extends CellIdentity {
        dest.writeInt(mCid);
        dest.writeInt(mArfcn);
        dest.writeInt(mBsic);
        dest.writeList(mAdditionalPlmns);
        dest.writeArraySet(mAdditionalPlmns);
    }

    /** Construct from Parcel, type has already been processed */
@@ -306,7 +307,7 @@ public final class CellIdentityGsm extends CellIdentity {
        mCid = in.readInt();
        mArfcn = in.readInt();
        mBsic = in.readInt();
        mAdditionalPlmns = in.readArrayList(null);
        mAdditionalPlmns = (ArraySet<String>) in.readArraySet(null);

        if (DBG) log(toString());
    }
+31 −21
Original line number Diff line number Diff line
@@ -23,11 +23,14 @@ import android.os.Build;
import android.os.Parcel;
import android.telephony.gsm.GsmCellLocation;
import android.text.TextUtils;
import android.util.ArraySet;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.Set;

/**
 * CellIdentity is to represent a unique LTE cell
@@ -52,9 +55,11 @@ public final class CellIdentityLte extends CellIdentity {
    private final int mEarfcn;
    // cell bandwidth, in kHz
    private final int mBandwidth;
    // cell bands
    private final List<Integer> mBands;

    // a list of additional PLMN-IDs reported for this cell
    private final List<String> mAdditionalPlmns;
    private final ArraySet<String> mAdditionalPlmns;

    private ClosedSubscriberGroupInfo mCsgInfo;

@@ -68,8 +73,9 @@ public final class CellIdentityLte extends CellIdentity {
        mPci = CellInfo.UNAVAILABLE;
        mTac = CellInfo.UNAVAILABLE;
        mEarfcn = CellInfo.UNAVAILABLE;
        mBands = Collections.emptyList();
        mBandwidth = CellInfo.UNAVAILABLE;
        mAdditionalPlmns = Collections.emptyList();
        mAdditionalPlmns = new ArraySet<>();
        mCsgInfo = null;
    }

@@ -85,8 +91,9 @@ public final class CellIdentityLte extends CellIdentity {
     */
    @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 115609023)
    public CellIdentityLte(int mcc, int mnc, int ci, int pci, int tac) {
        this(ci, pci, tac, CellInfo.UNAVAILABLE, CellInfo.UNAVAILABLE, String.valueOf(mcc),
                String.valueOf(mnc), null, null, Collections.emptyList(), null);
        this(ci, pci, tac, CellInfo.UNAVAILABLE, Collections.emptyList(), CellInfo.UNAVAILABLE,
                String.valueOf(mcc), String.valueOf(mnc), null, null, new ArraySet<>(),
                null);
    }

    /**
@@ -105,17 +112,18 @@ public final class CellIdentityLte extends CellIdentity {
     *
     * @hide
     */
    public CellIdentityLte(int ci, int pci, int tac, int earfcn, int bandwidth,
    public CellIdentityLte(int ci, int pci, int tac, int earfcn, List<Integer> bands, int bandwidth,
            @Nullable String mccStr, @Nullable String mncStr, @Nullable String alphal,
            @Nullable String alphas, @NonNull List<String> additionalPlmns,
            @Nullable String alphas, @NonNull Collection<String> additionalPlmns,
            @Nullable ClosedSubscriberGroupInfo csgInfo) {
        super(TAG, CellInfo.TYPE_LTE, mccStr, mncStr, alphal, alphas);
        mCi = inRangeOrUnavailable(ci, 0, MAX_CI);
        mPci = inRangeOrUnavailable(pci, 0, MAX_PCI);
        mTac = inRangeOrUnavailable(tac, 0, MAX_TAC);
        mEarfcn = inRangeOrUnavailable(earfcn, 0, MAX_EARFCN);
        mBands = new ArrayList<>(bands);
        mBandwidth = inRangeOrUnavailable(bandwidth, 0, MAX_BANDWIDTH);
        mAdditionalPlmns = new ArrayList<>(additionalPlmns.size());
        mAdditionalPlmns = new ArraySet<>(additionalPlmns.size());
        for (String plmn : additionalPlmns) {
            if (isValidPlmn(plmn)) {
                mAdditionalPlmns.add(plmn);
@@ -126,28 +134,28 @@ public final class CellIdentityLte extends CellIdentity {

    /** @hide */
    public CellIdentityLte(@NonNull android.hardware.radio.V1_0.CellIdentityLte cid) {
        this(cid.ci, cid.pci, cid.tac, cid.earfcn,
                CellInfo.UNAVAILABLE, cid.mcc, cid.mnc, "", "", Collections.emptyList(), null);
        this(cid.ci, cid.pci, cid.tac, cid.earfcn, Collections.emptyList(),
                CellInfo.UNAVAILABLE, cid.mcc, cid.mnc, "", "", new ArraySet<>(), null);
    }

    /** @hide */
    public CellIdentityLte(@NonNull android.hardware.radio.V1_2.CellIdentityLte cid) {
        this(cid.base.ci, cid.base.pci, cid.base.tac, cid.base.earfcn, cid.bandwidth,
                cid.base.mcc, cid.base.mnc, cid.operatorNames.alphaLong,
                cid.operatorNames.alphaShort, Collections.emptyList(), null);
        this(cid.base.ci, cid.base.pci, cid.base.tac, cid.base.earfcn, Collections.emptyList(),
                cid.bandwidth, cid.base.mcc, cid.base.mnc, cid.operatorNames.alphaLong,
                cid.operatorNames.alphaShort, new ArraySet<>(), null);
    }

    /** @hide */
    public CellIdentityLte(@NonNull android.hardware.radio.V1_5.CellIdentityLte cid) {
        this(cid.base.base.ci, cid.base.base.pci, cid.base.base.tac, cid.base.base.earfcn,
                cid.base.bandwidth, cid.base.base.mcc, cid.base.base.mnc,
                cid.bands, cid.base.bandwidth, cid.base.base.mcc, cid.base.base.mnc,
                cid.base.operatorNames.alphaLong, cid.base.operatorNames.alphaShort,
                cid.additionalPlmns, cid.optionalCsgInfo.csgInfo() != null
                        ? new ClosedSubscriberGroupInfo(cid.optionalCsgInfo.csgInfo()) : null);
    }

    private CellIdentityLte(@NonNull CellIdentityLte cid) {
        this(cid.mCi, cid.mPci, cid.mTac, cid.mEarfcn, cid.mBandwidth, cid.mMccStr,
        this(cid.mCi, cid.mPci, cid.mTac, cid.mEarfcn, cid.mBands, cid.mBandwidth, cid.mMccStr,
                cid.mMncStr, cid.mAlphaLong, cid.mAlphaShort, cid.mAdditionalPlmns, cid.mCsgInfo);
    }

@@ -155,7 +163,7 @@ public final class CellIdentityLte extends CellIdentity {
    @Override
    public @NonNull CellIdentityLte sanitizeLocationInfo() {
        return new CellIdentityLte(CellInfo.UNAVAILABLE, CellInfo.UNAVAILABLE, CellInfo.UNAVAILABLE,
                CellInfo.UNAVAILABLE, CellInfo.UNAVAILABLE,
                CellInfo.UNAVAILABLE, mBands, CellInfo.UNAVAILABLE,
                mMccStr, mMncStr, mAlphaLong, mAlphaShort, mAdditionalPlmns, null);
    }

@@ -224,8 +232,7 @@ public final class CellIdentityLte extends CellIdentity {
     */
    @NonNull
    public List<Integer> getBands() {
        // Todo: Add actual support
        return Collections.emptyList();
        return Collections.unmodifiableList(mBands);
    }

    /**
@@ -270,8 +277,8 @@ public final class CellIdentityLte extends CellIdentity {
     * @return a list of additional PLMN IDs supported by this cell.
     */
    @NonNull
    public List<String> getAdditionalPlmns() {
        return mAdditionalPlmns;
    public Set<String> getAdditionalPlmns() {
        return Collections.unmodifiableSet(mAdditionalPlmns);
    }

    /**
@@ -341,6 +348,7 @@ public final class CellIdentityLte extends CellIdentity {
        .append(" mPci=").append(mPci)
        .append(" mTac=").append(mTac)
        .append(" mEarfcn=").append(mEarfcn)
        .append(" mBands=").append(mBands)
        .append(" mBandwidth=").append(mBandwidth)
        .append(" mMcc=").append(mMccStr)
        .append(" mMnc=").append(mMncStr)
@@ -360,8 +368,9 @@ public final class CellIdentityLte extends CellIdentity {
        dest.writeInt(mPci);
        dest.writeInt(mTac);
        dest.writeInt(mEarfcn);
        dest.writeList(mBands);
        dest.writeInt(mBandwidth);
        dest.writeList(mAdditionalPlmns);
        dest.writeArraySet(mAdditionalPlmns);
        dest.writeParcelable(mCsgInfo, flags);
    }

@@ -372,8 +381,9 @@ public final class CellIdentityLte extends CellIdentity {
        mPci = in.readInt();
        mTac = in.readInt();
        mEarfcn = in.readInt();
        mBands = in.readArrayList(null);
        mBandwidth = in.readInt();
        mAdditionalPlmns = in.readArrayList(null);
        mAdditionalPlmns = (ArraySet<String>) in.readArraySet(null);
        mCsgInfo = in.readParcelable(null);
        if (DBG) log(toString());
    }
+11 −8
Original line number Diff line number Diff line
@@ -22,11 +22,14 @@ import android.annotation.Nullable;
import android.os.Parcel;
import android.telephony.AccessNetworkConstants.NgranBands.NgranBand;
import android.telephony.gsm.GsmCellLocation;
import android.util.ArraySet;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.Set;

/**
 * Information to represent a unique NR(New Radio 5G) cell.
@@ -46,7 +49,7 @@ public final class CellIdentityNr extends CellIdentity {
    private final List<Integer> mBands;

    // a list of additional PLMN-IDs reported for this cell
    private final List<String> mAdditionalPlmns;
    private final ArraySet<String> mAdditionalPlmns;

    /**
     *
@@ -66,14 +69,14 @@ public final class CellIdentityNr extends CellIdentity {
    public CellIdentityNr(int pci, int tac, int nrArfcn, @NgranBand List<Integer> bands,
                          @Nullable String mccStr, @Nullable String mncStr, long nci,
                          @Nullable String alphal, @Nullable String alphas,
                          @NonNull List<String> additionalPlmns) {
                          @NonNull Collection<String> additionalPlmns) {
        super(TAG, CellInfo.TYPE_NR, mccStr, mncStr, alphal, alphas);
        mPci = inRangeOrUnavailable(pci, 0, MAX_PCI);
        mTac = inRangeOrUnavailable(tac, 0, MAX_TAC);
        mNrArfcn = inRangeOrUnavailable(nrArfcn, 0, MAX_NRARFCN);
        mBands = new ArrayList<>(bands);
        mNci = inRangeOrUnavailable(nci, 0, MAX_NCI);
        mAdditionalPlmns = new ArrayList<>(additionalPlmns.size());
        mAdditionalPlmns = new ArraySet<>(additionalPlmns.size());
        for (String plmn : additionalPlmns) {
            if (isValidPlmn(plmn)) {
                mAdditionalPlmns.add(plmn);
@@ -85,7 +88,7 @@ public final class CellIdentityNr extends CellIdentity {
    public CellIdentityNr(@NonNull android.hardware.radio.V1_4.CellIdentityNr cid) {
        this(cid.pci, cid.tac, cid.nrarfcn, Collections.emptyList(), cid.mcc, cid.mnc, cid.nci,
                cid.operatorNames.alphaLong, cid.operatorNames.alphaShort,
                Collections.emptyList());
                new ArraySet<>());
    }

    /** @hide */
@@ -212,8 +215,8 @@ public final class CellIdentityNr extends CellIdentity {
     * @return a list of additional PLMN IDs supported by this cell.
     */
    @NonNull
    public List<String> getAdditionalPlmns() {
        return Collections.unmodifiableList(mAdditionalPlmns);
    public Set<String> getAdditionalPlmns() {
        return Collections.unmodifiableSet(mAdditionalPlmns);
    }

    @Override
@@ -241,7 +244,7 @@ public final class CellIdentityNr extends CellIdentity {
        dest.writeInt(mNrArfcn);
        dest.writeList(mBands);
        dest.writeLong(mNci);
        dest.writeList(mAdditionalPlmns);
        dest.writeArraySet(mAdditionalPlmns);
    }

    /** Construct from Parcel, type has already been processed */
@@ -252,7 +255,7 @@ public final class CellIdentityNr extends CellIdentity {
        mNrArfcn = in.readInt();
        mBands = in.readArrayList(null);
        mNci = in.readLong();
        mAdditionalPlmns = in.readArrayList(null);
        mAdditionalPlmns = (ArraySet<String>) in.readArraySet(null);
    }

    /** Implement the Parcelable interface */
+12 −10
Original line number Diff line number Diff line
@@ -20,11 +20,12 @@ import android.annotation.NonNull;
import android.annotation.Nullable;
import android.os.Parcel;
import android.telephony.gsm.GsmCellLocation;
import android.util.ArraySet;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.Set;

/**
 * CellIdentity is to represent a unique TD-SCDMA cell
@@ -50,7 +51,7 @@ public final class CellIdentityTdscdma extends CellIdentity {
    private final int mUarfcn;

    // a list of additional PLMN-IDs reported for this cell
    private final List<String> mAdditionalPlmns;
    private final ArraySet<String> mAdditionalPlmns;

    private ClosedSubscriberGroupInfo mCsgInfo;

@@ -63,7 +64,7 @@ public final class CellIdentityTdscdma extends CellIdentity {
        mCid = CellInfo.UNAVAILABLE;
        mCpid = CellInfo.UNAVAILABLE;
        mUarfcn = CellInfo.UNAVAILABLE;
        mAdditionalPlmns = Collections.emptyList();
        mAdditionalPlmns = new ArraySet<>();
        mCsgInfo = null;
    }

@@ -85,13 +86,14 @@ public final class CellIdentityTdscdma extends CellIdentity {
     */
    public CellIdentityTdscdma(@Nullable String mcc, @Nullable String mnc, int lac, int cid,
            int cpid, int uarfcn, @Nullable String alphal, @Nullable String alphas,
            @NonNull List<String> additionalPlmns, @Nullable ClosedSubscriberGroupInfo csgInfo) {
            @NonNull Collection<String> additionalPlmns,
            @Nullable ClosedSubscriberGroupInfo csgInfo) {
        super(TAG, CellInfo.TYPE_TDSCDMA, mcc, mnc, alphal, alphas);
        mLac = inRangeOrUnavailable(lac, 0, MAX_LAC);
        mCid = inRangeOrUnavailable(cid, 0, MAX_CID);
        mCpid = inRangeOrUnavailable(cpid, 0, MAX_CPID);
        mUarfcn = inRangeOrUnavailable(uarfcn, 0, MAX_UARFCN);
        mAdditionalPlmns = new ArrayList<>(additionalPlmns.size());
        mAdditionalPlmns = new ArraySet<>(additionalPlmns.size());
        for (String plmn : additionalPlmns) {
            if (isValidPlmn(plmn)) {
                mAdditionalPlmns.add(plmn);
@@ -208,8 +210,8 @@ public final class CellIdentityTdscdma extends CellIdentity {
     * @return a list of additional PLMN IDs supported by this cell.
     */
    @NonNull
    public List<String> getAdditionalPlmns() {
        return mAdditionalPlmns;
    public Set<String> getAdditionalPlmns() {
        return Collections.unmodifiableSet(mAdditionalPlmns);
    }

    /**
@@ -289,7 +291,7 @@ public final class CellIdentityTdscdma extends CellIdentity {
        dest.writeInt(mCid);
        dest.writeInt(mCpid);
        dest.writeInt(mUarfcn);
        dest.writeList(mAdditionalPlmns);
        dest.writeArraySet(mAdditionalPlmns);
        dest.writeParcelable(mCsgInfo, flags);
    }

@@ -300,7 +302,7 @@ public final class CellIdentityTdscdma extends CellIdentity {
        mCid = in.readInt();
        mCpid = in.readInt();
        mUarfcn = in.readInt();
        mAdditionalPlmns = in.readArrayList(null);
        mAdditionalPlmns = (ArraySet<String>) in.readArraySet(null);
        mCsgInfo = in.readParcelable(null);
        if (DBG) log(toString());
    }
Loading