summaryrefslogtreecommitdiffstats
path: root/telephony/java/android
diff options
context:
space:
mode:
authorAmit Mahajan <amitmahajan@google.com>2015-09-03 21:39:52 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2015-09-03 21:39:52 +0000
commit2f142ab0779c9e36c6f733d7e2e0be083f7172ac (patch)
tree5e54672341146b54ff2142c8293e30e2a892541a /telephony/java/android
parent16db4101829c7beee42a09fcaf87fa4e31bc1d5a (diff)
parent8a670f1da434c4720b08dbb62c635316e593b9b3 (diff)
downloadframeworks_base-2f142ab0779c9e36c6f733d7e2e0be083f7172ac.zip
frameworks_base-2f142ab0779c9e36c6f733d7e2e0be083f7172ac.tar.gz
frameworks_base-2f142ab0779c9e36c6f733d7e2e0be083f7172ac.tar.bz2
am 8a670f1d: Merge changes from topic \'TDSCDMA support\' into mnc-dr-dev
* commit '8a670f1da434c4720b08dbb62c635316e593b9b3': Add TDSCDMA family Telephony: Add TD-SCDMA SignalStrength
Diffstat (limited to 'telephony/java/android')
-rw-r--r--telephony/java/android/telephony/RadioAccessFamily.java60
-rw-r--r--telephony/java/android/telephony/ServiceState.java5
-rw-r--r--telephony/java/android/telephony/SignalStrength.java105
-rw-r--r--telephony/java/android/telephony/TelephonyManager.java10
4 files changed, 172 insertions, 8 deletions
diff --git a/telephony/java/android/telephony/RadioAccessFamily.java b/telephony/java/android/telephony/RadioAccessFamily.java
index 0c5c557..2bfaf1b 100644
--- a/telephony/java/android/telephony/RadioAccessFamily.java
+++ b/telephony/java/android/telephony/RadioAccessFamily.java
@@ -185,6 +185,36 @@ public class RadioAccessFamily implements Parcelable {
case RILConstants.NETWORK_MODE_GLOBAL:
raf = GSM | WCDMA | CDMA | EVDO;
break;
+ case RILConstants.NETWORK_MODE_TDSCDMA_ONLY:
+ raf = RAF_TD_SCDMA;
+ break;
+ case RILConstants.NETWORK_MODE_TDSCDMA_WCDMA:
+ raf = RAF_TD_SCDMA | WCDMA;
+ break;
+ case RILConstants.NETWORK_MODE_LTE_TDSCDMA:
+ raf = RAF_LTE | RAF_TD_SCDMA;
+ break;
+ case RILConstants.NETWORK_MODE_TDSCDMA_GSM:
+ raf = RAF_TD_SCDMA | GSM;
+ break;
+ case RILConstants.NETWORK_MODE_LTE_TDSCDMA_GSM:
+ raf = RAF_LTE | RAF_TD_SCDMA | GSM;
+ break;
+ case RILConstants.NETWORK_MODE_TDSCDMA_GSM_WCDMA:
+ raf = RAF_TD_SCDMA | GSM | WCDMA;
+ break;
+ case RILConstants.NETWORK_MODE_LTE_TDSCDMA_WCDMA:
+ raf = RAF_LTE | RAF_TD_SCDMA | WCDMA;
+ break;
+ case RILConstants.NETWORK_MODE_LTE_TDSCDMA_GSM_WCDMA:
+ raf = RAF_LTE | RAF_TD_SCDMA | GSM | WCDMA;
+ break;
+ case RILConstants.NETWORK_MODE_TDSCDMA_CDMA_EVDO_GSM_WCDMA:
+ raf = RAF_TD_SCDMA | CDMA | EVDO | GSM | WCDMA;
+ break;
+ case RILConstants.NETWORK_MODE_LTE_TDSCDMA_CDMA_EVDO_GSM_WCDMA:
+ raf = RAF_LTE | RAF_TD_SCDMA | CDMA | EVDO | GSM | WCDMA;
+ break;
default:
raf = RAF_UNKNOWN;
break;
@@ -248,6 +278,36 @@ public class RadioAccessFamily implements Parcelable {
case (GSM | WCDMA | CDMA | EVDO):
type = RILConstants.NETWORK_MODE_GLOBAL;
break;
+ case RAF_TD_SCDMA:
+ type = RILConstants.NETWORK_MODE_TDSCDMA_ONLY;
+ break;
+ case (RAF_TD_SCDMA | WCDMA):
+ type = RILConstants.NETWORK_MODE_TDSCDMA_WCDMA;
+ break;
+ case (RAF_LTE | RAF_TD_SCDMA):
+ type = RILConstants.NETWORK_MODE_LTE_TDSCDMA;
+ break;
+ case (RAF_TD_SCDMA | GSM):
+ type = RILConstants.NETWORK_MODE_TDSCDMA_GSM;
+ break;
+ case (RAF_LTE | RAF_TD_SCDMA | GSM):
+ type = RILConstants.NETWORK_MODE_LTE_TDSCDMA_GSM;
+ break;
+ case (RAF_TD_SCDMA | GSM | WCDMA):
+ type = RILConstants.NETWORK_MODE_TDSCDMA_GSM_WCDMA;
+ break;
+ case (RAF_LTE | RAF_TD_SCDMA | WCDMA):
+ type = RILConstants.NETWORK_MODE_LTE_TDSCDMA_WCDMA;
+ break;
+ case (RAF_LTE | RAF_TD_SCDMA | GSM | WCDMA):
+ type = RILConstants.NETWORK_MODE_LTE_TDSCDMA_GSM_WCDMA;
+ break;
+ case (RAF_TD_SCDMA | CDMA | EVDO | GSM | WCDMA):
+ type = RILConstants.NETWORK_MODE_TDSCDMA_CDMA_EVDO_GSM_WCDMA;
+ break;
+ case (RAF_LTE | RAF_TD_SCDMA | RAF_LTE | CDMA | EVDO | GSM | WCDMA):
+ type = RILConstants.NETWORK_MODE_LTE_TDSCDMA_CDMA_EVDO_GSM_WCDMA;
+ break;
default:
type = RILConstants.PREFERRED_NETWORK_MODE ;
break;
diff --git a/telephony/java/android/telephony/ServiceState.java b/telephony/java/android/telephony/ServiceState.java
index 80515cf..1337487 100644
--- a/telephony/java/android/telephony/ServiceState.java
+++ b/telephony/java/android/telephony/ServiceState.java
@@ -731,6 +731,9 @@ public class ServiceState implements Parcelable {
case RIL_RADIO_TECHNOLOGY_IWLAN:
rtString = "IWLAN";
break;
+ case RIL_RADIO_TECHNOLOGY_TD_SCDMA:
+ rtString = "TD-SCDMA";
+ break;
default:
rtString = "Unexpected";
Rlog.w(LOG_TAG, "Unexpected radioTechnology=" + rt);
@@ -1068,6 +1071,8 @@ public class ServiceState implements Parcelable {
return TelephonyManager.NETWORK_TYPE_HSPAP;
case ServiceState.RIL_RADIO_TECHNOLOGY_GSM:
return TelephonyManager.NETWORK_TYPE_GSM;
+ case ServiceState.RIL_RADIO_TECHNOLOGY_TD_SCDMA:
+ return TelephonyManager.NETWORK_TYPE_TD_SCDMA;
case ServiceState.RIL_RADIO_TECHNOLOGY_IWLAN:
return TelephonyManager.NETWORK_TYPE_IWLAN;
default:
diff --git a/telephony/java/android/telephony/SignalStrength.java b/telephony/java/android/telephony/SignalStrength.java
index f02d109..f535e5d 100644
--- a/telephony/java/android/telephony/SignalStrength.java
+++ b/telephony/java/android/telephony/SignalStrength.java
@@ -68,6 +68,7 @@ public class SignalStrength implements Parcelable {
private int mLteRsrq;
private int mLteRssnr;
private int mLteCqi;
+ private int mTdScdmaRscp;
private boolean isGsm; // This value is set by the ServiceStateTracker onSignalStrengthResult
@@ -107,6 +108,7 @@ public class SignalStrength implements Parcelable {
mLteRsrq = INVALID;
mLteRssnr = INVALID;
mLteCqi = INVALID;
+ mTdScdmaRscp = INVALID;
isGsm = true;
}
@@ -131,6 +133,7 @@ public class SignalStrength implements Parcelable {
mLteRsrq = INVALID;
mLteRssnr = INVALID;
mLteCqi = INVALID;
+ mTdScdmaRscp = INVALID;
isGsm = gsmFlag;
}
@@ -143,6 +146,22 @@ public class SignalStrength implements Parcelable {
int cdmaDbm, int cdmaEcio,
int evdoDbm, int evdoEcio, int evdoSnr,
int lteSignalStrength, int lteRsrp, int lteRsrq, int lteRssnr, int lteCqi,
+ int tdScdmaRscp, boolean gsmFlag) {
+ initialize(gsmSignalStrength, gsmBitErrorRate, cdmaDbm, cdmaEcio,
+ evdoDbm, evdoEcio, evdoSnr, lteSignalStrength, lteRsrp,
+ lteRsrq, lteRssnr, lteCqi, gsmFlag);
+ mTdScdmaRscp = tdScdmaRscp;
+ }
+
+ /**
+ * Constructor
+ *
+ * @hide
+ */
+ public SignalStrength(int gsmSignalStrength, int gsmBitErrorRate,
+ int cdmaDbm, int cdmaEcio,
+ int evdoDbm, int evdoEcio, int evdoSnr,
+ int lteSignalStrength, int lteRsrp, int lteRsrq, int lteRssnr, int lteCqi,
boolean gsmFlag) {
initialize(gsmSignalStrength, gsmBitErrorRate, cdmaDbm, cdmaEcio,
evdoDbm, evdoEcio, evdoSnr, lteSignalStrength, lteRsrp,
@@ -233,6 +252,7 @@ public class SignalStrength implements Parcelable {
mLteRsrq = lteRsrq;
mLteRssnr = lteRssnr;
mLteCqi = lteCqi;
+ mTdScdmaRscp = INVALID;
isGsm = gsm;
if (DBG) log("initialize: " + toString());
}
@@ -253,6 +273,7 @@ public class SignalStrength implements Parcelable {
mLteRsrq = s.mLteRsrq;
mLteRssnr = s.mLteRssnr;
mLteCqi = s.mLteCqi;
+ mTdScdmaRscp = s.mTdScdmaRscp;
isGsm = s.isGsm;
}
@@ -276,6 +297,7 @@ public class SignalStrength implements Parcelable {
mLteRsrq = in.readInt();
mLteRssnr = in.readInt();
mLteCqi = in.readInt();
+ mTdScdmaRscp = in.readInt();
isGsm = (in.readInt() != 0);
}
@@ -302,7 +324,7 @@ public class SignalStrength implements Parcelable {
ss.mLteRsrq = in.readInt();
ss.mLteRssnr = in.readInt();
ss.mLteCqi = in.readInt();
-
+ ss.mTdScdmaRscp = in.readInt();
return ss;
}
@@ -322,6 +344,7 @@ public class SignalStrength implements Parcelable {
out.writeInt(mLteRsrq);
out.writeInt(mLteRssnr);
out.writeInt(mLteCqi);
+ out.writeInt(mTdScdmaRscp);
out.writeInt(isGsm ? 1 : 0);
}
@@ -377,6 +400,9 @@ public class SignalStrength implements Parcelable {
mLteRsrq = ((mLteRsrq >= 3) && (mLteRsrq <= 20)) ? -mLteRsrq : SignalStrength.INVALID;
mLteRssnr = ((mLteRssnr >= -200) && (mLteRssnr <= 300)) ? mLteRssnr
: SignalStrength.INVALID;
+
+ mTdScdmaRscp = ((mTdScdmaRscp >= 25) && (mTdScdmaRscp <= 120))
+ ? -mTdScdmaRscp : SignalStrength.INVALID;
// Cqi no change
if (DBG) log("Signal after validate=" + this);
}
@@ -477,12 +503,15 @@ public class SignalStrength implements Parcelable {
* while 4 represents a very strong signal strength.
*/
public int getLevel() {
- int level;
+ int level = 0;
if (isGsm) {
level = getLteLevel();
if (level == SIGNAL_STRENGTH_NONE_OR_UNKNOWN) {
- level = getGsmLevel();
+ level = getTdScdmaLevel();
+ if (level == SIGNAL_STRENGTH_NONE_OR_UNKNOWN) {
+ level = getGsmLevel();
+ }
}
} else {
int cdmaLevel = getCdmaLevel();
@@ -508,10 +537,14 @@ public class SignalStrength implements Parcelable {
* @hide
*/
public int getAsuLevel() {
- int asuLevel;
+ int asuLevel = 0;
if (isGsm) {
if (getLteLevel() == SIGNAL_STRENGTH_NONE_OR_UNKNOWN) {
- asuLevel = getGsmAsuLevel();
+ if (getTdScdmaLevel() == SIGNAL_STRENGTH_NONE_OR_UNKNOWN) {
+ asuLevel = getGsmAsuLevel();
+ } else {
+ asuLevel = getTdScdmaAsuLevel();
+ }
} else {
asuLevel = getLteAsuLevel();
}
@@ -539,12 +572,16 @@ public class SignalStrength implements Parcelable {
* @hide
*/
public int getDbm() {
- int dBm;
+ int dBm = INVALID;
if(isGsm()) {
dBm = getLteDbm();
if (dBm == INVALID) {
- dBm = getGsmDbm();
+ if (getTdScdmaLevel() == SIGNAL_STRENGTH_NONE_OR_UNKNOWN) {
+ dBm = getGsmDbm();
+ } else {
+ dBm = getTdScdmaDbm();
+ }
}
} else {
int cdmaDbm = getCdmaDbm();
@@ -849,6 +886,54 @@ public class SignalStrength implements Parcelable {
}
/**
+ * @return get TD_SCDMA dbm
+ *
+ * @hide
+ */
+ public int getTdScdmaDbm() {
+ return this.mTdScdmaRscp;
+ }
+
+ /**
+ * Get TD-SCDMA as level 0..4
+ * Range : 25 to 120
+ * INT_MAX: 0x7FFFFFFF denotes invalid value
+ * Reference: 3GPP TS 25.123, section 9.1.1.1
+ *
+ * @hide
+ */
+ public int getTdScdmaLevel() {
+ final int tdScdmaDbm = getTdScdmaDbm();
+ int level;
+
+ if ((tdScdmaDbm > -25) || (tdScdmaDbm == SignalStrength.INVALID))
+ level = SIGNAL_STRENGTH_NONE_OR_UNKNOWN;
+ else if (tdScdmaDbm >= -49) level = SIGNAL_STRENGTH_GREAT;
+ else if (tdScdmaDbm >= -73) level = SIGNAL_STRENGTH_GOOD;
+ else if (tdScdmaDbm >= -97) level = SIGNAL_STRENGTH_MODERATE;
+ else if (tdScdmaDbm >= -120) level = SIGNAL_STRENGTH_POOR;
+ else level = SIGNAL_STRENGTH_NONE_OR_UNKNOWN;
+
+ if (DBG) log("getTdScdmaLevel = " + level);
+ return level;
+ }
+
+ /**
+ * Get the TD-SCDMA signal level as an asu value.
+ *
+ * @hide
+ */
+ public int getTdScdmaAsuLevel() {
+ final int tdScdmaDbm = getTdScdmaDbm();
+ int tdScdmaAsuLevel;
+
+ if (tdScdmaDbm == INVALID) tdScdmaAsuLevel = 255;
+ else tdScdmaAsuLevel = tdScdmaDbm + 120;
+ if (DBG) log("TD-SCDMA Asu level: " + tdScdmaAsuLevel);
+ return tdScdmaAsuLevel;
+ }
+
+ /**
* @return hash code
*/
@Override
@@ -860,7 +945,7 @@ public class SignalStrength implements Parcelable {
+ (mEvdoDbm * primeNum) + (mEvdoEcio * primeNum) + (mEvdoSnr * primeNum)
+ (mLteSignalStrength * primeNum) + (mLteRsrp * primeNum)
+ (mLteRsrq * primeNum) + (mLteRssnr * primeNum) + (mLteCqi * primeNum)
- + (isGsm ? 1 : 0));
+ + (mTdScdmaRscp * primeNum) + (isGsm ? 1 : 0));
}
/**
@@ -892,6 +977,7 @@ public class SignalStrength implements Parcelable {
&& mLteRsrq == s.mLteRsrq
&& mLteRssnr == s.mLteRssnr
&& mLteCqi == s.mLteCqi
+ && mTdScdmaRscp == s.mTdScdmaRscp
&& isGsm == s.isGsm);
}
@@ -913,6 +999,7 @@ public class SignalStrength implements Parcelable {
+ " " + mLteRsrq
+ " " + mLteRssnr
+ " " + mLteCqi
+ + " " + mTdScdmaRscp
+ " " + (isGsm ? "gsm|lte" : "cdma"));
}
@@ -935,6 +1022,7 @@ public class SignalStrength implements Parcelable {
mLteRsrq = m.getInt("LteRsrq");
mLteRssnr = m.getInt("LteRssnr");
mLteCqi = m.getInt("LteCqi");
+ mTdScdmaRscp = m.getInt("TdScdma");
isGsm = m.getBoolean("isGsm");
}
@@ -957,6 +1045,7 @@ public class SignalStrength implements Parcelable {
m.putInt("LteRsrq", mLteRsrq);
m.putInt("LteRssnr", mLteRssnr);
m.putInt("LteCqi", mLteCqi);
+ m.putInt("TdScdma", mTdScdmaRscp);
m.putBoolean("isGsm", Boolean.valueOf(isGsm));
}
diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java
index e104b38..f6e4bed 100644
--- a/telephony/java/android/telephony/TelephonyManager.java
+++ b/telephony/java/android/telephony/TelephonyManager.java
@@ -1099,11 +1099,21 @@ public class TelephonyManager {
case RILConstants.NETWORK_MODE_LTE_GSM_WCDMA:
case RILConstants.NETWORK_MODE_LTE_WCDMA:
case RILConstants.NETWORK_MODE_LTE_CDMA_EVDO_GSM_WCDMA:
+ case RILConstants.NETWORK_MODE_TDSCDMA_ONLY:
+ case RILConstants.NETWORK_MODE_TDSCDMA_WCDMA:
+ case RILConstants.NETWORK_MODE_LTE_TDSCDMA:
+ case RILConstants.NETWORK_MODE_TDSCDMA_GSM:
+ case RILConstants.NETWORK_MODE_LTE_TDSCDMA_GSM:
+ case RILConstants.NETWORK_MODE_TDSCDMA_GSM_WCDMA:
+ case RILConstants.NETWORK_MODE_LTE_TDSCDMA_WCDMA:
+ case RILConstants.NETWORK_MODE_LTE_TDSCDMA_GSM_WCDMA:
+ case RILConstants.NETWORK_MODE_LTE_TDSCDMA_CDMA_EVDO_GSM_WCDMA:
return PhoneConstants.PHONE_TYPE_GSM;
// Use CDMA Phone for the global mode including CDMA
case RILConstants.NETWORK_MODE_GLOBAL:
case RILConstants.NETWORK_MODE_LTE_CDMA_EVDO:
+ case RILConstants.NETWORK_MODE_TDSCDMA_CDMA_EVDO_GSM_WCDMA:
return PhoneConstants.PHONE_TYPE_CDMA;
case RILConstants.NETWORK_MODE_LTE_ONLY: