当前位置: 首页 > ops >正文

展锐平台(Android15)WLAN热点名称修改不生效问题分析

前言

在展锐Android V项目开发中,需要修改softAp/P2P热点名称时,发现集成GMS后直接修改framework层代码无效。具体表现为:

  • 修改packages/modules/Wifi/WifiApConfigStore中的getDefaultApConfiguration方法
  • 编译烧录后修改不生效

问题根源在于:Wi-Fi模块在Android S(12)及以上版本已纳入Mainline模块

Mainline模块机制解析

什么是Mainline?

Google将部分核心模块独立开发维护,这些模块会随系统更新单独升级,不再依赖AOSP版本迭代。这导致:

  • 修改本地代码会被系统预置模块覆盖
  • 整编时无法打包修改后的模块

受影响模块列表

参考Google官方文档:模块化系统架构

Wi-Fi模块自Android 11开始Mainline化

问题分析

修改失效原因

  1. 代码覆盖:Mainline模块优先级高于本地修改
  2. 编译机制:GMS版本会强制使用预置模块
  3. 认证限制:关闭Mainline会影响GTS测试

解决方案矩阵

方案适用场景限制条件
Overlay机制修改配置参数需展锐平台支持
运行时设置动态修改热点名需处理冲突逻辑
关闭Mainline仅限国内版本影响GMS认证

具体解决方案

方案1:使用Overlay机制(推荐)

展锐平台已提供Overlay配置入口:
vendor/sprd/platform/frameworks/opt/net/wifi/service/ServiceUniWifiResources/res/values/config.xml

<string name="config_wifi_softap_ssid">custom</string>
<string name="config_wifi_p2p_device_name">MyP2PName</string>

方案2:运行时动态设置

通过系统广播监听实现首次启动配置:

// 监听BOOT_COMPLETED广播
public class HotspotInitializer extends BroadcastReceiver {private static final String PREF_HOTSPOT_SET = "hotspot_initialized";@Overridepublic void onReceive(Context context, Intent intent) {if (isAlreadyConfigured(context)) return;WifiManager wifiManager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);SoftApConfiguration config = wifiManager.getSoftApConfiguration();String newSsid = SystemProperties.get("ro.product.model") + "_HOTSPOT";wifiManager.setSoftApConfiguration(new SoftApConfiguration.Builder(config).setSsid(newSsid).build());markAsConfigured(context);}private boolean isAlreadyConfigured(Context ctx) {return PreferenceManager.getDefaultSharedPreferences(ctx).getBoolean(PREF_HOTSPOT_SET, false);}
}

关键点:

  1. 使用SharedPreferences记录配置状态
  2. 通过系统属性获取设备型号作为SSID基础
  3. 需在AndroidManifest.xml中注册广播接收器

方案3:关闭Mainline模块(仅限国内版本)

在BoardConfig.mk中添加:

# 关闭Wi-Fi Mainline模块(影响GTS测试)
MAINLINE_INCLUDE_WIFI_MODULE := false

风险提示:

  • 可能导致GMS认证失败
  • 无法接收Wi-Fi模块安全更新
  • 仅建议在非GMS版本或测试环境使用

在这里插入图片描述

总结与建议

  1. 优先方案:使用Overlay机制(方案1),这是最安全合规的方式
  2. 备选方案:运行时设置(方案2),需处理好配置冲突
  3. 最后手段:关闭Mainline(方案3),仅限特定场景使用

对于GMS认证设备,建议采用方案1+方案2组合:

  • 使用Overlay设置默认值
  • 通过运行时机制允许用户自定义
  • 保留系统设置入口作为最终配置渠道

最后

附上Android15上测试可用的修改方法:
vendor/sprd/platform/packages/app/UniWifi/app/res/values/config.xml

     <!-- Carrier default softap ssid via IMEI, like as 1234, name1, name2 --><string-array translatable="false" name="config_uniwifi_softap_default_ssid_via_imei"></string-array><!-- Customer default softap ssid -->
-    <string translatable="false" name="config_uniwifi_softap_default_ssid"></string>
+    <string translatable="false" name="config_uniwifi_softap_default_ssid">custom</string><!-- Preset Carrier Network as Suggestion according to software version --><!-- ro.carrier, ssid, eap type(WifiConfiguration.SECURITY_TYPE#3-5-9),
http://www.xdnf.cn/news/17485.html

相关文章:

  • 【Docker实战】Spring Boot应用容器化
  • Chat2DB入门教程
  • JavaSE:入门
  • 【图像算法 - 11】基于深度学习 YOLO 与 ByteTrack 的目标检测与多目标跟踪系统(系统设计 + 算法实现 + 代码详解 + 扩展调优)
  • MySQL的隔离级别及MVCC原理解析
  • SpringCloud详细笔记
  • reinterpret_cast and static cast
  • 【PyTorch】单目标检测项目
  • 深度解析1688关键字搜索API接口:技术实现与应用探索
  • crc32算法php版----crc32.php
  • 什么是ABA问题?
  • 【牛客刷题】REAL800 棋盘
  • 随想记——excel报表
  • WinForm之TreeView控件
  • Excel版经纬度和百分度互转v1.1
  • 复现论文《多无人机协同任务分配算法设计与实现》
  • 【YOLO11改进 - C3k2融合】C3k2融合EBlock(Encoder Block):低光增强编码器块,利用傅里叶信息增强图像的低光条件
  • Spring 依赖注入、AOP代理
  • Stlink识别不到-安装驱动
  • Redis基本原理,性能优化和参数调优简述
  • Lua基础+Lua数据类型
  • 正则表达式常用语法参考
  • es查询小结
  • 机械学习--DBSCAN 算法(附实战案例)
  • 本地WSL部署接入 whisper + ollama qwen3:14b 总结字幕校对增强版
  • C++基础语法积累
  • Rust进阶-part6-宏
  • LLaMA-Adapter V2 Parameter-Efficient Visual Instruction Model
  • Shell脚本-数组定义
  • Android 四大布局:使用方式与性能优化原理