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

Commit 16e5d2a0 authored by Jack Yu's avatar Jack Yu
Browse files

Added bands from HAL 1.5

Test: Manual
Change-Id: Ib155ee5c2f660c8866a7be91e7f62a8c90e78d8e
Fix: 149475773
parent 3f9ddc30
Loading
Loading
Loading
Loading
+19 −11
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@ 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;
@@ -54,6 +55,8 @@ 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 ArraySet<String> mAdditionalPlmns;
@@ -70,6 +73,7 @@ public final class CellIdentityLte extends CellIdentity {
        mPci = CellInfo.UNAVAILABLE;
        mTac = CellInfo.UNAVAILABLE;
        mEarfcn = CellInfo.UNAVAILABLE;
        mBands = Collections.emptyList();
        mBandwidth = CellInfo.UNAVAILABLE;
        mAdditionalPlmns = new ArraySet<>();
        mCsgInfo = null;
@@ -87,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, new ArraySet<>(), null);
        this(ci, pci, tac, CellInfo.UNAVAILABLE, Collections.emptyList(), CellInfo.UNAVAILABLE,
                String.valueOf(mcc), String.valueOf(mnc), null, null, new ArraySet<>(),
                null);
    }

    /**
@@ -107,7 +112,7 @@ 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 Collection<String> additionalPlmns,
            @Nullable ClosedSubscriberGroupInfo csgInfo) {
@@ -116,6 +121,7 @@ public final class CellIdentityLte extends CellIdentity {
        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 ArraySet<>(additionalPlmns.size());
        for (String plmn : additionalPlmns) {
@@ -128,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,
        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,
        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);
    }

@@ -157,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);
    }

@@ -226,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);
    }

    /**
@@ -343,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)
@@ -362,6 +368,7 @@ public final class CellIdentityLte extends CellIdentity {
        dest.writeInt(mPci);
        dest.writeInt(mTac);
        dest.writeInt(mEarfcn);
        dest.writeList(mBands);
        dest.writeInt(mBandwidth);
        dest.writeArraySet(mAdditionalPlmns);
        dest.writeParcelable(mCsgInfo, flags);
@@ -374,6 +381,7 @@ public final class CellIdentityLte extends CellIdentity {
        mPci = in.readInt();
        mTac = in.readInt();
        mEarfcn = in.readInt();
        mBands = in.readArrayList(null);
        mBandwidth = in.readInt();
        mAdditionalPlmns = (ArraySet<String>) in.readArraySet(null);
        mCsgInfo = in.readParcelable(null);