summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSarah Chin <sarahchin@google.com>2020-03-20 03:30:15 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2020-03-20 03:30:15 +0000
commitfa0a47ed741107656e9fc2cbd8f2011c80b248da (patch)
tree22af3fb0d2a74462522106e6e43486898fe541a0
parentdfeb2a2bfc9a7dd5a17daf3e1dd605c6f6a4e0a7 (diff)
parentc0a1448ac8df60e65c48c058b3529104719d2030 (diff)
Merge "Add response and indication for CellInfo"
-rw-r--r--telephony/java/android/telephony/CellInfo.java57
-rw-r--r--telephony/java/android/telephony/CellInfoCdma.java9
-rw-r--r--telephony/java/android/telephony/CellInfoGsm.java8
-rw-r--r--telephony/java/android/telephony/CellInfoLte.java9
-rw-r--r--telephony/java/android/telephony/CellInfoNr.java8
-rw-r--r--telephony/java/android/telephony/CellInfoTdscdma.java8
-rw-r--r--telephony/java/android/telephony/CellInfoWcdma.java8
7 files changed, 88 insertions, 19 deletions
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.
*/