diff options
author | Treehugger Robot <android-build-prod@system.gserviceaccount.com> | 2020-03-29 00:42:43 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2020-03-29 00:42:43 +0000 |
commit | ab4024e133fced0d0618571b0b61b4551f489c96 (patch) | |
tree | b839d7e6f6ab5221c95ec72639f0853b011a2cac | |
parent | 7f87d96479b93c485cb7ebf1c779f795442ea694 (diff) | |
parent | 14afa42da93e4ebf9d7052d62d3213742f45c6ea (diff) |
Merge changes from topic "cellInfoList_1_5" into r-keystone-qcom-dev
* changes:
Fix issue with csginfo safe union
Add response and indication for CellInfo
10 files changed, 91 insertions, 27 deletions
diff --git a/telephony/java/android/telephony/CellIdentityLte.java b/telephony/java/android/telephony/CellIdentityLte.java index b4ce162274fb..d2d206347e44 100644 --- a/telephony/java/android/telephony/CellIdentityLte.java +++ b/telephony/java/android/telephony/CellIdentityLte.java @@ -150,9 +150,7 @@ public final class CellIdentityLte extends CellIdentity { this(cid.base.base.ci, cid.base.base.pci, cid.base.base.tac, cid.base.base.earfcn, cid.bands.stream().mapToInt(Integer::intValue).toArray(), 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); + cid.base.operatorNames.alphaShort, cid.additionalPlmns, null); } private CellIdentityLte(@NonNull CellIdentityLte cid) { diff --git a/telephony/java/android/telephony/CellIdentityTdscdma.java b/telephony/java/android/telephony/CellIdentityTdscdma.java index 30f98bc57458..ec288e2deb36 100644 --- a/telephony/java/android/telephony/CellIdentityTdscdma.java +++ b/telephony/java/android/telephony/CellIdentityTdscdma.java @@ -126,8 +126,7 @@ public final class CellIdentityTdscdma extends CellIdentity { this(cid.base.base.mcc, cid.base.base.mnc, cid.base.base.lac, cid.base.base.cid, cid.base.base.cpid, cid.base.uarfcn, cid.base.operatorNames.alphaLong, cid.base.operatorNames.alphaShort, - cid.additionalPlmns, cid.optionalCsgInfo.csgInfo() != null - ? new ClosedSubscriberGroupInfo(cid.optionalCsgInfo.csgInfo()) : null); + cid.additionalPlmns, null); } /** @hide */ diff --git a/telephony/java/android/telephony/CellIdentityWcdma.java b/telephony/java/android/telephony/CellIdentityWcdma.java index 9d2cb74bac23..1e00d330a5e4 100644 --- a/telephony/java/android/telephony/CellIdentityWcdma.java +++ b/telephony/java/android/telephony/CellIdentityWcdma.java @@ -120,9 +120,7 @@ public final class CellIdentityWcdma extends CellIdentity { public CellIdentityWcdma(@NonNull android.hardware.radio.V1_5.CellIdentityWcdma cid) { this(cid.base.base.lac, cid.base.base.cid, cid.base.base.psc, cid.base.base.uarfcn, 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); + cid.base.operatorNames.alphaShort, cid.additionalPlmns, null); } private CellIdentityWcdma(@NonNull CellIdentityWcdma cid) { diff --git a/telephony/java/android/telephony/CellInfo.java b/telephony/java/android/telephony/CellInfo.java index bfa209bd31f5..b381ccecde47 100644 --- a/telephony/java/android/telephony/CellInfo.java +++ b/telephony/java/android/telephony/CellInfo.java @@ -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 @@ -353,6 +345,13 @@ public abstract class CellInfo implements Parcelable { } /** @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; switch(ci.cellInfoType) { @@ -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; + } + } } diff --git a/telephony/java/android/telephony/CellInfoCdma.java b/telephony/java/android/telephony/CellInfoCdma.java index 0edb4a4eed9b..1bef681619ed 100644 --- a/telephony/java/android/telephony/CellInfoCdma.java +++ b/telephony/java/android/telephony/CellInfoCdma.java @@ -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. */ diff --git a/telephony/java/android/telephony/CellInfoGsm.java b/telephony/java/android/telephony/CellInfoGsm.java index 2dddd3f935cd..c19521fdfa99 100644 --- a/telephony/java/android/telephony/CellInfoGsm.java +++ b/telephony/java/android/telephony/CellInfoGsm.java @@ -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. */ diff --git a/telephony/java/android/telephony/CellInfoLte.java b/telephony/java/android/telephony/CellInfoLte.java index a57c7cd136db..320925ea63ae 100644 --- a/telephony/java/android/telephony/CellInfoLte.java +++ b/telephony/java/android/telephony/CellInfoLte.java @@ -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. */ diff --git a/telephony/java/android/telephony/CellInfoNr.java b/telephony/java/android/telephony/CellInfoNr.java index 8b41b8be7137..a7e79f93ae89 100644 --- a/telephony/java/android/telephony/CellInfoNr.java +++ b/telephony/java/android/telephony/CellInfoNr.java @@ -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. */ diff --git a/telephony/java/android/telephony/CellInfoTdscdma.java b/telephony/java/android/telephony/CellInfoTdscdma.java index d2cc9c6ce422..038c49ac37ee 100644 --- a/telephony/java/android/telephony/CellInfoTdscdma.java +++ b/telephony/java/android/telephony/CellInfoTdscdma.java @@ -77,6 +77,14 @@ public final class CellInfoTdscdma extends CellInfo implements Parcelable { mCellSignalStrengthTdscdma = new CellSignalStrengthTdscdma(cit.signalStrengthTdscdma); } + /** @hide */ + public CellInfoTdscdma(android.hardware.radio.V1_5.CellInfo ci, long timeStamp) { + super(ci, timeStamp); + final android.hardware.radio.V1_5.CellInfoTdscdma cit = ci.ratSpecificInfo.tdscdma(); + mCellIdentityTdscdma = new CellIdentityTdscdma(cit.cellIdentityTdscdma); + mCellSignalStrengthTdscdma = new CellSignalStrengthTdscdma(cit.signalStrengthTdscdma); + } + /** * @return a {@link CellIdentityTdscdma} instance. */ diff --git a/telephony/java/android/telephony/CellInfoWcdma.java b/telephony/java/android/telephony/CellInfoWcdma.java index 3f792d17b8ef..c74955f807b0 100644 --- a/telephony/java/android/telephony/CellInfoWcdma.java +++ b/telephony/java/android/telephony/CellInfoWcdma.java @@ -72,6 +72,14 @@ public final class CellInfoWcdma extends CellInfo implements Parcelable { mCellSignalStrengthWcdma = new CellSignalStrengthWcdma(ciw.signalStrengthWcdma); } + /** @hide */ + public CellInfoWcdma(android.hardware.radio.V1_5.CellInfo ci, long timeStamp) { + super(ci, timeStamp); + final android.hardware.radio.V1_5.CellInfoWcdma ciw = ci.ratSpecificInfo.wcdma(); + mCellIdentityWcdma = new CellIdentityWcdma(ciw.cellIdentityWcdma); + mCellSignalStrengthWcdma = new CellSignalStrengthWcdma(ciw.signalStrengthWcdma); + } + /** * @return a {@link CellIdentityWcdma} instance. */ |