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

   @Override
   public void onBootPhase(int phase) {
       if (phase == SystemService.PHASE_SYSTEM_SERVICES_READY) {
           mImpl.checkAndStartWifi();
       } else if (phase == SystemService.PHASE_BOOT_COMPLETED) {
           mImpl.handleBootCompleted();
       }
   }
 
   @Override
   public void onUserSwitching(TargetUser from, TargetUser to) {
       mImpl.handleUserSwitch(to.getUserHandle().getIdentifier());
   }
 
   @Override
   public 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

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

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

Windows 安装 MySQL 最新最简教程

Windows 安装 MySQL 最新最简教程 官网地址 https://dev.mysql.com/downloads/mysql/下载 MySQL zip 文件 配置 MySQL1、解压文件 2、进入 bin 目录 搜索栏输入 cmd 回车进入命令行 C:\Users\zhong\Desktop\MySQL\mysql-8.3.0-winx64\mysql-8.3.0-winx64\bin 注意这里是你自己…

【数据分享】1929-2023年全球站点的逐日平均风速数据(Shp\Excel\免费获取)

气象数据是在各项研究中都经常使用的数据&#xff0c;气象指标包括气温、风速、降水、能见度等指标&#xff0c;说到气象数据&#xff0c;最详细的气象数据是具体到气象监测站点的数据&#xff01; 有关气象指标的监测站点数据&#xff0c;之前我们分享过1929-2023年全球气象站…

深入探索 Express.js 的高级特性

引言 Express.js 是一个基于 Node.js 平台的 Web 开发框架&#xff0c;旨在提供一种简单、易于使用的方式来创建 Web 应用程序。由于其灵活性和可扩展性&#xff0c;它已经成为了 Node.js 社区最受欢迎的框架之一。在本文中&#xff0c;我们将重点介绍 Express.js 的高级特性&…

Python 深入理解 os 和 sys 模块

Python 深入理解 os 和 sys 模块 OS 介绍代码智能连接&#xff08;拼接&#xff09;路径创建目录展示&#xff08;列出目录&#xff09;删除文件重命名文件或目录 sys 介绍代码命令行参数处理 (sys.argv)标准输入输出重定向 (sys.stdin, sys.stdout, sys.stderr)&#xff1a;解…

08-Java过滤器模式 ( Filter Pattern )

Java过滤器模式 实现范例 过滤器模式&#xff08;Filter Pattern&#xff09;或允许开发人员使用不同的标准来过滤一组对象&#xff0c;通过逻辑运算以解耦的方式把它们连接起来 过滤器模式&#xff08;Filter Pattern&#xff09; 又称 标准模式&#xff08;Criteria Pattern…

基于LLM的Agent的兴起及其潜力:综述

原文链接&#xff1a;https://arxiv.org/pdf/2309.07864v1.pdf 1. Introduction LLM-based Agent的基本构成。本文认为&#xff0c;构成LLM-based Agent的核心部件有三个&#xff1a; brain: 主要目标有2个—信息记忆、信息处理perception: 主要目标在于让agent能够感受到更…

YOLOv8改进 | 利用训练好权重文件计算YOLOv8的FPS、推理每张图片的平均时间(科研必备)

一、本文介绍 本文给大家带来的改进机制是利用我们训练好的权重文件计算FPS,同时打印每张图片所利用的平均时间,模型大小(以MB为单位),同时支持batch_size功能的选择,对于轻量化模型的读者来说,本文的内容对你一定有帮助,可以清晰帮你展示出模型速度性能的提升以及轻量…

二进制安全虚拟机Protostar靶场(8)heap3 Fastbins unlink exploit

前言 这是一个系列文章&#xff0c;之前已经介绍过一些二进制安全的基础知识&#xff0c;这里就不过多重复提及&#xff0c;不熟悉的同学可以去看看我之前写的文章 heap3 程序静态分析 https://exploit.education/protostar/heap-three/#include <stdlib.h> #include …

三、设计模式相关理论总结

一、面向对象编程 1.1 概述 简称Object Oriented Program(OOP)&#xff0c;指以类或对象作为基础组织单元&#xff0c;遵循封装、继承、多态以及抽象等特性&#xff0c;进行编程。其中面向对象不一定遵循封装、继承、封装和多态等特性&#xff0c;只是前人总结的套路规范&…

携程网首页案例制作(移动端)

技术选型 方案&#xff1a;采用单独制作移动页面方案 技术&#xff1a;布局采用flex布局 body样式 通常要设置最大宽度&#xff0c;最小宽度&#xff0c;水平居中&#xff0c;字体设置&#xff0c;背景颜色以及相关初始化 body {max-width: 540px;min-width: 320px;margin…

CDH6.3.2 多 Spark 版本共存

一 部署Spark客户端 1.1 部署spark3客户端 tar -zxvf spark-3.3.1-bin-3.0.0-cdh6.3.2.tgz -C /opt/cloudera/parcels/CDH/lib cd /opt/cloudera/parcels/CDH/lib mv spark-3.3.1-bin-3.0.0-cdh6.3.2/ spark3将 CDH 集群的 spark-env.sh 复制到 /opt/cloudera/parcels/CDH/li…

RxJava Subject

目录 AsyncSubjectBehaviorSubjectPublishSubjectReplaySubjectSerializedSubjectUnicastSubject 在Rxjava中&#xff0c; Subject可以同时表示Observer和Observable, 允许从单个源到多个子观察者multiple child Observers。 除了 onSubscribe(io.reactivex.disposables.Dispos…

25、数据结构/二叉树相关练习20240207

一、二叉树相关练习 请编程实现二叉树的操作 1.二叉树的创建 2.二叉树的先序遍历 3.二叉树的中序遍历 4.二叉树的后序遍历 5.二叉树各个节点度的个数 6.二叉树的深度 代码&#xff1a; #include<stdlib.h> #include<string.h> #include<stdio.h> ty…

使用easyExcel 定义表头 字体 格式 颜色等,定义表内容,合计

HeadStyle 表头样式注解 HeadFontStyle 表头字体样式 HeadStyle(fillPatternType FillPatternTypeEnum.SOLID_FOREGROUND, fillForegroundColor 22) HeadFontStyle(fontHeightInPoints 12) 以下为实现效果

PostgreSql与Postgis安装

POstgresql安装 1.登录官网 PostgreSQL: Linux downloads (Red Hat family) 2.选择版本 3.安装 ### 源 yum install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm ### 客户端 yum install postgresql14 ###…

vue 实现一个持续时间定时器组件

vue 实现一个定时器组件 效果图子组件父组件 效果图 子组件 新建一个timer.vue文件 <template><span :class"{red: string > 600}">{{ string | formatDurationS }}</span> </template> <script>export default {name: timer,pro…

详细分析python中的from waitress import serve(附Demo)

目录 前言1. 基本知识2. serve源码分析3. 基本操作 前言 以前玩python 开发的时候写过一些见解&#xff0c;推荐阅读&#xff1a; uwsgi启动django以及uwsgi.ini的配置参数详解Django框架零基础入门 部署服务器除了Flask还有serve 在讲述serve之前&#xff0c;先讲述两者的…

[大厂实践] Netflix容器平台内核panic可观察性实践

在某些情况下&#xff0c;K8S节点和Pod会因为出错自动消失&#xff0c;很难追溯原因&#xff0c;其中一种情况就是发生了内核panic。本文介绍了Netflix容器平台针对内核panic所做的可观测性增强&#xff0c;使得发生内核panic的时候&#xff0c;能够导出信息&#xff0c;帮助排…

基于SpringBoot3的快速迭代平台

SpringBoot3的快速开发平台 前言一、技术栈二、项目结构三、总结 前言 MateBoot是一个基于SpringBoot3的快速开发平台&#xff0c;采用前后端分离的模式&#xff0c;前端采用Element Plus组件&#xff0c;后端采用SpringBoot3、Sa-token、Mybatis-Plus、Redis、RabbitMQ、Fast…

大模型为什么会有 tokens 限制?

人是以字数来计算文本长度&#xff0c;大语言模型 &#xff08;LLM&#xff09;是以 token 数来计算长度的。LLM 使用 token 把一个句子分解成若干部分。 token 可以是一个单词、一个单词中的一个部分、甚至是一个字符&#xff0c;具体取决于它使用的标记化方法 (tokenization…