Merge "[Telephony mainline] Move #dataStateToString and #getNetworkTypeName to calling location"
This commit is contained in:
@@ -37,6 +37,7 @@ import android.os.IBinder;
|
|||||||
import android.os.Message;
|
import android.os.Message;
|
||||||
import android.os.RemoteException;
|
import android.os.RemoteException;
|
||||||
import android.os.UserHandle;
|
import android.os.UserHandle;
|
||||||
|
import android.telephony.Annotation;
|
||||||
import android.telephony.Annotation.DataFailureCause;
|
import android.telephony.Annotation.DataFailureCause;
|
||||||
import android.telephony.Annotation.RadioPowerState;
|
import android.telephony.Annotation.RadioPowerState;
|
||||||
import android.telephony.Annotation.SrvccState;
|
import android.telephony.Annotation.SrvccState;
|
||||||
@@ -1563,8 +1564,8 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
|
|||||||
&& (mDataConnectionState[phoneId] != state
|
&& (mDataConnectionState[phoneId] != state
|
||||||
|| mDataConnectionNetworkType[phoneId] != networkType)) {
|
|| mDataConnectionNetworkType[phoneId] != networkType)) {
|
||||||
String str = "onDataConnectionStateChanged("
|
String str = "onDataConnectionStateChanged("
|
||||||
+ TelephonyManager.dataStateToString(state)
|
+ dataStateToString(state)
|
||||||
+ ", " + TelephonyManager.getNetworkTypeName(networkType)
|
+ ", " + getNetworkTypeName(networkType)
|
||||||
+ ") subId=" + subId + ", phoneId=" + phoneId;
|
+ ") subId=" + subId + ", phoneId=" + phoneId;
|
||||||
log(str);
|
log(str);
|
||||||
mLocalLog.log(str);
|
mLocalLog.log(str);
|
||||||
@@ -2676,4 +2677,73 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert data state to string
|
||||||
|
*
|
||||||
|
* @return The data state in string format.
|
||||||
|
*/
|
||||||
|
private String dataStateToString(@TelephonyManager.DataState int state) {
|
||||||
|
switch (state) {
|
||||||
|
case TelephonyManager.DATA_DISCONNECTED: return "DISCONNECTED";
|
||||||
|
case TelephonyManager.DATA_CONNECTING: return "CONNECTING";
|
||||||
|
case TelephonyManager.DATA_CONNECTED: return "CONNECTED";
|
||||||
|
case TelephonyManager.DATA_SUSPENDED: return "SUSPENDED";
|
||||||
|
}
|
||||||
|
return "UNKNOWN(" + state + ")";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a string representation of the radio technology (network type)
|
||||||
|
* currently in use on the device.
|
||||||
|
* @param subId for which network type is returned
|
||||||
|
* @return the name of the radio technology
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private String getNetworkTypeName(@Annotation.NetworkType int type) {
|
||||||
|
switch (type) {
|
||||||
|
case TelephonyManager.NETWORK_TYPE_GPRS:
|
||||||
|
return "GPRS";
|
||||||
|
case TelephonyManager.NETWORK_TYPE_EDGE:
|
||||||
|
return "EDGE";
|
||||||
|
case TelephonyManager.NETWORK_TYPE_UMTS:
|
||||||
|
return "UMTS";
|
||||||
|
case TelephonyManager.NETWORK_TYPE_HSDPA:
|
||||||
|
return "HSDPA";
|
||||||
|
case TelephonyManager.NETWORK_TYPE_HSUPA:
|
||||||
|
return "HSUPA";
|
||||||
|
case TelephonyManager.NETWORK_TYPE_HSPA:
|
||||||
|
return "HSPA";
|
||||||
|
case TelephonyManager.NETWORK_TYPE_CDMA:
|
||||||
|
return "CDMA";
|
||||||
|
case TelephonyManager.NETWORK_TYPE_EVDO_0:
|
||||||
|
return "CDMA - EvDo rev. 0";
|
||||||
|
case TelephonyManager.NETWORK_TYPE_EVDO_A:
|
||||||
|
return "CDMA - EvDo rev. A";
|
||||||
|
case TelephonyManager.NETWORK_TYPE_EVDO_B:
|
||||||
|
return "CDMA - EvDo rev. B";
|
||||||
|
case TelephonyManager.NETWORK_TYPE_1xRTT:
|
||||||
|
return "CDMA - 1xRTT";
|
||||||
|
case TelephonyManager.NETWORK_TYPE_LTE:
|
||||||
|
return "LTE";
|
||||||
|
case TelephonyManager.NETWORK_TYPE_EHRPD:
|
||||||
|
return "CDMA - eHRPD";
|
||||||
|
case TelephonyManager.NETWORK_TYPE_IDEN:
|
||||||
|
return "iDEN";
|
||||||
|
case TelephonyManager.NETWORK_TYPE_HSPAP:
|
||||||
|
return "HSPA+";
|
||||||
|
case TelephonyManager.NETWORK_TYPE_GSM:
|
||||||
|
return "GSM";
|
||||||
|
case TelephonyManager.NETWORK_TYPE_TD_SCDMA:
|
||||||
|
return "TD_SCDMA";
|
||||||
|
case TelephonyManager.NETWORK_TYPE_IWLAN:
|
||||||
|
return "IWLAN";
|
||||||
|
case TelephonyManager.NETWORK_TYPE_LTE_CA:
|
||||||
|
return "LTE_CA";
|
||||||
|
case TelephonyManager.NETWORK_TYPE_NR:
|
||||||
|
return "NR";
|
||||||
|
default:
|
||||||
|
return "UNKNOWN";
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user