private final void updateDataNetType(int slotId) {
int tempDataNetType;
NetworkType tempDataNetType3G = NetworkType.Type_G;

if (slotId == Phone.GEMINI_SIM_1) {
tempDataNetType = mDataNetType;
} else {
tempDataNetType = mDataNetTypeGemini;
}
Xlog.d(TAG, "updateDataNetType(" + slotId + "), DataNetType=" + tempDataNetType + ".");

int simColorId = SIMHelper.getSIMColorIdBySlot(mContext, slotId);
if (simColorId == -1) {
return;
}
Xlog.d(TAG, "updateDataNetType(" + slotId + "), simColorId=" + simColorId);

boolean tempIsRoaming = false;
if ((isCdma(slotId) && isCdmaEri(slotId))
|| mPhone.isNetworkRoamingGemini(slotId)) {
int tempRoamingId = 0;

if (simColorId > -1 && simColorId < 4) {
tempRoamingId = TelephonyIconsGemini.ROAMING[simColorId];
}
Xlog.d(TAG, "updateDataNetType(" + slotId + ") RoamingresId= " + tempRoamingId + " simColorId = " + simColorId);
if (slotId == Phone.GEMINI_SIM_1) {
mIsRoaming = true;
mIsRoamingId = tempRoamingId;
} else {
mIsRoamingGemini = true;
mIsRoamingGeminiId = tempRoamingId;
}
tempIsRoaming = true;
} else {
if (slotId == Phone.GEMINI_SIM_1) {
mIsRoaming = false;
mIsRoamingId = 0;
} else {
mIsRoamingGemini = false;
mIsRoamingGeminiId = 0;
}
}

DataType tempDateType;

String tempContentDescriptionDataType;
if (mIsWimaxEnabled && mWimaxConnected) {
// wimax is a special 4g network not handled by telephony
tempDateType = DataType.Type_4G;
tempContentDescriptionDataType = mContext.getString(
R.string.accessibility_data_connection_4g);
} else {
switch (tempDataNetType) {
case TelephonyManager.NETWORK_TYPE_UNKNOWN:
if (!mShowAtLeastThreeGees) {
tempDateType = DataType.Type_G;
tempContentDescriptionDataType = mContext.getString(
R.string.accessibility_data_connection_gprs);
break;
} else {
// fall through
}
case TelephonyManager.NETWORK_TYPE_EDGE:
if (!mShowAtLeastThreeGees) {
tempDateType = DataType.Type_E;
tempContentDescriptionDataType = mContext.getString(
R.string.accessibility_data_connection_edge);
break;
} else {
// fall through
}
case TelephonyManager.NETWORK_TYPE_UMTS:
tempDataNetType3G = NetworkType.Type_3G;
tempDateType = DataType.Type_3G;
tempContentDescriptionDataType = mContext.getString(
R.string.accessibility_data_connection_3g);
break;
case TelephonyManager.NETWORK_TYPE_HSDPA:
case TelephonyManager.NETWORK_TYPE_HSUPA:
case TelephonyManager.NETWORK_TYPE_HSPA:
case TelephonyManager.NETWORK_TYPE_HSPAP:
tempDataNetType3G = NetworkType.Type_3G;
if (mHspaDataDistinguishable) {
tempDateType = DataType.Type_H;
tempContentDescriptionDataType = mContext.getString(
R.string.accessibility_data_connection_3_5g);
} else {
tempDateType = DataType.Type_3G;
tempContentDescriptionDataType = mContext.getString(
R.string.accessibility_data_connection_3g);
}
break;
case TelephonyManager.NETWORK_TYPE_CDMA:
// display 1xRTT for IS95A/B
tempDataNetType3G = NetworkType.Type_1X;
tempDateType = DataType.Type_1X;
tempContentDescriptionDataType = mContext.getString(
R.string.accessibility_data_connection_cdma);
break;
case TelephonyManager.NETWORK_TYPE_1xRTT:
tempDataNetType3G = NetworkType.Type_1X;
tempDateType = DataType.Type_1X;
tempContentDescriptionDataType = mContext.getString(
R.string.accessibility_data_connection_cdma);
break;
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:
tempDataNetType3G = NetworkType.Type_1X3G;
tempDateType = DataType.Type_3G;
tempContentDescriptionDataType = mContext.getString(
R.string.accessibility_data_connection_3g);
break;
case TelephonyManager.NETWORK_TYPE_LTE:
tempDateType = DataType.Type_4G;
tempContentDescriptionDataType = mContext.getString(
R.string.accessibility_data_connection_4g);
break;
default:
if (!mShowAtLeastThreeGees) {
tempDataNetType3G = NetworkType.Type_G;
tempDateType = DataType.Type_G;
tempContentDescriptionDataType = mContext.getString(
R.string.accessibility_data_connection_gprs);
} else {
tempDataNetType3G = NetworkType.Type_3G;
tempDateType = DataType.Type_3G;
tempContentDescriptionDataType = mContext.getString(
R.string.accessibility_data_connection_3g);
}
break;
}
}

Android 源码 判断网络数据类型的更多相关文章

  1. Android源码服务专家(申明:来源于网络)

    Android源码服务专家(申明:来源于网络) 地址:http://www.javaapk.com/topics/demo/page/20/

  2. 从Android源码的角度分析Binder机制

    欢迎访问我的个人博客,原文链接:http://wensibo.top/2017/07/03/Binder/ ,未经允许不得转载! 前言 大家好,好久不见,距离上篇文章已经有35天之久了,因为身体不舒服 ...

  3. android源码的目录结构

    android源码的目录结构 [以下网络摘抄] |-- Makefile ! l/ a5 n% S% @- `0 d# z# a$ P4 V3 o7 R|-- bionic              ...

  4. Android源码-学习随笔

    在线代码网站1:http://grepcode.com/project/repository.grepcode.com/java/ext/com.google.android/android/ 书籍: ...

  5. android源码编译1

    一.环境说明: 1.liunx系统:Ubuntu12.04 2.jdk:sun-java6-jdk 3.g++4.5 gcc4.5 二.android源码的目录结构 |-- Makefile |-- ...

  6. 2014年最新720多套Android源码2.0GB免费一次性打包下载

    之前发过一个帖子,但是那个帖子有点问题我就重新发一个吧,下面的源码是我从今年3月份开始不断整理源码区和其他网站上的android源码,目前总共有720套左右,根据实现的功能被我分成了100多个类,总共 ...

  7. Android SDK目录具体结构及Android源码的具体结构

    Android SDK目录具体结构 1. add-ons:这里面保存着附加库,比如Google Maps,当然你如果安装了OphoneSDK,这里也会有一些类库在里面. 2. docs:这里面是And ...

  8. MTK Android 源码目录分析

    Android 源码目录分析 Android 4.0 |-- abi (application binary interface:应用二进制接口)|-- art (average retrieval ...

  9. Eclipse与Android源码中ProGuard工具的使用

    由于工作需要,这两天和同事在研究android下面的ProGuard工具的使用,通过查看android官网对该工具的介绍以及网络上其它相关资料,再加上自己的亲手实践,算是有了一个基本了解.下面将自己的 ...

随机推荐

  1. VPN错误800、错误789

    VPN突然无法连接解决方法: 1. 单击“开始”,单击“运行”,键入“regedit”,然后单击“确定” 2. 找到下面的注册表子项,然后单击它:HKEY_LOCAL_MACHINE\System\C ...

  2. debain上安装mono3.4.0和jexus5.5.2

    今天折腾了四个小时才把这个正确安装上,特此记录下.特别感谢群友的支持. 在VMware上新安装了Debain7.5,具体细节不复述了. 一.更新系统 #apt-get update #apt-get ...

  3. 上传图片的回调函数,callback作为一个函数针对回调函数

    Tool.ImageUpload = function (selector, callback) { /// <summary>图片上传</summary> /// <p ...

  4. [转]Reed Solomon纠删码

    [转]Reed Solomon纠删码    http://peterylh.blog.163.com/blog/static/12033201371375050233/     纠删码是存储领域常用的 ...

  5. .NET DES 加密

    using System; using System.Collections.Generic; using System.Text; using System.Security; using Syst ...

  6. mini6410-JNI-led

    一.编写JNI模块 当安装好NDK编译环境后,会在它的目录下找到sample目录,它里面有一些例子,可以参考这些例子来写我们自已的模块. 1.在/home/android/文件夹下,新建“ledjni ...

  7. java rest框架jersey数组单记录问题解决

    JAVA数据接口采用jersey技术,可以返回xml,json等格式,可以根据客户端请求accept,如:Application/json,Application/xml 来得到不同的接口数据,非常好 ...

  8. 软件工程随堂小作业——寻找“水桶”(C++)

    一.设计思想 思路与寻找一个水王相似,这次只是计数器和嫌疑人变量都设置为数组.每次选取一个ID与三个嫌疑人比较,若有相同则计数:若三个都不相同,则三个计数器都减一.若减为0,则从新赋值给嫌疑人. 二. ...

  9. 【Longest Valid Parentheses】cpp

    题目: Given a string containing just the characters '(' and ')', find the length of the longest valid ...

  10. source insight 完全卸载和重装

    Source insight的卸载不干净,会影响之后的安装 切入正题,完美卸载source insight的方法: 一.在pc的控制面板—>程序—>卸载程序 找到source insigh ...