summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--service/java/com/android/server/wifi/SoftApManager.java80
-rw-r--r--service/java/com/android/server/wifi/WifiServiceImpl.java38
-rw-r--r--tests/wifitests/src/com/android/server/wifi/ActiveModeWardenTest.java20
-rw-r--r--tests/wifitests/src/com/android/server/wifi/SoftApManagerTest.java101
-rw-r--r--tests/wifitests/src/com/android/server/wifi/WifiServiceImplTest.java13
5 files changed, 237 insertions, 15 deletions
diff --git a/service/java/com/android/server/wifi/SoftApManager.java b/service/java/com/android/server/wifi/SoftApManager.java
index c28d224ff..757c1de31 100644
--- a/service/java/com/android/server/wifi/SoftApManager.java
+++ b/service/java/com/android/server/wifi/SoftApManager.java
@@ -26,6 +26,7 @@ import android.content.Intent;
import android.database.ContentObserver;
import android.net.MacAddress;
import android.net.wifi.ScanResult;
+import android.net.wifi.SoftApInfo;
import android.net.wifi.WifiClient;
import android.net.wifi.WifiConfiguration;
import android.net.wifi.WifiManager;
@@ -48,6 +49,7 @@ import com.android.internal.util.WakeupMessage;
import com.android.server.wifi.WifiNative.InterfaceCallback;
import com.android.server.wifi.WifiNative.SoftApListener;
import com.android.server.wifi.util.ApConfigUtil;
+import com.android.server.wifi.wificond.IApInterfaceEventCallback;
import com.android.server.wifi.wificond.NativeWifiClient;
import java.io.FileDescriptor;
@@ -94,8 +96,8 @@ public class SoftApManager implements ActiveModeManager {
@NonNull
private SoftApModeConfiguration mApConfig;
- private int mReportedFrequency = -1;
- private int mReportedBandwidth = -1;
+ @NonNull
+ private SoftApInfo mCurrentSoftApInfo = new SoftApInfo();
private List<WifiClient> mConnectedClients = new ArrayList<>();
private boolean mTimeoutEnabled = false;
@@ -226,8 +228,7 @@ public class SoftApManager implements ActiveModeManager {
pw.println("mApConfig.wifiConfiguration.hiddenSSID: " + wifiConfig.hiddenSSID);
pw.println("mConnectedClients.size(): " + mConnectedClients.size());
pw.println("mTimeoutEnabled: " + mTimeoutEnabled);
- pw.println("mReportedFrequency: " + mReportedFrequency);
- pw.println("mReportedBandwidth: " + mReportedBandwidth);
+ pw.println("mCurrentSoftApInfo " + mCurrentSoftApInfo);
pw.println("mStartTimestamp: " + mStartTimestamp);
mStateMachine.dump(fd, pw, args);
}
@@ -600,6 +601,55 @@ public class SoftApManager implements ActiveModeManager {
return clients;
}
+ private void setSoftApChannel(int freq, int bandwidth) {
+ int apBandwidth;
+
+ Log.d(TAG, "Channel switched. Frequency: " + freq
+ + " Bandwidth: " + bandwidth);
+ switch(bandwidth) {
+ case IApInterfaceEventCallback.BANDWIDTH_INVALID:
+ apBandwidth = SoftApInfo.CHANNEL_WIDTH_INVALID;
+ break;
+ case IApInterfaceEventCallback.BANDWIDTH_20_NOHT:
+ apBandwidth = SoftApInfo.CHANNEL_WIDTH_20MHZ_NOHT;
+ break;
+ case IApInterfaceEventCallback.BANDWIDTH_20:
+ apBandwidth = SoftApInfo.CHANNEL_WIDTH_20MHZ;
+ break;
+ case IApInterfaceEventCallback.BANDWIDTH_40:
+ apBandwidth = SoftApInfo.CHANNEL_WIDTH_40MHZ;
+ break;
+ case IApInterfaceEventCallback.BANDWIDTH_80:
+ apBandwidth = SoftApInfo.CHANNEL_WIDTH_80MHZ;
+ break;
+ case IApInterfaceEventCallback.BANDWIDTH_80P80:
+ apBandwidth = SoftApInfo.CHANNEL_WIDTH_80MHZ_PLUS_MHZ;
+ break;
+ case IApInterfaceEventCallback.BANDWIDTH_160:
+ apBandwidth = SoftApInfo.CHANNEL_WIDTH_160MHZ;
+ break;
+ default:
+ apBandwidth = SoftApInfo.CHANNEL_WIDTH_INVALID;
+ break;
+ }
+
+ if (freq == mCurrentSoftApInfo.getFrequency()
+ && apBandwidth == mCurrentSoftApInfo.getBandwidth()) {
+ return; // no change
+ }
+
+ mCurrentSoftApInfo.setFrequency(freq);
+ mCurrentSoftApInfo.setBandwidth(apBandwidth);
+ mSoftApCallback.onInfoChanged(mCurrentSoftApInfo);
+
+ // ignore invalid freq and softap disable case for metrics
+ if (freq > 0 && apBandwidth != SoftApInfo.CHANNEL_WIDTH_INVALID) {
+ mWifiMetrics.addSoftApChannelSwitchedEvent(mCurrentSoftApInfo.getFrequency(),
+ mCurrentSoftApInfo.getBandwidth(), mApConfig.getTargetMode());
+ updateUserBandPreferenceViolationMetricsIfNeeded();
+ }
+ }
+
private void onUpChanged(boolean isUp) {
if (isUp == mIfaceIsUp) {
return; // no change
@@ -658,6 +708,7 @@ public class SoftApManager implements ActiveModeManager {
Log.d(TAG, "Resetting num stations on stop");
setConnectedClients(new ArrayList<>());
cancelTimeoutMessage();
+
// Need this here since we are exiting |Started| state and won't handle any
// future CMD_INTERFACE_STATUS_CHANGED events after this point
mWifiMetrics.addSoftApUpChangedEvent(false, mApConfig.getTargetMode());
@@ -671,18 +722,19 @@ public class SoftApManager implements ActiveModeManager {
mRole = ROLE_UNSPECIFIED;
mStateMachine.quitNow();
mModeListener.onStopped();
+ setSoftApChannel(0, SoftApInfo.CHANNEL_WIDTH_INVALID);
}
private void updateUserBandPreferenceViolationMetricsIfNeeded() {
int band = mApConfig.getWifiConfiguration().apBand;
boolean bandPreferenceViolated =
(band == WifiConfiguration.AP_BAND_2GHZ
- && ScanResult.is5GHz(mReportedFrequency))
- || (band == WifiConfiguration.AP_BAND_5GHZ
- && ScanResult.is24GHz(mReportedFrequency));
+ && ScanResult.is5GHz(mCurrentSoftApInfo.getFrequency()))
+ || (band == WifiConfiguration.AP_BAND_5GHZ
+ && ScanResult.is24GHz(mCurrentSoftApInfo.getFrequency()));
if (bandPreferenceViolated) {
Log.e(TAG, "Channel does not satisfy user band preference: "
- + mReportedFrequency);
+ + mCurrentSoftApInfo.getFrequency());
mWifiMetrics.incrementNumSoftApUserBandPreferenceUnsatisfied();
}
}
@@ -702,13 +754,11 @@ public class SoftApManager implements ActiveModeManager {
setConnectedClients((List<NativeWifiClient>) message.obj);
break;
case CMD_SOFT_AP_CHANNEL_SWITCHED:
- mReportedFrequency = message.arg1;
- mReportedBandwidth = message.arg2;
- Log.d(TAG, "Channel switched. Frequency: " + mReportedFrequency
- + " Bandwidth: " + mReportedBandwidth);
- mWifiMetrics.addSoftApChannelSwitchedEvent(mReportedFrequency,
- mReportedBandwidth, mApConfig.getTargetMode());
- updateUserBandPreferenceViolationMetricsIfNeeded();
+ if (message.arg1 < 0) {
+ Log.e(TAG, "Invalid ap channel frequency: " + message.arg1);
+ break;
+ }
+ setSoftApChannel(message.arg1, message.arg2);
break;
case CMD_TIMEOUT_TOGGLE_CHANGED:
boolean isEnabled = (message.arg1 == 1);
diff --git a/service/java/com/android/server/wifi/WifiServiceImpl.java b/service/java/com/android/server/wifi/WifiServiceImpl.java
index d2a4678ad..6ec72137b 100644
--- a/service/java/com/android/server/wifi/WifiServiceImpl.java
+++ b/service/java/com/android/server/wifi/WifiServiceImpl.java
@@ -59,6 +59,7 @@ import android.net.wifi.ITrafficStateCallback;
import android.net.wifi.ITxPacketCountListener;
import android.net.wifi.ScanResult;
import android.net.wifi.SoftApConfiguration;
+import android.net.wifi.SoftApInfo;
import android.net.wifi.WifiActivityEnergyInfo;
import android.net.wifi.WifiClient;
import android.net.wifi.WifiConfiguration;
@@ -838,6 +839,7 @@ public class WifiServiceImpl extends BaseWifiService {
private final Object mLock = new Object();
private int mTetheredSoftApState = WIFI_AP_STATE_DISABLED;
private List<WifiClient> mTetheredSoftApConnectedClients = new ArrayList<>();
+ private SoftApInfo mTetheredSoftApInfo = new SoftApInfo();
public int getState() {
synchronized (mLock) {
@@ -858,6 +860,10 @@ public class WifiServiceImpl extends BaseWifiService {
return mTetheredSoftApConnectedClients;
}
+ public SoftApInfo getSoftApInfo() {
+ return mTetheredSoftApInfo;
+ }
+
private final ExternalCallbackTracker<ISoftApCallback> mRegisteredSoftApCallbacks =
new ExternalCallbackTracker<>(mClientModeImplHandler);
@@ -921,6 +927,27 @@ public class WifiServiceImpl extends BaseWifiService {
}
}
}
+
+ /**
+ * Called when information of softap changes.
+ *
+ * @param softApInfo is the softap information. {@link SoftApInfo}
+ */
+ @Override
+ public void onInfoChanged(SoftApInfo softApInfo) {
+ mTetheredSoftApInfo = new SoftApInfo(softApInfo);
+
+ Iterator<ISoftApCallback> iterator =
+ mRegisteredSoftApCallbacks.getCallbacks().iterator();
+ while (iterator.hasNext()) {
+ ISoftApCallback callback = iterator.next();
+ try {
+ callback.onInfoChanged(mTetheredSoftApInfo);
+ } catch (RemoteException e) {
+ Log.e(TAG, "onInfoChanged: remote exception -- " + e);
+ }
+ }
+ }
}
/**
@@ -1247,6 +1274,16 @@ public class WifiServiceImpl extends BaseWifiService {
public void onConnectedClientsChanged(List<WifiClient> clients) {
// Nothing to do
}
+
+ /**
+ * Called when information of softap changes.
+ *
+ * @param softApInfo is the softap information. {@link SoftApInfo}
+ */
+ @Override
+ public void onInfoChanged(SoftApInfo softApInfo) {
+ // Nothing to do
+ }
}
/**
@@ -1288,6 +1325,7 @@ public class WifiServiceImpl extends BaseWifiService {
try {
callback.onStateChanged(mTetheredSoftApTracker.getState(), 0);
callback.onConnectedClientsChanged(mTetheredSoftApTracker.getConnectedClients());
+ callback.onInfoChanged(mTetheredSoftApTracker.getSoftApInfo());
} catch (RemoteException e) {
Log.e(TAG, "registerSoftApCallback: remote exception -- " + e);
}
diff --git a/tests/wifitests/src/com/android/server/wifi/ActiveModeWardenTest.java b/tests/wifitests/src/com/android/server/wifi/ActiveModeWardenTest.java
index 073ef4e3f..7d788c3d1 100644
--- a/tests/wifitests/src/com/android/server/wifi/ActiveModeWardenTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/ActiveModeWardenTest.java
@@ -45,6 +45,7 @@ import android.content.Intent;
import android.content.IntentFilter;
import android.content.res.Resources;
import android.location.LocationManager;
+import android.net.wifi.SoftApInfo;
import android.net.wifi.WifiClient;
import android.net.wifi.WifiConfiguration;
import android.net.wifi.WifiManager;
@@ -87,6 +88,8 @@ public class ActiveModeWardenTest extends WifiBaseTest {
private static final String WIFI_IFACE_NAME = "mockWlan";
private static final int TEST_WIFI_RECOVERY_DELAY_MS = 2000;
+ private static final int TEST_AP_FREQUENCY = 2412;
+ private static final int TEST_AP_BANDWIDTH = SoftApInfo.CHANNEL_WIDTH_20MHZ;
TestLooper mLooper;
@Mock WifiInjector mWifiInjector;
@@ -114,6 +117,7 @@ public class ActiveModeWardenTest extends WifiBaseTest {
@Mock WifiManager.SoftApCallback mLohsStateMachineCallback;
WifiNative.StatusListener mWifiNativeStatusListener;
ActiveModeWarden mActiveModeWarden;
+ private SoftApInfo mTestSoftApInfo;
final ArgumentCaptor<WifiNative.StatusListener> mStatusListenerCaptor =
ArgumentCaptor.forClass(WifiNative.StatusListener.class);
@@ -170,6 +174,9 @@ public class ActiveModeWardenTest extends WifiBaseTest {
mActiveModeWarden.registerSoftApCallback(mSoftApStateMachineCallback);
mActiveModeWarden.registerLohsCallback(mLohsStateMachineCallback);
+ mTestSoftApInfo = new SoftApInfo();
+ mTestSoftApInfo.setFrequency(TEST_AP_FREQUENCY);
+ mTestSoftApInfo.setBandwidth(TEST_AP_BANDWIDTH);
}
private ActiveModeWarden createActiveModeWarden() {
@@ -641,6 +648,7 @@ public class ActiveModeWardenTest extends WifiBaseTest {
verify(mSoftApStateMachineCallback, never()).onStateChanged(anyInt(), anyInt());
verify(mSoftApStateMachineCallback, never()).onConnectedClientsChanged(any());
+ verify(mSoftApStateMachineCallback, never()).onInfoChanged(any());
}
/**
@@ -657,6 +665,18 @@ public class ActiveModeWardenTest extends WifiBaseTest {
}
/**
+ * Verifies that SoftApInfoChanged event is being passed from SoftApManager to WifiServiceImpl
+ */
+ @Test
+ public void callsWifiServiceCallbackOnSoftApInfoChanged() throws Exception {
+ enterSoftApActiveMode();
+ mSoftApManagerCallback.onInfoChanged(mTestSoftApInfo);
+ mLooper.dispatchAll();
+
+ verify(mSoftApStateMachineCallback).onInfoChanged(mTestSoftApInfo);
+ }
+
+ /**
* Test that we remain in the active state when we get a state change update that scan mode is
* active.
*/
diff --git a/tests/wifitests/src/com/android/server/wifi/SoftApManagerTest.java b/tests/wifitests/src/com/android/server/wifi/SoftApManagerTest.java
index 9fd36fbd9..a00c1bac6 100644
--- a/tests/wifitests/src/com/android/server/wifi/SoftApManagerTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/SoftApManagerTest.java
@@ -54,6 +54,7 @@ import android.content.res.Resources;
import android.database.ContentObserver;
import android.net.MacAddress;
import android.net.Uri;
+import android.net.wifi.SoftApInfo;
import android.net.wifi.WifiClient;
import android.net.wifi.WifiConfiguration;
import android.net.wifi.WifiManager;
@@ -104,12 +105,17 @@ public class SoftApManagerTest extends WifiBaseTest {
};
private static final List<NativeWifiClient> TEST_CONNECTED_NATIVECLIENTS =
new ArrayList(Arrays.asList(TEST_NATIVE_CLIENT));
+ private static final int TEST_AP_FREQUENCY = 2412;
+ private static final int TEST_AP_BANDWIDTH_FROM_IFACE_CALLBACK =
+ IApInterfaceEventCallback.BANDWIDTH_20;
+ private static final int TEST_AP_BANDWIDTH_IN_SOFTAPINFO = SoftApInfo.CHANNEL_WIDTH_20MHZ;
private final WifiConfiguration mDefaultApConfig = createDefaultApConfig();
private ContentObserver mContentObserver;
private TestLooper mLooper;
private TestAlarmManager mAlarmManager;
+ private SoftApInfo mTestSoftApInfo;
@Mock Context mContext;
@Mock Resources mResources;
@@ -150,6 +156,9 @@ public class SoftApManagerTest extends WifiBaseTest {
when(mWifiNative.getFactoryMacAddress(any())).thenReturn(TEST_MAC_ADDRESS);
when(mWifiApConfigStore.randomizeBssidIfUnset(any(), any())).thenAnswer(
(invocation) -> invocation.getArgument(1));
+ mTestSoftApInfo = new SoftApInfo();
+ mTestSoftApInfo.setFrequency(TEST_AP_FREQUENCY);
+ mTestSoftApInfo.setBandwidth(TEST_AP_BANDWIDTH_IN_SOFTAPINFO);
}
private WifiConfiguration createDefaultApConfig() {
@@ -885,6 +894,98 @@ public class SoftApManagerTest extends WifiBaseTest {
verify(mWifiMetrics, never()).incrementNumSoftApUserBandPreferenceUnsatisfied();
}
+ /**
+ * If SoftApManager gets an update for the ap channal and the frequency, it will trigger
+ * callbacks to update softap information.
+ */
+ @Test
+ public void testOnSoftApChannelSwitchedEventTriggerSoftApInfoUpdate() throws Exception {
+ SoftApModeConfiguration apConfig =
+ new SoftApModeConfiguration(WifiManager.IFACE_IP_MODE_TETHERED, null);
+ startSoftApAndVerifyEnabled(apConfig);
+
+ mSoftApListenerCaptor.getValue().onSoftApChannelSwitched(
+ TEST_AP_FREQUENCY, TEST_AP_BANDWIDTH_FROM_IFACE_CALLBACK);
+ mLooper.dispatchAll();
+
+ verify(mCallback).onInfoChanged(mTestSoftApInfo);
+ verify(mWifiMetrics).addSoftApChannelSwitchedEvent(TEST_AP_FREQUENCY,
+ TEST_AP_BANDWIDTH_IN_SOFTAPINFO, apConfig.getTargetMode());
+ }
+
+ /**
+ * If SoftApManager gets an update for the ap channal and the frequency those are the same,
+ * do not trigger callbacks a second time.
+ */
+ @Test
+ public void testDoesNotTriggerCallbackForSameChannelInfoUpdate() throws Exception {
+ SoftApModeConfiguration apConfig =
+ new SoftApModeConfiguration(WifiManager.IFACE_IP_MODE_TETHERED, null);
+ startSoftApAndVerifyEnabled(apConfig);
+
+ mSoftApListenerCaptor.getValue().onSoftApChannelSwitched(
+ TEST_AP_FREQUENCY, TEST_AP_BANDWIDTH_FROM_IFACE_CALLBACK);
+ mLooper.dispatchAll();
+
+ // now trigger callback again, but we should have each method only called once
+ mSoftApListenerCaptor.getValue().onSoftApChannelSwitched(
+ TEST_AP_FREQUENCY, TEST_AP_BANDWIDTH_FROM_IFACE_CALLBACK);
+ mLooper.dispatchAll();
+
+ verify(mCallback).onInfoChanged(mTestSoftApInfo);
+ verify(mWifiMetrics).addSoftApChannelSwitchedEvent(TEST_AP_FREQUENCY,
+ TEST_AP_BANDWIDTH_IN_SOFTAPINFO, apConfig.getTargetMode());
+ }
+
+ /**
+ * If SoftApManager gets an update for the invalid ap frequency, it will not
+ * trigger callbacks
+ */
+ @Test
+ public void testHandlesInvalidChannelFrequency() throws Exception {
+ SoftApModeConfiguration apConfig =
+ new SoftApModeConfiguration(WifiManager.IFACE_IP_MODE_TETHERED, null);
+ startSoftApAndVerifyEnabled(apConfig);
+
+ mSoftApListenerCaptor.getValue().onSoftApChannelSwitched(
+ -1, TEST_AP_BANDWIDTH_FROM_IFACE_CALLBACK);
+ mLooper.dispatchAll();
+
+ verify(mCallback, never()).onInfoChanged(any());
+ verify(mWifiMetrics, never()).addSoftApChannelSwitchedEvent(anyInt(), anyInt(),
+ anyInt());
+ }
+
+ /**
+ * If softap leave started state, it should update softap inforation which frequency is 0 via
+ * trigger callbacks.
+ */
+ @Test
+ public void testCallbackForChannelUpdateToZeroWhenLeaveSoftapStarted() throws Exception {
+ InOrder order = inOrder(mCallback, mWifiMetrics);
+ SoftApModeConfiguration apConfig =
+ new SoftApModeConfiguration(WifiManager.IFACE_IP_MODE_TETHERED, null);
+ startSoftApAndVerifyEnabled(apConfig);
+
+ mSoftApListenerCaptor.getValue().onSoftApChannelSwitched(
+ TEST_AP_FREQUENCY, TEST_AP_BANDWIDTH_FROM_IFACE_CALLBACK);
+ mLooper.dispatchAll();
+
+ order.verify(mCallback).onInfoChanged(mTestSoftApInfo);
+ order.verify(mWifiMetrics).addSoftApChannelSwitchedEvent(TEST_AP_FREQUENCY,
+ TEST_AP_BANDWIDTH_IN_SOFTAPINFO, apConfig.getTargetMode());
+
+ mSoftApManager.stop();
+ mLooper.dispatchAll();
+
+ mTestSoftApInfo.setFrequency(0);
+ mTestSoftApInfo.setBandwidth(SoftApInfo.CHANNEL_WIDTH_INVALID);
+
+ order.verify(mCallback).onInfoChanged(mTestSoftApInfo);
+ order.verify(mWifiMetrics, never()).addSoftApChannelSwitchedEvent(0,
+ SoftApInfo.CHANNEL_WIDTH_INVALID, apConfig.getTargetMode());
+ }
+
@Test
public void updatesConnectedClients() throws Exception {
SoftApModeConfiguration apConfig =
diff --git a/tests/wifitests/src/com/android/server/wifi/WifiServiceImplTest.java b/tests/wifitests/src/com/android/server/wifi/WifiServiceImplTest.java
index 0c85dc132..ed0737cbb 100644
--- a/tests/wifitests/src/com/android/server/wifi/WifiServiceImplTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/WifiServiceImplTest.java
@@ -99,6 +99,7 @@ import android.net.wifi.ITrafficStateCallback;
import android.net.wifi.ITxPacketCountListener;
import android.net.wifi.ScanResult;
import android.net.wifi.SoftApConfiguration;
+import android.net.wifi.SoftApInfo;
import android.net.wifi.WifiClient;
import android.net.wifi.WifiConfiguration;
import android.net.wifi.WifiConfiguration.KeyMgmt;
@@ -198,7 +199,10 @@ public class WifiServiceImplTest extends WifiBaseTest {
4, 1100001, "\"yellow\"", true, true, "example.org", "Yellow"),
WifiConfigurationTestUtil.generateWifiConfig(
5, 1100002, "\"magenta\"", false, false, null, null));
+ private static final int TEST_AP_FREQUENCY = 2412;
+ private static final int TEST_AP_BANDWIDTH = SoftApInfo.CHANNEL_WIDTH_20MHZ;
+ private SoftApInfo mTestSoftApInfo;
private AsyncChannel mAsyncChannel;
private WifiServiceImpl mWifiServiceImpl;
private TestLooper mLooper;
@@ -383,6 +387,9 @@ public class WifiServiceImplTest extends WifiBaseTest {
// permission not granted by default
doThrow(SecurityException.class).when(mContext).enforceCallingOrSelfPermission(
eq(Manifest.permission.NETWORK_SETUP_WIZARD), any());
+ mTestSoftApInfo = new SoftApInfo();
+ mTestSoftApInfo.setFrequency(TEST_AP_FREQUENCY);
+ mTestSoftApInfo.setBandwidth(TEST_AP_BANDWIDTH);
}
/**
@@ -1925,6 +1932,7 @@ public class WifiServiceImplTest extends WifiBaseTest {
mLooper.dispatchAll();
verify(mClientSoftApCallback, never()).onStateChanged(WIFI_AP_STATE_DISABLED, 0);
verify(mClientSoftApCallback, never()).onConnectedClientsChanged(any());
+ verify(mClientSoftApCallback, never()).onInfoChanged(any());
}
@@ -1947,6 +1955,7 @@ public class WifiServiceImplTest extends WifiBaseTest {
mLooper.dispatchAll();
verify(callback).onStateChanged(WIFI_AP_STATE_DISABLED, 0);
verify(callback).onConnectedClientsChanged(Mockito.<WifiClient>anyList());
+ verify(callback).onInfoChanged(new SoftApInfo());
}
/**
@@ -2027,6 +2036,7 @@ public class WifiServiceImplTest extends WifiBaseTest {
final List<WifiClient> testClients = new ArrayList();
mStateMachineSoftApCallback.onStateChanged(WIFI_AP_STATE_ENABLED, 0);
mStateMachineSoftApCallback.onConnectedClientsChanged(testClients);
+ mStateMachineSoftApCallback.onInfoChanged(mTestSoftApInfo);
// Register another callback and verify the new state is returned in the immediate callback
final int anotherUid = 2;
@@ -2034,6 +2044,7 @@ public class WifiServiceImplTest extends WifiBaseTest {
mLooper.dispatchAll();
verify(mAnotherSoftApCallback).onStateChanged(WIFI_AP_STATE_ENABLED, 0);
verify(mAnotherSoftApCallback).onConnectedClientsChanged(testClients);
+ verify(mAnotherSoftApCallback).onInfoChanged(mTestSoftApInfo);
// unregister the fisrt callback
mWifiServiceImpl.unregisterSoftApCallback(callbackIdentifier);
@@ -2121,6 +2132,7 @@ public class WifiServiceImplTest extends WifiBaseTest {
final List<WifiClient> testClients = new ArrayList();
mStateMachineSoftApCallback.onStateChanged(WIFI_AP_STATE_ENABLED, 0);
mStateMachineSoftApCallback.onConnectedClientsChanged(testClients);
+ mStateMachineSoftApCallback.onInfoChanged(mTestSoftApInfo);
// Register callback after num clients and soft AP are changed.
final int callbackIdentifier = 1;
@@ -2129,6 +2141,7 @@ public class WifiServiceImplTest extends WifiBaseTest {
mLooper.dispatchAll();
verify(mClientSoftApCallback).onStateChanged(WIFI_AP_STATE_ENABLED, 0);
verify(mClientSoftApCallback).onConnectedClientsChanged(testClients);
+ verify(mClientSoftApCallback).onInfoChanged(mTestSoftApInfo);
}
private class IntentFilterMatcher implements ArgumentMatcher<IntentFilter> {