SoftApHelper icon indicating copy to clipboard operation
SoftApHelper copied to clipboard

关于隐藏热点类型在Android14上的问题

Open tegzwn opened this issue 10 months ago • 31 comments

设备:Redmi 12 5G 系统:Android14(HyperOS1) 问题: 在使用iOS设备连接Android设备开启的热点后发现iOS设备会在锁屏后一段时间自动断开与热点的链接。 用pc上的软件发现是Android设备将Access Network Type设置成Chargeable public network (2)导致的, 搜索源码后发现在 https://xrefandroid.com/android-14.0.0_r21/xref/hardware/interfaces/wifi/hostapd/aidl/android/hardware/wifi/hostapd/NetworkParams.aidl#42 中开启hostapd时存在

/**
     * Enable the interworking service and set access network type to
     * CHARGEABLE_PUBLIC_NETWORK when set to true.
     */
    boolean isMetered;
    /**
     * Additional vendor specific elements for Beacon and Probe Response frames
     * This parameter can be used to add additional vendor specific element(s) into
     * the end of the Beacon and Probe Response frames. The format for these
     * element(s) is a binary dump of the raw information elements (id+len+payload for
     * one or more elements). Example: byte[]{ 221, 4, 17, 34, 51, 1 }
     */
    byte[] vendorElements;

搜索布尔值 isMetered时发现在 https://xrefandroid.com/android-14.0.0_r21/xref/frameworks/base/packages/SettingsLib/src/com/android/settingslib/wifi/AccessPoint.java#mIsScoredNetworkMetered 中存在

    /**
     * Updates the AccessPoint's metering based on {@link ScoredNetwork#meteredHint}, returning
     * true if the metering changed.
     */
    private boolean updateMetered(WifiNetworkScoreCache scoreCache) {
        boolean oldMetering = mIsScoredNetworkMetered;
        mIsScoredNetworkMetered = false;

        if (isActive() && mInfo != null) {
            NetworkKey key = NetworkKey.createFromWifiInfo(mInfo);
            ScoredNetwork score = scoreCache.getScoredNetwork(key);
            if (score != null) {
                mIsScoredNetworkMetered |= score.meteredHint;
            }
        } else {
            synchronized (mLock) {
                for (ScanResult result : mScanResults) {
                    ScoredNetwork score = scoreCache.getScoredNetwork(result);
                    if (score == null) {
                        continue;
                    }
                    mIsScoredNetworkMetered |= score.meteredHint;
                }
            }
        }
        return oldMetering != mIsScoredNetworkMetered;
    }

    /**
     * Returns if the network should be considered metered.
     */
    public boolean isMetered() {
        return mIsScoredNetworkMetered
                || WifiConfiguration.isMetered(mConfig, mInfo);
    }

导致返回为计费网络,由于我不会写java所以想让作者添加一下这个hook,这样热点就不会使iOS设备断连了。 谢谢作者的辛苦付出!

附图: Image

tegzwn avatar Jan 20 '25 11:01 tegzwn

这个功能是已经支持的。

安卓14已知问题:

部分安卓14系统由于存在缓存,需要手动重新优化Tethering,模块才能生效

LSPosed-模块-SoftApHelper-长按Tethering-重新优化-重启手机

---原始邮件--- 发件人: @.> 发送时间: 2025年1月20日(周一) 晚上7:05 收件人: @.>; 抄送: @.***>; 主题: [XhyEax/SoftApHelper] 关于隐藏热点类型在Android14上的问题 (Issue #31)

设备:Redmi 12 5G 系统:Android14(HyperOS1) 问题: 在使用iOS设备连接Android设备开启的热点后发现iOS设备会在锁屏后一段时间自动断开与热点的链接。 用pc上的软件发现是Android设备将Access Network Type设置成Chargeable public network (2)导致的, 搜索源码后发现在

中开启hostapd时存在 /** * Enable the interworking service and set access network type to * CHARGEABLE_PUBLIC_NETWORK when set to true. / boolean isMetered; /* * Additional vendor specific elements for Beacon and Probe Response frames * This parameter can be used to add additional vendor specific element(s) into * the end of the Beacon and Probe Response frames. The format for these * element(s) is a binary dump of the raw information elements (id+len+payload for * one or more elements). Example: byte[]{ 221, 4, 17, 34, 51, 1 } / byte[] vendorElements;
搜索布尔值 isMetered时发现在 中存在 /
* * Updates the AccessPoint's metering based on @.*** ScoredNetwork#meteredHint}, returning * true if the metering changed. / private boolean updateMetered(WifiNetworkScoreCache scoreCache) { boolean oldMetering = mIsScoredNetworkMetered; mIsScoredNetworkMetered = false; if (isActive() && mInfo != null) { NetworkKey key = NetworkKey.createFromWifiInfo(mInfo); ScoredNetwork score = scoreCache.getScoredNetwork(key); if (score != null) { mIsScoredNetworkMetered |= score.meteredHint; } } else { synchronized (mLock) { for (ScanResult result : mScanResults) { ScoredNetwork score = scoreCache.getScoredNetwork(result); if (score == null) { continue; } mIsScoredNetworkMetered |= score.meteredHint; } } } return oldMetering != mIsScoredNetworkMetered; }
和 /
* * Returns if the network should be considered metered. */ public boolean isMetered() { return mIsScoredNetworkMetered || WifiConfiguration.isMetered(mConfig, mInfo); }
导致返回为计费网络,由于我不会写java所以想让作者添加一下这个hook,这样热点就不会使iOS设备断连了。 谢谢作者的辛苦付出!

附图: image.png (view on web)

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you are subscribed to this thread.Message ID: @.***>

XhyEax avatar Jan 20 '25 11:01 XhyEax

已经尝试过重新优化Tethering了,没有效果。 我感觉这个不是DHCP的问题而是hostapd参数的问题。 因为就算不连接热点也能发现这个ssid是被设置成计费网络的,这时候还没进行DHCP过程。

tegzwn avatar Jan 20 '25 11:01 tegzwn

ios设备连接应该也是显示一把锁吧

---原始邮件--- 发件人: @.> 发送时间: 2025年1月20日(周一) 晚上7:13 收件人: @.>; 抄送: @.@.>; 主题: Re: [XhyEax/SoftApHelper] 关于隐藏热点类型在Android14上的问题 (Issue #31)

已经尝试过重新优化Tethering了,没有效果。 我感觉这个不是DHCP的问题而是hostapd参数的问题。 因为就算不连接热点也能发现这个ssid是被设置成计费网络的,这时候还没进行DHCP过程。

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>

XhyEax avatar Jan 20 '25 11:01 XhyEax

在哪看的网络参数是计费网络,我用ios连接是一把锁,不是热点图标,也没有低数据模式。安卓设备连接也没有移动热点标志。

---原始邮件--- 发件人: @.> 发送时间: 2025年1月20日(周一) 晚上7:13 收件人: @.>; 抄送: @.@.>; 主题: Re: [XhyEax/SoftApHelper] 关于隐藏热点类型在Android14上的问题 (Issue #31)

已经尝试过重新优化Tethering了,没有效果。 我感觉这个不是DHCP的问题而是hostapd参数的问题。 因为就算不连接热点也能发现这个ssid是被设置成计费网络的,这时候还没进行DHCP过程。

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>

XhyEax avatar Jan 20 '25 11:01 XhyEax

我这边需要这个计费网络标志是否存在的软件或者方式,不然也没法确定改成功没有

---原始邮件--- 发件人: @.> 发送时间: 2025年1月20日(周一) 晚上7:13 收件人: @.>; 抄送: @.@.>; 主题: Re: [XhyEax/SoftApHelper] 关于隐藏热点类型在Android14上的问题 (Issue #31)

已经尝试过重新优化Tethering了,没有效果。 我感觉这个不是DHCP的问题而是hostapd参数的问题。 因为就算不连接热点也能发现这个ssid是被设置成计费网络的,这时候还没进行DHCP过程。

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>

XhyEax avatar Jan 20 '25 11:01 XhyEax

我这看热点和普通wifi在设置界面也是一样的,但是连上热点就会锁屏断连而其他的wifi不会,用pc上的软件看在802.11Frame 里还是有计费网络的内容。

tegzwn avatar Jan 20 '25 11:01 tegzwn

软件是这个: https://lizardsystems.com/wi-fi-scanner/

tegzwn avatar Jan 20 '25 11:01 tegzwn

作者的iOS设备会出现锁屏断连的情况吗?

tegzwn avatar Jan 20 '25 11:01 tegzwn

软件名字是?

---原始邮件--- 发件人: @.> 发送时间: 2025年1月20日(周一) 晚上7:20 收件人: @.>; 抄送: @.@.>; 主题: Re: [XhyEax/SoftApHelper] 关于隐藏热点类型在Android14上的问题 (Issue #31)

我这看热点和普通wifi在设置界面也是一样的,但是连上热点就会锁屏断连而其他的wifi不会,用pc上的软件看在802.11Frame 里还是有计费网络的内容。

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>

XhyEax avatar Jan 20 '25 11:01 XhyEax

行,我有空的话看看

---原始邮件--- 发件人: @.> 发送时间: 2025年1月20日(周一) 晚上7:21 收件人: @.>; 抄送: @.@.>; 主题: Re: [XhyEax/SoftApHelper] 关于隐藏热点类型在Android14上的问题 (Issue #31)

软件是这个: https://lizardsystems.com/wi-fi-scanner/

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>

XhyEax avatar Jan 20 '25 11:01 XhyEax

没出现过

---原始邮件--- 发件人: @.> 发送时间: 2025年1月20日(周一) 晚上7:22 收件人: @.>; 抄送: @.@.>; 主题: Re: [XhyEax/SoftApHelper] 关于隐藏热点类型在Android14上的问题 (Issue #31)

作者的iOS设备会出现锁屏断连的情况吗?

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>

XhyEax avatar Jan 20 '25 11:01 XhyEax

另附一个有关的帖子: https://www.v2ex.com/t/1062763 我这边测试和楼主一样的,VPNHostpot开中继模式或者临时WiFi热点就不会断连, 且不出现计费网络的内容。 附图(临时WiFi热点): Image

tegzwn avatar Jan 20 '25 11:01 tegzwn

好的,谢谢作者!

tegzwn avatar Jan 20 '25 11:01 tegzwn

我在安卓13+插件和安卓14的设备上没看到这个,是要先连接?

---原始邮件--- 发件人: @.> 发送时间: 2025年1月20日(周一) 晚上7:26 收件人: @.>; 抄送: @.@.>; 主题: Re: [XhyEax/SoftApHelper] 关于隐藏热点类型在Android14上的问题 (Issue #31)

另附一个有关的帖子: https://www.v2ex.com/t/1062763 我这边测试和楼主一样的,VPNHostpot开中继模式或者临时WiFi热点就不会断连, 且不出现计费网络的内容。 附图(临时WiFi热点): image.png (view on web)

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>

XhyEax avatar Jan 20 '25 11:01 XhyEax

不需要连接就能看

tegzwn avatar Jan 20 '25 11:01 tegzwn

我连接热点之后也还是没有这个标签

---原始邮件--- 发件人: @.> 发送时间: 2025年1月20日(周一) 晚上7:26 收件人: @.>; 抄送: @.@.>; 主题: Re: [XhyEax/SoftApHelper] 关于隐藏热点类型在Android14上的问题 (Issue #31)

另附一个有关的帖子: https://www.v2ex.com/t/1062763 我这边测试和楼主一样的,VPNHostpot开中继模式或者临时WiFi热点就不会断连, 且不出现计费网络的内容。 附图(临时WiFi热点): image.png (view on web)

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>

XhyEax avatar Jan 20 '25 11:01 XhyEax

没有Interworking这个子项吗,奇怪。

tegzwn avatar Jan 20 '25 11:01 tegzwn

插件其他功能正常吗?固定ip

---原始邮件--- 发件人: @.> 发送时间: 2025年1月20日(周一) 晚上7:47 收件人: @.>; 抄送: @.@.>; 主题: Re: [XhyEax/SoftApHelper] 关于隐藏热点类型在Android14上的问题 (Issue #31)

不需要连接就能看

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>

XhyEax avatar Jan 20 '25 11:01 XhyEax

其他的都正常

tegzwn avatar Jan 20 '25 11:01 tegzwn

你发的这个代码是手机自身获取当前连接wifi的配置的

---原始邮件--- 发件人: @.> 发送时间: 2025年1月20日(周一) 晚上7:05 收件人: @.>; 抄送: @.***>; 主题: [XhyEax/SoftApHelper] 关于隐藏热点类型在Android14上的问题 (Issue #31)

设备:Redmi 12 5G 系统:Android14(HyperOS1) 问题: 在使用iOS设备连接Android设备开启的热点后发现iOS设备会在锁屏后一段时间自动断开与热点的链接。 用pc上的软件发现是Android设备将Access Network Type设置成Chargeable public network (2)导致的, 搜索源码后发现在

中开启hostapd时存在 /** * Enable the interworking service and set access network type to * CHARGEABLE_PUBLIC_NETWORK when set to true. / boolean isMetered; /* * Additional vendor specific elements for Beacon and Probe Response frames * This parameter can be used to add additional vendor specific element(s) into * the end of the Beacon and Probe Response frames. The format for these * element(s) is a binary dump of the raw information elements (id+len+payload for * one or more elements). Example: byte[]{ 221, 4, 17, 34, 51, 1 } / byte[] vendorElements;
搜索布尔值 isMetered时发现在 中存在 /
* * Updates the AccessPoint's metering based on @.*** ScoredNetwork#meteredHint}, returning * true if the metering changed. / private boolean updateMetered(WifiNetworkScoreCache scoreCache) { boolean oldMetering = mIsScoredNetworkMetered; mIsScoredNetworkMetered = false; if (isActive() && mInfo != null) { NetworkKey key = NetworkKey.createFromWifiInfo(mInfo); ScoredNetwork score = scoreCache.getScoredNetwork(key); if (score != null) { mIsScoredNetworkMetered |= score.meteredHint; } } else { synchronized (mLock) { for (ScanResult result : mScanResults) { ScoredNetwork score = scoreCache.getScoredNetwork(result); if (score == null) { continue; } mIsScoredNetworkMetered |= score.meteredHint; } } } return oldMetering != mIsScoredNetworkMetered; }
和 /
* * Returns if the network should be considered metered. */ public boolean isMetered() { return mIsScoredNetworkMetered || WifiConfiguration.isMetered(mConfig, mInfo); }
导致返回为计费网络,由于我不会写java所以想让作者添加一下这个hook,这样热点就不会使iOS设备断连了。 谢谢作者的辛苦付出!

附图: image.png (view on web)

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you are subscribed to this thread.Message ID: @.***>

XhyEax avatar Jan 20 '25 11:01 XhyEax

我看是hostapd配置的,也就是在系统层面指定的

---原始邮件--- 发件人: @.> 发送时间: 2025年1月20日(周一) 晚上7:49 收件人: @.>; 抄送: @.@.>; 主题: Re: [XhyEax/SoftApHelper] 关于隐藏热点类型在Android14上的问题 (Issue #31)

没有Interworking这个子项吗,奇怪。

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>

XhyEax avatar Jan 20 '25 11:01 XhyEax

好像是跟IEEE 802.11u这个协议有关,在hostapd的配置里有

##### IEEE 802.11u-2011 #######################################################

# Enable Interworking service
#interworking=1

# Access Network Type
# 0 = Private network
# 1 = Private network with guest access
# 2 = Chargeable public network
# 3 = Free public network
# 4 = Personal device network
# 5 = Emergency services only network
# 14 = Test or experimental
# 15 = Wildcard
#access_network_type=0

# Whether the network provides connectivity to the Internet
# 0 = Unspecified
# 1 = Network provides connectivity to the Internet
#internet=1

# Additional Step Required for Access
# Note: This is only used with open network, i.e., ASRA shall ne set to 0 if
# RSN is used.
#asra=0

# Emergency services reachable
#esr=0

# Unauthenticated emergency service accessible
#uesa=0

tegzwn avatar Jan 20 '25 11:01 tegzwn

hostapd.cpp的CONFIG_INTERWORKING

---原始邮件--- 发件人: @.> 发送时间: 2025年1月20日(周一) 晚上7:49 收件人: @.>; 抄送: @.@.>; 主题: Re: [XhyEax/SoftApHelper] 关于隐藏热点类型在Android14上的问题 (Issue #31)

没有Interworking这个子项吗,奇怪。

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>

XhyEax avatar Jan 20 '25 11:01 XhyEax

和isMetered

---原始邮件--- 发件人: @.> 发送时间: 2025年1月20日(周一) 晚上7:49 收件人: @.>; 抄送: @.@.>; 主题: Re: [XhyEax/SoftApHelper] 关于隐藏热点类型在Android14上的问题 (Issue #31)

没有Interworking这个子项吗,奇怪。

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>

XhyEax avatar Jan 20 '25 11:01 XhyEax

我把你说的代码hook上,然后你安装试试

---原始邮件--- 发件人: @.> 发送时间: 2025年1月20日(周一) 晚上7:49 收件人: @.>; 抄送: @.@.>; 主题: Re: [XhyEax/SoftApHelper] 关于隐藏热点类型在Android14上的问题 (Issue #31)

没有Interworking这个子项吗,奇怪。

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>

XhyEax avatar Jan 20 '25 11:01 XhyEax

这个是在/data/vendor/wifi/hostapd下的文件,似乎是当前开启热点的hostapd配置文件

Image

tegzwn avatar Jan 20 '25 12:01 tegzwn

我这也是这个,那应该能够验证

---原始邮件--- 发件人: @.> 发送时间: 2025年1月20日(周一) 晚上8:01 收件人: @.>; 抄送: @.@.>; 主题: Re: [XhyEax/SoftApHelper] 关于隐藏热点类型在Android14上的问题 (Issue #31)

这个是在/data/vendor/wifi/hostapd下的文件,似乎是当前开启热点的hostapd配置文件

Screenshot_2025-01-20-19-58-56-729_bin.mt.plus.jpg (view on web)

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>

XhyEax avatar Jan 20 '25 12:01 XhyEax

我试试你说的hook点

---原始邮件--- 发件人: @.> 发送时间: 2025年1月20日(周一) 晚上8:01 收件人: @.>; 抄送: @.@.>; 主题: Re: [XhyEax/SoftApHelper] 关于隐藏热点类型在Android14上的问题 (Issue #31)

这个是在/data/vendor/wifi/hostapd下的文件,似乎是当前开启热点的hostapd配置文件

Screenshot_2025-01-20-19-58-56-729_bin.mt.plus.jpg (view on web)

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>

XhyEax avatar Jan 20 '25 12:01 XhyEax

用VPN热点开出来的热点呢

---原始邮件--- 发件人: @.> 发送时间: 2025年1月20日(周一) 晚上8:01 收件人: @.>; 抄送: @.@.>; 主题: Re: [XhyEax/SoftApHelper] 关于隐藏热点类型在Android14上的问题 (Issue #31)

这个是在/data/vendor/wifi/hostapd下的文件,似乎是当前开启热点的hostapd配置文件

Screenshot_2025-01-20-19-58-56-729_bin.mt.plus.jpg (view on web)

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>

XhyEax avatar Jan 20 '25 12:01 XhyEax

开wlan热点会有,开临时wlan热点没有

tegzwn avatar Jan 20 '25 12:01 tegzwn