Android U 匹配不到APN,无法发起数据建立的问题分析

问题

打开数据开关后,没有data PDN请求发起,因此无法上网。

根据日志确定是没有找到合适的data profile,原因一般有:

1、APN 没有配置

2、APN 类型/网络能力不满足——APN type或bearer

3、APN 配置了但被disable了——APN proofile的carrierEnable值

日志分析

fail log:

APN 被disable了,所以无法匹配。

//preferred=true说明当前选中的是此条APN

11-20 15:01:51.409140  2316  3480 D DPM-0   : getApnSettingForNetworkRequest: networkType=13 isMtkImsDataSupport=true hasEimsCapability=false mPreferredDataProfile=[DataProfile=[ApnSetting]....] dataProfilesCount=0 dataProfiles=[] mAllDataProfiles=[[DataProfile=[ApnSetting] INTERNET, 3080, xxxxxx, internet, , null, , null, null, 0, supl | hipri | default, IPV4V6, IP, false, 0, true, 0, 0, 0, 0, 0, gid, xxxxx000000000000, false, UNKNOWN, UNKNOWN, 0, -1, -1, false, 961, TrafficDescriptor={mDnn=internet, null}, preferred=true]...]
11-20 15:01:51.410224  2316  3480 D DPM-0   : Can't find any data profile that can satisfy [NetworkRequest [ NONE id=0, [ Capabilities: DUN&TRUSTED&NOT_VPN&NOT_VCN_MANAGED Uid: 1001 UnderlyingNetworks: Null] ], mPriority=30, state=UNSATISFIED, mAttachedDataNetwork=null, isMetered=true, created time=15:01:51.407, evaluation result=null]
11-20 15:01:51.411224  1366  1366 D ImsManager: [1] Registration callback removed.
11-20 15:01:51.413463  2316  3480 D DPM-0   : Unable to find a data profile for [NetworkRequest [ NONE id=0, [ Capabilities: DUN&TRUSTED&NOT_VPN&NOT_VCN_MANAGED Uid: 1001 UnderlyingNetworks: Null] ], mPriority=30, state=UNSATISFIED, mAttachedDataNetwork=null, isMetered=true, created time=15:01:51.408, evaluation result=null]

正常日志:

dataProfilesCount 指明网络能力匹配的APN数

11-20 15:19:20.723854  2316  2316 D DPM-0   : getApnSettingForNetworkRequest: networkType=13 isMtkImsDataSupport=true hasEimsCapability=false mPreferredDataProfile=[DataProfile=[ApnSetting] ....] dataProfilesCount=1 dataProfiles=[[DataProfile=[ApnSetting] 

11-20 15:19:20.725075  2316  2316 V DPM-0   : Satisfied profile: [DataProfile=[ApnSetting]

11-20 15:19:20.725871  2316  2316 D DPM-0   : The final available profile: [DataProfile=[ApnSetting] 

11-20 15:19:20.729504  2316  2316 D DNC-0   : Data evaluation: evaluation reason:NEW_REQUEST, Data allowed reason: NORMAL, candidate profile=[DataProfile=[ApnSetting] 

11-20 15:19:20.730116  2316  2316 D DNC-0   : onSetupDataNetwork: dataProfile=[DataProfile=[ApnSetting] 

11-20 15:19:20.731688  2316  2316 D DNC-0   : Creating data network on WWAN with [DataProfile=[ApnSetting] 

11-20 15:19:20.768286  2316  2316 D DSM-C-0 : setupDataCall

11-20 15:19:20.769505  2316  2316 D DN-114-C: ConnectingState: setupData: accessNetwork=EUTRAN, [DataProfile=[ApnSetting] ...], isModemRoaming=false, allowRoaming=true, PDU session id=0, matchAllRuleAllowed=true
11-20 15:19:20.776007  2316  2682 D RILJ    :

 [0868]> SETUP_DATA_CALL,reason=NORMAL,accessNetworkType=EUTRAN,dataProfile=[DataProfile=[ApnSetting] ..],isRoaming=false,allowRoaming=true,linkProperties=null,pduSessionId=0,sliceInfo=null,trafficDescriptor=TrafficDescriptor={mDnn=VZWADMIN, null},matchAllRuleAllowed=true [PHONE0]

11-20 15:19:21.063568  2316  2674 D RILJ    : [0868]< SETUP_DATA_CALL DataCallResponse: { cause=NONE(0x0) retry=-1 cid=1803 linkStatus=2 protocolType=2 ifname=ccmni3 addresses=[10.128.159.113/32, 2600:100f:f00c:330f:0:56:6fe2:e801/64] dnses=[/2001:4888:53:ff00:524:d::, /2001:4888:52:ff00:528:d::, /198.224.166.135, /198.224.167.135] gateways=[/10.128.159.113, /::] pcscf=[] mtu=1428 mtuV4=1428 mtuV6=1428 handoverFailureMode=unknown pduSessionId=0 defaultQos=EpsQos { qosClassId=8 downlink=Bandwidth { maxBitrateKbps=0 guaranteedBitrateKbps=0} uplink=Bandwidth { maxBitrateKbps=0 guaranteedBitrateKbps=0}} qosBearerSessions=[] sliceInfo=null trafficDescriptors=[]} [PHONE0]

 代码分析

DataProfileManager.java - 【frameworks/opt/telephony】

/*** Get the APN setting for the network request.** @param networkRequest The network request.* @param networkType The current data network type.* @param ignorePermanentFailure {@code true} to ignore {@link ApnSetting#getPermanentFailed()}.* This should be set to true for condition-based retry/setup.* @return The APN setting. {@code null} if can't find any satisfiable data profile.*/
private @Nullable ApnSetting getApnSettingForNetworkRequest(@NonNull TelephonyNetworkRequest networkRequest, @NetworkType int networkType,boolean ignorePermanentFailure) {if (!networkRequest.hasAttribute(TelephonyNetworkRequest.CAPABILITY_ATTRIBUTE_APN_SETTING)) {loge("Network request does not have APN setting attribute.");return null;}//1、优先选择preferred APN,如果满足并且不处于PermanentFailure状态则直接请求// If the preferred data profile can be used, always use it if it can satisfy the network// request with current network type (even though it's been marked as permanent failed.)if (mPreferredDataProfile != null&& networkRequest.canBeSatisfiedBy(mPreferredDataProfile)&& mPreferredDataProfile.getApnSetting() != null&& mPreferredDataProfile.getApnSetting().canSupportNetworkType(networkType)) {if (ignorePermanentFailure || !mPreferredDataProfile.getApnSetting().getPermanentFailed()) {return mPreferredDataProfile.getApnSetting();}log("The preferred data profile is permanently failed. Only condition based retry "+ "can happen.");return null;}//2、如果没有首选数据配置文件,则过滤掉不能满足网络请求的数据配置文件//Note:找不到profile 一般就是这里匹配不到了// Filter out the data profile that can't satisfy the request.// Preferred data profile should be returned in the top of the list.List<DataProfile> dataProfiles = mAllDataProfiles.stream().filter(networkRequest::canBeSatisfiedBy)// The longest time hasn't used data profile will be in the front so all the data// profiles can be tried..sorted(Comparator.comparing(DataProfile::getLastSetupTimestamp))    //并按照它们的最后设置时间进行排序,将最长时间未使用的数据配置文件放在列表的前面.collect(Collectors.toList());for (DataProfile dataProfile : dataProfiles) {    //然后尝试筛选并使用它们来满足网络请求。logv("Satisfied profile: " + dataProfile + ", last setup="+ DataUtils.elapsedTimeToString(dataProfile.getLastSetupTimestamp()));}if (dataProfiles.size() == 0) {log("Can't find any data profile that can satisfy " + networkRequest);return null;}// Check if the remaining data profiles can used in current data network type.dataProfiles = dataProfiles.stream().filter(dp -> dp.getApnSetting() != null&& dp.getApnSetting().canSupportNetworkType(networkType)).collect(Collectors.toList());if (dataProfiles.size() == 0) {log("Can't find any data profile for network type "+ TelephonyManager.getNetworkTypeName(networkType));return null;}// Check if preferred data profile set id matches.dataProfiles = dataProfiles.stream().filter(dp -> dp.getApnSetting() != null&& (dp.getApnSetting().getApnSetId()== Telephony.Carriers.MATCH_ALL_APN_SET_ID|| dp.getApnSetting().getApnSetId() == mPreferredDataProfileSetId)).collect(Collectors.toList());if (dataProfiles.size() == 0) {log("Can't find any data profile has APN set id matched. mPreferredDataProfileSetId="+ mPreferredDataProfileSetId);return null;}// Check if data profiles are permanently failed.dataProfiles = dataProfiles.stream().filter(dp -> ignorePermanentFailure || !dp.getApnSetting().getPermanentFailed()).collect(Collectors.toList());if (dataProfiles.size() == 0) {log("The suitable data profiles are all in permanent failed state.");return null;}return dataProfiles.get(0).getApnSetting();
}
排查接口

canBeSatisfiedBy in TelephonyNetworkRequest.java -【frameworks/opt/telephony】

canHandleType in ApnSetting.java【frameworks/base/telephony】


匹配不到关键就是在网络能力评估的过程,canBeSatisfiedBy会根据APN类型筛选能力匹配的项,在canHandleType检查完APN可用性之后,返回enable且符合网络的APN。

/**
* Check if this network request can be satisfied by a data profile.
*
* @param dataProfile The data profile to check.
* @return {@code true} if this network request can be satisfied by the data profile.
*/
public boolean canBeSatisfiedBy(@NonNull DataProfile dataProfile) {// If the network request can be translated to OS/App id, then check if the data profile's// OS/App id can satisfy it.if (hasAttribute(CAPABILITY_ATTRIBUTE_TRAFFIC_DESCRIPTOR_OS_APP_ID)&& getOsAppId() != null) {// The network request has traffic descriptor type capabilities. Match the traffic// descriptor.if (dataProfile.getTrafficDescriptor() != null && Arrays.equals(getOsAppId().getBytes(),dataProfile.getTrafficDescriptor().getOsAppId())) {return true;}}// If the network request can be translated to APN setting or DNN in traffic descriptor,// then check if the data profile's APN setting can satisfy it.if ((hasAttribute(CAPABILITY_ATTRIBUTE_APN_SETTING)|| hasAttribute(CAPABILITY_ATTRIBUTE_TRAFFIC_DESCRIPTOR_DNN))&& dataProfile.getApnSetting() != null) {// Fallback to the legacy APN type matching.List<Integer> apnTypes = Arrays.stream(getCapabilities()).boxed().map(DataUtils::networkCapabilityToApnType).filter(apnType -> apnType != ApnSetting.TYPE_NONE).collect(Collectors.toList());// In case of enterprise network request, the network request will have internet,// but APN type will not have default type as the enterprise apn should not be used// as default network. Ignore default type of the network request if it// has enterprise type as well. This will make sure the network request with// internet and enterprise will be satisfied with data profile with enterprise at the// same time default network request will not get satisfied with enterprise data// profile.// TODO b/232264746if (apnTypes.contains(ApnSetting.TYPE_ENTERPRISE)) {apnTypes.remove((Integer) ApnSetting.TYPE_DEFAULT);}return apnTypes.stream().allMatch(dataProfile.getApnSetting()::canHandleType);}return false;
}/** @hide */
public boolean canHandleType(@ApnType int type) {if (!mCarrierEnabled) {return false;}// DEFAULT can handle HIPRI.return hasApnType(type);
}

定位原因的方法

查看APNSettings配置是否正确,以上问题就是APN配置了但被disable了。

[DataProfile=[ApnSetting] INTERNET, 3080, xxxxxx, internet, , null, , null, null, 0, supl | hipri | default, IPV4V6, IP, false, 0, true, 0, 0, 0, 0, 0, gid, xxxxx000000000000, false, UNKNOWN, UNKNOWN, 0, -1, -1, false, 961, TrafficDescriptor={mDnn=internet, null}, preferred=true]

根据ApnSettings实体节后打印信息,mCarrierEnabled就是上述日志false的位置。

/*** Returns the string representation of ApnSetting.** This method prints null for unset elements. The output doesn't contain password or user.* @hide*/
public String toString() {StringBuilder sb = new StringBuilder();sb.append("[ApnSetting] ").append(mEntryName).append(", ").append(mId).append(", ").append(mOperatorNumeric).append(", ").append(mApnName).append(", ").append(mProxyAddress).append(", ").append(UriToString(mMmsc)).append(", ").append(mMmsProxyAddress).append(", ").append(portToString(mMmsProxyPort)).append(", ").append(portToString(mProxyPort)).append(", ").append(mAuthType).append(", ");final String[] types = getApnTypesStringFromBitmask(mApnTypeBitmask).split(",");sb.append(TextUtils.join(" | ", types));sb.append(", ").append(PROTOCOL_INT_MAP.get(mProtocol));sb.append(", ").append(PROTOCOL_INT_MAP.get(mRoamingProtocol));sb.append(", ").append(mCarrierEnabled);    //APN启用情况sb.append(", ").append(mProfileId);sb.append(", ").append(mPersistent);sb.append(", ").append(mMaxConns);sb.append(", ").append(mWaitTime);sb.append(", ").append(mMaxConnsTime);sb.append(", ").append(mMtuV4);sb.append(", ").append(mMtuV6);sb.append(", ").append(MVNO_TYPE_INT_MAP.get(mMvnoType));sb.append(", ").append(mMvnoMatchData);sb.append(", ").append(mPermanentFailed);sb.append(", ").append(TelephonyManager.convertNetworkTypeBitmaskToString(mNetworkTypeBitmask));sb.append(", ").append(TelephonyManager.convertNetworkTypeBitmaskToString(mLingeringNetworkTypeBitmask));sb.append(", ").append(mApnSetId);sb.append(", ").append(mCarrierId);sb.append(", ").append(mSkip464Xlat);sb.append(", ").append(mAlwaysOn);sb.append(", ").append(Objects.hash(mUser, mPassword));return sb.toString();
}

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/159504.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

每日一题 2304. 网格中的最小路径代价(中等,动态规划)

由于他每一行的每一个值都可以到下一行的所有节点&#xff0c;且路径的代价没有什么相关性&#xff0c;所以只能用 O(mn2) 的动态规划求解 class Solution:def minPathCost(self, grid: List[List[int]], moveCost: List[List[int]]) -> int:m, n len(grid), len(grid[0])…

redis作为缓存详解

目录 前言&#xff1a; 为什么说关系型数据库性能不高 如何提高MySQL并发量 缓存更新策略 定期更新 实时更新 内存淘汰策略 Redis内置的淘汰策略 缓存常见问题 缓存预热 缓存穿透 缓存雪崩 缓存击穿 前言&#xff1a; 对于缓存的理解&#xff0c;缓存目的就是为了…

Https攻击怎么防御

随着互联网技术的发展&#xff0c;网站所遭受的网络攻击频率也在不断上升。某种程度上&#xff0c;我们可以说互联网上的每个网站都容易遭受安全攻击。因为网络攻击者最主要的动机是求财。无论你运营的是电子商务项目还是简单的小型商业网站&#xff0c;潜在攻击的风险就在那里…

PC分页操作

page-size 每页显示条目个数 current-page 当前页数 total 数据总数 current-change【currentPage 改变时会触发】 <el-paginationbackgroundlayout"prev, pager, next"align"right"style"padding: 10px":page-size"pageParams.pagesize…

连接k8s和凌鲨

通过连接k8s和凌鲨&#xff0c;可以让研发过程中的重用操作更加方便。 更新容器镜像调整部署规模查看日志运行命令 架构 所有操作通过k8s proxy连接&#xff0c;通过设置namespace label赋予访问权限。只有赋予特定label的namespace才能被访问。 使用步骤 部署k8s proxy 你…

【Java】基于SaaS模式的Java基层医院卫生健康云HIS系统源码

一、模板管理 模板分为两种&#xff1a;病历模板和报表模板。模板管理是运营管理的核心组成部分&#xff0c;是基层卫生健康云中各医疗机构定制电子病历和报表的地方&#xff0c;各医疗机构可根据自身特点特色定制电子病历和报表&#xff0c;制作的电子病历及报表可直接在业务…

No mapping for GET /swagger-ui.html的解决方法

我的Swagger配置类 Configuration EnableSwagger2 public class SwaggerConfig {Autowiredprivate SwaggerInfo swaggerInfo;Beanpublic Docket createRestApi(){return new Docket(DocumentationType.SWAGGER_2).apiInfo(apiInfo()).select().apis(RequestHandlerSelectors.b…

【qsort学习及改造冒泡排序能排序任何数】

qsort学习及改造冒泡排序能排序任何数 qsort的使用 qsort的使用 这个函数也不是很复杂&#xff01;&#xff01;&#xff01; qsort(void*base,size_t num,size_t width,int(int (__cdecl *compare )(const void *elem1, const void *elem2 )))  void * base,为数组的基地…

【深度学习】python调用超分Real-ESRGAN

Real-ESRGAN是超分自然场景图和动漫图&#xff0c;视频也可以&#xff0c;项目地址&#xff1a;https://github.com/xinntao/Real-ESRGAN/tree/master 安装python包&#xff1a; basicsr>1.4.2 facexlib>0.2.5 gfpgan>1.3.5 numpy opencv-python Pillow torch>1.…

GD32替换STM32使用HAL库开发问题

GD32HAL库开发问题 1can初始化进入error handle2发送邮箱不能按照填写顺序发送3 GD32修改代码被stm32cudemx覆盖问题 1can初始化进入error handle HAL库的HAL_CAN_Init中&#xff0c;hcan->Instance->MSR寄存器无法清零&#xff0c;STM32先清零&#xff0c;再退出睡眠模…

编译 CUDA加速的 OpenCV-4.8.0 版本

文章目录 前言一、编译环境二、前期准备三、CMake编译四、VS编译OpenCV.sln五、问题 前言 由于项目需要用上CUDA加速的OpenCV&#xff0c;编译时也踩了不少坑&#xff0c;所以这里记录一下。 一、编译环境 我的编译环境是&#xff1a; Win10 RTX4050 CUDA-12.0 CUDNN 8.9.…

代码混淆不再愁:一篇掌握核心技巧

​ 1. 概述 代码混淆是将计算机程序的代码转换成一种功能上等价&#xff0c;但是难以阅读和理解的形式。 对于软件开发者来说&#xff0c;代码混淆可以在一定程度上保护程序免被逆向。 对于逆向工程师来说&#xff0c;学习代码混淆可以帮助我们研究反混淆技术。 2. 常见混淆…

半导体工艺控制设备1

半导体工艺控制设备对芯片良率至关重要&#xff0c;随着制程微缩需求倍增。工艺节点每缩减一代&#xff0c;工艺中产生的致命缺陷数量会增加 50%&#xff0c;因此每一道工序的良品率都要保持在非常高的水平才能保证最终的良品率。当工序超过 500 道时&#xff0c;只有保证每一道…

污水处理智能化:污水处理拓扑图的未来发展趋势

随着城市化进程的不断加速&#xff0c;城市污水处理已经成为了一个重要的问题。污水处理不仅关系到城市环境的质量&#xff0c;还直接影响着人们的生活质量和健康。污水处理拓扑图作为一种新型的污水处理技术&#xff0c;已经被广泛应用于各种污水处理设施中。本文将介绍污水处…

如何判断客户对你是不是真的满意

我们平时生活中打个滴滴、叫个外卖&#xff0c;都会让做星级评价&#xff0c;就算去银行办业务&#xff0c;也会让按个按钮&#xff0c;对窗口的服务做个评价…… 再问一个问题&#xff1a;客户满意了&#xff0c;您的生意就一定好吗&#xff1f; 一、满意度&#xff1a;质量监…

2023 IDEA大会开幕 共探AI新篇章下的技术创新与创业

11月22日&#xff0c;AI与数字经济领域一年一度的科创盛会&#xff0c;2023 IDEA大会在深圳举行。IDEA研究院创院理事长、美国国家工程院外籍院士沈向洋在会上发表主旨演讲&#xff0c;发布IDEA研究院的重磅研产结晶与市场化成果&#xff1b;在大咖云集的论坛环节&#xff0c;多…

AIOps探索 | 应急处置中排障的降本增效方法探索(上)

文章来源&#xff1a;公众号ID-布博士&#xff08;擎创科技资深产品专家&#xff09; 哈喽~友友们大家好&#xff0c;最近运维界也是蛮热闹的&#xff0c;前有语雀多次崩溃&#xff0c;后有阿里全系产品集体故障&#xff0c;不管是哪种&#xff0c;都足够逼疯一个运维工程师。…

【Python】scrapy 命令提示找不到文件

问题记录&#xff1a; 执行以下命令的时候返回了找不到文件 scrapy startproject myproject具体信息如下 bash: /usr/local/bin/scrapy: No such file or directory查看 /usr/local/bin/ 目录确实没有 scrapy。 注&#xff1a;/usr/local/bin/ 目录一般存放应用执行文件的软…

Web自动化测试流程:从入门到精通,帮你成为测试专家!

Web应用程序在今天的软件开发中占据着越来越重要的地位。保证Web应用程序的质量和稳定性是非常必要的&#xff0c;而自动化测试是一种有效的方法。本文将介绍Web自动化测试流程&#xff0c;并提供代码示例。 步骤一&#xff1a;选取测试工具 选择适合自己团队的自动化测试工具…