WifiConfigStore初始化读取-Android13

WifiConfigStore初始化读取

  • 1、StoreData创建并注册
  • 2、WifiConfigStore读取
    • 2.1 文件读取流程
    • 2.2 时序图
    • 2.3 日志


1、StoreData创建并注册

packages/modules/Wifi/service/java/com/android/server/wifi/WifiConfigManager.java

mWifiConfigStore.registerStoreData(mNetworkListSharedStoreData)
mWifiConfigStore.registerStoreData(mNetworkListUserStoreData)
mWifiConfigStore.registerStoreData(mRandomizedMacStoreData)
mWifiConfigStore.registerStoreData(mConnectedFreqStoreData)

packages/modules/Wifi/service/java/com/android/server/wifi/WifiNetworkSuggestionsManager.java

wifiConfigStore.registerStoreData( wifiInjector.makeNetworkSuggestionStoreData(new NetworkSuggestionDataSource()))

2、WifiConfigStore读取

2.1 文件读取流程

1》当 SystemService.PHASE_SYSTEM_SERVICES_READY 系统服务准备,mImpl.checkAndStartWifi()通过WifiConfigManager.java#loadFromStore读取mWifiConfigStore.read()

/data/misc/apexdata/com.android.wifi/WifiConfigStore.xml
/data/misc/apexdata/com.android.wifi/WifiConfigStoreSoftAp.xml

2》当onUserUnlocking用户锁定,mImpl.handleUserUnlock通过WifiConfigManager.java#handleUserUnlockOrSwitch读取mWifiConfigStore.switchUserStoresAndRead(userStoreFiles)

/data/misc_ce/0/apexdata/com.android.wifi/WifiConfigStore.xml
/data/misc_ce/0/apexdata/com.android.wifi/WifiConfigStoreNetworkSuggestions.xml

packages/modules/Wifi/service/java/com/android/server/wifi/WifiService.java
packages/modules/Wifi/service/java/com/android/server/wifi/WifiServiceImpl.java

   @Overridepublic void onBootPhase(int phase) {if (phase == SystemService.PHASE_SYSTEM_SERVICES_READY) {mImpl.checkAndStartWifi();} else if (phase == SystemService.PHASE_BOOT_COMPLETED) {mImpl.handleBootCompleted();}}@Overridepublic void onUserSwitching(TargetUser from, TargetUser to) {mImpl.handleUserSwitch(to.getUserHandle().getIdentifier());}@Overridepublic void onUserUnlocking(TargetUser user) {mImpl.handleUserUnlock(user.getUserHandle().getIdentifier());}

packages/modules/Wifi/service/java/com/android/server/wifi/WifiConfigManager.java

    public boolean loadFromStore() {// If the user unlock comes in before we load from store, which means the user store have// not been setup yet for the current user. Setup the user store before the read so that// configurations for the current user will also being loaded.if (mDeferredUserUnlockRead) {Log.i(TAG, "Handling user unlock before loading from store.");List<WifiConfigStore.StoreFile> userStoreFiles =WifiConfigStore.createUserFiles(mCurrentUserId, mFrameworkFacade.isNiapModeOn(mContext));if (userStoreFiles == null) {Log.wtf(TAG, "Failed to create user store files");return false;}mWifiConfigStore.setUserStores(userStoreFiles);mDeferredUserUnlockRead = false;}try {mWifiConfigStore.read();} catch (IOException | IllegalStateException e) {Log.wtf(TAG, "Reading from new store failed. All saved networks are lost!", e);return handleConfigStoreFailure(false);} catch (XmlPullParserException e) {Log.wtf(TAG, "XML deserialization of store failed. All saved networks are lost!", e);return handleConfigStoreFailure(false);}loadInternalData(mNetworkListSharedStoreData.getConfigurations(),mNetworkListUserStoreData.getConfigurations(),mRandomizedMacStoreData.getMacMapping(),mConnectedFreqStoreData.getFreqList());return true;}private void handleUserUnlockOrSwitch(int userId) {if (mVerboseLoggingEnabled) {Log.v(TAG, "Loading from store after user switch/unlock for " + userId);}// Switch out the user store file.if (loadFromUserStoreAfterUnlockOrSwitch(userId)) {saveToStore(true);mPendingUnlockStoreRead = false;}}private boolean loadFromUserStoreAfterUnlockOrSwitch(int userId) {try {List<WifiConfigStore.StoreFile> userStoreFiles =WifiConfigStore.createUserFiles(userId, mFrameworkFacade.isNiapModeOn(mContext));if (userStoreFiles == null) {Log.e(TAG, "Failed to create user store files");return false;}mWifiConfigStore.switchUserStoresAndRead(userStoreFiles);} catch (IOException | IllegalStateException e) {Log.wtf(TAG, "Reading from new store failed. All saved private networks are lost!", e);return handleConfigStoreFailure(true);} catch (XmlPullParserException e) {Log.wtf(TAG, "XML deserialization of store failed. All saved private networks are "+ "lost!", e);return handleConfigStoreFailure(true);}loadInternalDataFromUserStore(mNetworkListUserStoreData.getConfigurations());return true;}

2.2 时序图

在这里插入图片描述

2.3 日志

02-06 17:21:42.574  7067  7238 E WifiConfigManager: xhbruce loadFromStore
02-06 17:21:42.581  7067  7238 E WifiConfigStore: xhbruce readFromSharedStoreFiles : sharedStoreFile=/data/misc/apexdata/com.android.wifi/WifiConfigStore.xml
02-06 17:21:42.593  7067  7238 E WifiConfigStore: xhbruce deserializeData : storeData=com.android.server.wifi.WifiCarrierInfoStoreManagerData@3b32c54:storeFile:com.android.server.wifi.WifiConfigStore$StoreFile@7c3a7fd
02-06 17:21:42.613  7067  7238 E WifiConfigStore: xhbruce deserializeData : storeData=com.android.server.wifi.NetworkListSharedStoreData@28b6069:storeFile:com.android.server.wifi.WifiConfigStore$StoreFile@7c3a7fd
02-06 17:21:42.615  7067  7238 E WifiConfigStore: xhbruce deserializeData : storeData=com.android.server.wifi.RandomizedMacStoreData@6ee3aee:storeFile:com.android.server.wifi.WifiConfigStore$StoreFile@7c3a7fd
02-06 17:21:42.615  7067  7238 E WifiConfigStore: xhbruce deserializeData : storeData=com.android.server.wifi.ConnectedFreqManager$ConnectedFreqStoreData@b77cb8f:storeFile:com.android.server.wifi.WifiConfigStore$StoreFile@7c3a7fd
02-06 17:21:42.616  7067  7238 E WifiConfigStore: xhbruce deserializeData : storeData=com.android.server.wifi.WifiSettingsConfigStore$StoreData@4655008:storeFile:com.android.server.wifi.WifiConfigStore$StoreFile@7c3a7fd
02-06 17:21:42.616  7067  7238 E WifiConfigStore: xhbruce deserializeData : storeData=com.android.server.wifi.hotspot2.PasspointConfigSharedStoreData@89eb9c6:storeFile:com.android.server.wifi.WifiConfigStore$StoreFile@7c3a7fd
02-06 17:21:42.616  7067  7238 E WifiConfigStore: xhbruce deserializeData : storeDatasInvoked=[com.android.server.wifi.RandomizedMacStoreData@6ee3aee, com.android.server.wifi.NetworkListSharedStoreData@28b6069, com.android.server.wifi.WifiCarrierInfoStoreManagerData@3b32c54, com.android.server.wifi.ConnectedFreqManager$ConnectedFreqStoreData@b77cb8f, com.android.server.wifi.hotspot2.PasspointConfigSharedStoreData@89eb9c6, com.android.server.wifi.WifiSettingsConfigStore$StoreData@4655008]
02-06 17:21:42.617  7067  7238 E WifiConfigStore: xhbruce readFromSharedStoreFiles : sharedStoreFile=/data/misc/apexdata/com.android.wifi/WifiConfigStoreSoftAp.xml
02-06 17:21:42.626  7067  7238 E WifiConfigStore: xhbruce deserializeData : storeData=com.android.server.wifi.SoftApStoreData@91a0f05:storeFile:com.android.server.wifi.WifiConfigStore$StoreFile@38a1b5a
02-06 17:21:42.626  7067  7238 E WifiConfigStore: xhbruce deserializeData : storeDatasInvoked=[com.android.server.wifi.SoftApStoreData@91a0f05]
02-06 17:21:42.627  7067  7238 D WifiConfigStore: Reading from all stores completed in 50 ms.
02-06 17:21:42.627  7067  7238 E WifiConfigManager: xhbruce loadFromStore : mNetworkListSharedStoreData=[- DSBLE ID: -1 SSID: "guest_5G" PROVIDER-NAME: null BSSID: null FQDN: null HOME-PROVIDER-NETWORK: false PRIO: 0 HIDDEN: false PMF: false CarrierId: -1 SubscriptionId: -1 SubscriptionGroup: null
02-06 17:21:42.635  7067  7238 E WifiConfigStore: xhbruce write :sharedStoreFile:/data/misc/apexdata/com.android.wifi/WifiConfigStore.xml
02-06 17:21:45.963  7067  7238 E WifiConfigStore:  xhbruce write :sharedStoreFile:/data/misc/apexdata/com.android.wifi/WifiConfigStore.xml
02-06 17:21:45.986  7067  7238 D WifiConfigStore: Writing to stores completed in 18 ms.
02-06 17:21:48.971  7067  7238 E WifiConfigStore:  xhbruce write :sharedStoreFile:/data/misc/apexdata/com.android.wifi/WifiConfigStore.xml
02-06 17:21:48.989  7067  7238 D WifiConfigStore: Writing to stores completed in 17 ms.
02-06 17:21:48.996  7067  7238 E WifiConfigStore:  xhbruce write :sharedStoreFile:/data/misc/apexdata/com.android.wifi/WifiConfigStore.xml
02-06 17:21:49.000  7067  7238 D WifiConfigStore: Writing to stores completed in 4 ms.
02-06 17:21:51.863  7067  7238 V WifiConfigManager: Handling user unlock for 0
02-06 17:21:51.868  7067  7238 V WifiConfigManager: Loading from store after user switch/unlock for 0
02-06 17:21:51.905  7067  7238 E WifiConfigStore: xhbruce readFromUserStoreFiles : userStoreFile=/data/misc_ce/0/apexdata/com.android.wifi/WifiConfigStore.xml
02-06 17:21:51.915  7067  7238 E WifiConfigStore: xhbruce deserializeData : storeData=com.android.server.wifi.ImsiPrivacyProtectionExemptionStoreData@eeb7cd8:storeFile:com.android.server.wifi.WifiConfigStore$StoreFile@15e2831
02-06 17:21:51.936  7067  7238 E WifiConfigStore: xhbruce deserializeData : storeData=com.android.server.wifi.NetworkListUserStoreData@2bc166d:storeFile:com.android.server.wifi.WifiConfigStore$StoreFile@15e2831
02-06 17:21:51.959  7067  7238 E WifiConfigStore: xhbruce deserializeData : storeData=com.android.server.wifi.hotspot2.PasspointConfigUserStoreData@378db33:storeFile:com.android.server.wifi.WifiConfigStore$StoreFile@15e2831
02-06 17:21:51.970  7067  7238 E WifiConfigStore: xhbruce deserializeData : storeData=com.android.server.wifi.SsidSetStoreData@b302a1c:storeFile:com.android.server.wifi.WifiConfigStore$StoreFile@15e2831
02-06 17:21:51.970  7067  7238 E WifiConfigStore: xhbruce deserializeData : storeData=com.android.server.wifi.NetworkRequestStoreData@dfea625:storeFile:com.android.server.wifi.WifiConfigStore$StoreFile@15e2831
02-06 17:21:51.971  7067  7238 E WifiConfigStore: xhbruce deserializeData : storeData=com.android.server.wifi.WakeupConfigStoreData@1aa33fa:storeFile:com.android.server.wifi.WifiConfigStore$StoreFile@15e2831
02-06 17:21:51.971  7067  7238 E WifiConfigStore: xhbruce deserializeData : storeDatasInvoked=[com.android.server.wifi.WakeupConfigStoreData@1aa33fa, com.android.server.wifi.NetworkListUserStoreData@2bc166d, com.android.server.wifi.ImsiPrivacyProtectionExemptionStoreData@eeb7cd8, com.android.server.wifi.hotspot2.PasspointConfigUserStoreData@378db33, com.android.server.wifi.NetworkRequestStoreData@dfea625, com.android.server.wifi.SsidSetStoreData@b302a1c]
02-06 17:21:51.971  7067  7238 E WifiConfigStore: xhbruce readFromUserStoreFiles : userStoreFile=/data/misc_ce/0/apexdata/com.android.wifi/WifiConfigStoreNetworkSuggestions.xml
02-06 17:21:51.976  7067  7238 E WifiConfigStore: xhbruce deserializeData : storeData=com.android.server.wifi.NetworkSuggestionStoreData@69c74dd:storeFile:com.android.server.wifi.WifiConfigStore$StoreFile@c274852
02-06 17:21:51.982  7067  7238 E WifiConfigStore: xhbruce deserializeData : storeDatasInvoked=[com.android.server.wifi.NetworkSuggestionStoreData@69c74dd]
02-06 17:21:51.982  7067  7238 D WifiConfigStore: Reading from user stores completed in 98 ms.
02-06 17:21:51.999  7067  7238 E WifiConfigStore:  xhbruce write :sharedStoreFile:/data/misc/apexdata/com.android.wifi/WifiConfigStore.xml
02-06 17:21:52.020  7067  7238 E WifiConfigStore:  xhbruce write :userStoreFile:/data/misc_ce/0/apexdata/com.android.wifi/WifiConfigStore.xml
02-06 17:21:52.084  7067  7238 E WifiConfigStore:  xhbruce write :userStoreFile:/data/misc_ce/0/apexdata/com.android.wifi/WifiConfigStoreNetworkSuggestions.xml
02-06 17:21:52.178  7067  7238 D WifiConfigStore: Writing to stores completed in 21 ms.
02-06 17:21:52.332  7067  7238 E WifiConfigStore:  xhbruce write :sharedStoreFile:/data/misc/apexdata/com.android.wifi/WifiConfigStore.xml
02-06 17:21:52.357  7067  7238 E WifiConfigStore:  xhbruce write :userStoreFile:/data/misc_ce/0/apexdata/com.android.wifi/WifiConfigStore.xml
02-06 17:21:52.362  7067  7238 E WifiConfigStore:  xhbruce write :userStoreFile:/data/misc_ce/0/apexdata/com.android.wifi/WifiConfigStoreNetworkSuggestions.xml
02-06 17:21:52.379  7067  7238 D WifiConfigStore: Writing to stores completed in 17 ms.
02-06 17:21:52.386  7067  7238 E WifiConfigStore:  xhbruce write :sharedStoreFile:/data/misc/apexdata/com.android.wifi/WifiConfigStore.xml
02-06 17:21:52.401  7067  7238 E WifiConfigStore:  xhbruce write :userStoreFile:/data/misc_ce/0/apexdata/com.android.wifi/WifiConfigStore.xml
02-06 17:21:52.419  7067  7238 D WifiConfigStore: Writing to stores completed in 18 ms.
02-06 17:21:54.247  7067  7238 E WifiConfigStore:  xhbruce write :sharedStoreFile:/data/misc/apexdata/com.android.wifi/WifiConfigStore.xml
02-06 17:21:54.247  7067  7238 E WifiConfigStore:  xhbruce write :userStoreFile:/data/misc_ce/0/apexdata/com.android.wifi/WifiConfigStore.xml

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

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

相关文章

利用LLM大模型生成sql的深入应用探究

Chat2DB 是一款有开源免费的多数据库客户端工具,和传统的数据库客户端软件Navicat、DBeaver 相比 Chat2DB 集成了 AIGC 的能力&#xff0c;能够将自然语言转换为 SQL&#xff0c;也可以将 SQL 转换为自然语言&#xff0c;可以给出研发人员 SQL 的优化建议&#xff0c;极大地提升…

流量嗅探详解

不少人存在这样的观点&#xff1a;只要计算机安装各种专业的安全软件&#xff0c;系统及时更 新补丁&#xff0c;密码尽可能复杂&#xff0c;那么计算机就会避免遭到入侵。当然这样的确不容易 被入侵&#xff0c;但那也只是针对传统的病毒、木马而言&#xff0c;在流量攻击面前…

Qt 常见容器类用法(一)

目录 QMap类 QHash类 QVector类 QMap类 QMap<key,T>提供一个从类型为Key的键到类型为T的值的映射。通常&#xff0c;QMap存储的数据形式是一个键对应一个值&#xff0c;并且按照键Key的次序存储数据。为了能够支持一键多值的情况&#xff0c;QMap提供QMap<key,T&g…

C语言——字符、数组和函数指针变量

目录 1. 字符指针变量2. 数组指针变量2.1 数组指针变量是什么&#xff1f;2.2 数组指针变量怎么初始化 3. 二维数组传参的本质4. 函数指针变量4.1 函数指针变量的创建4.2 函数指针变量的使用4.3 typedef关键字 5. 函数指针数组6. 转移表 1. 字符指针变量 在指针的类型中我们知道…

解析基于检索排序的知识图谱问答系统

目录 前言1 问句的表示与语义理解1.1 问句表示的重要性1.2 端到端网络的优势 2 知识图谱中的排序问题2.1 知识图谱的核心作用2.2 查询匹配的转化与排序问题2.3 实体链接的关键性2.4 路径的构建与系统优化 3 难点与挑战3.1 实体链接、命名实体识别和消歧3.2 排序模型的挑战 4 优…

泛娱乐社交出海洞察,Flat Ads解锁海外增长新思路

摘要:解读泛娱乐社交应用出海现状与趋势,解锁“掘金”泛娱乐社交出海赛道新思路。 根据全球舆情监测机构 Meltwater 和社交媒体机构We are Social最新发布数据显示,全球社交媒体活跃用户数量已突破50亿,约占世界人口总数62.5%。庞大的用户数量意味着广阔的增量空间,目前,随着全…

板块零 IDEA编译器基础:第三节 下载和在IDEA中集成 Tomcat服务器 来自【汤米尼克的JAVAEE全套教程专栏】

板块零 IDEA编译器基础&#xff1a;第三节 下载和在IDEA中集成 Tomcat服务器 一、为什么选择Tomcat&#xff08;1&#xff09;常见的JAVA WEB服务器&#xff08;2&#xff09;选择Tomcat的理由 二、Tomcat 8.5下载解压三、Tomcat 结构目录四、在IDEA中集成Tomcat 假设我们已经…

23.HarmonyOS App(JAVA)堆叠布局StackLayout使用方法

不常用 StackLayout直接在屏幕上开辟出一块空白的区域&#xff0c;添加到这个布局中的视图都是以层叠的方式显示&#xff0c;而它会把这些视图默认放到这块区域的左上角&#xff0c;第一个添加到布局中的视图显示在最底层&#xff0c;最后一个被放在最顶层。上一层的视图会覆盖…

过年回家必备,向日葵远程控制帮您假期轻松“应急”

春节假期临近&#xff0c;无论是回家过年还是假期出游&#xff0c;我们都可能遇到突然的“业务”需要临时处理&#xff0c;可是电脑没在身边又怎么办呢&#xff1f;别慌&#xff0c;我们可以用向日葵远程控制。 通过使用向日葵远程控制&#xff0c;手机就能远程控制办公电脑&a…

微信小程序(三十六)事件传参

注释很详细&#xff0c;直接上代码 上一篇 新增内容&#xff1a; 1.传参步骤 2.传参接收解构步骤 源码&#xff1a; index.wxml <button type"primary" bind:tap"onclick" mark:index"{{0}}" mark:remb"{{1}}" class"But&quo…

DataX详解和架构介绍

系列文章目录 一、 DataX详解和架构介绍 二、 DataX源码分析 JobContainer 三、DataX源码分析 TaskGroupContainer 四、DataX源码分析 TaskExecutor 五、DataX源码分析 reader 六、DataX源码分析 writer 七、DataX源码分析 Channel 文章目录 系列文章目录DataX是什么&#xff…

在WORD中设置公式居中编号右对齐设置方式

1 软件环境 Office Microsoft Office LTSC 专业增强版2021 2 最终效果 3 操作步骤 编辑公式&#xff1b;光标定位到公式的最后&#xff08;不是行的最后&#xff09;&#xff1b;输入#编号光标定位在公式最后&#xff08;不是行的最后&#xff09;&#xff0c;按Enter键回车…