做设计常用网站,响应式网站手机,设计公司网站建设方案,dw做网站模版Android13分享热点设置安全性为wpa3 文章目录 Android13分享热点设置安全性为wpa3一、前言热点WPA3加密类型是需要底层硬件支持的。Wifi WPA3 和 热点 WPA3 是不一样的分享初衷 二、代码分析1、应用代码中热点设置WPA3 加密格式报错部分日志信息#xff1a; 2、系统代码分析 2、系统代码分析1热点重要工具类 ApConfigUtil.java2Wifi、热点服务实现具体逻辑类 WifiServiceImpl.java3继续热点重要工具类 ApConfigUtil.java4修改wifi相关res属性5WPA3 热点开启成功但是其他设备无法连接日志6WPA1 热点开启成功但是其他设备正常连接日志 三、Android加密类型介绍1、Android11 网络加密类型2、Android11 Wifi 加密类型代码中的定义3、Android13 Wifi 加密类型代码中的定义4、Android11 热点加密类型定义5、Android13 热点加密类型定义 四、总结1、热点开启流程2、WPA3 热点加密类型系统上层适配 一、前言
Android 网络加密类型WPA3比WPA和WPA2 安全性强一下
有些客户强制要求支持WPA3那么就需要系统进行一些适配了。
Android手机上热点分享显示的安全性部分手机可以选择WPA3
比如红米12Android12一加Ace2Android13
但是其他很多手机都没有选择加密类型比如Nova6Android12、红米Android10谷歌Piex4Android13。
从这里大致可以猜到
热点WPA3加密类型是需要底层硬件支持的。
如果只是系统上层简单适配一下就行估计大部分手机都是会支持WPA3热点的了。
并且热点WPA3 估计是Android11之后的系统才存在的加密类型
查看了Android9的代码不存在相关属性的判断。
从Android11-13 系统Framework代码看上层也是有相关属性需要适配
但是发现上层适配后可以打开WPA3加密类型的热点
但是其他安卓设备无法连接这个WPA3加密类型的网络
从日志看不出具体原因底层/硬件需要如何适配也还不清楚。
Wifi WPA3 和 热点 WPA3 是不一样的
之前也有Wifi WPA3 加密类型相关分析
https://blog.csdn.net/wenzhi20102321/article/details/126219495
这里大概介绍一下区别
Wifi WPA3 指的是Android设备 支持连接WPA3 类型的Wifi 网络这个只需要适配连接Wifi 的应用代码即可这个功能在Android11 之后系统原生Framework和原生Settings默认都是支持的。
热点 WPA3 指的是热点开启的加密类型是WPA3其他手机搜到这个热点限制的加密类型是WPA3类型。这个适配要系统适配有点麻烦。
分享初衷
在普通网址和CSDN上搜索了一下暂时没有搜索到热点WPA3相关的分析不管是上层的还是底层的相关适配都是空白的。
但是这些种种不妨碍我分享一下关于热点WPA3上层开发的知识。
本文虽然不能完全分析到wpa3热点分享实现但是对上层的开发和研究是有一定的价值的。
二、代码分析
1、应用代码中热点设置WPA3 加密格式
//构造热点信息对象
SoftApConfiguration.Builder configBuilder new SoftApConfiguration.Builder();//热点名称configBuilder.setSsid(mHotspotName);//根据情况配置密码//加密情况才需要设置密码,如果热点不用密码不需要设置就行if (mSecurityType ! 0) { //密码类型1WPA2WPA3过度3WPA3configBuilder.setPassphrase(mPassword, mSecurityType);}//设置信道和wifi类型,信道值可以根据情况设置if (mChanel ! 0) {configBuilder.setChannel(mChanel, mBand);} else {configBuilder.setBand(mBand);}SoftApConfiguration softApConfiguration configBuilder.build();//设置热点信息
mWifiManager.setSoftApConfiguration(softApConfiguration);//启动热点mConnectivityManager.startTethering(ConnectivityManager.TETHERING_WIFI, true,mOnStartTetheringCallback, new Handler(Looper.getMainLooper()));
通过demo 测试发现 setPassphrase 设置热点密码类型 mSecurityType 设置 2和3都是无法打开热点的
报错部分日志信息
logcat -c;logcat | grep -i -E SoftApManager|ApConfigUtil //设置无密码加密格式正常打开热点日志
11-08 17:42:25.559 813 1073 D SoftApManager[ap0]: startSoftAp: band 2 iface ap0 country US
11-08 17:42:25.566 813 1073 E ApConfigUtil: Can not start softAp with band 6Ghz not supported. //这个不影响热点开启
11-08 17:42:25.578 813 1073 D SoftApManager[ap0]: Soft AP is started
11-08 17:42:25.578 813 1073 D SoftApManager[ap0]: SoftAp is ready for use//设置wap3加密格式加密类型为3无法正常打开热点日志
11-08 17:42:46.527 813 1073 D SoftApManager[ap0]: currentstate: StartedState
11-08 17:42:46.623 813 1073 D SoftApManager[ap0]: Soft AP is stopped
11-08 17:42:46.623 813 1073 D SoftApManager[ap0]: Timeout message canceled on ap0
11-08 17:42:46.624 813 1073 D SoftApManager[unknown]: SoftApInfo update null, isRemoved: false
11-08 17:42:49.673 813 1073 D SoftApManager[ap0]: startSoftAp: band 2 iface ap0 country US
11-08 17:42:49.685 813 1073 D ApConfigUtil: Error, SAE requires HAL support //热点打开失败关键需要追一下 SoftApManager 和 ApConfigUtil 里面的代码
11-08 17:42:49.686 813 1073 D SoftApManager[ap0]: Unsupported Configuration detect! config ssid AndroidAP_7983
11-08 17:42:49.686 813 1073 D SoftApManager[ap0]: Passphrase non-empty
11-08 17:42:49.686 813 1073 D SoftApManager[ap0]: HiddenSsid false
11-08 17:42:49.686 813 1073 D SoftApManager[ap0]: Channels {236}
11-08 17:42:49.686 813 1073 D SoftApManager[ap0]: SecurityType 3 11-08 17:42:49.743 813 1073 D SoftApManager[ap0]: Soft AP is stopped
11-08 17:42:49.743 813 1073 E WifiActiveModeWarden: SoftApManager start failed!SoftApManager{id6497707 ifaceap0 roleROLE_SOFTAP_TETHERED}设置加密类型2和3都是上面的报错
重点报错信息SAE requires HAL support这也是导致WPA3 热点无法正常开启的原因
了解过 wifi 加密类型都会知道 SAE 类型 就是 WPA3 网络加密类型。
2、系统代码分析
1热点重要工具类 ApConfigUtil.java
packages\modules\Wifi\service\java\com\android\server\wifi\util\ApConfigUtil.java
public static boolean checkSupportAllConfiguration(SoftApConfiguration config,SoftApCapability capability) {if (!capability.areFeaturesSupported(SoftApCapability.SOFTAP_FEATURE_WPA3_SAE) (config.getSecurityType() SoftApConfiguration.SECURITY_TYPE_WPA3_SAE_TRANSITION|| config.getSecurityType() SoftApConfiguration.SECURITY_TYPE_WPA3_SAE)) {Log.d(TAG, Error, SAE requires HAL support); //设置热点无法打开的关键return false;}
。。。return true;
}SECURITY_TYPE_WPA3_SAE_TRANSITION 2
SECURITY_TYPE_WPA3_SAE 3
config.getSecurityType() 2 或者 3 并且 capability.areFeaturesSupported(SoftApCapability.SOFTAP_FEATURE_WPA3_SAE) 为false就会触发这个条件。
所以重点是 capability 对象的分析这个分析其实是有点复杂的但是通过全局搜索日志打印还是可以分析到的。
其实是 WifiServiceImpl.java 开启热点前会更新一下 相关数据。
关于系统代码怎么调用到 ApConfigUtil.checkSupportAllConfiguration其实是热点开启的流程最后总结有SoftApManager.startSoftAp() 多个数据校验的时候调用的。
2Wifi、热点服务实现具体逻辑类 WifiServiceImpl.java
packages\modules\Wifi\service\java\com\android\server\wifi\WifiServiceImpl.java public SoftApCapability getSoftApCapability() {synchronized (mLock) {if (mSoftApCapability null) {mSoftApCapability ApConfigUtil.updateCapabilityFromResource(mContext);// Default country codemSoftApCapability updateSoftApCapabilityWithAvailableChannelList(mSoftApCapability, mCountryCode.getCountryCode());}return mSoftApCapability;}}有N多个地方调用了 getSoftApCapability() 方法详细流程可以自己摸索一下。
可以看到 SoftApCapability 对象有进行复制和修改
//主要分析这个
mSoftApCapability ApConfigUtil.updateCapabilityFromResource(mContext);
//这个往后的流程还有N多个这里不展开分析
mSoftApCapability updateSoftApCapabilityWithAvailableChannelList(mSoftApCapability, mCountryCode.getCountryCode());3继续热点重要工具类 ApConfigUtil.java
下面追踪一下 ApConfigUtil.java 的代码
packages\modules\Wifi\service\java\com\android\server\wifi\util\ApConfigUtil.java public static SoftApCapability updateCapabilityFromResource(NonNull Context context) {long features 0;if (isAcsSupported(context)) {Log.d(TAG, Update Softap capability, add acs feature support);features | SoftApCapability.SOFTAP_FEATURE_ACS_OFFLOAD;}if (isWpa3SaeSupported(context)) {Log.d(TAG, Update Softap capability, add SAE feature support);features | SoftApCapability.SOFTAP_FEATURE_WPA3_SAE;}
...return capability;}//看这里终于看到了点有用的信息一个res属性的判断public static boolean isWpa3SaeSupported(NonNull Context context) {return context.getResources().getBoolean(R.bool.config_wifi_softap_sae_supported);}
ApConfigUtil 这个热点工具类是有封装了很多方法的很多地方有调用到。
通过上面一顿分析发现只要把 config_wifi_softap_sae_supported 设置成 true 就可以在上层设置支持WPA3 热点功能。
4修改wifi相关res属性
packages\modules\Wifi\service\ServiceWifiResources\res\values\config.xml
修改属性内容 !-- Wifi driver supports WPA3 Simultaneous Authentication of Equals (WPA3-SAE) for softap --bool translatablefalse nameconfig_wifi_softap_sae_supportedtrue/bool //默认false里面还有很多热点相关的属性不清楚是否需要修改但是这个属性是一定要修改的。
5WPA3 热点开启成功但是其他设备无法连接日志
通过res属性修改后wpa3热点开启成功但是其他手机无法连接自身设备分享WPA3热点的设备报错
这里是过滤 ap0 节点关键字的日志信息。
11-09 08:57:11.415 806 1471 I EthernetTracker: interfaceLinkStateChanged, iface: ap0, up: true
11-09 08:57:11.419 806 1047 E EthernetNetworkFactoryExt: interfaceLinkStateChanged: iface ap0, up true
11-09 08:57:11.428 611 611 I wificond: New station fa:fb:73:72:8c:a5 connected to hotspot using interface ap0
11-09 08:57:11.428 611 611 I wificond: Sending notifications for station add event
11-09 08:57:11.482 611 611 I wificond: Station fa:fb:73:72:8c:a5 disassociated from hotspot
11-09 08:57:11.483 6379 6379 I hostapd : ap0: STA fa:fb:73:72:8c:a5 IEEE 802.11: disassociated
11-09 08:57:17.880 806 1471 I EthernetTracker: interfaceLinkStateChanged, iface: ap0, up: true
11-09 08:57:17.880 806 1047 E EthernetNetworkFactoryExt: interfaceLinkStateChanged: iface ap0, up true
11-09 08:57:17.978 611 611 I wificond: New station 18:87:40:31:22:e6 connected to hotspot using interface ap0
11-09 08:57:17.978 6379 6379 I hostapd : ap0: STA 18:87:40:31:22:e6 IEEE 802.11: associated
11-09 08:57:17.978 611 611 I wificond: Sending notifications for station add event
11-09 08:57:17.978 6379 6379 I hostapd : ap0: STA 18:87:40:31:22:e6 IEEE 802.11: associated
11-09 08:57:18.003 611 611 I wificond: Station 18:87:40:31:22:e6 disassociated from hotspot
01-01 08:08:26.998 0 0 I [4 T758 ..] [wlan][758]saaFsmRunEventRxDeauth: (SAA EVENT) ucRoleIdx 1, name ap0, ifindex 18, dev_addr0a:cf:89:a6:44:28
11-09 08:57:18.003 6379 6379 I hostapd : ap0: STA 18:87:40:31:22:e6 IEEE 802.11: disassociated
11-09 08:57:19.256 806 1478 I EthernetTracker: interfaceLinkStateChanged, iface: ap0, up: true
11-09 08:57:19.257 806 1047 E EthernetNetworkFactoryExt: interfaceLinkStateChanged: iface ap0, up true
11-09 08:57:19.270 6379 6379 I hostapd : ap0: STA 18:87:40:31:22:e6 IEEE 802.11: associated
11-09 08:57:19.271 611 611 I wificond: New station 18:87:40:31:22:e6 connected to hotspot using interface ap0
11-09 08:57:19.271 611 611 I wificond: Sending notifications for station add event
11-09 08:57:19.271 6379 6379 I hostapd : ap0: STA 18:87:40:31:22:e6 IEEE 802.11: associated
11-09 08:57:19.292 611 611 I wificond: Station 18:87:40:31:22:e6 disassociated from hotspot
01-01 08:08:28.287 0 0 I [4 T758 ..] [wlan][758]saaFsmRunEventRxDeauth: (SAA EVENT) ucRoleIdx 1, name ap0, ifindex 18, dev_addr0a:cf:89:a6:44:28
11-09 08:57:19.292 6379 6379 I hostapd : ap0: STA 18:87:40:31:22:e6 IEEE 802.11: disassociated
从上面日志未看出日志明显异常信息。
连接动作“connected to hotspot using interface ap0”这个日志倒是看到有多次但是之后就没有明显的动作日志了。
那么对比开启wap热点其他手机正常连接的日志看看吧。
6WPA1 热点开启成功但是其他设备正常连接日志
正常连接的日志
11-09 09:19:06.109 17222 17222 D wpa_supplicant: RTM_NEWLINK: ifi_index18 ifnameap0 wext ifi_family0 ifi_flags0x11043 ([UP][RUNNING][LOWER_UP])
11-09 09:19:06.112 806 1478 I EthernetTracker: interfaceLinkStateChanged, iface: ap0, up: true
11-09 09:19:06.112 806 1047 E EthernetNetworkFactoryExt: interfaceLinkStateChanged: iface ap0, up true
11-09 09:19:06.122 611 611 I wificond: New station fa:fb:73:72:8c:a5 connected to hotspot using interface ap0
11-09 09:19:06.122 611 611 I wificond: Sending notifications for station add event
11-09 09:19:06.122 18018 18018 I hostapd : ap0: STA fa:fb:73:72:8c:a5 IEEE 802.11: associated
11-09 09:19:06.250 18018 18018 I hostapd : ap0: AP-STA-CONNECTED fa:fb:73:72:8c:a5
11-09 09:19:06.250 18018 18018 I hostapd : ap0: STA fa:fb:73:72:8c:a5 WPA: pairwise key handshake completed (RSN)
11-09 09:19:06.251 18018 18018 I hostapd : ap0: EAPOL-4WAY-HS-COMPLETED fa:fb:73:72:8c:a5
11-09 09:19:06.252 806 1608 D HostapdHalAidlImp: onConnectedClientsChanged on ap0 / ap0 and Mac is fa:fb:73:72:8c:a5 isConnected: true
11-09 09:19:06.254 806 1037 D SoftApManager[ap0]: CMD_ASSOCIATED_STATIONS_CHANGED, Client: fa:fb:73:72:8c:a5 isConnected: true
11-09 09:19:06.255 806 1037 D SoftApManager[ap0]: The connected wifi stations have changed with count: 1: [WifiClient{mMacAddressfa:fb:73:72:8c:a5mApInstanceIdentifierap0}] on the AP which info is SoftApInfo{bandwidth 2, frequency 2437,bssid0a:cf:89:a6:44:28, wifiStandard 4, mApInstanceIdentifier ap0, mIdleShutdownTimeoutMillis 600000}
11-09 09:19:06.256 806 1037 D SoftApManager[ap0]: rescheduleTimeoutMessageIfNeeded ap0, timeoutEnabledtrue, isChargingfalse, clientNumber1
11-09 09:19:06.256 806 1037 D SoftApManager[ap0]: Timeout message canceled on ap0
11-09 09:19:06.257 1226 1269 V WifiManager: SoftApCallbackProxy on mode 1, send onConnectedClientsChanged, changedInfo is SoftApInfo{bandwidth 2, frequency 2437,bssid0a:cf:89:a6:44:28, wifiStandard 4, mApInstanceIdentifier ap0, mIdleShutdownTimeoutMillis 600000} and clients are [WifiClient{mMacAddressfa:fb:73:72:8c:a5mApInstanceIdentifierap0}]
11-09 09:19:06.258 1226 1269 V WifiManager: SoftApCallbackProxy on mode 1, send onConnectedClientsChanged(clients): [WifiClient{mMacAddressfa:fb:73:72:8c:a5mApInstanceIdentifierap0}]这个日志同样有 “connected to hotspot using interface ap0”
随后有 hostapd、HostapdHalAidlImp、SoftApManager 相关日志
从isConnected: true,明显可以看到有其他设备连接上了分享的热点。
hostapd 是网络身份校验的逻辑代码 wpa_supplicant 模块处理。
HostapdHalAidlImp 上层是调用底层接口的实现Android11 没有这个类但是有类似的HostapdHal。
SoftApManager 是上层校验信息逻辑实现
wpa_supplicant 模块的代码全部都是C/C 的代码路径
//原生路径
release\external\wpa_supplicant_8\
//部分芯片厂商路径比如AMl的
release\vendor\amlogic\common\wifi_bt\wifi\wpa_supplicant_8\这部分代码基本没有进行分析过修改的也只修改过已有对策的代码。
到这里已经分析不下去了网络身份校验的部分逻辑有需求的自行分析。
同时发现即使设置WPA3 热点开启成功其他Android设备还是未显示WPA3类型的网络
有的手机显示显示WPA有的显示WPA2具体原因不清楚是哪里的问题
三、Android加密类型介绍
以前只分析过Android11 这里发现Android13 有些区别记录一下。
1、Android11 网络加密类型
SECURITY_TYPE_OPEN 0; //无密码
SECURITY_TYPE_WEP 1; //比较旧的加密方式基本很少用不太安全更多文字介绍https://blog.csdn.net/u013403237/article/details/50663790SECURITY_TYPE_PSK 2; //目前常用包含WPA/WPA2更多文字介绍https://www.jianshu.com/p/9316c433ec5f/SECURITY_TYPE_EAP 3; //非常安全EAP 的类型是一种企业验证的安全类型EAP 全称叫 802.1X/EAP 他常常给误解成 802.11x。EAP 的意思就是可扩展认证协议的缩写。最常部署的 EAP 验证类型包括 EAP-MD-5、EAP-TLS、EAP-LEAP、EAP-TTLS、EAP-Fast、EAP-PEAP;所以EAP网络也是连接wifi参数最多的网络还需要添加客户端和服务器端的证书安装。更多文字介绍https://blog.csdn.net/hl1293348082/article/details/123888636SECURITY_TYPE_SAE 4;SAE最早是802.11s中为mesh网络提出的基于password的认证和key生成协议[1]。在WPA2-PSK中PMK就是PSK直接来源于密钥而SAE则保证任何STA pairAP-STAnonAP-STA在不同的session都有不同的PMK使用SAE认证的个人无线网络通常称为WPA3-PSK/WPA3-Personal。简单的说SAE就是WPA2的升级简称WPA3更多文字介绍https://blog.csdn.net/qq_23087099/article/details/113921261SECURITY_TYPE_EAP_SUITE_B 5;EAP网络的另一种加密形式具体介绍查不出SECURITY_TYPE_OWE 6;未查出相关介绍在当前类中发现入下介绍Opportunististic 共产主义大概是共享网络的一种加密格式吧。/*** Opportunististic Wireless Encryption*/public static final int OWE 9;最后两种SECURITY_TYPE_WAPI_X WAPI(无线网络WLANAuthenticationandPrivacyInfrastructure)是我国自主研发并大力推行的无线网络WLAN安全标准
它通过了IEEE(注意不是Wi-Fi)认证和授权是一种认证和私密性保护协议其作用类似于802.11b中的WEP但是能提供更加完善的安全保护。
上面的加密类型都是基于Android11 进行搜索和总结的Android13 上看了是有点区别的。
但是基本类型WPAEAPSAEWPA3是不变的。
Android 加密类型的定义是在 WifiConfiguration.java
2、Android11 Wifi 加密类型代码中的定义
frameworks\base\wifi\java\android\net\wifi\WifiConfiguration.java /*** Set the various security params to correspond to the provided security type.* This is accomplished by setting the various BitSets exposed in WifiConfiguration.** param securityType One of the following security types:* {link #SECURITY_TYPE_OPEN}, //0* {link #SECURITY_TYPE_WEP}, //1* {link #SECURITY_TYPE_PSK}, //2* {link #SECURITY_TYPE_EAP}, //3* {link #SECURITY_TYPE_SAE}, //4* {link #SECURITY_TYPE_EAP_SUITE_B}, //5* {link #SECURITY_TYPE_OWE}, //6* {link #SECURITY_TYPE_WAPI_PSK}, or //7* {link #SECURITY_TYPE_WAPI_CERT} //8*/
3、Android13 Wifi 加密类型代码中的定义
packages\modules\Wifi\framework\java\android\net\wifi\WifiConfiguration.java /*** Security types we support.* hide*/Retention(RetentionPolicy.SOURCE)IntDef(prefix { SECURITY_TYPE_ }, value {SECURITY_TYPE_OPEN,SECURITY_TYPE_WEP,SECURITY_TYPE_PSK,SECURITY_TYPE_EAP,SECURITY_TYPE_SAE,SECURITY_TYPE_EAP_SUITE_B,SECURITY_TYPE_OWE,SECURITY_TYPE_WAPI_PSK,SECURITY_TYPE_WAPI_CERT,//下面几个是新增的SECURITY_TYPE_EAP_WPA3_ENTERPRISE,SECURITY_TYPE_EAP_WPA3_ENTERPRISE_192_BIT,SECURITY_TYPE_PASSPOINT_R1_R2,SECURITY_TYPE_PASSPOINT_R3,SECURITY_TYPE_DPP,})//下面是最后几个新增的加密类型的代码说明/*** Security type for an OSEN network.* hide*/public static final int SECURITY_TYPE_OSEN 10;/*** Security type for a Passpoint R1/R2 network.* Passpoint R1/R2 uses Enterprise security, where TKIP and WEP are not allowed.* hide*/public static final int SECURITY_TYPE_PASSPOINT_R1_R2 11;/*** Security type for a Passpoint R3 network.* Passpoint R3 uses Enterprise security, where TKIP and WEP are not allowed,* and PMF must be set to Required.* hide*/public static final int SECURITY_TYPE_PASSPOINT_R3 12;/** Security type for Easy Connect (DPP) network */public static final int SECURITY_TYPE_DPP 13;/*** This is used for the boundary check and should be the same as the last type.* hide*/public static final int SECURITY_TYPE_NUM SECURITY_TYPE_DPP;
具体加密类型不做分析有兴趣的可以自己看看。
热点的加密类型没有那么多但是也在慢慢增加估计是要一定的协议和硬件支持。
热点加密类型是定义在 SoftApConfiguration.java
4、Android11 热点加密类型定义
frameworks\base\wifi\java\android\net\wifi\SoftApConfiguration.java /*** The operating security type of the AP.* One of the following security types:* {link #SECURITY_TYPE_OPEN}, //0* {link #SECURITY_TYPE_WPA2_PSK}, //1* {link #SECURITY_TYPE_WPA3_SAE_TRANSITION}, //2 , TRANSITION 是过度的意思* {link #SECURITY_TYPE_WPA3_SAE} //3*/5、Android13 热点加密类型定义
packages\modules\Wifi\framework\java\android\net\wifi\SoftApConfiguration.java /*** The operating security type of the AP.* One of the following security types:* {link #SECURITY_TYPE_OPEN}, //1* {link #SECURITY_TYPE_WPA2_PSK}, //2* {link #SECURITY_TYPE_WPA3_SAE_TRANSITION}, //3* {link #SECURITY_TYPE_WPA3_SAE}, //4* {link #SECURITY_TYPE_WPA3_OWE_TRANSITION}, //5* {link #SECURITY_TYPE_WPA3_OWE} //6*/四、总结
关于热点开启是如何走到 SoftApManager 可以看下我之前对热点开启流程的分析
1、热点开启流程
https://blog.csdn.net/wenzhi20102321/article/details/128473734
Android11 热点开启大致流程
(1)ConnectivityManager.startTethering
(2)TetheringManager.startTethering(request, executor, tetheringCallback)
(3)TetheringService.TetheringConnector.startTethering
(4)Tethering.startTethering(request, listener);
//方法名变化使用null 对象开启热点
(5)WifiManager.startTetheredHotspot(null /* use existing softap config */)
(6)WifiServiceImpl.startTetheredHotspot(Nullable SoftApConfiguration softApConfig)
//方法名再变化
(7)ActiveModeWarden.startSoftAp(apModeConfig);
(8)ActiveModeManager.start();ActiveModeManager manager mWifiInjector.makeSoftApManager(listener, callback, softApConfig);listener.setActiveModeManager(manager);manager.start();
ActiveModeManager是接口类会调用到SoftApManager.start()
(9)SoftApManager.startSoftAp()
(10)WifiNative.startSoftAp(mApInterfaceName, localConfigBuilder.build(), mSoftApListener)
(11)HostapdHal.addAccessPoint(ifaceName, config, listener::onFailure)
(12)根据硬件版本调用不同的接口实现:addAccessPoint_X_X
上面是Android11 上分析的代码逻辑Android13 上应该是只有 HostapdHal 这个类不一样其他流程是一样的。
2、WPA3 热点加密类型系统上层适配
需要设置系统 wpa3 相关 res属性 为true如果不设置wap3 为true是无法打开wpa3 热点的。
packages\modules\Wifi\service\ServiceWifiResources\res\values\config.xml
修改属性内容 !-- Wifi driver supports WPA3 Simultaneous Authentication of Equals (WPA3-SAE) for softap --bool translatablefalse nameconfig_wifi_softap_sae_supportedtrue/bool //默认false简单来说本文就是为了说这个属性设置为 true 其他相关知识都是附带介绍的。
系统上层适配后还是有点bug其他设备无法连接分享的wpa3 热点
这个问题很大概率跟硬件模组相关需要进一步分析。 文章转载自: http://www.morning.lbcfj.cn.gov.cn.lbcfj.cn http://www.morning.ylph.cn.gov.cn.ylph.cn http://www.morning.rdmn.cn.gov.cn.rdmn.cn http://www.morning.xqjrg.cn.gov.cn.xqjrg.cn http://www.morning.rwlnk.cn.gov.cn.rwlnk.cn http://www.morning.gmplp.cn.gov.cn.gmplp.cn http://www.morning.tndhm.cn.gov.cn.tndhm.cn http://www.morning.jstggt.cn.gov.cn.jstggt.cn http://www.morning.ykrkq.cn.gov.cn.ykrkq.cn http://www.morning.cwyrp.cn.gov.cn.cwyrp.cn http://www.morning.kxgn.cn.gov.cn.kxgn.cn http://www.morning.byywt.cn.gov.cn.byywt.cn http://www.morning.fwllb.cn.gov.cn.fwllb.cn http://www.morning.ruifund.com.gov.cn.ruifund.com http://www.morning.zrgx.cn.gov.cn.zrgx.cn http://www.morning.mhcys.cn.gov.cn.mhcys.cn http://www.morning.ttryd.cn.gov.cn.ttryd.cn http://www.morning.zgdnd.cn.gov.cn.zgdnd.cn http://www.morning.mwqbp.cn.gov.cn.mwqbp.cn http://www.morning.dnmzl.cn.gov.cn.dnmzl.cn http://www.morning.wrbnh.cn.gov.cn.wrbnh.cn http://www.morning.jokesm.com.gov.cn.jokesm.com http://www.morning.dzqyn.cn.gov.cn.dzqyn.cn http://www.morning.xnltz.cn.gov.cn.xnltz.cn http://www.morning.rzbgn.cn.gov.cn.rzbgn.cn http://www.morning.ityi666.cn.gov.cn.ityi666.cn http://www.morning.qkxt.cn.gov.cn.qkxt.cn http://www.morning.qgghr.cn.gov.cn.qgghr.cn http://www.morning.zknxh.cn.gov.cn.zknxh.cn http://www.morning.pjftk.cn.gov.cn.pjftk.cn http://www.morning.gktds.cn.gov.cn.gktds.cn http://www.morning.xjqrn.cn.gov.cn.xjqrn.cn http://www.morning.hgwsj.cn.gov.cn.hgwsj.cn http://www.morning.nytqy.cn.gov.cn.nytqy.cn http://www.morning.fqtdz.cn.gov.cn.fqtdz.cn http://www.morning.qfmns.cn.gov.cn.qfmns.cn http://www.morning.tsxg.cn.gov.cn.tsxg.cn http://www.morning.tslwz.cn.gov.cn.tslwz.cn http://www.morning.chmcq.cn.gov.cn.chmcq.cn http://www.morning.ztmnr.cn.gov.cn.ztmnr.cn http://www.morning.xrpjr.cn.gov.cn.xrpjr.cn http://www.morning.pggkr.cn.gov.cn.pggkr.cn http://www.morning.xqbbc.cn.gov.cn.xqbbc.cn http://www.morning.ljjmr.cn.gov.cn.ljjmr.cn http://www.morning.ctqlq.cn.gov.cn.ctqlq.cn http://www.morning.nhzps.cn.gov.cn.nhzps.cn http://www.morning.ytnn.cn.gov.cn.ytnn.cn http://www.morning.prqdr.cn.gov.cn.prqdr.cn http://www.morning.wpqwk.cn.gov.cn.wpqwk.cn http://www.morning.zffps.cn.gov.cn.zffps.cn http://www.morning.rlqwz.cn.gov.cn.rlqwz.cn http://www.morning.crkmm.cn.gov.cn.crkmm.cn http://www.morning.txzmy.cn.gov.cn.txzmy.cn http://www.morning.aswev.com.gov.cn.aswev.com http://www.morning.gqtzb.cn.gov.cn.gqtzb.cn http://www.morning.kdbbm.cn.gov.cn.kdbbm.cn http://www.morning.sqyjh.cn.gov.cn.sqyjh.cn http://www.morning.rwxnn.cn.gov.cn.rwxnn.cn http://www.morning.bmfqg.cn.gov.cn.bmfqg.cn http://www.morning.mdmxf.cn.gov.cn.mdmxf.cn http://www.morning.nkdmd.cn.gov.cn.nkdmd.cn http://www.morning.nzxdz.cn.gov.cn.nzxdz.cn http://www.morning.dmtbs.cn.gov.cn.dmtbs.cn http://www.morning.xqcgb.cn.gov.cn.xqcgb.cn http://www.morning.rjznm.cn.gov.cn.rjznm.cn http://www.morning.nqnqz.cn.gov.cn.nqnqz.cn http://www.morning.gpkjx.cn.gov.cn.gpkjx.cn http://www.morning.jkmjm.cn.gov.cn.jkmjm.cn http://www.morning.fmry.cn.gov.cn.fmry.cn http://www.morning.lswgs.cn.gov.cn.lswgs.cn http://www.morning.bsjxh.cn.gov.cn.bsjxh.cn http://www.morning.rqbkc.cn.gov.cn.rqbkc.cn http://www.morning.ymjrg.cn.gov.cn.ymjrg.cn http://www.morning.psxwc.cn.gov.cn.psxwc.cn http://www.morning.mjglk.cn.gov.cn.mjglk.cn http://www.morning.muniubangcaishui.cn.gov.cn.muniubangcaishui.cn http://www.morning.gkktj.cn.gov.cn.gkktj.cn http://www.morning.xtrzh.cn.gov.cn.xtrzh.cn http://www.morning.tkztx.cn.gov.cn.tkztx.cn http://www.morning.mjtgt.cn.gov.cn.mjtgt.cn