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. 同时执行2个存储过程,2个SP中分别有相同的临时表名,会有冲突吗?

    同时执行2个存储过程,2个SP中分别有相同的临时表名,会有冲突吗?答案:不会 这就可以在以后写存储过程的时候统一临时表名了. alter procedure sp_01 as begin create ...

  2. Cron表达式说明

    CronTrigger CronTriggers往往比SimpleTrigger更有用,如果您需要基于日历的概念,而非SimpleTrigger完全指定的时间间隔,复发的发射工作的时间表. CronT ...

  3. go语言示例-Timer计时器的用法

    计时器用来定时执行任务,分享一段代码: package main import "time" import "fmt" func main() { //新建计时 ...

  4. [转]JSON与XML的区别比较

    1.定义介绍 (1).XML定义扩展标记语言 (Extensible Markup Language, XML) ,用于标记电子文件使其具有结构性的标记语言,可以用来标记数据.定义数据类型,是一种允许 ...

  5. .Net开源数据库设计工具Mr.E For Linq (EF 6.1) 教程(二)级联删除和触发器

    1.建立级联删除 Mr.E的级联删除并非数据库自带那个级联删除,而是Mr.E自带的,所以它能触发你C#里面编写的触发器. 首先,建立级联删除关系,如下图有两个表,UserInfo和UserDocume ...

  6. TList,TObjectList 使用——资源释放

    TOjectList = Class (Tlist); TOjectList继承Tlist,从名字上看就可以知道它是专门为对象列表制作的,那么他到底丰富了那些功能呢? 首先是 TObject 作为对象 ...

  7. LeetCode-Implement strStr()-KMP

    Implement strStr(). Returns the index of the first occurrence of needle in haystack, or -1 if needle ...

  8. java线程图

  9. Nagios全方位告警接入-电话/微信/短信都支持

    百度告警平台地址: http://gaojing.baidu.com 联系我们: 邮箱:gaojing@baidu.com 电话:13924600771 QQ群:183806029 Nagios接入 ...

  10. Surface Pro 3 扩展坞体验

    Surface Pro 3 的确是Microsoft的诚意之作,虽然价格不便宜,但值得入手. 买完Surface Pro 3 后,没事在某网站上闲逛,这货(扩展坞)映入我的眼帘,看完后,心想,这货必须 ...