Merge "Update Wcdma and Tdscdma CellInfo for HAL 1.2"

This commit is contained in:
Nathan Harold
2018-07-11 17:58:50 +00:00
committed by Gerrit Code Review
14 changed files with 487 additions and 48 deletions

View File

@@ -175,7 +175,10 @@ public abstract class CellIdentity implements Parcelable {
}
CellIdentity o = (CellIdentity) other;
return TextUtils.equals(mAlphaLong, o.mAlphaLong)
return mType == o.mType
&& TextUtils.equals(mMccStr, o.mMccStr)
&& TextUtils.equals(mMncStr, o.mMncStr)
&& TextUtils.equals(mAlphaLong, o.mAlphaLong)
&& TextUtils.equals(mAlphaShort, o.mAlphaShort);
}
@@ -233,4 +236,4 @@ public abstract class CellIdentity implements Parcelable {
protected void log(String s) {
Rlog.w(mTag, s);
}
}
}

View File

@@ -16,8 +16,8 @@
package android.telephony;
import android.annotation.Nullable;
import android.os.Parcel;
import android.text.TextUtils;
import java.util.Objects;
@@ -34,6 +34,8 @@ public final class CellIdentityTdscdma extends CellIdentity {
private final int mCid;
// 8-bit Cell Parameters ID described in TS 25.331, 0..127, INT_MAX if unknown.
private final int mCpid;
// 16-bit UMTS Absolute RF Channel Number described in TS 25.101 sec. 5.4.3
private final int mUarfcn;
/**
* @hide
@@ -43,6 +45,7 @@ public final class CellIdentityTdscdma extends CellIdentity {
mLac = Integer.MAX_VALUE;
mCid = Integer.MAX_VALUE;
mCpid = Integer.MAX_VALUE;
mUarfcn = Integer.MAX_VALUE;
}
/**
@@ -51,28 +54,12 @@ public final class CellIdentityTdscdma extends CellIdentity {
* @param lac 16-bit Location Area Code, 0..65535, INT_MAX if unknown
* @param cid 28-bit UMTS Cell Identity described in TS 25.331, 0..268435455, INT_MAX if unknown
* @param cpid 8-bit Cell Parameters ID described in TS 25.331, 0..127, INT_MAX if unknown
* @param uarfcn 16-bit UMTS Absolute RF Channel Number described in TS 25.101 sec. 5.4.3
*
* @hide
*/
public CellIdentityTdscdma(int mcc, int mnc, int lac, int cid, int cpid) {
this(String.valueOf(mcc), String.valueOf(mnc), lac, cid, cpid, null, null);
}
/**
* @param mcc 3-digit Mobile Country Code in string format
* @param mnc 2 or 3-digit Mobile Network Code in string format
* @param lac 16-bit Location Area Code, 0..65535, INT_MAX if unknown
* @param cid 28-bit UMTS Cell Identity described in TS 25.331, 0..268435455, INT_MAX if unknown
* @param cpid 8-bit Cell Parameters ID described in TS 25.331, 0..127, INT_MAX if unknown
*
* FIXME: This is a temporary constructor to facilitate migration.
* @hide
*/
public CellIdentityTdscdma(String mcc, String mnc, int lac, int cid, int cpid) {
super(TAG, TYPE_TDSCDMA, mcc, mnc, null, null);
mLac = lac;
mCid = cid;
mCpid = cpid;
public CellIdentityTdscdma(int mcc, int mnc, int lac, int cid, int cpid, int uarfcn) {
this(String.valueOf(mcc), String.valueOf(mnc), lac, cid, cpid, uarfcn, null, null);
}
/**
@@ -81,22 +68,24 @@ public final class CellIdentityTdscdma extends CellIdentity {
* @param lac 16-bit Location Area Code, 0..65535, INT_MAX if unknown
* @param cid 28-bit UMTS Cell Identity described in TS 25.331, 0..268435455, INT_MAX if unknown
* @param cpid 8-bit Cell Parameters ID described in TS 25.331, 0..127, INT_MAX if unknown
* @param uarfcn 16-bit UMTS Absolute RF Channel Number described in TS 25.101 sec. 5.4.3
* @param alphal long alpha Operator Name String or Enhanced Operator Name String
* @param alphas short alpha Operator Name String or Enhanced Operator Name String
*
* @hide
*/
public CellIdentityTdscdma(String mcc, String mnc, int lac, int cid, int cpid,
public CellIdentityTdscdma(String mcc, String mnc, int lac, int cid, int cpid, int uarfcn,
String alphal, String alphas) {
super(TAG, TYPE_TDSCDMA, mcc, mnc, alphal, alphas);
mLac = lac;
mCid = cid;
mCpid = cpid;
mUarfcn = uarfcn;
}
private CellIdentityTdscdma(CellIdentityTdscdma cid) {
this(cid.mMccStr, cid.mMncStr, cid.mLac, cid.mCid,
cid.mCpid, cid.mAlphaLong, cid.mAlphaShort);
cid.mCpid, cid.mUarfcn, cid.mAlphaLong, cid.mAlphaShort);
}
CellIdentityTdscdma copy() {
@@ -140,9 +129,32 @@ public final class CellIdentityTdscdma extends CellIdentity {
return mCpid;
}
/** @hide */
@Override
public int hashCode() {
return Objects.hash(mLac, mCid, mCpid, super.hashCode());
public int getChannelNumber() {
return mUarfcn;
}
/**
* @return The long alpha tag associated with the current scan result (may be the operator
* name string or extended operator name string). May be null if unknown.
*
* @hide
*/
@Nullable
public CharSequence getOperatorAlphaLong() {
return mAlphaLong;
}
/**
* @return The short alpha tag associated with the current scan result (may be the operator
* name string or extended operator name string). May be null if unknown.
*
* @hide
*/
@Nullable
public CharSequence getOperatorAlphaShort() {
return mAlphaShort;
}
@Override
@@ -156,24 +168,29 @@ public final class CellIdentityTdscdma extends CellIdentity {
}
CellIdentityTdscdma o = (CellIdentityTdscdma) other;
return TextUtils.equals(mMccStr, o.mMccStr)
&& TextUtils.equals(mMncStr, o.mMncStr)
&& mLac == o.mLac
return mLac == o.mLac
&& mCid == o.mCid
&& mCpid == o.mCpid
&& mUarfcn == o.mUarfcn
&& super.equals(other);
}
@Override
public int hashCode() {
return Objects.hash(mLac, mCid, mCpid, mUarfcn, super.hashCode());
}
@Override
public String toString() {
return new StringBuilder(TAG)
.append(":{ mMcc=").append(mMccStr)
.append(" mMnc=").append(mMncStr)
.append(" mAlphaLong=").append(mAlphaLong)
.append(" mAlphaShort=").append(mAlphaShort)
.append(" mLac=").append(mLac)
.append(" mCid=").append(mCid)
.append(" mCpid=").append(mCpid)
.append(" mAlphaLong=").append(mAlphaLong)
.append(" mAlphaShort=").append(mAlphaShort)
.append(" mUarfcn=").append(mUarfcn)
.append("}").toString();
}
@@ -185,6 +202,7 @@ public final class CellIdentityTdscdma extends CellIdentity {
dest.writeInt(mLac);
dest.writeInt(mCid);
dest.writeInt(mCpid);
dest.writeInt(mUarfcn);
}
/** Construct from Parcel, type has already been processed */
@@ -193,7 +211,7 @@ public final class CellIdentityTdscdma extends CellIdentity {
mLac = in.readInt();
mCid = in.readInt();
mCpid = in.readInt();
mUarfcn = in.readInt();
if (DBG) log(toString());
}

View File

@@ -34,7 +34,7 @@ public final class CellIdentityWcdma extends CellIdentity {
private final int mCid;
// 9-bit UMTS Primary Scrambling Code described in TS 25.331, 0..511
private final int mPsc;
// 16-bit UMTS Absolute RF Channel Number
// 16-bit UMTS Absolute RF Channel Number described in TS 25.101 sec. 5.4.4
private final int mUarfcn;
/**
@@ -69,7 +69,7 @@ public final class CellIdentityWcdma extends CellIdentity {
* @param lac 16-bit Location Area Code, 0..65535
* @param cid 28-bit UMTS Cell Identity
* @param psc 9-bit UMTS Primary Scrambling Code
* @param uarfcn 16-bit UMTS Absolute RF Channel Number
* @param uarfcn 16-bit UMTS Absolute RF Channel Number described in TS 25.101 sec. 5.4.3
*
* @hide
*/
@@ -82,7 +82,7 @@ public final class CellIdentityWcdma extends CellIdentity {
* @param lac 16-bit Location Area Code, 0..65535
* @param cid 28-bit UMTS Cell Identity
* @param psc 9-bit UMTS Primary Scrambling Code
* @param uarfcn 16-bit UMTS Absolute RF Channel Number
* @param uarfcn 16-bit UMTS Absolute RF Channel Number described in TS 25.101 sec. 5.4.3
* @param mccStr 3-digit Mobile Country Code in string format
* @param mncStr 2 or 3-digit Mobile Network Code in string format
* @param alphal long alpha Operator Name String or Enhanced Operator Name String

View File

@@ -19,6 +19,7 @@ package android.telephony;
import android.annotation.IntDef;
import android.os.Parcel;
import android.os.Parcelable;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
@@ -36,6 +37,8 @@ public abstract class CellInfo implements Parcelable {
protected static final int TYPE_LTE = 3;
/** @hide */
protected static final int TYPE_WCDMA = 4;
/** @hide */
protected static final int TYPE_TDCDMA = 5;
// Type to distinguish where time stamp gets recorded.
@@ -260,6 +263,7 @@ public abstract class CellInfo implements Parcelable {
case TYPE_CDMA: return CellInfoCdma.createFromParcelBody(in);
case TYPE_LTE: return CellInfoLte.createFromParcelBody(in);
case TYPE_WCDMA: return CellInfoWcdma.createFromParcelBody(in);
case TYPE_TDCDMA: return CellInfoTdscdma.createFromParcelBody(in);
default: throw new RuntimeException("Bad CellInfo Parcel");
}
}

View File

@@ -21,7 +21,7 @@ import android.os.Parcelable;
import android.telephony.Rlog;
/**
* Immutable cell information from a point in time.
* A {@link CellInfo} representing a CDMA cell that provides identity and measurement info.
*/
public final class CellInfoCdma extends CellInfo implements Parcelable {

View File

@@ -21,7 +21,7 @@ import android.os.Parcelable;
import android.telephony.Rlog;
/**
* Immutable cell information from a point in time.
* A {@link CellInfo} representing a GSM cell that provides identity and measurement info.
*/
public final class CellInfoGsm extends CellInfo implements Parcelable {

View File

@@ -21,7 +21,7 @@ import android.os.Parcelable;
import android.telephony.Rlog;
/**
* Immutable cell information from a point in time.
* A {@link CellInfo} representing an LTE cell that provides identity and measurement info.
*/
public final class CellInfoLte extends CellInfo implements Parcelable {

View File

@@ -0,0 +1,151 @@
/*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package android.telephony;
import android.os.Parcel;
import android.os.Parcelable;
import java.util.Objects;
/**
* A {@link CellInfo} representing a TD-SCDMA cell that provides identity and measurement info.
*
* @hide
*/
public final class CellInfoTdscdma extends CellInfo implements Parcelable {
private static final String LOG_TAG = "CellInfoTdscdma";
private static final boolean DBG = false;
private CellIdentityTdscdma mCellIdentityTdscdma;
private CellSignalStrengthTdscdma mCellSignalStrengthTdscdma;
/** @hide */
public CellInfoTdscdma() {
super();
mCellIdentityTdscdma = new CellIdentityTdscdma();
mCellSignalStrengthTdscdma = new CellSignalStrengthTdscdma();
}
/** @hide */
public CellInfoTdscdma(CellInfoTdscdma ci) {
super(ci);
this.mCellIdentityTdscdma = ci.mCellIdentityTdscdma.copy();
this.mCellSignalStrengthTdscdma = ci.mCellSignalStrengthTdscdma.copy();
}
public CellIdentityTdscdma getCellIdentity() {
return mCellIdentityTdscdma;
}
/** @hide */
public void setCellIdentity(CellIdentityTdscdma cid) {
mCellIdentityTdscdma = cid;
}
public CellSignalStrengthTdscdma getCellSignalStrength() {
return mCellSignalStrengthTdscdma;
}
/** @hide */
public void setCellSignalStrength(CellSignalStrengthTdscdma css) {
mCellSignalStrengthTdscdma = css;
}
/**
* @return hash code
*/
@Override
public int hashCode() {
return Objects.hash(super.hashCode(), mCellIdentityTdscdma, mCellSignalStrengthTdscdma);
}
@Override
public boolean equals(Object other) {
if (!super.equals(other)) {
return false;
}
try {
CellInfoTdscdma o = (CellInfoTdscdma) other;
return mCellIdentityTdscdma.equals(o.mCellIdentityTdscdma)
&& mCellSignalStrengthTdscdma.equals(o.mCellSignalStrengthTdscdma);
} catch (ClassCastException e) {
return false;
}
}
@Override
public String toString() {
StringBuffer sb = new StringBuffer();
sb.append("CellInfoTdscdma:{");
sb.append(super.toString());
sb.append(" ").append(mCellIdentityTdscdma);
sb.append(" ").append(mCellSignalStrengthTdscdma);
sb.append("}");
return sb.toString();
}
/** Implement the Parcelable interface */
@Override
public int describeContents() {
return 0;
}
/** Implement the Parcelable interface */
@Override
public void writeToParcel(Parcel dest, int flags) {
super.writeToParcel(dest, flags, TYPE_TDCDMA);
mCellIdentityTdscdma.writeToParcel(dest, flags);
mCellSignalStrengthTdscdma.writeToParcel(dest, flags);
}
/**
* Construct a CellInfoTdscdma object from the given parcel
* where the token is already been processed.
*/
private CellInfoTdscdma(Parcel in) {
super(in);
mCellIdentityTdscdma = CellIdentityTdscdma.CREATOR.createFromParcel(in);
mCellSignalStrengthTdscdma = CellSignalStrengthTdscdma.CREATOR.createFromParcel(in);
}
/** Implement the Parcelable interface */
public static final Creator<CellInfoTdscdma> CREATOR = new Creator<CellInfoTdscdma>() {
@Override
public CellInfoTdscdma createFromParcel(Parcel in) {
in.readInt(); // Skip past token, we know what it is
return createFromParcelBody(in);
}
@Override
public CellInfoTdscdma[] newArray(int size) {
return new CellInfoTdscdma[size];
}
};
/** @hide */
protected static CellInfoTdscdma createFromParcelBody(Parcel in) {
return new CellInfoTdscdma(in);
}
/**
* log
*/
private static void log(String s) {
Rlog.w(LOG_TAG, s);
}
}

View File

@@ -20,8 +20,10 @@ import android.os.Parcel;
import android.os.Parcelable;
import android.telephony.Rlog;
import java.util.Objects;
/**
* Immutable cell information from a point in time.
* A {@link CellInfo} representing a WCDMA cell that provides identity and measurement info.
*/
public final class CellInfoWcdma extends CellInfo implements Parcelable {
@@ -66,7 +68,7 @@ public final class CellInfoWcdma extends CellInfo implements Parcelable {
*/
@Override
public int hashCode() {
return super.hashCode() + mCellIdentityWcdma.hashCode() + mCellSignalStrengthWcdma.hashCode();
return Objects.hash(super.hashCode(), mCellIdentityWcdma, mCellSignalStrengthWcdma);
}
@Override

View File

@@ -104,7 +104,10 @@ public final class CellSignalStrengthCdma extends CellSignalStrength implements
}
/**
* Get signal level as an int from 0..4
* Retrieve an abstract level value for the overall signal strength.
*
* @return a single integer from 0 to 4 representing the general signal quality.
* 0 represents very poor signal strength while 4 represents a very strong signal strength.
*/
@Override
public int getLevel() {

View File

@@ -82,7 +82,10 @@ public final class CellSignalStrengthGsm extends CellSignalStrength implements P
}
/**
* Get signal level as an int from 0..4
* Retrieve an abstract level value for the overall signal strength.
*
* @return a single integer from 0 to 4 representing the general signal quality.
* 0 represents very poor signal strength while 4 represents a very strong signal strength.
*/
@Override
public int getLevel() {

View File

@@ -86,7 +86,10 @@ public final class CellSignalStrengthLte extends CellSignalStrength implements P
}
/**
* Get signal level as an int from 0..4
* Retrieve an abstract level value for the overall signal strength.
*
* @return a single integer from 0 to 4 representing the general signal quality.
* 0 represents very poor signal strength while 4 represents a very strong signal strength.
*/
@Override
public int getLevel() {

View File

@@ -0,0 +1,228 @@
/*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package android.telephony;
import android.os.Parcel;
import android.os.Parcelable;
import java.util.Objects;
/**
* Tdscdma signal strength related information.
*
* @hide
*/
public final class CellSignalStrengthTdscdma extends CellSignalStrength implements Parcelable {
private static final String LOG_TAG = "CellSignalStrengthTdscdma";
private static final boolean DBG = false;
private static final int TDSCDMA_SIGNAL_STRENGTH_GREAT = 12;
private static final int TDSCDMA_SIGNAL_STRENGTH_GOOD = 8;
private static final int TDSCDMA_SIGNAL_STRENGTH_MODERATE = 5;
private int mSignalStrength; // in ASU; Valid values are (0-31, 99) as defined in TS 27.007 8.5
// or Integer.MAX_VALUE if unknown
private int mBitErrorRate; // bit error rate (0-7, 99) as defined in TS 27.007 8.5 or
// Integer.MAX_VALUE if unknown
private int mRscp; // Pilot power (0-96, 255) as defined in TS 27.007 8.69 or Integer.MAX_VALUE
// if unknown
/** @hide */
public CellSignalStrengthTdscdma() {
setDefaultValues();
}
/** @hide */
public CellSignalStrengthTdscdma(int ss, int ber, int rscp) {
mSignalStrength = ss;
mBitErrorRate = ber;
mRscp = rscp;
}
/** @hide */
public CellSignalStrengthTdscdma(CellSignalStrengthTdscdma s) {
copyFrom(s);
}
/** @hide */
protected void copyFrom(CellSignalStrengthTdscdma s) {
mSignalStrength = s.mSignalStrength;
mBitErrorRate = s.mBitErrorRate;
mRscp = s.mRscp;
}
/** @hide */
@Override
public CellSignalStrengthTdscdma copy() {
return new CellSignalStrengthTdscdma(this);
}
/** @hide */
@Override
public void setDefaultValues() {
mSignalStrength = Integer.MAX_VALUE;
mBitErrorRate = Integer.MAX_VALUE;
mRscp = Integer.MAX_VALUE;
}
/**
* Retrieve an abstract level value for the overall signal strength.
*
* @return a single integer from 0 to 4 representing the general signal quality.
* 0 represents very poor signal strength while 4 represents a very strong signal strength.
*/
@Override
public int getLevel() {
int level;
// ASU ranges from 0 to 31 - TS 27.007 Sec 8.5
// asu = 0 (-113dB or less) is very weak
// signal, its better to show 0 bars to the user in such cases.
// asu = 99 is a special case, where the signal strength is unknown.
int asu = mSignalStrength;
if (asu <= 2 || asu == 99) {
level = SIGNAL_STRENGTH_NONE_OR_UNKNOWN;
} else if (asu >= TDSCDMA_SIGNAL_STRENGTH_GREAT) {
level = SIGNAL_STRENGTH_GREAT;
} else if (asu >= TDSCDMA_SIGNAL_STRENGTH_GOOD) {
level = SIGNAL_STRENGTH_GOOD;
} else if (asu >= TDSCDMA_SIGNAL_STRENGTH_MODERATE) {
level = SIGNAL_STRENGTH_MODERATE;
} else {
level = SIGNAL_STRENGTH_POOR;
}
if (DBG) log("getLevel=" + level);
return level;
}
/**
* Get the signal strength as dBm
*/
@Override
public int getDbm() {
int dBm;
int level = mSignalStrength;
int asu = (level == 99 ? Integer.MAX_VALUE : level);
if (asu != Integer.MAX_VALUE) {
dBm = -113 + (2 * asu);
} else {
dBm = Integer.MAX_VALUE;
}
if (DBG) log("getDbm=" + dBm);
return dBm;
}
/**
* Get the signal level as an asu value between 0..31, 99 is unknown
* Asu is calculated based on 3GPP RSRP. Refer to 3GPP 27.007 (Ver 10.3.0) Sec 8.69
*/
@Override
public int getAsuLevel() {
// ASU ranges from 0 to 31 - TS 27.007 Sec 8.5
// asu = 0 (-113dB or less) is very weak
// signal, its better to show 0 bars to the user in such cases.
// asu = 99 is a special case, where the signal strength is unknown.
int level = mSignalStrength;
if (DBG) log("getAsuLevel=" + level);
return level;
}
@Override
public int hashCode() {
return Objects.hash(mSignalStrength, mBitErrorRate);
}
@Override
public boolean equals(Object o) {
CellSignalStrengthTdscdma s;
try {
s = (CellSignalStrengthTdscdma) o;
} catch (ClassCastException ex) {
return false;
}
if (o == null) {
return false;
}
return mSignalStrength == s.mSignalStrength
&& mBitErrorRate == s.mBitErrorRate
&& mRscp == s.mRscp;
}
/**
* @return string representation.
*/
@Override
public String toString() {
return "CellSignalStrengthTdscdma:"
+ " ss=" + mSignalStrength
+ " ber=" + mBitErrorRate
+ " rscp=" + mRscp;
}
/** Implement the Parcelable interface */
@Override
public void writeToParcel(Parcel dest, int flags) {
if (DBG) log("writeToParcel(Parcel, int): " + toString());
dest.writeInt(mSignalStrength);
dest.writeInt(mBitErrorRate);
dest.writeInt(mRscp);
}
/**
* Construct a SignalStrength object from the given parcel
* where the token is already been processed.
*/
private CellSignalStrengthTdscdma(Parcel in) {
mSignalStrength = in.readInt();
mBitErrorRate = in.readInt();
mRscp = in.readInt();
if (DBG) log("CellSignalStrengthTdscdma(Parcel): " + toString());
}
/** Implement the Parcelable interface */
@Override
public int describeContents() {
return 0;
}
/** Implement the Parcelable interface */
@SuppressWarnings("hiding")
public static final Parcelable.Creator<CellSignalStrengthTdscdma> CREATOR =
new Parcelable.Creator<CellSignalStrengthTdscdma>() {
@Override
public CellSignalStrengthTdscdma createFromParcel(Parcel in) {
return new CellSignalStrengthTdscdma(in);
}
@Override
public CellSignalStrengthTdscdma[] newArray(int size) {
return new CellSignalStrengthTdscdma[size];
}
};
/**
* log
*/
private static void log(String s) {
Rlog.w(LOG_TAG, s);
}
}

View File

@@ -35,7 +35,13 @@ public final class CellSignalStrengthWcdma extends CellSignalStrength implements
private static final int WCDMA_SIGNAL_STRENGTH_MODERATE = 5;
private int mSignalStrength; // in ASU; Valid values are (0-31, 99) as defined in TS 27.007 8.5
private int mBitErrorRate; // bit error rate (0-7, 99) as defined in TS 27.007 8.5
// or Integer.MAX_VALUE if unknown
private int mBitErrorRate; // bit error rate (0-7, 99) as defined in TS 27.007 8.5 or
// Integer.MAX_VALUE if unknown
private int mRscp; // bit error rate (0-96, 255) as defined in TS 27.007 8.69 or
// Integer.MAX_VALUE if unknown
private int mEcNo; // signal to noise radio (0-49, 255) as defined in TS 27.007 8.69 or
// Integer.MAX_VALUE if unknown
/** @hide */
public CellSignalStrengthWcdma() {
@@ -43,9 +49,11 @@ public final class CellSignalStrengthWcdma extends CellSignalStrength implements
}
/** @hide */
public CellSignalStrengthWcdma(int ss, int ber) {
public CellSignalStrengthWcdma(int ss, int ber, int rscp, int ecno) {
mSignalStrength = ss;
mBitErrorRate = ber;
mRscp = rscp;
mEcNo = ecno;
}
/** @hide */
@@ -57,6 +65,8 @@ public final class CellSignalStrengthWcdma extends CellSignalStrength implements
protected void copyFrom(CellSignalStrengthWcdma s) {
mSignalStrength = s.mSignalStrength;
mBitErrorRate = s.mBitErrorRate;
mRscp = s.mRscp;
mEcNo = s.mEcNo;
}
/** @hide */
@@ -70,10 +80,15 @@ public final class CellSignalStrengthWcdma extends CellSignalStrength implements
public void setDefaultValues() {
mSignalStrength = Integer.MAX_VALUE;
mBitErrorRate = Integer.MAX_VALUE;
mRscp = Integer.MAX_VALUE;
mEcNo = Integer.MAX_VALUE;
}
/**
* Get signal level as an int from 0..4
* Retrieve an abstract level value for the overall signal strength.
*
* @return a single integer from 0 to 4 representing the general signal quality.
* 0 represents very poor signal strength while 4 represents a very strong signal strength.
*/
@Override
public int getLevel() {
@@ -145,7 +160,10 @@ public final class CellSignalStrengthWcdma extends CellSignalStrength implements
return false;
}
return mSignalStrength == s.mSignalStrength && mBitErrorRate == s.mBitErrorRate;
return mSignalStrength == s.mSignalStrength
&& mBitErrorRate == s.mBitErrorRate
&& mRscp == s.mRscp
&& mEcNo == s.mEcNo;
}
/**
@@ -155,7 +173,9 @@ public final class CellSignalStrengthWcdma extends CellSignalStrength implements
public String toString() {
return "CellSignalStrengthWcdma:"
+ " ss=" + mSignalStrength
+ " ber=" + mBitErrorRate;
+ " ber=" + mBitErrorRate
+ " rscp=" + mRscp
+ " ecno=" + mEcNo;
}
/** Implement the Parcelable interface */
@@ -164,6 +184,8 @@ public final class CellSignalStrengthWcdma extends CellSignalStrength implements
if (DBG) log("writeToParcel(Parcel, int): " + toString());
dest.writeInt(mSignalStrength);
dest.writeInt(mBitErrorRate);
dest.writeInt(mRscp);
dest.writeInt(mEcNo);
}
/**
@@ -173,6 +195,8 @@ public final class CellSignalStrengthWcdma extends CellSignalStrength implements
private CellSignalStrengthWcdma(Parcel in) {
mSignalStrength = in.readInt();
mBitErrorRate = in.readInt();
mRscp = in.readInt();
mEcNo = in.readInt();
if (DBG) log("CellSignalStrengthWcdma(Parcel): " + toString());
}