Android 源码 判断网络数据类型
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 源码 判断网络数据类型的更多相关文章
- Android源码服务专家(申明:来源于网络)
Android源码服务专家(申明:来源于网络) 地址:http://www.javaapk.com/topics/demo/page/20/
- 从Android源码的角度分析Binder机制
欢迎访问我的个人博客,原文链接:http://wensibo.top/2017/07/03/Binder/ ,未经允许不得转载! 前言 大家好,好久不见,距离上篇文章已经有35天之久了,因为身体不舒服 ...
- android源码的目录结构
android源码的目录结构 [以下网络摘抄] |-- Makefile ! l/ a5 n% S% @- `0 d# z# a$ P4 V3 o7 R|-- bionic ...
- Android源码-学习随笔
在线代码网站1:http://grepcode.com/project/repository.grepcode.com/java/ext/com.google.android/android/ 书籍: ...
- android源码编译1
一.环境说明: 1.liunx系统:Ubuntu12.04 2.jdk:sun-java6-jdk 3.g++4.5 gcc4.5 二.android源码的目录结构 |-- Makefile |-- ...
- 2014年最新720多套Android源码2.0GB免费一次性打包下载
之前发过一个帖子,但是那个帖子有点问题我就重新发一个吧,下面的源码是我从今年3月份开始不断整理源码区和其他网站上的android源码,目前总共有720套左右,根据实现的功能被我分成了100多个类,总共 ...
- Android SDK目录具体结构及Android源码的具体结构
Android SDK目录具体结构 1. add-ons:这里面保存着附加库,比如Google Maps,当然你如果安装了OphoneSDK,这里也会有一些类库在里面. 2. docs:这里面是And ...
- MTK Android 源码目录分析
Android 源码目录分析 Android 4.0 |-- abi (application binary interface:应用二进制接口)|-- art (average retrieval ...
- Eclipse与Android源码中ProGuard工具的使用
由于工作需要,这两天和同事在研究android下面的ProGuard工具的使用,通过查看android官网对该工具的介绍以及网络上其它相关资料,再加上自己的亲手实践,算是有了一个基本了解.下面将自己的 ...
随机推荐
- SaaS应用“正益工作”发布,为大中型企业轻松构建移动门户
6月24日,以“平台之上,应用无限”为主题的2016 AppCan移动开发者大会,在北京国际会议中心隆重举行,逾1500名移动开发者一起见证了此次大会盛况. 会上,在专家领导.技术大咖.移动开发者的共 ...
- ios中怎么样调节占位文字与字体大小在同一高度
在设置好字体以后,在占位文字中设置leading这个字体属性,用leading来乘以一个比例(CGFloat)来调节位置.
- c++基础(二):成员he派生类
struct Date{ int day, month, year; }; struct Book{ string name; Date date; void init(string n, int y ...
- WCF note1
Summary of WCF Client to use service use ChannelFactory to create proxy to use service. Client code ...
- 可综合风格的VerilogHDL模块实例
1.赋值语句:assign{cout,sum}=a+b+cin; 2.利用电平敏感的always块设计组合逻辑电路 3.always块中如果含有局部变量,就必须在begin后加模块名,是必须加,同样的 ...
- C++异常机制知识点
在这里总结一下,C++中的异常机制,以及如何使用异常的知识点 C++中处理异常的过程是这样的:在执行程序发生异常,可以不在本函数中处理,而是抛出一个错误信息,把它传递给上一级的函数来解决,上一级解决 ...
- Windows8 各种版本区别对比详解
微软的 Windows8 操作系统提供了4个不同的版本,分别是 Windows RT.Windows 8 标准版.Windows 8 Pro 专业版 以及 Windows 8 Enterprise 企 ...
- Hibernate使用原生sql语句
异常类型1:could not extract resulted --->表名字和类名不一致 异常类型2:could not execute query---->可能是sql语句错: 异常 ...
- 使用usb+preseed在virtualbox上安装ubuntu(一)
1.制作usb boot盘,在ubuntu上使用startup disk creater将ubuntu-server12.04.iso写入到usb中: 2.修改syslinux文件夹中的syslinu ...
- Windows准备Node.js运行与开发环境
如何在Windows环境下搭建Node.js开发环境:1.下载Node.js windows安装版http://www.nodejs.org/download/ 2.正常安装完成后,在系统环境变量已经 ...