使用 命令svc wifi来调试,避免使用GUI
相关资料 https://community.freescale.com/thread/319407
D/WifiService( 313): setWifiEnabled: true pid=892, uid=1000
在源码目录下 frameworks/base/services/java/com/android/server/WifiService.java
public synchronized boolean setWifiEnabled(boolean enable) {
enforceChangePermission();
Slog.d(TAG, "setWifiEnabled: " + enable + " pid=" + Binder.getCallingPid()
+ ", uid=" + Binder.getCallingUid());
if (DBG) {
Slog.e(TAG, "Invoking mWifiStateMachine.setWifiEnabled\n");
}
if (enable) {
reportStartWorkSource();
}
mWifiStateMachine.setWifiEnabled(enable);
........................................................................................
public void setWifiEnabled(boolean enable) {
mLastEnableUid.set(Binder.getCallingUid());
if (enable) {
/* Argument is the state that is entered prior to load */
sendMessage(obtainMessage(CMD_LOAD_DRIVER, WIFI_STATE_ENABLING, 0));
sendMessage(CMD_START_SUPPLICANT);
} else {
sendMessage(CMD_STOP_SUPPLICANT);
/* Argument is the state that is entered upon success */
sendMessage(obtainMessage(CMD_UNLOAD_DRIVER, WIFI_STATE_DISABLED, 0));
}
}
.........................................................................................
/*
* Caller might not have WRITE_SECURE_SETTINGS,
* only CHANGE_WIFI_STATE is enforced
*/
long ident = Binder.clearCallingIdentity();
try {
handleWifiToggled(enable);
} finally {
Binder.restoreCallingIdentity(ident);
}
if (enable) {
if (!mIsReceiverRegistered) {
registerForBroadcasts();
mIsReceiverRegistered = true;
}
} else if (mIsReceiverRegistered) {
mContext.unregisterReceiver(mReceiver);
mIsReceiverRegistered = false;
}
return true;
}
D/BluetoothAdapter( 892): 1103147976: getState() : mService = null. Returning STATE_OFF
D/Tethering( 313): sendTetherStateChangedBroadcast 1, 0, 0
D/WifiStateMachine( 313): CMD_START_SUPPLICANT
E/NetdConnector( 313): NDC Command {11 softap fwreload wlan0 STA} took too long (538ms)
E/WifiStateMachine( 313): Failed to reload STA firmware java.lang.IllegalStateException: command '35 softap fwreload wlan0 STA' failed with '400 35 Softap operation failed (Cannot assign requested address)'
frameworks/base/wifi/java/android/net/wifi/WifiStateMachine.java
DriverLoadedState
case CMD_START_SUPPLICANT:
Slog.d(TAG,"CMD_START_SUPPLICANT");
try {
mNwService.wifiFirmwareReload(mInterfaceName, "STA");
} catch (Exception e) {
loge("Failed to reload STA firmware " + e);
// continue
}
...........................................................................................
./base/services/java/com/android/server/NetworkManagementService.java
public void wifiFirmwareReload(String wlanIface, String mode) {
mContext.enforceCallingOrSelfPermission(CONNECTIVITY_INTERNAL, TAG);
try {
mConnector.execute("softap", "fwreload", wlanIface, mode);
} catch (NativeDaemonConnectorException e) {
throw e.rethrowAsParcelableException();
}
}
.............................................................................................
W/SocketClient( 64): write error (Broken pipe)
D/CommandListener( 64): Setting iface cfg
D/CommandListener( 64): Trying to bring down wlan0
I/wpa_supplicant( 926): Successfully initialized wpa_supplicant
I/wpa_supplicant( 926): rfkill: Cannot open RFKILL control device
D/Tethering( 313): InitialState.processMessage what=4
D/Tethering( 313): sendTetherStateChangedBroadcast 0, 0, 0
I/wpa_supplicant( 926): rfkill: Cannot open RFKILL control device
E/wpa_supplicant( 926): nl80211: Could not configure driver to use managed mode
E/wpa_supplicant( 926): Could not read interface p2p0 flags: No such device
E/wpa_supplicant( 926): p2p0: Failed to initialize driver interface
I/wpa_supplicant( 926): wlan0: CTRL-EVENT-TERMINATING
E/WifiHW ( 313): Supplicant not running, cannot connect
E/WifiHW ( 313): Supplicant not running, cannot connect
E/WifiHW ( 313): Supplicant not running, cannot connect
E/WifiHW ( 313): Supplicant not running, cannot connect
E/WifiHW ( 313): Supplicant not running, cannot connect