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

Commit 40aa75d3 authored by Pengquan Meng's avatar Pengquan Meng Committed by Gerrit Code Review
Browse files

Merge "Add CellInfo converter V1_4"

parents 30b6573e 629f1160
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -33,6 +33,11 @@ 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;
+22 −0
Original line number Diff line number Diff line
@@ -19,8 +19,10 @@ package android.telephony;
import android.annotation.IntDef;
import android.annotation.NonNull;
import android.annotation.UnsupportedAppUsage;
import android.hardware.radio.V1_4.CellInfo.Info;
import android.os.Parcel;
import android.os.Parcelable;
import android.os.SystemClock;

import com.android.internal.annotations.VisibleForTesting;

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

    /** @hide */
    protected CellInfo(android.hardware.radio.V1_4.CellInfo ci) {
        this.mRegistered = ci.isRegistered;
        this.mTimeStamp = SystemClock.elapsedRealtimeNanos();
        this.mCellConnectionStatus = ci.connectionStatus;
    }

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

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

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

    @Override
    public CellIdentityCdma getCellIdentity() {
        return mCellIdentityCdma;
+8 −0
Original line number Diff line number Diff line
@@ -63,6 +63,14 @@ public final class CellInfoGsm extends CellInfo implements Parcelable {
        mCellSignalStrengthGsm = new CellSignalStrengthGsm(cig.signalStrengthGsm);
    }

    /** @hide */
    public CellInfoGsm(android.hardware.radio.V1_4.CellInfo ci) {
        super(ci);
        final android.hardware.radio.V1_2.CellInfoGsm cig = ci.info.gsm();
        mCellIdentityGsm = new CellIdentityGsm(cig.cellIdentityGsm);
        mCellSignalStrengthGsm = new CellSignalStrengthGsm(cig.signalStrengthGsm);
    }

    @Override
    public CellIdentityGsm getCellIdentity() {
        return mCellIdentityGsm;
+9 −0
Original line number Diff line number Diff line
@@ -70,6 +70,15 @@ public final class CellInfoLte extends CellInfo implements Parcelable {
        mCellConfig = new CellConfigLte();
    }

    /** @hide */
    public CellInfoLte(android.hardware.radio.V1_4.CellInfo ci) {
        super(ci);
        final android.hardware.radio.V1_4.CellInfoLte cil = ci.info.lte();
        mCellIdentityLte = new CellIdentityLte(cil.base.cellIdentityLte);
        mCellSignalStrengthLte = new CellSignalStrengthLte(cil.base.signalStrengthLte);
        mCellConfig = new CellConfigLte(cil.cellConfig);
    }

    @Override
    public CellIdentityLte getCellIdentity() {
        if (DBG) log("getCellIdentity: " + mCellIdentityLte);
Loading