EVDO项目如何修改在通话时状态条中只显示1X不显示3G信号
时间:10-02
整理:3721RD
点击:
[DESCRIPTION]
由于在通话状态下无法进行上网等数据连接的功能,所以需要在通话时只显示1X那个通话状态的信号条,去掉3G的标识
。
修改前如下:
修改后去掉3G,只显示1X
[SOLUTION]
NetworkControllerGemini.java文件:
1. 先加一个boolean的flag作为打电话的标记,例如flag变量;
2. PhoneStateListener mPhoneStateListener = new PhoneStateListener() 中
@Override
public void onCallStateChanged(int state, String incomingNumber) {
Xlog.d(TAG, "honeStateListenernCallStateChanged, SIM1 before.");
Xlog.d(TAG, "PhoneStateListener:onCallStateChanged, state=" + state);
//从这里将state的状态作为判断条件
if(state == TelephonyManager.CALL_STATE_IDLE)
flag = false; // 标识未有电话
else
flag = true;//标识有电话
// In CDMA, if a voice call is made, RSSI should switch to 1x.
if (isCdma(Phone.GEMINI_SIM_1)) {
if(IS_CT)
updateDataNetType(Phone.GEMINI_SIM_1);
updateTelephonySignalStrength(Phone.GEMINI_SIM_1);
。
3. updateDataNetType方法
case TelephonyManager.NETWORK_TYPE_EVDO_0: //fall through
case TelephonyManager.NETWORK_TYPE_EVDO_A:
case TelephonyManager.NETWORK_TYPE_EVDO_B:
case TelephonyManager.NETWORK_TYPE_EHRPD:
if(flag){
tempDataNetType3G = DataNetType._1X;
}
else{
tempDataNetType3G = DataNetType._1X_3G;
}
if (IS_CT) {
tempDataIconList = TelephonyIconsGemini.DATA_3G_CT;
if(flag){
tempDataTypeIconId = 0;
}
else{
tempDataTypeIconId = TelephonyIconsGemini.DATA_3G_CT[simColorId];
}
} else {
tempDataIconList = TelephonyIconsGemini.DATA_3G;
if(flag){
tempDataTypeIconId = 0;
}
else{
tempDataTypeIconId = TelephonyIconsGemini.DATA_3G[simColorId];
}
}
tempContentDescriptionDataType = mContext.getString(
R.string.accessibility_data_connection_3g);
break;
} else {
tempDataIconList = TelephonyIconsGemini.DATA_1X;
tempDataTypeIconId = TelephonyIconsGemini.DATA_1X[simColorId];
}
tempContentDescriptionDataType = mContext.getString(
R.string.accessibility_data_connection_cdma);
break;
tempDataIconList = TelephonyIconsGemini.DATA_1X;
tempDataTypeIconId = TelephonyIconsGemini.DATA_1X[simColorId];
}
由于在通话状态下无法进行上网等数据连接的功能,所以需要在通话时只显示1X那个通话状态的信号条,去掉3G的标识
。
修改前如下:
修改后去掉3G,只显示1X
[SOLUTION]
NetworkControllerGemini.java文件:
1. 先加一个boolean的flag作为打电话的标记,例如flag变量;
2. PhoneStateListener mPhoneStateListener = new PhoneStateListener() 中
@Override
public void onCallStateChanged(int state, String incomingNumber) {
Xlog.d(TAG, "honeStateListenernCallStateChanged, SIM1 before.");
Xlog.d(TAG, "PhoneStateListener:onCallStateChanged, state=" + state);
//从这里将state的状态作为判断条件
if(state == TelephonyManager.CALL_STATE_IDLE)
flag = false; // 标识未有电话
else
flag = true;//标识有电话
// In CDMA, if a voice call is made, RSSI should switch to 1x.
if (isCdma(Phone.GEMINI_SIM_1)) {
if(IS_CT)
updateDataNetType(Phone.GEMINI_SIM_1);
updateTelephonySignalStrength(Phone.GEMINI_SIM_1);
。
3. updateDataNetType方法
case TelephonyManager.NETWORK_TYPE_EVDO_0: //fall through
case TelephonyManager.NETWORK_TYPE_EVDO_A:
case TelephonyManager.NETWORK_TYPE_EVDO_B:
case TelephonyManager.NETWORK_TYPE_EHRPD:
if(flag){
tempDataNetType3G = DataNetType._1X;
}
else{
tempDataNetType3G = DataNetType._1X_3G;
}
if (IS_CT) {
tempDataIconList = TelephonyIconsGemini.DATA_3G_CT;
if(flag){
tempDataTypeIconId = 0;
}
else{
tempDataTypeIconId = TelephonyIconsGemini.DATA_3G_CT[simColorId];
}
} else {
tempDataIconList = TelephonyIconsGemini.DATA_3G;
if(flag){
tempDataTypeIconId = 0;
}
else{
tempDataTypeIconId = TelephonyIconsGemini.DATA_3G[simColorId];
}
}
tempContentDescriptionDataType = mContext.getString(
R.string.accessibility_data_connection_3g);
break;
} else {
tempDataIconList = TelephonyIconsGemini.DATA_1X;
tempDataTypeIconId = TelephonyIconsGemini.DATA_1X[simColorId];
}
tempContentDescriptionDataType = mContext.getString(
R.string.accessibility_data_connection_cdma);
break;
tempDataIconList = TelephonyIconsGemini.DATA_1X;
tempDataTypeIconId = TelephonyIconsGemini.DATA_1X[simColorId];
}