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

Commit c1e6b2dd authored by Sarah Chin's avatar Sarah Chin Committed by Android (Google) Code Review
Browse files

Merge "Move HAL constructors to RILUtils"

parents 9d0e2db3 1f77f459
Loading
Loading
Loading
Loading
+0 −37
Original line number Diff line number Diff line
@@ -28,7 +28,6 @@ import android.util.SparseArray;

import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.util.List;
import java.util.Objects;

/**
@@ -269,42 +268,6 @@ public final class BarringInfo implements Parcelable {
        mBarringServiceInfos = barringServiceInfos;
    }

    /** @hide */
    public static BarringInfo create(
            @NonNull android.hardware.radio.V1_5.CellIdentity halBarringCellId,
            @NonNull List<android.hardware.radio.V1_5.BarringInfo> halBarringInfos) {
        CellIdentity ci = CellIdentity.create(halBarringCellId);
        SparseArray<BarringServiceInfo> serviceInfos = new SparseArray<>();

        for (android.hardware.radio.V1_5.BarringInfo halBarringInfo : halBarringInfos) {
            if (halBarringInfo.barringType
                    == android.hardware.radio.V1_5.BarringInfo.BarringType.CONDITIONAL) {
                if (halBarringInfo.barringTypeSpecificInfo.getDiscriminator()
                        != android.hardware.radio.V1_5.BarringInfo.BarringTypeSpecificInfo
                                .hidl_discriminator.conditional) {
                    // this is an error case where the barring info is conditional but the
                    // conditional barring fields weren't included
                    continue;
                }
                android.hardware.radio.V1_5.BarringInfo.BarringTypeSpecificInfo
                        .Conditional conditionalInfo =
                        halBarringInfo.barringTypeSpecificInfo.conditional();
                serviceInfos.put(
                        halBarringInfo.serviceType, new BarringServiceInfo(
                                halBarringInfo.barringType, // will always be CONDITIONAL here
                                conditionalInfo.isBarred,
                                conditionalInfo.factor,
                                conditionalInfo.timeSeconds));
            } else {
                // Barring type is either NONE or UNCONDITIONAL
                serviceInfos.put(
                        halBarringInfo.serviceType, new BarringServiceInfo(
                                halBarringInfo.barringType, false, 0, 0));
            }
        }
        return new BarringInfo(ci, serviceInfos);
    }

    /**
     * Get the BarringServiceInfo for a specified service.
     *
+0 −5
Original line number Diff line number Diff line
@@ -33,11 +33,6 @@ public class CellConfigLte implements Parcelable {
        mIsEndcAvailable = false;
    }

    /** @hide */
    public CellConfigLte(android.hardware.radio.V1_4.CellConfigLte cellConfig) {
        mIsEndcAvailable = cellConfig.isEndcAvailable;
    }

    /** @hide */
    public CellConfigLte(boolean isEndcAvailable) {
        mIsEndcAvailable = isEndcAvailable;
+0 −101
Original line number Diff line number Diff line
@@ -20,7 +20,6 @@ import android.annotation.CallSuper;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.SystemApi;
import android.hardware.radio.V1_0.CellInfoType;
import android.os.Parcel;
import android.os.Parcelable;
import android.text.TextUtils;
@@ -359,104 +358,4 @@ public abstract class CellIdentity implements Parcelable {

        return true;
    }

    /** @hide */
    public static CellIdentity create(android.hardware.radio.V1_0.CellIdentity cellIdentity) {
        if (cellIdentity == null)  return null;
        switch(cellIdentity.cellInfoType) {
            case CellInfoType.GSM: {
                if (cellIdentity.cellIdentityGsm.size() == 1) {
                    return new CellIdentityGsm(cellIdentity.cellIdentityGsm.get(0));
                }
                break;
            }
            case CellInfoType.WCDMA: {
                if (cellIdentity.cellIdentityWcdma.size() == 1) {
                    return new CellIdentityWcdma(cellIdentity.cellIdentityWcdma.get(0));
                }
                break;
            }
            case CellInfoType.TD_SCDMA: {
                if (cellIdentity.cellIdentityTdscdma.size() == 1) {
                    return new  CellIdentityTdscdma(cellIdentity.cellIdentityTdscdma.get(0));
                }
                break;
            }
            case CellInfoType.LTE: {
                if (cellIdentity.cellIdentityLte.size() == 1) {
                    return new CellIdentityLte(cellIdentity.cellIdentityLte.get(0));
                }
                break;
            }
            case CellInfoType.CDMA: {
                if (cellIdentity.cellIdentityCdma.size() == 1) {
                    return new CellIdentityCdma(cellIdentity.cellIdentityCdma.get(0));
                }
                break;
            }
            case CellInfoType.NONE: break;
            default: break;
        }
        return null;
    }

    /** @hide */
    public static CellIdentity create(android.hardware.radio.V1_2.CellIdentity cellIdentity) {
        if (cellIdentity == null)  return null;
        switch(cellIdentity.cellInfoType) {
            case CellInfoType.GSM: {
                if (cellIdentity.cellIdentityGsm.size() == 1) {
                    return new CellIdentityGsm(cellIdentity.cellIdentityGsm.get(0));
                }
                break;
            }
            case CellInfoType.WCDMA: {
                if (cellIdentity.cellIdentityWcdma.size() == 1) {
                    return new CellIdentityWcdma(cellIdentity.cellIdentityWcdma.get(0));
                }
                break;
            }
            case CellInfoType.TD_SCDMA: {
                if (cellIdentity.cellIdentityTdscdma.size() == 1) {
                    return new  CellIdentityTdscdma(cellIdentity.cellIdentityTdscdma.get(0));
                }
                break;
            }
            case CellInfoType.LTE: {
                if (cellIdentity.cellIdentityLte.size() == 1) {
                    return new CellIdentityLte(cellIdentity.cellIdentityLte.get(0));
                }
                break;
            }
            case CellInfoType.CDMA: {
                if (cellIdentity.cellIdentityCdma.size() == 1) {
                    return new CellIdentityCdma(cellIdentity.cellIdentityCdma.get(0));
                }
                break;
            }
            case CellInfoType.NONE: break;
            default: break;
        }
        return null;
    }

    /** @hide */
    public static CellIdentity create(android.hardware.radio.V1_5.CellIdentity ci) {
        if (ci == null) return null;
        switch (ci.getDiscriminator()) {
            case android.hardware.radio.V1_5.CellIdentity.hidl_discriminator.gsm:
                return new CellIdentityGsm(ci.gsm());
            case android.hardware.radio.V1_5.CellIdentity.hidl_discriminator.cdma:
                return new CellIdentityCdma(ci.cdma());
            case android.hardware.radio.V1_5.CellIdentity.hidl_discriminator.lte:
                return new CellIdentityLte(ci.lte());
            case android.hardware.radio.V1_5.CellIdentity.hidl_discriminator.wcdma:
                return new CellIdentityWcdma(ci.wcdma());
            case android.hardware.radio.V1_5.CellIdentity.hidl_discriminator.tdscdma:
                return new CellIdentityTdscdma(ci.tdscdma());
            case android.hardware.radio.V1_5.CellIdentity.hidl_discriminator.nr:
                return new CellIdentityNr(ci.nr());
            default: return null;
        }
    }
}
+0 −11
Original line number Diff line number Diff line
@@ -112,17 +112,6 @@ public final class CellIdentityCdma extends CellIdentity {
        updateGlobalCellId();
    }

    /** @hide */
    public CellIdentityCdma(@NonNull android.hardware.radio.V1_0.CellIdentityCdma cid) {
        this(cid.networkId, cid.systemId, cid.baseStationId, cid.longitude, cid.latitude, "", "");
    }

    /** @hide */
    public CellIdentityCdma(@NonNull android.hardware.radio.V1_2.CellIdentityCdma cid) {
        this(cid.base.networkId, cid.base.systemId, cid.base.baseStationId, cid.base.longitude,
                cid.base.latitude, cid.operatorNames.alphaLong, cid.operatorNames.alphaShort);
    }

    private CellIdentityCdma(@NonNull CellIdentityCdma cid) {
        this(cid.mNetworkId, cid.mSystemId, cid.mBasestationId, cid.mLongitude, cid.mLatitude,
                cid.mAlphaLong, cid.mAlphaShort);
+0 −24
Original line number Diff line number Diff line
@@ -101,30 +101,6 @@ public final class CellIdentityGsm extends CellIdentity {
        updateGlobalCellId();
    }

    /** @hide */
    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, "", "", new ArraySet<>());
    }

    /** @hide */
    public CellIdentityGsm(@NonNull android.hardware.radio.V1_2.CellIdentityGsm cid) {
        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,
                new ArraySet<>());
    }

    /** @hide */
    public CellIdentityGsm(@NonNull android.hardware.radio.V1_5.CellIdentityGsm cid) {
        this(cid.base.base.lac, cid.base.base.cid, cid.base.base.arfcn,
                cid.base.base.bsic == (byte) 0xFF ? CellInfo.UNAVAILABLE
                        : cid.base.base.bsic, cid.base.base.mcc,
                cid.base.base.mnc, cid.base.operatorNames.alphaLong,
                cid.base.operatorNames.alphaShort, cid.additionalPlmns);
    }

    private CellIdentityGsm(@NonNull CellIdentityGsm cid) {
        this(cid.mLac, cid.mCid, cid.mArfcn, cid.mBsic, cid.mMccStr,
                cid.mMncStr, cid.mAlphaLong, cid.mAlphaShort, cid.mAdditionalPlmns);
Loading