Merge changes from topics "cdma-null-island", "cdma-signal-strength" am: d5ba391425
am: 78f2c228d1
Change-Id: I4b821915c69aedd594747520186b2fb123d34b78
This commit is contained in:
@@ -103,8 +103,12 @@ public final class CellIdentityCdma extends CellIdentity {
|
|||||||
mNetworkId = nid;
|
mNetworkId = nid;
|
||||||
mSystemId = sid;
|
mSystemId = sid;
|
||||||
mBasestationId = bid;
|
mBasestationId = bid;
|
||||||
mLongitude = lon;
|
if (!isNullIsland(lat, lon)) {
|
||||||
mLatitude = lat;
|
mLongitude = lon;
|
||||||
|
mLatitude = lat;
|
||||||
|
} else {
|
||||||
|
mLongitude = mLatitude = Integer.MAX_VALUE;
|
||||||
|
}
|
||||||
mAlphaLong = alphal;
|
mAlphaLong = alphal;
|
||||||
mAlphaShort = alphas;
|
mAlphaShort = alphas;
|
||||||
}
|
}
|
||||||
@@ -118,6 +122,18 @@ public final class CellIdentityCdma extends CellIdentity {
|
|||||||
return new CellIdentityCdma(this);
|
return new CellIdentityCdma(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Take the latitude and longitude in 1/4 seconds and see if
|
||||||
|
* the reported location is on Null Island.
|
||||||
|
*
|
||||||
|
* @return whether the reported Lat/Long are for Null Island
|
||||||
|
*
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
private boolean isNullIsland(int lat, int lon) {
|
||||||
|
return Math.abs(lat) <= 1 && Math.abs(lon) <= 1;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Network Id 0..65535, Integer.MAX_VALUE if unknown
|
* @return Network Id 0..65535, Integer.MAX_VALUE if unknown
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -41,14 +41,36 @@ public final class CellSignalStrengthCdma extends CellSignalStrength implements
|
|||||||
setDefaultValues();
|
setDefaultValues();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @hide */
|
/**
|
||||||
|
* SignalStrength constructor for input from the HAL.
|
||||||
|
*
|
||||||
|
* Note that values received from the HAL require coersion to be compatible here. All values
|
||||||
|
* reported through IRadio are the negative of the actual values (which results in a positive
|
||||||
|
* input to this method.
|
||||||
|
*
|
||||||
|
* <p>Note that this HAL is inconsistent with UMTS-based radio techs as the value indicating
|
||||||
|
* that a field is unreported is negative, rather than a large(r) positive number.
|
||||||
|
* <p>Also note that to keep the public-facing methods of this class consistent with others,
|
||||||
|
* unreported values are coerced to Integer.MAX_VALUE rather than left as -1, which is
|
||||||
|
* a departure from SignalStrength, which is stuck with the values it currently reports.
|
||||||
|
*
|
||||||
|
* @param cdmaDbm negative of the CDMA signal strength value or -1 if invalid.
|
||||||
|
* @param cdmaEcio negative of the CDMA pilot/noise ratio or -1 if invalid.
|
||||||
|
* @param evdoDbm negative of the EvDO signal strength value or -1 if invalid.
|
||||||
|
* @param evdoEcio negative of the EvDO pilot/noise ratio or -1 if invalid.
|
||||||
|
* @param evdoSnr an SNR value 0..8 or -1 if invalid.
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
public CellSignalStrengthCdma(int cdmaDbm, int cdmaEcio, int evdoDbm, int evdoEcio,
|
public CellSignalStrengthCdma(int cdmaDbm, int cdmaEcio, int evdoDbm, int evdoEcio,
|
||||||
int evdoSnr) {
|
int evdoSnr) {
|
||||||
mCdmaDbm = cdmaDbm;
|
// The values here were lifted from SignalStrength.validateInput()
|
||||||
mCdmaEcio = cdmaEcio;
|
// FIXME: Combine all checking and setting logic between this and SignalStrength.
|
||||||
mEvdoDbm = evdoDbm;
|
mCdmaDbm = ((cdmaDbm > 0) && (cdmaDbm < 120)) ? -cdmaDbm : Integer.MAX_VALUE;
|
||||||
mEvdoEcio = evdoEcio;
|
mCdmaEcio = ((cdmaEcio > 0) && (cdmaEcio < 160)) ? -cdmaEcio : Integer.MAX_VALUE;
|
||||||
mEvdoSnr = evdoSnr;
|
|
||||||
|
mEvdoDbm = ((evdoDbm > 0) && (evdoDbm < 120)) ? -evdoDbm : Integer.MAX_VALUE;
|
||||||
|
mEvdoEcio = ((evdoEcio > 0) && (evdoEcio < 160)) ? -evdoEcio : Integer.MAX_VALUE;
|
||||||
|
mEvdoSnr = ((evdoSnr > 0) && (evdoSnr <= 8)) ? evdoSnr : Integer.MAX_VALUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @hide */
|
/** @hide */
|
||||||
@@ -303,13 +325,10 @@ public final class CellSignalStrengthCdma extends CellSignalStrength implements
|
|||||||
@Override
|
@Override
|
||||||
public void writeToParcel(Parcel dest, int flags) {
|
public void writeToParcel(Parcel dest, int flags) {
|
||||||
if (DBG) log("writeToParcel(Parcel, int): " + toString());
|
if (DBG) log("writeToParcel(Parcel, int): " + toString());
|
||||||
// Need to multiply CdmaDbm, CdmaEcio, EvdoDbm and EvdoEcio by -1
|
dest.writeInt(mCdmaDbm);
|
||||||
// to ensure consistency when reading values written here
|
dest.writeInt(mCdmaEcio);
|
||||||
// unless the value is invalid
|
dest.writeInt(mEvdoDbm);
|
||||||
dest.writeInt(mCdmaDbm * (mCdmaDbm != Integer.MAX_VALUE ? -1 : 1));
|
dest.writeInt(mEvdoEcio);
|
||||||
dest.writeInt(mCdmaEcio * (mCdmaEcio != Integer.MAX_VALUE ? -1 : 1));
|
|
||||||
dest.writeInt(mEvdoDbm * (mEvdoDbm != Integer.MAX_VALUE ? -1 : 1));
|
|
||||||
dest.writeInt(mEvdoEcio * (mEvdoEcio != Integer.MAX_VALUE ? -1 : 1));
|
|
||||||
dest.writeInt(mEvdoSnr);
|
dest.writeInt(mEvdoSnr);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -322,13 +341,9 @@ public final class CellSignalStrengthCdma extends CellSignalStrength implements
|
|||||||
// the parcel as positive values.
|
// the parcel as positive values.
|
||||||
// Need to convert into negative values unless the value is invalid
|
// Need to convert into negative values unless the value is invalid
|
||||||
mCdmaDbm = in.readInt();
|
mCdmaDbm = in.readInt();
|
||||||
if (mCdmaDbm != Integer.MAX_VALUE) mCdmaDbm *= -1;
|
|
||||||
mCdmaEcio = in.readInt();
|
mCdmaEcio = in.readInt();
|
||||||
if (mCdmaEcio != Integer.MAX_VALUE) mCdmaEcio *= -1;
|
|
||||||
mEvdoDbm = in.readInt();
|
mEvdoDbm = in.readInt();
|
||||||
if (mEvdoDbm != Integer.MAX_VALUE) mEvdoDbm *= -1;
|
|
||||||
mEvdoEcio = in.readInt();
|
mEvdoEcio = in.readInt();
|
||||||
if (mEvdoEcio != Integer.MAX_VALUE) mEvdoEcio *= -1;
|
|
||||||
mEvdoSnr = in.readInt();
|
mEvdoSnr = in.readInt();
|
||||||
if (DBG) log("CellSignalStrengthCdma(Parcel): " + toString());
|
if (DBG) log("CellSignalStrengthCdma(Parcel): " + toString());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -314,11 +314,11 @@ public class SignalStrength implements Parcelable {
|
|||||||
// BER no change;
|
// BER no change;
|
||||||
|
|
||||||
mCdmaDbm = mCdmaDbm > 0 ? -mCdmaDbm : -120;
|
mCdmaDbm = mCdmaDbm > 0 ? -mCdmaDbm : -120;
|
||||||
mCdmaEcio = (mCdmaEcio > 0) ? -mCdmaEcio : -160;
|
mCdmaEcio = (mCdmaEcio >= 0) ? -mCdmaEcio : -160;
|
||||||
|
|
||||||
mEvdoDbm = (mEvdoDbm > 0) ? -mEvdoDbm : -120;
|
mEvdoDbm = (mEvdoDbm > 0) ? -mEvdoDbm : -120;
|
||||||
mEvdoEcio = (mEvdoEcio >= 0) ? -mEvdoEcio : -1;
|
mEvdoEcio = (mEvdoEcio >= 0) ? -mEvdoEcio : -160;
|
||||||
mEvdoSnr = ((mEvdoSnr > 0) && (mEvdoSnr <= 8)) ? mEvdoSnr : -1;
|
mEvdoSnr = ((mEvdoSnr >= 0) && (mEvdoSnr <= 8)) ? mEvdoSnr : -1;
|
||||||
|
|
||||||
// TS 36.214 Physical Layer Section 5.1.3, TS 36.331 RRC
|
// TS 36.214 Physical Layer Section 5.1.3, TS 36.331 RRC
|
||||||
mLteSignalStrength = (mLteSignalStrength >= 0) ? mLteSignalStrength : 99;
|
mLteSignalStrength = (mLteSignalStrength >= 0) ? mLteSignalStrength : 99;
|
||||||
|
|||||||
Reference in New Issue
Block a user