Loading core/java/android/os/INetworkManagementService.aidl +1 −1 Original line number Original line Diff line number Diff line Loading @@ -180,7 +180,7 @@ interface INetworkManagementService /** /** * Stop Wifi Access Point * Stop Wifi Access Point */ */ void stopAccessPoint(); void stopAccessPoint(String wlanIface); /** /** * Set Access Point config * Set Access Point config Loading services/java/com/android/server/NetworkManagementService.java +3 −2 Original line number Original line Diff line number Diff line Loading @@ -849,7 +849,6 @@ class NetworkManagementService extends INetworkManagementService.Stub { mContext.enforceCallingOrSelfPermission( mContext.enforceCallingOrSelfPermission( android.Manifest.permission.CHANGE_WIFI_STATE, "NetworkManagementService"); android.Manifest.permission.CHANGE_WIFI_STATE, "NetworkManagementService"); try { try { mConnector.doCommand(String.format("softap stop " + wlanIface)); mConnector.doCommand(String.format("softap fwreload " + wlanIface + " AP")); mConnector.doCommand(String.format("softap fwreload " + wlanIface + " AP")); mConnector.doCommand(String.format("softap start " + wlanIface)); mConnector.doCommand(String.format("softap start " + wlanIface)); if (wifiConfig == null) { if (wifiConfig == null) { Loading Loading @@ -897,13 +896,15 @@ class NetworkManagementService extends INetworkManagementService.Stub { } } } } public void stopAccessPoint() throws IllegalStateException { public void stopAccessPoint(String wlanIface) throws IllegalStateException { mContext.enforceCallingOrSelfPermission( mContext.enforceCallingOrSelfPermission( android.Manifest.permission.CHANGE_NETWORK_STATE, "NetworkManagementService"); android.Manifest.permission.CHANGE_NETWORK_STATE, "NetworkManagementService"); mContext.enforceCallingOrSelfPermission( mContext.enforceCallingOrSelfPermission( android.Manifest.permission.CHANGE_WIFI_STATE, "NetworkManagementService"); android.Manifest.permission.CHANGE_WIFI_STATE, "NetworkManagementService"); try { try { mConnector.doCommand("softap stopap"); mConnector.doCommand("softap stopap"); mConnector.doCommand("softap stop " + wlanIface); mConnector.doCommand(String.format("softap fwreload " + wlanIface + " STA")); } catch (NativeDaemonConnectorException e) { } catch (NativeDaemonConnectorException e) { throw new IllegalStateException("Error communicating to native daemon to stop soft AP", throw new IllegalStateException("Error communicating to native daemon to stop soft AP", e); e); Loading services/java/com/android/server/connectivity/Tethering.java +2 −0 Original line number Original line Diff line number Diff line Loading @@ -211,6 +211,8 @@ public class Tethering extends INetworkManagementEventObserver.Stub { } } public void interfaceLinkStateChanged(String iface, boolean up) { public void interfaceLinkStateChanged(String iface, boolean up) { if (DEBUG) Log.d(TAG, "interfaceLinkStateChanged " + iface + ", " + up); interfaceStatusChanged(iface, up); } } private boolean isUsb(String iface) { private boolean isUsb(String iface) { Loading wifi/java/android/net/wifi/WifiStateMachine.java +74 −28 Original line number Original line Diff line number Diff line Loading @@ -97,7 +97,7 @@ public class WifiStateMachine extends StateMachine { private static final String NETWORKTYPE = "WIFI"; private static final String NETWORKTYPE = "WIFI"; private static final boolean DBG = false; private static final boolean DBG = false; /* TODO: fetch a configurable interface */ /* TODO: This is no more used with the hostapd code. Clean up */ private static final String SOFTAP_IFACE = "wl0.1"; private static final String SOFTAP_IFACE = "wl0.1"; private WifiMonitor mWifiMonitor; private WifiMonitor mWifiMonitor; Loading Loading @@ -208,8 +208,10 @@ public class WifiStateMachine extends StateMachine { static final int CMD_SET_AP_CONFIG = BASE + 23; static final int CMD_SET_AP_CONFIG = BASE + 23; /* Get the soft access point configuration */ /* Get the soft access point configuration */ static final int CMD_GET_AP_CONFIG = BASE + 24; static final int CMD_GET_AP_CONFIG = BASE + 24; /* Set configuration on tether interface */ static final int CMD_TETHER_INTERFACE = BASE + 25; static final int CMD_BLUETOOTH_ADAPTER_STATE_CHANGE = BASE + 25; static final int CMD_BLUETOOTH_ADAPTER_STATE_CHANGE = BASE + 26; /* Supplicant events */ /* Supplicant events */ /* Connection to supplicant established */ /* Connection to supplicant established */ Loading Loading @@ -421,8 +423,10 @@ public class WifiStateMachine extends StateMachine { /* Waiting for WPS to be completed*/ /* Waiting for WPS to be completed*/ private State mWaitForWpsCompletionState = new WaitForWpsCompletionState(); private State mWaitForWpsCompletionState = new WaitForWpsCompletionState(); /* Soft Ap is running */ /* Soft ap is running */ private State mSoftApStartedState = new SoftApStartedState(); private State mSoftApStartedState = new SoftApStartedState(); /* Soft ap is running and we are tethered through connectivity service */ private State mTetheredState = new TetheredState(); /** /** Loading Loading @@ -513,13 +517,9 @@ public class WifiStateMachine extends StateMachine { new BroadcastReceiver() { new BroadcastReceiver() { @Override @Override public void onReceive(Context context, Intent intent) { public void onReceive(Context context, Intent intent) { ArrayList<String> available = intent.getStringArrayListExtra( ArrayList<String> available = intent.getStringArrayListExtra( ConnectivityManager.EXTRA_AVAILABLE_TETHER); ConnectivityManager.EXTRA_AVAILABLE_TETHER); ArrayList<String> active = intent.getStringArrayListExtra( sendMessage(CMD_TETHER_INTERFACE, available); ConnectivityManager.EXTRA_ACTIVE_TETHER); updateTetherState(available, active); } } },new IntentFilter(ConnectivityManager.ACTION_TETHER_STATE_CHANGED)); },new IntentFilter(ConnectivityManager.ACTION_TETHER_STATE_CHANGED)); Loading Loading @@ -559,6 +559,7 @@ public class WifiStateMachine extends StateMachine { addState(mDriverStoppedState, mSupplicantStartedState); addState(mDriverStoppedState, mSupplicantStartedState); addState(mSupplicantStoppingState, mDefaultState); addState(mSupplicantStoppingState, mDefaultState); addState(mSoftApStartedState, mDefaultState); addState(mSoftApStartedState, mDefaultState); addState(mTetheredState, mSoftApStartedState); setInitialState(mInitialState); setInitialState(mInitialState); Loading Loading @@ -1048,14 +1049,17 @@ public class WifiStateMachine extends StateMachine { * Internal private functions * Internal private functions ********************************************************/ ********************************************************/ private void updateTetherState(ArrayList<String> available, ArrayList<String> tethered) { private void checkAndSetConnectivityInstance() { boolean wifiTethered = false; boolean wifiAvailable = false; if (mCm == null) { if (mCm == null) { mCm = (ConnectivityManager) mContext.getSystemService(Context.CONNECTIVITY_SERVICE); mCm = (ConnectivityManager) mContext.getSystemService(Context.CONNECTIVITY_SERVICE); } } } private void startTethering(ArrayList<String> available) { boolean wifiAvailable = false; checkAndSetConnectivityInstance(); String[] wifiRegexs = mCm.getTetherableWifiRegexs(); String[] wifiRegexs = mCm.getTetherableWifiRegexs(); Loading Loading @@ -1091,6 +1095,29 @@ public class WifiStateMachine extends StateMachine { } } } } private void stopTethering() { checkAndSetConnectivityInstance(); /* Clear the interface config to allow dhcp correctly configure new ip settings */ InterfaceConfiguration ifcg = null; try { ifcg = nwService.getInterfaceConfig(mInterfaceName); if (ifcg != null) { ifcg.addr = new LinkAddress(NetworkUtils.numericToInetAddress( "0.0.0.0"), 0); nwService.setInterfaceConfig(mInterfaceName, ifcg); } } catch (Exception e) { Log.e(TAG, "Error resetting interface " + mInterfaceName + ", :" + e); } if (mCm.untether(mInterfaceName) != ConnectivityManager.TETHER_ERROR_NO_ERROR) { Log.e(TAG, "Untether initiate failed!"); } } /** /** * Set the country code from the system setting value, if any. * Set the country code from the system setting value, if any. */ */ Loading Loading @@ -1616,12 +1643,15 @@ public class WifiStateMachine extends StateMachine { if (currentStatus == SOFT_AP_STOPPED) { if (currentStatus == SOFT_AP_STOPPED) { nwService.startAccessPoint(config, mInterfaceName, SOFTAP_IFACE); nwService.startAccessPoint(config, mInterfaceName, SOFTAP_IFACE); } else if (currentStatus == SOFT_AP_RUNNING) { } else if (currentStatus == SOFT_AP_RUNNING) { nwService.setAccessPoint(config, mInterfaceName, SOFTAP_IFACE); //nwService.setAccessPoint(config, mInterfaceName, SOFTAP_IFACE); //TODO: when we have a control channel to hostapd, we should not need to do this nwService.stopAccessPoint(mInterfaceName); nwService.startAccessPoint(config, mInterfaceName, SOFTAP_IFACE); } } } catch (Exception e) { } catch (Exception e) { Log.e(TAG, "Exception in softap start " + e); Log.e(TAG, "Exception in softap start " + e); try { try { nwService.stopAccessPoint(); nwService.stopAccessPoint(mInterfaceName); nwService.startAccessPoint(config, mInterfaceName, SOFTAP_IFACE); nwService.startAccessPoint(config, mInterfaceName, SOFTAP_IFACE); } catch (Exception ee) { } catch (Exception ee) { Log.e(TAG, "Exception during softap restart : " + ee); Log.e(TAG, "Exception during softap restart : " + ee); Loading Loading @@ -1774,6 +1804,7 @@ public class WifiStateMachine extends StateMachine { case CMD_STOP_DRIVER: case CMD_STOP_DRIVER: case CMD_START_AP: case CMD_START_AP: case CMD_STOP_AP: case CMD_STOP_AP: case CMD_TETHER_INTERFACE: case CMD_START_SCAN: case CMD_START_SCAN: case CMD_DISCONNECT: case CMD_DISCONNECT: case CMD_RECONNECT: case CMD_RECONNECT: Loading Loading @@ -2828,10 +2859,7 @@ public class WifiStateMachine extends StateMachine { deferMessage(message); deferMessage(message); break; break; case CMD_REQUEST_CM_WAKELOCK: case CMD_REQUEST_CM_WAKELOCK: if (mCm == null) { checkAndSetConnectivityInstance(); mCm = (ConnectivityManager)mContext.getSystemService( Context.CONNECTIVITY_SERVICE); } mCm.requestNetworkTransitionWakelock(TAG); mCm.requestNetworkTransitionWakelock(TAG); break; break; case CMD_SET_SCAN_MODE: case CMD_SET_SCAN_MODE: Loading Loading @@ -3109,16 +3137,9 @@ public class WifiStateMachine extends StateMachine { case CMD_STOP_AP: case CMD_STOP_AP: Log.d(TAG,"Stopping Soft AP"); Log.d(TAG,"Stopping Soft AP"); setWifiApState(WIFI_AP_STATE_DISABLING); setWifiApState(WIFI_AP_STATE_DISABLING); stopTethering(); if (mCm == null) { mCm = (ConnectivityManager) mContext.getSystemService( Context.CONNECTIVITY_SERVICE); } if (mCm.untether(SOFTAP_IFACE) != ConnectivityManager.TETHER_ERROR_NO_ERROR) { Log.e(TAG, "Untether initiate failed!"); } try { try { nwService.stopAccessPoint(); nwService.stopAccessPoint(mInterfaceName); } catch(Exception e) { } catch(Exception e) { Log.e(TAG, "Exception in stopAccessPoint()"); Log.e(TAG, "Exception in stopAccessPoint()"); } } Loading @@ -3140,6 +3161,11 @@ public class WifiStateMachine extends StateMachine { Log.e(TAG,"Cannot start supplicant with a running soft AP"); Log.e(TAG,"Cannot start supplicant with a running soft AP"); setWifiState(WIFI_STATE_UNKNOWN); setWifiState(WIFI_STATE_UNKNOWN); break; break; case CMD_TETHER_INTERFACE: ArrayList<String> available = (ArrayList<String>) message.obj; startTethering(available); transitionTo(mTetheredState); break; default: default: return NOT_HANDLED; return NOT_HANDLED; } } Loading @@ -3147,4 +3173,24 @@ public class WifiStateMachine extends StateMachine { return HANDLED; return HANDLED; } } } } class TetheredState extends State { @Override public void enter() { if (DBG) Log.d(TAG, getName() + "\n"); EventLog.writeEvent(EVENTLOG_WIFI_STATE_CHANGED, getName()); } @Override public boolean processMessage(Message message) { if (DBG) Log.d(TAG, getName() + message.toString() + "\n"); switch(message.what) { case CMD_TETHER_INTERFACE: // Ignore any duplicate interface available notifications // when in tethered state return HANDLED; default: return NOT_HANDLED; } } } } } Loading
core/java/android/os/INetworkManagementService.aidl +1 −1 Original line number Original line Diff line number Diff line Loading @@ -180,7 +180,7 @@ interface INetworkManagementService /** /** * Stop Wifi Access Point * Stop Wifi Access Point */ */ void stopAccessPoint(); void stopAccessPoint(String wlanIface); /** /** * Set Access Point config * Set Access Point config Loading
services/java/com/android/server/NetworkManagementService.java +3 −2 Original line number Original line Diff line number Diff line Loading @@ -849,7 +849,6 @@ class NetworkManagementService extends INetworkManagementService.Stub { mContext.enforceCallingOrSelfPermission( mContext.enforceCallingOrSelfPermission( android.Manifest.permission.CHANGE_WIFI_STATE, "NetworkManagementService"); android.Manifest.permission.CHANGE_WIFI_STATE, "NetworkManagementService"); try { try { mConnector.doCommand(String.format("softap stop " + wlanIface)); mConnector.doCommand(String.format("softap fwreload " + wlanIface + " AP")); mConnector.doCommand(String.format("softap fwreload " + wlanIface + " AP")); mConnector.doCommand(String.format("softap start " + wlanIface)); mConnector.doCommand(String.format("softap start " + wlanIface)); if (wifiConfig == null) { if (wifiConfig == null) { Loading Loading @@ -897,13 +896,15 @@ class NetworkManagementService extends INetworkManagementService.Stub { } } } } public void stopAccessPoint() throws IllegalStateException { public void stopAccessPoint(String wlanIface) throws IllegalStateException { mContext.enforceCallingOrSelfPermission( mContext.enforceCallingOrSelfPermission( android.Manifest.permission.CHANGE_NETWORK_STATE, "NetworkManagementService"); android.Manifest.permission.CHANGE_NETWORK_STATE, "NetworkManagementService"); mContext.enforceCallingOrSelfPermission( mContext.enforceCallingOrSelfPermission( android.Manifest.permission.CHANGE_WIFI_STATE, "NetworkManagementService"); android.Manifest.permission.CHANGE_WIFI_STATE, "NetworkManagementService"); try { try { mConnector.doCommand("softap stopap"); mConnector.doCommand("softap stopap"); mConnector.doCommand("softap stop " + wlanIface); mConnector.doCommand(String.format("softap fwreload " + wlanIface + " STA")); } catch (NativeDaemonConnectorException e) { } catch (NativeDaemonConnectorException e) { throw new IllegalStateException("Error communicating to native daemon to stop soft AP", throw new IllegalStateException("Error communicating to native daemon to stop soft AP", e); e); Loading
services/java/com/android/server/connectivity/Tethering.java +2 −0 Original line number Original line Diff line number Diff line Loading @@ -211,6 +211,8 @@ public class Tethering extends INetworkManagementEventObserver.Stub { } } public void interfaceLinkStateChanged(String iface, boolean up) { public void interfaceLinkStateChanged(String iface, boolean up) { if (DEBUG) Log.d(TAG, "interfaceLinkStateChanged " + iface + ", " + up); interfaceStatusChanged(iface, up); } } private boolean isUsb(String iface) { private boolean isUsb(String iface) { Loading
wifi/java/android/net/wifi/WifiStateMachine.java +74 −28 Original line number Original line Diff line number Diff line Loading @@ -97,7 +97,7 @@ public class WifiStateMachine extends StateMachine { private static final String NETWORKTYPE = "WIFI"; private static final String NETWORKTYPE = "WIFI"; private static final boolean DBG = false; private static final boolean DBG = false; /* TODO: fetch a configurable interface */ /* TODO: This is no more used with the hostapd code. Clean up */ private static final String SOFTAP_IFACE = "wl0.1"; private static final String SOFTAP_IFACE = "wl0.1"; private WifiMonitor mWifiMonitor; private WifiMonitor mWifiMonitor; Loading Loading @@ -208,8 +208,10 @@ public class WifiStateMachine extends StateMachine { static final int CMD_SET_AP_CONFIG = BASE + 23; static final int CMD_SET_AP_CONFIG = BASE + 23; /* Get the soft access point configuration */ /* Get the soft access point configuration */ static final int CMD_GET_AP_CONFIG = BASE + 24; static final int CMD_GET_AP_CONFIG = BASE + 24; /* Set configuration on tether interface */ static final int CMD_TETHER_INTERFACE = BASE + 25; static final int CMD_BLUETOOTH_ADAPTER_STATE_CHANGE = BASE + 25; static final int CMD_BLUETOOTH_ADAPTER_STATE_CHANGE = BASE + 26; /* Supplicant events */ /* Supplicant events */ /* Connection to supplicant established */ /* Connection to supplicant established */ Loading Loading @@ -421,8 +423,10 @@ public class WifiStateMachine extends StateMachine { /* Waiting for WPS to be completed*/ /* Waiting for WPS to be completed*/ private State mWaitForWpsCompletionState = new WaitForWpsCompletionState(); private State mWaitForWpsCompletionState = new WaitForWpsCompletionState(); /* Soft Ap is running */ /* Soft ap is running */ private State mSoftApStartedState = new SoftApStartedState(); private State mSoftApStartedState = new SoftApStartedState(); /* Soft ap is running and we are tethered through connectivity service */ private State mTetheredState = new TetheredState(); /** /** Loading Loading @@ -513,13 +517,9 @@ public class WifiStateMachine extends StateMachine { new BroadcastReceiver() { new BroadcastReceiver() { @Override @Override public void onReceive(Context context, Intent intent) { public void onReceive(Context context, Intent intent) { ArrayList<String> available = intent.getStringArrayListExtra( ArrayList<String> available = intent.getStringArrayListExtra( ConnectivityManager.EXTRA_AVAILABLE_TETHER); ConnectivityManager.EXTRA_AVAILABLE_TETHER); ArrayList<String> active = intent.getStringArrayListExtra( sendMessage(CMD_TETHER_INTERFACE, available); ConnectivityManager.EXTRA_ACTIVE_TETHER); updateTetherState(available, active); } } },new IntentFilter(ConnectivityManager.ACTION_TETHER_STATE_CHANGED)); },new IntentFilter(ConnectivityManager.ACTION_TETHER_STATE_CHANGED)); Loading Loading @@ -559,6 +559,7 @@ public class WifiStateMachine extends StateMachine { addState(mDriverStoppedState, mSupplicantStartedState); addState(mDriverStoppedState, mSupplicantStartedState); addState(mSupplicantStoppingState, mDefaultState); addState(mSupplicantStoppingState, mDefaultState); addState(mSoftApStartedState, mDefaultState); addState(mSoftApStartedState, mDefaultState); addState(mTetheredState, mSoftApStartedState); setInitialState(mInitialState); setInitialState(mInitialState); Loading Loading @@ -1048,14 +1049,17 @@ public class WifiStateMachine extends StateMachine { * Internal private functions * Internal private functions ********************************************************/ ********************************************************/ private void updateTetherState(ArrayList<String> available, ArrayList<String> tethered) { private void checkAndSetConnectivityInstance() { boolean wifiTethered = false; boolean wifiAvailable = false; if (mCm == null) { if (mCm == null) { mCm = (ConnectivityManager) mContext.getSystemService(Context.CONNECTIVITY_SERVICE); mCm = (ConnectivityManager) mContext.getSystemService(Context.CONNECTIVITY_SERVICE); } } } private void startTethering(ArrayList<String> available) { boolean wifiAvailable = false; checkAndSetConnectivityInstance(); String[] wifiRegexs = mCm.getTetherableWifiRegexs(); String[] wifiRegexs = mCm.getTetherableWifiRegexs(); Loading Loading @@ -1091,6 +1095,29 @@ public class WifiStateMachine extends StateMachine { } } } } private void stopTethering() { checkAndSetConnectivityInstance(); /* Clear the interface config to allow dhcp correctly configure new ip settings */ InterfaceConfiguration ifcg = null; try { ifcg = nwService.getInterfaceConfig(mInterfaceName); if (ifcg != null) { ifcg.addr = new LinkAddress(NetworkUtils.numericToInetAddress( "0.0.0.0"), 0); nwService.setInterfaceConfig(mInterfaceName, ifcg); } } catch (Exception e) { Log.e(TAG, "Error resetting interface " + mInterfaceName + ", :" + e); } if (mCm.untether(mInterfaceName) != ConnectivityManager.TETHER_ERROR_NO_ERROR) { Log.e(TAG, "Untether initiate failed!"); } } /** /** * Set the country code from the system setting value, if any. * Set the country code from the system setting value, if any. */ */ Loading Loading @@ -1616,12 +1643,15 @@ public class WifiStateMachine extends StateMachine { if (currentStatus == SOFT_AP_STOPPED) { if (currentStatus == SOFT_AP_STOPPED) { nwService.startAccessPoint(config, mInterfaceName, SOFTAP_IFACE); nwService.startAccessPoint(config, mInterfaceName, SOFTAP_IFACE); } else if (currentStatus == SOFT_AP_RUNNING) { } else if (currentStatus == SOFT_AP_RUNNING) { nwService.setAccessPoint(config, mInterfaceName, SOFTAP_IFACE); //nwService.setAccessPoint(config, mInterfaceName, SOFTAP_IFACE); //TODO: when we have a control channel to hostapd, we should not need to do this nwService.stopAccessPoint(mInterfaceName); nwService.startAccessPoint(config, mInterfaceName, SOFTAP_IFACE); } } } catch (Exception e) { } catch (Exception e) { Log.e(TAG, "Exception in softap start " + e); Log.e(TAG, "Exception in softap start " + e); try { try { nwService.stopAccessPoint(); nwService.stopAccessPoint(mInterfaceName); nwService.startAccessPoint(config, mInterfaceName, SOFTAP_IFACE); nwService.startAccessPoint(config, mInterfaceName, SOFTAP_IFACE); } catch (Exception ee) { } catch (Exception ee) { Log.e(TAG, "Exception during softap restart : " + ee); Log.e(TAG, "Exception during softap restart : " + ee); Loading Loading @@ -1774,6 +1804,7 @@ public class WifiStateMachine extends StateMachine { case CMD_STOP_DRIVER: case CMD_STOP_DRIVER: case CMD_START_AP: case CMD_START_AP: case CMD_STOP_AP: case CMD_STOP_AP: case CMD_TETHER_INTERFACE: case CMD_START_SCAN: case CMD_START_SCAN: case CMD_DISCONNECT: case CMD_DISCONNECT: case CMD_RECONNECT: case CMD_RECONNECT: Loading Loading @@ -2828,10 +2859,7 @@ public class WifiStateMachine extends StateMachine { deferMessage(message); deferMessage(message); break; break; case CMD_REQUEST_CM_WAKELOCK: case CMD_REQUEST_CM_WAKELOCK: if (mCm == null) { checkAndSetConnectivityInstance(); mCm = (ConnectivityManager)mContext.getSystemService( Context.CONNECTIVITY_SERVICE); } mCm.requestNetworkTransitionWakelock(TAG); mCm.requestNetworkTransitionWakelock(TAG); break; break; case CMD_SET_SCAN_MODE: case CMD_SET_SCAN_MODE: Loading Loading @@ -3109,16 +3137,9 @@ public class WifiStateMachine extends StateMachine { case CMD_STOP_AP: case CMD_STOP_AP: Log.d(TAG,"Stopping Soft AP"); Log.d(TAG,"Stopping Soft AP"); setWifiApState(WIFI_AP_STATE_DISABLING); setWifiApState(WIFI_AP_STATE_DISABLING); stopTethering(); if (mCm == null) { mCm = (ConnectivityManager) mContext.getSystemService( Context.CONNECTIVITY_SERVICE); } if (mCm.untether(SOFTAP_IFACE) != ConnectivityManager.TETHER_ERROR_NO_ERROR) { Log.e(TAG, "Untether initiate failed!"); } try { try { nwService.stopAccessPoint(); nwService.stopAccessPoint(mInterfaceName); } catch(Exception e) { } catch(Exception e) { Log.e(TAG, "Exception in stopAccessPoint()"); Log.e(TAG, "Exception in stopAccessPoint()"); } } Loading @@ -3140,6 +3161,11 @@ public class WifiStateMachine extends StateMachine { Log.e(TAG,"Cannot start supplicant with a running soft AP"); Log.e(TAG,"Cannot start supplicant with a running soft AP"); setWifiState(WIFI_STATE_UNKNOWN); setWifiState(WIFI_STATE_UNKNOWN); break; break; case CMD_TETHER_INTERFACE: ArrayList<String> available = (ArrayList<String>) message.obj; startTethering(available); transitionTo(mTetheredState); break; default: default: return NOT_HANDLED; return NOT_HANDLED; } } Loading @@ -3147,4 +3173,24 @@ public class WifiStateMachine extends StateMachine { return HANDLED; return HANDLED; } } } } class TetheredState extends State { @Override public void enter() { if (DBG) Log.d(TAG, getName() + "\n"); EventLog.writeEvent(EVENTLOG_WIFI_STATE_CHANGED, getName()); } @Override public boolean processMessage(Message message) { if (DBG) Log.d(TAG, getName() + message.toString() + "\n"); switch(message.what) { case CMD_TETHER_INTERFACE: // Ignore any duplicate interface available notifications // when in tethered state return HANDLED; default: return NOT_HANDLED; } } } } }