fix bug forcing low quality audio calls when network type is unchecked.
This commit is contained in:
parent
8e59bd9c1d
commit
38f0af6ebe
3 changed files with 11 additions and 42 deletions
|
@ -169,7 +169,7 @@ public class IncomingCallActivity extends Activity implements LinphoneSliderTrig
|
|||
private void answer() {
|
||||
LinphoneCallParams params = LinphoneManager.getLc().createDefaultCallParameters();
|
||||
|
||||
boolean isLowBandwidthConnection = !LinphoneUtils.isHightBandwidthConnection(this);
|
||||
boolean isLowBandwidthConnection = !LinphoneUtils.isHighBandwidthConnection(this);
|
||||
if (isLowBandwidthConnection) {
|
||||
params.enableLowBandwidth(true);
|
||||
Log.d("Low bandwidth enabled in call params");
|
||||
|
|
|
@ -296,7 +296,7 @@ public class LinphoneManager implements LinphoneCoreListener {
|
|||
}
|
||||
lAddress.setDisplayName(displayName);
|
||||
|
||||
boolean isLowBandwidthConnection = !LinphoneUtils.isHightBandwidthConnection(LinphoneService.instance().getApplicationContext());
|
||||
boolean isLowBandwidthConnection = !LinphoneUtils.isHighBandwidthConnection(LinphoneService.instance().getApplicationContext());
|
||||
|
||||
if (mLc.isNetworkReachable()) {
|
||||
try {
|
||||
|
|
|
@ -296,54 +296,23 @@ public final class LinphoneUtils {
|
|||
state == LinphoneCall.State.Pausing;
|
||||
}
|
||||
|
||||
public static boolean isHightBandwidthConnection(Context context){
|
||||
public static boolean isHighBandwidthConnection(Context context){
|
||||
ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
|
||||
NetworkInfo info = cm.getActiveNetworkInfo();
|
||||
return (info != null && info.isConnected() && isConnectionFast(info.getType(),info.getSubtype()));
|
||||
}
|
||||
|
||||
private static boolean isConnectionFast(int type, int subType){
|
||||
if (type == ConnectivityManager.TYPE_WIFI) {
|
||||
return true;
|
||||
} else if (type == ConnectivityManager.TYPE_MOBILE) {
|
||||
if (type == ConnectivityManager.TYPE_MOBILE) {
|
||||
switch (subType) {
|
||||
case TelephonyManager.NETWORK_TYPE_1xRTT:
|
||||
return false; // ~ 50-100 kbps
|
||||
case TelephonyManager.NETWORK_TYPE_CDMA:
|
||||
return false; // ~ 14-64 kbps
|
||||
case TelephonyManager.NETWORK_TYPE_EDGE:
|
||||
return false; // ~ 50-100 kbps
|
||||
case TelephonyManager.NETWORK_TYPE_GPRS:
|
||||
return false; // ~ 100 kbps
|
||||
case TelephonyManager.NETWORK_TYPE_EVDO_0:
|
||||
return false; // ~25 kbps
|
||||
case TelephonyManager.NETWORK_TYPE_LTE:
|
||||
return true; // ~ 400-1000 kbps
|
||||
case TelephonyManager.NETWORK_TYPE_EVDO_A:
|
||||
return true; // ~ 600-1400 kbps
|
||||
case TelephonyManager.NETWORK_TYPE_HSDPA:
|
||||
return true; // ~ 2-14 Mbps
|
||||
case TelephonyManager.NETWORK_TYPE_HSPA:
|
||||
return true; // ~ 700-1700 kbps
|
||||
case TelephonyManager.NETWORK_TYPE_HSUPA:
|
||||
return true; // ~ 1-23 Mbps
|
||||
case TelephonyManager.NETWORK_TYPE_UMTS:
|
||||
return true; // ~ 400-7000 kbps
|
||||
case TelephonyManager.NETWORK_TYPE_EHRPD:
|
||||
return true; // ~ 1-2 Mbps
|
||||
case TelephonyManager.NETWORK_TYPE_EVDO_B:
|
||||
return true; // ~ 5 Mbps
|
||||
case TelephonyManager.NETWORK_TYPE_HSPAP:
|
||||
return true; // ~ 10-20 Mbps
|
||||
case TelephonyManager.NETWORK_TYPE_IDEN:
|
||||
return true; // ~ 10+ Mbps
|
||||
case TelephonyManager.NETWORK_TYPE_UNKNOWN:
|
||||
default:
|
||||
return false;
|
||||
case TelephonyManager.NETWORK_TYPE_EDGE:
|
||||
case TelephonyManager.NETWORK_TYPE_GPRS:
|
||||
case TelephonyManager.NETWORK_TYPE_IDEN:
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
//in doubt, assume connection is good.
|
||||
return true;
|
||||
}
|
||||
|
||||
public static void clearLogs() {
|
||||
|
|
Loading…
Reference in a new issue