Android 8.0 Hostap流程(Softap)

版权声明:本文为博主原创文章,未经博主允许不得转载。

Android 8.0 Hostap流程(也叫Softap)

1)从Android 7.0开始,google已经从原先直接调用WifiManager.setWifiApEnabled()的方式,直接改成调用ConnectivityManager.startTethering()的方式了。
2)当修改AP配置时,也不用原先像mWifiManager.setWifiApEnabled(null, false),再mWifiManager.setWifiApEnabled(mWifiConfig, true)的方式。改成了当hostap关闭后,接收hostap的广播,再进行打开操作,这样避免了开关过快导致hostap不能再次打开的问题

修改的commit如下:
https://github.com/aosp-mirror/platform_packages_apps_settings/commit/ffb4fbb1a7a8df82fb8425321244cda4be5b76c2#diff-b5bd2dc5ae07339804903e3fccb75613

commit ffb4fbb1a7a8df82fb8425321244cda4be5b76c2
Author: Rebecca Silberstein @google.com>
Rebecca Silberstein committed on 5 Mar 2016 

    Save WifiAp config changes when hotspot is enabled
    We need to properly handle asynchronous events when WifiAp for hotspot
    is enabled and the user changes the config.  This CL changes the
    behavior to:
    1 - mark local boolean indicating a restart is needed
    2 - trigger the WifiAp to stop
    3 - save the new config
    4 - when the stop is complete (and the boolean is set), restart the
    WifiAp.

    Also fix a few style issues in the file.

    BUG:27460194
    Change-Id: I7e49ab9c49e125017cf83866a396701e440bf383

Hostap/Softap的流程如下:
Android 8.0 Hostap流程(Softap)_第1张图片

你可能感兴趣的:(Android)