分析WifiP2pService启动流程,主要流程参考流程图
从SystemServer开始分析:
frameworks/base/services/java/com/android/server/SystemServer.java
private static final String WIFI_P2P_SERVICE_CLASS =
"com.android.server.wifi.p2p.WifiP2pService";
frameworks/opt/net/wifi/service/java/com/android/server/wifi/p2p/WifiP2pService.java
frameworks/base/services/core/java/com/android/server/SystemServiceManager.java
frameworks/opt/net/wifi/service/java/com/android/server/wifi/p2p/WifiP2pServiceImpl.java
frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
Log信息:
SystemServer: StartWifiP2P
SystemServiceManager: Starting com.android.server.wifi.p2p.WifiP2pService
流程图:
P2pStateMachine状态图:
支持P2P的情况下,InitialState是P2pDisabledState;若在不支持P2P的情况下,InitialState是P2pNotSupportedState