summaryrefslogtreecommitdiff
path: root/service
diff options
context:
space:
mode:
Diffstat (limited to 'service')
-rw-r--r--service/java/com/android/server/wifi/WifiServiceImpl.java11
-rw-r--r--service/java/com/android/server/wifi/WifiStateMachine.java21
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 ec05f7cec..1b3334d5f 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;
@@ -491,7 +492,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));
@@ -993,10 +996,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 7f57316a6..5ac8a3520 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);
}
@@ -6667,6 +6677,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
@@ -6677,7 +6688,7 @@ public class WifiStateMachine extends StateMachine implements WifiNative.WifiRss
sendMessage(CMD_START_AP_FAILURE);
}
- setWifiApState(state, reason);
+ setWifiApState(state, reason, mIfaceName);
}
}
@@ -6700,6 +6711,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();
@@ -6714,6 +6732,7 @@ public class WifiStateMachine extends StateMachine implements WifiNative.WifiRss
@Override
public void exit() {
mSoftApManager = null;
+ mIfaceName = null;
}
@Override