Merge "Add response and indication for CellInfo" into rvc-dev am: 11001c05ce am: 239bc9ba6e
Change-Id: Id64348b0a2928a6015973e3e3253b0176290c708
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
*/
|
||||
|
||||
@@ -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.
|
||||
*/
|
||||
|
||||
@@ -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.
|
||||
*/
|
||||
|
||||
@@ -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.
|
||||
*/
|
||||
|
||||
@@ -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.
|
||||
*/
|
||||
|
||||
@@ -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.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user