diff options
author | Rebecca Silberstein <silberst@google.com> | 2017-06-06 19:10:35 +0000 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2017-06-06 19:10:35 +0000 |
commit | c75b04438e296b818ff3eb315e0ec2093d86d85c (patch) | |
tree | 3c32ea865a026411c3b0430d9cf18c82de89f2ee /service | |
parent | d8fe6e83c6abb4819715c2d5acd18cc0d8e81bfd (diff) | |
parent | 1e34b97fcfdc4c78817f15985a168f279b100afa (diff) |
Merge "WifiStateMachine: add iface name to ap updates" into oc-dev am: 70126fea67
am: 1e34b97fcf
Change-Id: Ia008e5608ea91f336be4656636965df3ac0ff2da
Diffstat (limited to 'service')
-rw-r--r-- | service/java/com/android/server/wifi/WifiServiceImpl.java | 11 | ||||
-rw-r--r-- | service/java/com/android/server/wifi/WifiStateMachine.java | 21 |
2 files changed, 28 insertions, 4 deletions
diff --git a/service/java/com/android/server/wifi/WifiServiceImpl.java b/service/java/com/android/server/wifi/WifiServiceImpl.java index 64fd684e4..b819e0d2c 100644 --- a/service/java/com/android/server/wifi/WifiServiceImpl.java +++ b/service/java/com/android/server/wifi/WifiServiceImpl.java @@ -18,6 +18,7 @@ package com.android.server.wifi; import static android.net.wifi.WifiManager.EXTRA_PREVIOUS_WIFI_AP_STATE; import static android.net.wifi.WifiManager.EXTRA_WIFI_AP_FAILURE_REASON; +import static android.net.wifi.WifiManager.EXTRA_WIFI_AP_INTERFACE_NAME; import static android.net.wifi.WifiManager.EXTRA_WIFI_AP_STATE; import static android.net.wifi.WifiManager.LocalOnlyHotspotCallback.ERROR_GENERIC; import static android.net.wifi.WifiManager.LocalOnlyHotspotCallback.ERROR_NO_CHANNEL; @@ -492,7 +493,9 @@ public class WifiServiceImpl extends IWifiManager.Stub { WIFI_AP_STATE_DISABLED); final int errorCode = intent.getIntExtra(EXTRA_WIFI_AP_FAILURE_REASON, HOTSPOT_NO_ERROR); - handleWifiApStateChange(currentState, prevState, errorCode); + final String ifaceName = + intent.getStringExtra(EXTRA_WIFI_AP_INTERFACE_NAME); + handleWifiApStateChange(currentState, prevState, errorCode, ifaceName); } }, new IntentFilter(WifiManager.WIFI_AP_STATE_CHANGED_ACTION)); @@ -994,10 +997,12 @@ public class WifiServiceImpl extends IWifiManager.Stub { /** * Private method to handle SoftAp state changes */ - private void handleWifiApStateChange(int currentState, int previousState, int errorCode) { + private void handleWifiApStateChange( + int currentState, int previousState, int errorCode, String ifaceName) { // The AP state update from WifiStateMachine for softap Slog.d(TAG, "handleWifiApStateChange: currentState=" + currentState - + " previousState=" + previousState + " errorCode= " + errorCode); + + " previousState=" + previousState + " errorCode= " + errorCode + + " ifaceName=" + ifaceName); // check if we have a failure - since it is possible (worst case scenario where // WifiController and WifiStateMachine are out of sync wrt modes) to get two FAILED diff --git a/service/java/com/android/server/wifi/WifiStateMachine.java b/service/java/com/android/server/wifi/WifiStateMachine.java index 4560225da..5d2745c4d 100644 --- a/service/java/com/android/server/wifi/WifiStateMachine.java +++ b/service/java/com/android/server/wifi/WifiStateMachine.java @@ -2807,6 +2807,10 @@ public class WifiStateMachine extends StateMachine implements WifiNative.WifiRss } private void setWifiApState(int wifiApState, int reason) { + setWifiApState(wifiApState, reason, null); + } + + private void setWifiApState(int wifiApState, int reason, String ifaceName) { final int previousWifiApState = mWifiApState.get(); try { @@ -2833,6 +2837,12 @@ public class WifiStateMachine extends StateMachine implements WifiNative.WifiRss intent.putExtra(WifiManager.EXTRA_WIFI_AP_FAILURE_REASON, reason); } + if (ifaceName == null) { + loge("Updating wifiApState with a null iface name"); + } else { + intent.putExtra(WifiManager.EXTRA_WIFI_AP_INTERFACE_NAME, ifaceName); + } + mContext.sendStickyBroadcastAsUser(intent, UserHandle.ALL); } @@ -6672,6 +6682,7 @@ public class WifiStateMachine extends StateMachine implements WifiNative.WifiRss class SoftApState extends State { private SoftApManager mSoftApManager; + private String mIfaceName; private class SoftApListener implements SoftApManager.Listener { @Override @@ -6682,7 +6693,7 @@ public class WifiStateMachine extends StateMachine implements WifiNative.WifiRss sendMessage(CMD_START_AP_FAILURE); } - setWifiApState(state, reason); + setWifiApState(state, reason, mIfaceName); } } @@ -6705,6 +6716,13 @@ public class WifiStateMachine extends StateMachine implements WifiNative.WifiRss return; } + try { + mIfaceName = apInterface.getInterfaceName(); + } catch (RemoteException e) { + // Failed to get the interface name. The name will not be available for + // the enabled broadcast, but since we had an error getting the name, we most likely + // won't be able to fully start softap mode. + } WifiConfiguration config = (WifiConfiguration) message.obj; checkAndSetConnectivityInstance(); @@ -6719,6 +6737,7 @@ public class WifiStateMachine extends StateMachine implements WifiNative.WifiRss @Override public void exit() { mSoftApManager = null; + mIfaceName = null; } @Override |