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

Commit c0a1448a authored by Sarah Chin's avatar Sarah Chin
Browse files

Add response and indication for CellInfo

cellInfoList_1_5
getCellInfoListResponse_1_5
networkScanResult_1_5

Test: atest RILTest
Bug: 151774189
Change-Id: I1ba01eb97f13f843fd27b65d4a2b1049e97ead71
Merged-In: I1ba01eb97f13f843fd27b65d4a2b1049e97ead71
parent dfeb2a2b
Loading
Loading
Loading
Loading
+38 −19
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ import android.annotation.IntDef;
import android.annotation.NonNull;
import android.compat.annotation.UnsupportedAppUsage;
import android.hardware.radio.V1_4.CellInfo.Info;
import android.hardware.radio.V1_5.CellInfo.CellInfoRatSpecificInfo;
import android.os.Parcel;
import android.os.Parcelable;

@@ -28,6 +29,7 @@ import com.android.internal.annotations.VisibleForTesting;

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

/**
 * Immutable cell information from a point in time.
@@ -152,7 +154,7 @@ public abstract class CellInfo implements Parcelable {
    protected CellInfo() {
        this.mRegistered = false;
        this.mTimeStamp = Long.MAX_VALUE;
        mCellConnectionStatus = CONNECTION_NONE;
        this.mCellConnectionStatus = CONNECTION_NONE;
    }

    /** @hide */
@@ -240,27 +242,17 @@ public abstract class CellInfo implements Parcelable {

    @Override
    public int hashCode() {
        int primeNum = 31;
        return ((mRegistered ? 0 : 1) * primeNum) + ((int)(mTimeStamp / 1000) * primeNum)
                + (mCellConnectionStatus * primeNum);
        return Objects.hash(mCellConnectionStatus, mRegistered, mTimeStamp);
    }

    @Override
    public boolean equals(Object other) {
        if (other == null) {
            return false;
        }
        if (this == other) {
            return true;
        }
        try {
            CellInfo o = (CellInfo) other;
            return mRegistered == o.mRegistered
                    && mTimeStamp == o.mTimeStamp
                    && mCellConnectionStatus == o.mCellConnectionStatus;
        } catch (ClassCastException e) {
            return false;
        }
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof CellInfo)) return false;
        CellInfo cellInfo = (CellInfo) o;
        return mCellConnectionStatus == cellInfo.mCellConnectionStatus
                && mRegistered == cellInfo.mRegistered
                && mTimeStamp == cellInfo.mTimeStamp;
    }

    @Override
@@ -352,6 +344,13 @@ public abstract class CellInfo implements Parcelable {
        this.mCellConnectionStatus = ci.connectionStatus;
    }

    /** @hide */
    protected CellInfo(android.hardware.radio.V1_5.CellInfo ci, long timeStamp) {
        this.mRegistered = ci.registered;
        this.mTimeStamp = timeStamp;
        this.mCellConnectionStatus = ci.connectionStatus;
    }

    /** @hide */
    public static CellInfo create(android.hardware.radio.V1_0.CellInfo ci) {
        if (ci == null) return null;
@@ -391,4 +390,24 @@ public abstract class CellInfo implements Parcelable {
            default: return null;
        }
    }

    /** @hide */
    public static CellInfo create(android.hardware.radio.V1_5.CellInfo ci, long timeStamp) {
        if (ci == null) return null;
        switch (ci.ratSpecificInfo.getDiscriminator()) {
            case CellInfoRatSpecificInfo.hidl_discriminator.gsm:
                return new CellInfoGsm(ci, timeStamp);
            case CellInfoRatSpecificInfo.hidl_discriminator.cdma:
                return new CellInfoCdma(ci, timeStamp);
            case CellInfoRatSpecificInfo.hidl_discriminator.lte:
                return new CellInfoLte(ci, timeStamp);
            case CellInfoRatSpecificInfo.hidl_discriminator.wcdma:
                return new CellInfoWcdma(ci, timeStamp);
            case CellInfoRatSpecificInfo.hidl_discriminator.tdscdma:
                return new CellInfoTdscdma(ci, timeStamp);
            case CellInfoRatSpecificInfo.hidl_discriminator.nr:
                return new CellInfoNr(ci, timeStamp);
            default: return null;
        }
    }
}
+9 −0
Original line number Diff line number Diff line
@@ -78,6 +78,15 @@ public final class CellInfoCdma extends CellInfo implements Parcelable {
                new CellSignalStrengthCdma(cic.signalStrengthCdma, cic.signalStrengthEvdo);
    }

    /** @hide */
    public CellInfoCdma(android.hardware.radio.V1_5.CellInfo ci, long timeStamp) {
        super(ci, timeStamp);
        final android.hardware.radio.V1_2.CellInfoCdma cic = ci.ratSpecificInfo.cdma();
        mCellIdentityCdma = new CellIdentityCdma(cic.cellIdentityCdma);
        mCellSignalStrengthCdma =
                new CellSignalStrengthCdma(cic.signalStrengthCdma, cic.signalStrengthEvdo);
    }

    /**
     * @return a {@link CellIdentityCdma} instance.
     */
+8 −0
Original line number Diff line number Diff line
@@ -73,6 +73,14 @@ public final class CellInfoGsm extends CellInfo implements Parcelable {
        mCellSignalStrengthGsm = new CellSignalStrengthGsm(cig.signalStrengthGsm);
    }

    /** @hide */
    public CellInfoGsm(android.hardware.radio.V1_5.CellInfo ci, long timeStamp) {
        super(ci, timeStamp);
        final android.hardware.radio.V1_5.CellInfoGsm cig = ci.ratSpecificInfo.gsm();
        mCellIdentityGsm = new CellIdentityGsm(cig.cellIdentityGsm);
        mCellSignalStrengthGsm = new CellSignalStrengthGsm(cig.signalStrengthGsm);
    }

    /**
     * @return a {@link CellIdentityGsm} instance.
     */
+9 −0
Original line number Diff line number Diff line
@@ -82,6 +82,15 @@ public final class CellInfoLte extends CellInfo implements Parcelable {
        mCellConfig = new CellConfigLte(cil.cellConfig);
    }

    /** @hide */
    public CellInfoLte(android.hardware.radio.V1_5.CellInfo ci, long timeStamp) {
        super(ci, timeStamp);
        final android.hardware.radio.V1_5.CellInfoLte cil = ci.ratSpecificInfo.lte();
        mCellIdentityLte = new CellIdentityLte(cil.cellIdentityLte);
        mCellSignalStrengthLte = new CellSignalStrengthLte(cil.signalStrengthLte);
        mCellConfig = new CellConfigLte();
    }

    /**
     * @return a {@link CellIdentityLte} instance.
     */
+8 −0
Original line number Diff line number Diff line
@@ -53,6 +53,14 @@ public final class CellInfoNr extends CellInfo {
        mCellSignalStrength = new CellSignalStrengthNr(cil.signalStrength);
    }

    /** @hide */
    public CellInfoNr(android.hardware.radio.V1_5.CellInfo ci, long timeStamp) {
        super(ci, timeStamp);
        final android.hardware.radio.V1_5.CellInfoNr cil = ci.ratSpecificInfo.nr();
        mCellIdentity = new CellIdentityNr(cil.cellIdentityNr);
        mCellSignalStrength = new CellSignalStrengthNr(cil.signalStrengthNr);
    }

    /**
     * @return a {@link CellIdentityNr} instance.
     */
Loading