IMS: Add Motorola specific API for VT
* The data format is incompatible with original QCOM, so set
ro.qcom.ims.use_moto_vt_ext=true to enable.
* The IMS stack will crash when making a VT call without these
extensions, and the outcoming call cannot be hung up unless restart.
Change-Id: I557daf261472fccbd7792934d4a377d5cbb2f252
diff --git a/ims/ims-ext-common/src/org/codeaurora/ims/QtiVideoCallDataUsage.java b/ims/ims-ext-common/src/org/codeaurora/ims/QtiVideoCallDataUsage.java
index c188fb9..170e418 100644
--- a/ims/ims-ext-common/src/org/codeaurora/ims/QtiVideoCallDataUsage.java
+++ b/ims/ims-ext-common/src/org/codeaurora/ims/QtiVideoCallDataUsage.java
@@ -31,6 +31,7 @@
import android.os.Parcel;
import android.os.Parcelable;
+import android.os.SystemProperties;
/**
* Parcelable object to handle Video Call DataUsage information
@@ -45,31 +46,82 @@
public static final int DATA_USAGE_INVALID_VALUE = -1;
private static final String[] TEXT = {"LteDataUsage = "," WlanDataUsage = "};
+ // Motorola specific
+ public static final int DATA_USAGE_LTE_TX = 0;
+ public static final int DATA_USAGE_LTE_RX = 1;
+ public static final int DATA_USAGE_WLAN_TX = 2;
+ public static final int DATA_USAGE_WLAN_RX = 3;
+ private static final String[] TEXT_MOTO = {
+ "LteTxDataUsage = ", " LteRxDataUsage = ", " WlanTxDataUsage = ", " WlanRxDataUsage = "
+ };
+ private static final String MOTO_VT_PROP = "ro.qcom.ims.use_moto_vt_ext";
+ private final boolean mUseMotoExt;
+
public QtiVideoCallDataUsage(long[] dUsage) {
if (dUsage == null || dUsage.length == 0 ) {
throw new RuntimeException();
}
mDataUsage = dUsage;
+ mUseMotoExt = SystemProperties.getBoolean(MOTO_VT_PROP, false);
}
public QtiVideoCallDataUsage(Parcel in) {
readFromParcel(in);
+ mUseMotoExt = SystemProperties.getBoolean(MOTO_VT_PROP, false);
}
/*
* This method returns LTE Data Usage
*/
public long getLteDataUsage() {
- return mDataUsage.length > DATA_USAGE_LTE ? mDataUsage[DATA_USAGE_LTE] :
- DATA_USAGE_INVALID_VALUE;
+ if (mUseMotoExt) {
+ return mDataUsage.length > DATA_USAGE_LTE_RX
+ ? mDataUsage[DATA_USAGE_LTE_TX] + mDataUsage[DATA_USAGE_LTE_RX]
+ : DATA_USAGE_INVALID_VALUE;
+ } else {
+ return mDataUsage.length > DATA_USAGE_LTE
+ ? mDataUsage[DATA_USAGE_LTE]
+ : DATA_USAGE_INVALID_VALUE;
+ }
+ }
+
+ public long getLteTxDataUsage() {
+ return (mUseMotoExt && mDataUsage.length > DATA_USAGE_LTE_TX)
+ ? mDataUsage[DATA_USAGE_LTE_TX]
+ : DATA_USAGE_INVALID_VALUE;
+ }
+
+ public long getLteRxDataUsage() {
+ return (mUseMotoExt && mDataUsage.length > DATA_USAGE_LTE_RX)
+ ? mDataUsage[DATA_USAGE_LTE_RX]
+ : DATA_USAGE_INVALID_VALUE;
}
/*
* This method returns WLAN Data Usage
*/
public long getWlanDataUsage() {
- return mDataUsage.length > DATA_USAGE_WLAN ? mDataUsage[DATA_USAGE_WLAN] :
- DATA_USAGE_INVALID_VALUE;
+ if (mUseMotoExt) {
+ return mDataUsage.length > DATA_USAGE_WLAN_RX
+ ? mDataUsage[DATA_USAGE_WLAN_TX] + mDataUsage[DATA_USAGE_WLAN_RX]
+ : DATA_USAGE_INVALID_VALUE;
+ } else {
+ return mDataUsage.length > DATA_USAGE_WLAN
+ ? mDataUsage[DATA_USAGE_WLAN]
+ : DATA_USAGE_INVALID_VALUE;
+ }
+ }
+
+ public long getWlanTxDataUsage() {
+ return (mUseMotoExt && mDataUsage.length > DATA_USAGE_WLAN_TX)
+ ? mDataUsage[DATA_USAGE_WLAN_TX]
+ : DATA_USAGE_INVALID_VALUE;
+ }
+
+ public long getWlanRxDataUsage() {
+ return (mUseMotoExt && mDataUsage.length > DATA_USAGE_WLAN_RX)
+ ? mDataUsage[DATA_USAGE_WLAN_RX]
+ : DATA_USAGE_INVALID_VALUE;
}
@Override
@@ -103,8 +155,9 @@
public String toString() {
if(mDataUsage != null) {
String msg = "";
+ String[] text = mUseMotoExt ? TEXT_MOTO : TEXT;
for (int i = 0; i < mDataUsage.length; i++) {
- msg += TEXT[i] + mDataUsage[i];
+ msg += text[i] + mDataUsage[i];
}
return msg;
}