I am trying to trace the wifi settings code. My intention is to know the flow from application to kernel layer after toggling the WIFI button OFF to ON.
While we go to Settings page in Android, toggle the WLAN(WIFI) button, then your wifi should be enabled.
I found that this page corresponds to
WifiSettings.java
. In this file, while you toggle the button from OFF to ON:private void updateWifiState(int state) { getActivity().invalidateOptionsMenu(); switch (state) { case WifiManager.WIFI_STATE_ENABLING: addMessagePreference(R.string.wifi_starting); break; } mLastInfo = null; mLastState = null; mScanner.pause(); }
This function will be called.
I then go to check
WifiManager.java
. I found:/** * Wi-Fi is currently being enabled. The state will change to {@link#WIFI_STATE_ENABLED} if it finishes successfully. * * @see #WIFI_STATE_CHANGED_ACTION * @see #getWifiState() */ public static final int WIFI_STATE_ENABLING = 2;
However, after this, I did not really understand how to dig deeper in tracing the flow.