场景
一些非国产的rom包,比如:aosp,lineageOS,crdorid,PE,PixelOS等,在连接wifi 的时候,会显示一个感叹号,这就造成了一个情况,不能自动连接WIFI,无法自动WIFI调试。
解决方案
修改源码路径:packages/modules/NetworkStack/res/values/config.xml
源文本:
<string name="default_captive_portal_http_url" translatable="false">http://connectivitycheck.gstatic.com/generate_204</string>
<!-- HTTPS URL for network validation, to use for confirming internet connectivity. -->
<!-- default_captive_portal_https_url is not configured as overlayable so
OEMs that wish to change captive_portal_https_url configuration must
do so via configuring runtime resource overlay to
config_captive_portal_https_url and *NOT* by changing or overlaying
this resource. It will break if the enforcement of overlayable starts.
-->
<string name="default_captive_portal_https_url" translatable="false">https://www.google.com/generate_204</string>
<!-- List of fallback URLs to use for detecting captive portals. -->
<!-- default_captive_portal_fallback_urls is not configured as overlayable
so OEMs that wish to change captive_portal_fallback_urls configuration
must do so via configuring runtime resource overlay to
config_captive_portal_fallback_urls and *NOT* by changing or overlaying
this resource. It will break if the enforcement of overlayable starts.
-->
<string-array name="default_captive_portal_fallback_urls" translatable="false">
<item>http://www.google.com/gen_204</item>
<item>http://play.googleapis.com/generate_204</item>
</string-array>
修改后文本:
<string name="default_captive_portal_http_url" translatable="false">http://connect.rom.miui.com/generate_204</string>
<!-- HTTPS URL for network validation, to use for confirming internet connectivity. -->
<!-- default_captive_portal_https_url is not configured as overlayable so
OEMs that wish to change captive_portal_https_url configuration must
do so via configuring runtime resource overlay to
config_captive_portal_https_url and *NOT* by changing or overlaying
this resource. It will break if the enforcement of overlayable starts.
-->
<string name="default_captive_portal_https_url" translatable="false">https://connect.rom.miui.com/generate_204</string>
<!-- List of fallback URLs to use for detecting captive portals. -->
<!-- default_captive_portal_fallback_urls is not configured as overlayable
so OEMs that wish to change captive_portal_fallback_urls configuration
must do so via configuring runtime resource overlay to
config_captive_portal_fallback_urls and *NOT* by changing or overlaying
this resource. It will break if the enforcement of overlayable starts.
-->
<string-array name="default_captive_portal_fallback_urls" translatable="false">
<item>http://connect.rom.miui.com/gen_204</item>
<item>http://connect.rom.miui.com/generate_204</item>
</string-array>
就是把国外的地址,改成miui的就行。