summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorNate Jiang <qiangjiang@google.com>2020-04-07 20:46:05 -0700
committerNate Jiang <qiangjiang@google.com>2020-04-09 09:16:11 -0700
commitbe30bfa05fcc465cf2f37a75ef0b5fbbd058d1b1 (patch)
treef74a0b4612b7df20dbf918eca34f351ebc551cd2 /tests
parent7faeb01bd0764cda06d8d915f43a5d968211e842 (diff)
Move IMSI notification to WifiCarrierInfoManager
Moving the IMSI protection notification from WifiNetworkSuggestionManager to WifiCarrierInfoManager. Because we will call and send notification from multiple class. Bug: 153109682 Test: atest com.android.server.wifi Change-Id: Ie950403932130cf82ebaee48555b6586c17827f7
Diffstat (limited to 'tests')
-rw-r--r--tests/wifitests/src/com/android/server/wifi/ClientModeImplTest.java4
-rw-r--r--tests/wifitests/src/com/android/server/wifi/ImsiPrivacyProtectionExemptionStoreDataTest.java2
-rw-r--r--tests/wifitests/src/com/android/server/wifi/WifiCarrierInfoManagerTest.java360
-rw-r--r--tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java4
-rw-r--r--tests/wifitests/src/com/android/server/wifi/WifiNetworkSuggestionsManagerTest.java178
-rw-r--r--tests/wifitests/src/com/android/server/wifi/hotspot2/PasspointManagerTest.java5
6 files changed, 366 insertions, 187 deletions
diff --git a/tests/wifitests/src/com/android/server/wifi/ClientModeImplTest.java b/tests/wifitests/src/com/android/server/wifi/ClientModeImplTest.java
index 2b87a2820..17fc1a7f8 100644
--- a/tests/wifitests/src/com/android/server/wifi/ClientModeImplTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/ClientModeImplTest.java
@@ -542,8 +542,8 @@ public class ClientModeImplTest extends WifiBaseTest {
.thenReturn(new int[]{DATA_SUBID});
WifiCarrierInfoManager tu = new WifiCarrierInfoManager(mTelephonyManager,
- mSubscriptionManager,
- mock(FrameworkFacade.class), mock(Context.class), mock(Handler.class));
+ mSubscriptionManager, mWifiInjector, mock(FrameworkFacade.class),
+ mock(WifiContext.class), mock(WifiConfigStore.class), mock(Handler.class));
mWifiCarrierInfoManager = spy(tu);
// static mocking
mSession = ExtendedMockito.mockitoSession().strictness(Strictness.LENIENT)
diff --git a/tests/wifitests/src/com/android/server/wifi/ImsiPrivacyProtectionExemptionStoreDataTest.java b/tests/wifitests/src/com/android/server/wifi/ImsiPrivacyProtectionExemptionStoreDataTest.java
index f9e05cb32..ec2142dbf 100644
--- a/tests/wifitests/src/com/android/server/wifi/ImsiPrivacyProtectionExemptionStoreDataTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/ImsiPrivacyProtectionExemptionStoreDataTest.java
@@ -79,7 +79,7 @@ public class ImsiPrivacyProtectionExemptionStoreDataTest {
*/
@Test
public void verifyStoreFileId() throws Exception {
- assertEquals(WifiConfigStore.STORE_FILE_USER_NETWORK_SUGGESTIONS,
+ assertEquals(WifiConfigStore.STORE_FILE_USER_GENERAL,
mImsiPrivacyProtectionExemptionStoreData.getStoreFileId());
}
diff --git a/tests/wifitests/src/com/android/server/wifi/WifiCarrierInfoManagerTest.java b/tests/wifitests/src/com/android/server/wifi/WifiCarrierInfoManagerTest.java
index bbc3a1c3b..1053d733f 100644
--- a/tests/wifitests/src/com/android/server/wifi/WifiCarrierInfoManagerTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/WifiCarrierInfoManagerTest.java
@@ -18,14 +18,23 @@ package com.android.server.wifi;
import static com.android.dx.mockito.inline.extended.ExtendedMockito.doReturn;
import static com.android.dx.mockito.inline.extended.ExtendedMockito.when;
+import static com.android.server.wifi.WifiCarrierInfoManager.NOTIFICATION_USER_ALLOWED_CARRIER_INTENT_ACTION;
+import static com.android.server.wifi.WifiCarrierInfoManager.NOTIFICATION_USER_DISALLOWED_CARRIER_INTENT_ACTION;
+import static com.android.server.wifi.WifiCarrierInfoManager.NOTIFICATION_USER_DISMISSED_INTENT_ACTION;
import static org.junit.Assert.*;
import static org.mockito.Mockito.*;
+import android.app.AlertDialog;
+import android.app.Notification;
+import android.app.NotificationManager;
+import android.app.PendingIntent;
import android.content.BroadcastReceiver;
import android.content.Context;
+import android.content.DialogInterface;
import android.content.Intent;
import android.content.IntentFilter;
+import android.content.res.Resources;
import android.database.ContentObserver;
import android.net.Uri;
import android.net.wifi.WifiConfiguration;
@@ -42,17 +51,21 @@ import android.telephony.SubscriptionManager;
import android.telephony.TelephonyManager;
import android.util.Base64;
import android.util.Pair;
+import android.view.Window;
import androidx.test.filters.SmallTest;
import com.android.dx.mockito.inline.extended.ExtendedMockito;
+import com.android.internal.messages.nano.SystemMessageProto.SystemMessage;
import com.android.server.wifi.WifiCarrierInfoManager.SimAuthRequestData;
import com.android.server.wifi.WifiCarrierInfoManager.SimAuthResponseData;
+import com.android.wifi.resources.R;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.mockito.ArgumentCaptor;
+import org.mockito.InOrder;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.mockito.MockitoSession;
@@ -94,29 +107,34 @@ public class WifiCarrierInfoManagerTest extends WifiBaseTest {
private static final String ANONYMOUS_IDENTITY = "anonymous@wlan.mnc456.mcc123.3gppnetwork.org";
private static final String CARRIER_NAME = "Google";
- @Mock
- CarrierConfigManager mCarrierConfigManager;
- @Mock
- Context mContext;
- @Mock
- FrameworkFacade mFrameworkFacade;
- @Mock
- TelephonyManager mTelephonyManager;
- @Mock
- TelephonyManager mDataTelephonyManager;
- @Mock
- TelephonyManager mNonDataTelephonyManager;
- @Mock
- SubscriptionManager mSubscriptionManager;
- @Mock
- SubscriptionInfo mDataSubscriptionInfo;
- @Mock
- SubscriptionInfo mNonDataSubscriptionInfo;
+ @Mock CarrierConfigManager mCarrierConfigManager;
+ @Mock WifiContext mContext;
+ @Mock Resources mResources;
+ @Mock FrameworkFacade mFrameworkFacade;
+ @Mock TelephonyManager mTelephonyManager;
+ @Mock TelephonyManager mDataTelephonyManager;
+ @Mock TelephonyManager mNonDataTelephonyManager;
+ @Mock SubscriptionManager mSubscriptionManager;
+ @Mock SubscriptionInfo mDataSubscriptionInfo;
+ @Mock SubscriptionInfo mNonDataSubscriptionInfo;
+ @Mock WifiConfigStore mWifiConfigStore;
+ @Mock WifiInjector mWifiInjector;
+ @Mock WifiConfigManager mWifiConfigManager;
+ @Mock ImsiPrivacyProtectionExemptionStoreData mImsiPrivacyProtectionExemptionStoreData;
+ @Mock NotificationManager mNotificationManger;
+ @Mock Notification.Builder mNotificationBuilder;
+ @Mock Notification mNotification;
+ @Mock AlertDialog.Builder mAlertDialogBuilder;
+ @Mock AlertDialog mAlertDialog;
+ @Mock WifiCarrierInfoManager.OnUserApproveCarrierListener mListener;
private List<SubscriptionInfo> mSubInfoList;
MockitoSession mMockingSession = null;
TestLooper mLooper;
+ private ImsiPrivacyProtectionExemptionStoreData.DataSource mImsiDataSource;
+ private ArgumentCaptor<BroadcastReceiver> mBroadcastReceiverCaptor =
+ ArgumentCaptor.forClass(BroadcastReceiver.class);
@Before
public void setUp() throws Exception {
@@ -124,8 +142,48 @@ public class WifiCarrierInfoManagerTest extends WifiBaseTest {
mLooper = new TestLooper();
when(mContext.getSystemService(Context.CARRIER_CONFIG_SERVICE))
.thenReturn(mCarrierConfigManager);
+ when(mContext.getResources()).thenReturn(mResources);
+ when(mContext.getSystemService(Context.NOTIFICATION_SERVICE))
+ .thenReturn(mNotificationManger);
+ when(mContext.getWifiOverlayApkPkgName()).thenReturn("test.com.android.wifi.resources");
+ when(mFrameworkFacade.makeAlertDialogBuilder(any()))
+ .thenReturn(mAlertDialogBuilder);
+ when(mFrameworkFacade.makeNotificationBuilder(any(), anyString()))
+ .thenReturn(mNotificationBuilder);
+ when(mFrameworkFacade.getBroadcast(any(), anyInt(), any(), anyInt()))
+ .thenReturn(mock(PendingIntent.class));
+ when(mAlertDialogBuilder.setTitle(any())).thenReturn(mAlertDialogBuilder);
+ when(mAlertDialogBuilder.setMessage(any())).thenReturn(mAlertDialogBuilder);
+ when(mAlertDialogBuilder.setPositiveButton(any(), any())).thenReturn(mAlertDialogBuilder);
+ when(mAlertDialogBuilder.setNegativeButton(any(), any())).thenReturn(mAlertDialogBuilder);
+ when(mAlertDialogBuilder.setOnDismissListener(any())).thenReturn(mAlertDialogBuilder);
+ when(mAlertDialogBuilder.setOnCancelListener(any())).thenReturn(mAlertDialogBuilder);
+ when(mAlertDialogBuilder.create()).thenReturn(mAlertDialog);
+ when(mAlertDialog.getWindow()).thenReturn(mock(Window.class));
+ when(mNotificationBuilder.setSmallIcon(any())).thenReturn(mNotificationBuilder);
+ when(mNotificationBuilder.setTicker(any())).thenReturn(mNotificationBuilder);
+ when(mNotificationBuilder.setContentTitle(any())).thenReturn(mNotificationBuilder);
+ when(mNotificationBuilder.setStyle(any())).thenReturn(mNotificationBuilder);
+ when(mNotificationBuilder.setDeleteIntent(any())).thenReturn(mNotificationBuilder);
+ when(mNotificationBuilder.setShowWhen(anyBoolean())).thenReturn(mNotificationBuilder);
+ when(mNotificationBuilder.setLocalOnly(anyBoolean())).thenReturn(mNotificationBuilder);
+ when(mNotificationBuilder.setColor(anyInt())).thenReturn(mNotificationBuilder);
+ when(mNotificationBuilder.addAction(any())).thenReturn(mNotificationBuilder);
+ when(mNotificationBuilder.build()).thenReturn(mNotification);
+ when(mWifiInjector.makeImsiProtectionExemptionStoreData(any()))
+ .thenReturn(mImsiPrivacyProtectionExemptionStoreData);
+ when(mWifiInjector.getWifiConfigManager()).thenReturn(mWifiConfigManager);
mWifiCarrierInfoManager = new WifiCarrierInfoManager(mTelephonyManager,
- mSubscriptionManager, mFrameworkFacade, mContext, new Handler(mLooper.getLooper()));
+ mSubscriptionManager, mWifiInjector, mFrameworkFacade, mContext, mWifiConfigStore,
+ new Handler(mLooper.getLooper()));
+ ArgumentCaptor<ImsiPrivacyProtectionExemptionStoreData.DataSource>
+ imsiDataSourceArgumentCaptor =
+ ArgumentCaptor.forClass(ImsiPrivacyProtectionExemptionStoreData.DataSource.class);
+ verify(mContext).registerReceiver(mBroadcastReceiverCaptor.capture(), any(), any(), any());
+ verify(mWifiInjector).makeImsiProtectionExemptionStoreData(imsiDataSourceArgumentCaptor
+ .capture());
+ mImsiDataSource = imsiDataSourceArgumentCaptor.getValue();
+ assertNotNull(mImsiDataSource);
mSubInfoList = new ArrayList<>();
mSubInfoList.add(mDataSubscriptionInfo);
mSubInfoList.add(mNonDataSubscriptionInfo);
@@ -160,6 +218,31 @@ public class WifiCarrierInfoManagerTest extends WifiBaseTest {
when(mNonDataTelephonyManager.getSimState()).thenReturn(TelephonyManager.SIM_STATE_READY);
when(mSubscriptionManager.getActiveSubscriptionIdList())
.thenReturn(new int[]{DATA_SUBID, NON_DATA_SUBID});
+
+ // setup resource strings for IMSI protection notification.
+ when(mResources.getString(eq(R.string.wifi_suggestion_imsi_privacy_title), anyString()))
+ .thenAnswer(s -> "blah" + s.getArguments()[1]);
+ when(mResources.getString(eq(R.string.wifi_suggestion_imsi_privacy_content)))
+ .thenReturn("blah");
+ when(mResources.getText(
+ eq(R.string.wifi_suggestion_action_allow_imsi_privacy_exemption_carrier)))
+ .thenReturn("blah");
+ when(mResources.getText(
+ eq(R.string.wifi_suggestion_action_disallow_imsi_privacy_exemption_carrier)))
+ .thenReturn("blah");
+ when(mResources.getString(
+ eq(R.string.wifi_suggestion_imsi_privacy_exemption_confirmation_title)))
+ .thenReturn("blah");
+ when(mResources.getString(
+ eq(R.string.wifi_suggestion_imsi_privacy_exemption_confirmation_content),
+ anyString())).thenAnswer(s -> "blah" + s.getArguments()[1]);
+ when(mResources.getText(
+ eq(R.string.wifi_suggestion_action_allow_imsi_privacy_exemption_confirmation)))
+ .thenReturn("blah");
+ when(mResources.getText(
+ eq(R.string.wifi_suggestion_action_disallow_imsi_privacy_exemption_confirmation)))
+ .thenReturn("blah");
+ mWifiCarrierInfoManager.addImsiExemptionUserApprovalListener(mListener);
}
@After
@@ -1413,4 +1496,243 @@ public class WifiCarrierInfoManagerTest extends WifiBaseTest {
config.carrierId = NON_DATA_CARRIER_ID;
assertTrue(mWifiCarrierInfoManager.isCarrierNetworkFromNonDefaultDataSim(config));
}
+
+ @Test
+ public void testCheckSetClearImsiProtectionExemption() {
+ InOrder inOrder = inOrder(mWifiConfigManager);
+ assertFalse(mWifiCarrierInfoManager
+ .hasUserApprovedImsiPrivacyExemptionForCarrier(DATA_CARRIER_ID));
+ mWifiCarrierInfoManager.setHasUserApprovedImsiPrivacyExemptionForCarrier(true,
+ DATA_CARRIER_ID);
+ verify(mListener).onUserAllowed(DATA_CARRIER_ID);
+ inOrder.verify(mWifiConfigManager).saveToStore(true);
+ assertTrue(mWifiCarrierInfoManager
+ .hasUserApprovedImsiPrivacyExemptionForCarrier(DATA_CARRIER_ID));
+ mWifiCarrierInfoManager.clearImsiPrivacyExemptionForCarrier(DATA_CARRIER_ID);
+ inOrder.verify(mWifiConfigManager).saveToStore(true);
+ assertFalse(mWifiCarrierInfoManager
+ .hasUserApprovedImsiPrivacyExemptionForCarrier(DATA_CARRIER_ID));
+ }
+
+ @Test
+ public void testSendImsiProtectionExemptionNotificationWithUserAllowed() {
+ // Setup carrier without IMSI privacy protection
+ when(mCarrierConfigManager.getConfigForSubId(DATA_SUBID))
+ .thenReturn(generateTestCarrierConfig(false));
+ ArgumentCaptor<BroadcastReceiver> receiver =
+ ArgumentCaptor.forClass(BroadcastReceiver.class);
+ verify(mContext).registerReceiver(receiver.capture(), any(IntentFilter.class));
+
+ receiver.getValue().onReceive(mContext,
+ new Intent(CarrierConfigManager.ACTION_CARRIER_CONFIG_CHANGED));
+ assertFalse(mWifiCarrierInfoManager.requiresImsiEncryption(DATA_SUBID));
+
+ mWifiCarrierInfoManager.sendImsiProtectionExemptionNotificationIfRequired(DATA_CARRIER_ID);
+ validateImsiProtectionNotification(CARRIER_NAME);
+ // Simulate user clicking on allow in the notification.
+ sendBroadcastForUserActionOnImsi(NOTIFICATION_USER_ALLOWED_CARRIER_INTENT_ACTION,
+ CARRIER_NAME, DATA_CARRIER_ID);
+ verify(mNotificationManger).cancel(SystemMessage.NOTE_NETWORK_SUGGESTION_AVAILABLE);
+ validateUserApprovalDialog(CARRIER_NAME);
+
+ // Simulate user clicking on allow in the dialog.
+ ArgumentCaptor<DialogInterface.OnClickListener> clickListenerCaptor =
+ ArgumentCaptor.forClass(DialogInterface.OnClickListener.class);
+ verify(mAlertDialogBuilder, atLeastOnce()).setPositiveButton(
+ any(), clickListenerCaptor.capture());
+ assertNotNull(clickListenerCaptor.getValue());
+ clickListenerCaptor.getValue().onClick(mAlertDialog, 0);
+ mLooper.dispatchAll();
+ ArgumentCaptor<Intent> intentCaptor = ArgumentCaptor.forClass(Intent.class);
+ verify(mContext).sendBroadcast(intentCaptor.capture());
+ assertEquals(Intent.ACTION_CLOSE_SYSTEM_DIALOGS, intentCaptor.getValue().getAction());
+ verify(mWifiConfigManager).saveToStore(true);
+ assertTrue(mImsiDataSource.hasNewDataToSerialize());
+ assertTrue(mWifiCarrierInfoManager
+ .hasUserApprovedImsiPrivacyExemptionForCarrier(DATA_CARRIER_ID));
+ verify(mListener).onUserAllowed(DATA_CARRIER_ID);
+ }
+
+ @Test
+ public void testSendImsiProtectionExemptionNotificationWithUserDisallowed() {
+ // Setup carrier without IMSI privacy protection
+ when(mCarrierConfigManager.getConfigForSubId(DATA_SUBID))
+ .thenReturn(generateTestCarrierConfig(false));
+ ArgumentCaptor<BroadcastReceiver> receiver =
+ ArgumentCaptor.forClass(BroadcastReceiver.class);
+ verify(mContext).registerReceiver(receiver.capture(), any(IntentFilter.class));
+
+ receiver.getValue().onReceive(mContext,
+ new Intent(CarrierConfigManager.ACTION_CARRIER_CONFIG_CHANGED));
+ assertFalse(mWifiCarrierInfoManager.requiresImsiEncryption(DATA_SUBID));
+
+ mWifiCarrierInfoManager.sendImsiProtectionExemptionNotificationIfRequired(DATA_CARRIER_ID);
+ validateImsiProtectionNotification(CARRIER_NAME);
+ // Simulate user clicking on disallow in the notification.
+ sendBroadcastForUserActionOnImsi(NOTIFICATION_USER_DISALLOWED_CARRIER_INTENT_ACTION,
+ CARRIER_NAME, DATA_CARRIER_ID);
+ verify(mNotificationManger).cancel(SystemMessage.NOTE_NETWORK_SUGGESTION_AVAILABLE);
+ verify(mAlertDialog, never()).show();
+
+ verify(mWifiConfigManager).saveToStore(true);
+ assertTrue(mImsiDataSource.hasNewDataToSerialize());
+ assertFalse(mWifiCarrierInfoManager
+ .hasUserApprovedImsiPrivacyExemptionForCarrier(DATA_CARRIER_ID));
+ verify(mListener, never()).onUserAllowed(DATA_CARRIER_ID);
+ }
+
+ @Test
+ public void testSendImsiProtectionExemptionNotificationWithUserDismissal() {
+ // Setup carrier without IMSI privacy protection
+ when(mCarrierConfigManager.getConfigForSubId(DATA_SUBID))
+ .thenReturn(generateTestCarrierConfig(false));
+ ArgumentCaptor<BroadcastReceiver> receiver =
+ ArgumentCaptor.forClass(BroadcastReceiver.class);
+ verify(mContext).registerReceiver(receiver.capture(), any(IntentFilter.class));
+
+ receiver.getValue().onReceive(mContext,
+ new Intent(CarrierConfigManager.ACTION_CARRIER_CONFIG_CHANGED));
+ assertFalse(mWifiCarrierInfoManager.requiresImsiEncryption(DATA_SUBID));
+
+ mWifiCarrierInfoManager.sendImsiProtectionExemptionNotificationIfRequired(DATA_CARRIER_ID);
+ validateImsiProtectionNotification(CARRIER_NAME);
+ //Simulate user dismissal the notification
+ sendBroadcastForUserActionOnImsi(NOTIFICATION_USER_DISMISSED_INTENT_ACTION,
+ CARRIER_NAME, DATA_SUBID);
+ reset(mNotificationManger);
+ // No Notification is active, should send notification again.
+ mWifiCarrierInfoManager.sendImsiProtectionExemptionNotificationIfRequired(DATA_CARRIER_ID);
+ validateImsiProtectionNotification(CARRIER_NAME);
+ reset(mNotificationManger);
+
+ // As there is notification is active, should not send notification again.
+ sendBroadcastForUserActionOnImsi(NOTIFICATION_USER_DISMISSED_INTENT_ACTION,
+ CARRIER_NAME, DATA_SUBID);
+ verifyNoMoreInteractions(mNotificationManger);
+ verify(mWifiConfigManager, never()).saveToStore(true);
+ assertFalse(mImsiDataSource.hasNewDataToSerialize());
+ assertFalse(mWifiCarrierInfoManager
+ .hasUserApprovedImsiPrivacyExemptionForCarrier(DATA_CARRIER_ID));
+ verify(mListener, never()).onUserAllowed(DATA_CARRIER_ID);
+ }
+
+ @Test
+ public void testSendImsiProtectionExemptionConfirmationDialogWithUserDisallowed() {
+ // Setup carrier without IMSI privacy protection
+ when(mCarrierConfigManager.getConfigForSubId(DATA_SUBID))
+ .thenReturn(generateTestCarrierConfig(false));
+ ArgumentCaptor<BroadcastReceiver> receiver =
+ ArgumentCaptor.forClass(BroadcastReceiver.class);
+ verify(mContext).registerReceiver(receiver.capture(), any(IntentFilter.class));
+
+ receiver.getValue().onReceive(mContext,
+ new Intent(CarrierConfigManager.ACTION_CARRIER_CONFIG_CHANGED));
+ assertFalse(mWifiCarrierInfoManager.requiresImsiEncryption(DATA_SUBID));
+
+ mWifiCarrierInfoManager.sendImsiProtectionExemptionNotificationIfRequired(DATA_CARRIER_ID);
+ validateImsiProtectionNotification(CARRIER_NAME);
+ // Simulate user clicking on allow in the notification.
+ sendBroadcastForUserActionOnImsi(NOTIFICATION_USER_ALLOWED_CARRIER_INTENT_ACTION,
+ CARRIER_NAME, DATA_SUBID);
+ verify(mNotificationManger).cancel(SystemMessage.NOTE_NETWORK_SUGGESTION_AVAILABLE);
+ validateUserApprovalDialog(CARRIER_NAME);
+
+ // Simulate user clicking on disallow in the dialog.
+ ArgumentCaptor<DialogInterface.OnClickListener> clickListenerCaptor =
+ ArgumentCaptor.forClass(DialogInterface.OnClickListener.class);
+ verify(mAlertDialogBuilder, atLeastOnce()).setNegativeButton(
+ any(), clickListenerCaptor.capture());
+ assertNotNull(clickListenerCaptor.getValue());
+ clickListenerCaptor.getValue().onClick(mAlertDialog, 0);
+ mLooper.dispatchAll();
+ ArgumentCaptor<Intent> intentCaptor = ArgumentCaptor.forClass(Intent.class);
+ verify(mContext).sendBroadcast(intentCaptor.capture());
+ assertEquals(Intent.ACTION_CLOSE_SYSTEM_DIALOGS, intentCaptor.getValue().getAction());
+ verify(mWifiConfigManager).saveToStore(true);
+ assertTrue(mImsiDataSource.hasNewDataToSerialize());
+ assertFalse(mWifiCarrierInfoManager
+ .hasUserApprovedImsiPrivacyExemptionForCarrier(DATA_CARRIER_ID));
+ verify(mListener, never()).onUserAllowed(DATA_CARRIER_ID);
+ }
+
+ @Test
+ public void testSendImsiProtectionExemptionConfirmationDialogWithUserDismissal() {
+ // Setup carrier without IMSI privacy protection
+ when(mCarrierConfigManager.getConfigForSubId(DATA_SUBID))
+ .thenReturn(generateTestCarrierConfig(false));
+ ArgumentCaptor<BroadcastReceiver> receiver =
+ ArgumentCaptor.forClass(BroadcastReceiver.class);
+ verify(mContext).registerReceiver(receiver.capture(), any(IntentFilter.class));
+
+ receiver.getValue().onReceive(mContext,
+ new Intent(CarrierConfigManager.ACTION_CARRIER_CONFIG_CHANGED));
+ assertFalse(mWifiCarrierInfoManager.requiresImsiEncryption(DATA_SUBID));
+
+ mWifiCarrierInfoManager.sendImsiProtectionExemptionNotificationIfRequired(DATA_CARRIER_ID);
+ validateImsiProtectionNotification(CARRIER_NAME);
+ sendBroadcastForUserActionOnImsi(NOTIFICATION_USER_ALLOWED_CARRIER_INTENT_ACTION,
+ CARRIER_NAME, DATA_SUBID);
+ verify(mNotificationManger).cancel(SystemMessage.NOTE_NETWORK_SUGGESTION_AVAILABLE);
+ validateUserApprovalDialog(CARRIER_NAME);
+
+ // Simulate user clicking on dismissal in the dialog.
+ ArgumentCaptor<DialogInterface.OnDismissListener> dismissListenerCaptor =
+ ArgumentCaptor.forClass(DialogInterface.OnDismissListener.class);
+ verify(mAlertDialogBuilder, atLeastOnce()).setOnDismissListener(
+ dismissListenerCaptor.capture());
+ assertNotNull(dismissListenerCaptor.getValue());
+ dismissListenerCaptor.getValue().onDismiss(mAlertDialog);
+ mLooper.dispatchAll();
+ ArgumentCaptor<Intent> intentCaptor = ArgumentCaptor.forClass(Intent.class);
+ verify(mContext).sendBroadcast(intentCaptor.capture());
+ assertEquals(Intent.ACTION_CLOSE_SYSTEM_DIALOGS, intentCaptor.getValue().getAction());
+
+ // As no notification is active, new notification should be sent
+ mWifiCarrierInfoManager.sendImsiProtectionExemptionNotificationIfRequired(DATA_CARRIER_ID);
+ validateImsiProtectionNotification(CARRIER_NAME);
+
+ verify(mWifiConfigManager, never()).saveToStore(true);
+ assertFalse(mImsiDataSource.hasNewDataToSerialize());
+ assertFalse(mWifiCarrierInfoManager
+ .hasUserApprovedImsiPrivacyExemptionForCarrier(DATA_CARRIER_ID));
+ verify(mListener, never()).onUserAllowed(DATA_CARRIER_ID);
+ }
+
+ private void validateImsiProtectionNotification(String carrierName) {
+ verify(mNotificationManger, atLeastOnce()).notify(
+ eq(SystemMessage.NOTE_NETWORK_SUGGESTION_AVAILABLE),
+ eq(mNotification));
+ ArgumentCaptor<CharSequence> contentCaptor =
+ ArgumentCaptor.forClass(CharSequence.class);
+ verify(mNotificationBuilder, atLeastOnce()).setContentTitle(contentCaptor.capture());
+ CharSequence content = contentCaptor.getValue();
+ assertNotNull(content);
+ assertTrue(content.toString().contains(carrierName));
+ }
+
+ private void validateUserApprovalDialog(String... anyOfExpectedAppNames) {
+ verify(mAlertDialog, atLeastOnce()).show();
+ ArgumentCaptor<CharSequence> contentCaptor =
+ ArgumentCaptor.forClass(CharSequence.class);
+ verify(mAlertDialogBuilder, atLeastOnce()).setMessage(contentCaptor.capture());
+ CharSequence content = contentCaptor.getValue();
+ assertNotNull(content);
+
+ boolean foundMatch = false;
+ for (int i = 0; i < anyOfExpectedAppNames.length; i++) {
+ foundMatch = content.toString().contains(anyOfExpectedAppNames[i]);
+ if (foundMatch) break;
+ }
+ assertTrue(foundMatch);
+ }
+
+ private void sendBroadcastForUserActionOnImsi(String action, String carrierName,
+ int carrierId) {
+ Intent intent = new Intent()
+ .setAction(action)
+ .putExtra(WifiCarrierInfoManager.EXTRA_CARRIER_NAME, carrierName)
+ .putExtra(WifiCarrierInfoManager.EXTRA_CARRIER_ID, carrierId);
+ assertNotNull(mBroadcastReceiverCaptor.getValue());
+ mBroadcastReceiverCaptor.getValue().onReceive(mContext, intent);
+ }
}
diff --git a/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java b/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java
index 25326e5e8..b1e6f2189 100644
--- a/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java
@@ -226,8 +226,8 @@ public class WifiConfigManagerTest extends WifiBaseTest {
when(mWifiScoreCard.lookupNetwork(any())).thenReturn(mPerNetwork);
mWifiCarrierInfoManager = new WifiCarrierInfoManager(mTelephonyManager,
- mSubscriptionManager, mock(FrameworkFacade.class), mock(Context.class),
- mock(Handler.class));
+ mSubscriptionManager, mWifiInjector, mock(FrameworkFacade.class),
+ mock(WifiContext.class), mock(WifiConfigStore.class), mock(Handler.class));
mLruConnectionTracker = new LruConnectionTracker(100, mContext);
createWifiConfigManager();
mWifiConfigManager.addOnNetworkUpdateListener(mWcmListener);
diff --git a/tests/wifitests/src/com/android/server/wifi/WifiNetworkSuggestionsManagerTest.java b/tests/wifitests/src/com/android/server/wifi/WifiNetworkSuggestionsManagerTest.java
index 66e0da855..3899453d5 100644
--- a/tests/wifitests/src/com/android/server/wifi/WifiNetworkSuggestionsManagerTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/WifiNetworkSuggestionsManagerTest.java
@@ -26,9 +26,7 @@ import static android.app.AppOpsManager.OPSTR_CHANGE_WIFI_STATE;
import static com.android.dx.mockito.inline.extended.ExtendedMockito.doReturn;
import static com.android.dx.mockito.inline.extended.ExtendedMockito.when;
import static com.android.server.wifi.WifiNetworkSuggestionsManager.NOTIFICATION_USER_ALLOWED_APP_INTENT_ACTION;
-import static com.android.server.wifi.WifiNetworkSuggestionsManager.NOTIFICATION_USER_ALLOWED_CARRIER_INTENT_ACTION;
import static com.android.server.wifi.WifiNetworkSuggestionsManager.NOTIFICATION_USER_DISALLOWED_APP_INTENT_ACTION;
-import static com.android.server.wifi.WifiNetworkSuggestionsManager.NOTIFICATION_USER_DISALLOWED_CARRIER_INTENT_ACTION;
import static com.android.server.wifi.WifiNetworkSuggestionsManager.NOTIFICATION_USER_DISMISSED_INTENT_ACTION;
import static org.junit.Assert.assertEquals;
@@ -138,10 +136,8 @@ public class WifiNetworkSuggestionsManagerTest extends WifiBaseTest {
private @Mock WifiConfigStore mWifiConfigStore;
private @Mock WifiConfigManager mWifiConfigManager;
private @Mock NetworkSuggestionStoreData mNetworkSuggestionStoreData;
- private @Mock ImsiPrivacyProtectionExemptionStoreData mImsiPrivacyProtectionExemptionStoreData;
private @Mock WifiMetrics mWifiMetrics;
- private @Mock
- WifiCarrierInfoManager mWifiCarrierInfoManager;
+ private @Mock WifiCarrierInfoManager mWifiCarrierInfoManager;
private @Mock PasspointManager mPasspointManager;
private @Mock ISuggestionConnectionStatusListener mListener;
private @Mock IBinder mBinder;
@@ -158,12 +154,14 @@ public class WifiNetworkSuggestionsManagerTest extends WifiBaseTest {
ArgumentCaptor.forClass(AppOpsManager.OnOpChangedListener.class);
private ArgumentCaptor<BroadcastReceiver> mBroadcastReceiverCaptor =
ArgumentCaptor.forClass(BroadcastReceiver.class);
+ private ArgumentCaptor<WifiCarrierInfoManager.OnUserApproveCarrierListener>
+ mUserApproveCarrierListenerArgumentCaptor = ArgumentCaptor.forClass(
+ WifiCarrierInfoManager.OnUserApproveCarrierListener.class);
private InOrder mInorder;
private WifiNetworkSuggestionsManager mWifiNetworkSuggestionsManager;
private NetworkSuggestionStoreData.DataSource mDataSource;
- private ImsiPrivacyProtectionExemptionStoreData.DataSource mImsiDataSource;
/**
* Setup the mocks.
@@ -177,8 +175,6 @@ public class WifiNetworkSuggestionsManagerTest extends WifiBaseTest {
when(mWifiInjector.makeNetworkSuggestionStoreData(any()))
.thenReturn(mNetworkSuggestionStoreData);
- when(mWifiInjector.makeImsiProtectionExemptionStoreData(any()))
- .thenReturn(mImsiPrivacyProtectionExemptionStoreData);
when(mWifiInjector.getFrameworkFacade()).thenReturn(mFrameworkFacade);
when(mWifiInjector.getPasspointManager()).thenReturn(mPasspointManager);
when(mWifiInjector.getWifiScoreCard()).thenReturn(mWifiScoreCard);
@@ -230,30 +226,6 @@ public class WifiNetworkSuggestionsManagerTest extends WifiBaseTest {
when(mResources.getText(eq(R.string.wifi_suggestion_action_disallow_app)))
.thenReturn("blah");
- // setup resource strings for IMSI protection notification.
- when(mResources.getString(eq(R.string.wifi_suggestion_imsi_privacy_title), anyString()))
- .thenAnswer(s -> "blah" + s.getArguments()[1]);
- when(mResources.getString(eq(R.string.wifi_suggestion_imsi_privacy_content)))
- .thenReturn("blah");
- when(mResources.getText(
- eq(R.string.wifi_suggestion_action_allow_imsi_privacy_exemption_carrier)))
- .thenReturn("blah");
- when(mResources.getText(
- eq(R.string.wifi_suggestion_action_disallow_imsi_privacy_exemption_carrier)))
- .thenReturn("blah");
- when(mResources.getString(
- eq(R.string.wifi_suggestion_imsi_privacy_exemption_confirmation_title)))
- .thenReturn("blah");
- when(mResources.getString(
- eq(R.string.wifi_suggestion_imsi_privacy_exemption_confirmation_content),
- anyString())).thenAnswer(s -> "blah" + s.getArguments()[1]);
- when(mResources.getText(
- eq(R.string.wifi_suggestion_action_allow_imsi_privacy_exemption_confirmation)))
- .thenReturn("blah");
- when(mResources.getText(
- eq(R.string.wifi_suggestion_action_disallow_imsi_privacy_exemption_confirmation)))
- .thenReturn("blah");
-
// Our app Info. Needed for notification builder.
ApplicationInfo ourAppInfo = new ApplicationInfo();
@@ -290,13 +262,8 @@ public class WifiNetworkSuggestionsManagerTest extends WifiBaseTest {
mDataSource = dataSourceArgumentCaptor.getValue();
assertNotNull(mDataSource);
- ArgumentCaptor<ImsiPrivacyProtectionExemptionStoreData.DataSource>
- imsiDataSourceArgumentCaptor =
- ArgumentCaptor.forClass(ImsiPrivacyProtectionExemptionStoreData.DataSource.class);
- verify(mWifiInjector).makeImsiProtectionExemptionStoreData(imsiDataSourceArgumentCaptor
- .capture());
- mImsiDataSource = imsiDataSourceArgumentCaptor.getValue();
- assertNotNull(mImsiDataSource);
+ verify(mWifiCarrierInfoManager).addImsiExemptionUserApprovalListener(
+ mUserApproveCarrierListenerArgumentCaptor.capture());
mWifiNetworkSuggestionsManager.enableVerboseLogging(1);
}
@@ -2886,18 +2853,6 @@ public class WifiNetworkSuggestionsManagerTest extends WifiBaseTest {
assertEquals(expectedNetworkSuggestion, networkSuggestion);
}
- private void validateImsiProtectionNotification(String carrierName) {
- verify(mNotificationManger, atLeastOnce()).notify(
- eq(SystemMessage.NOTE_NETWORK_SUGGESTION_AVAILABLE),
- eq(mNotification));
- ArgumentCaptor<CharSequence> contentCaptor =
- ArgumentCaptor.forClass(CharSequence.class);
- verify(mNotificationBuilder, atLeastOnce()).setContentTitle(contentCaptor.capture());
- CharSequence content = contentCaptor.getValue();
- assertNotNull(content);
- assertTrue(content.toString().contains(carrierName));
- }
-
private void validateUserApprovalDialog(String... anyOfExpectedAppNames) {
verify(mAlertDialog, atLeastOnce()).show();
ArgumentCaptor<CharSequence> contentCaptor =
@@ -2941,16 +2896,6 @@ public class WifiNetworkSuggestionsManagerTest extends WifiBaseTest {
mBroadcastReceiverCaptor.getValue().onReceive(mContext, intent);
}
- private void sendBroadcastForUserActionOnImsi(String action, String carrierName,
- int carrierId) {
- Intent intent = new Intent()
- .setAction(action)
- .putExtra(WifiNetworkSuggestionsManager.EXTRA_CARRIER_NAME, carrierName)
- .putExtra(WifiNetworkSuggestionsManager.EXTRA_CARRIER_ID, carrierId);
- assertNotNull(mBroadcastReceiverCaptor.getValue());
- mBroadcastReceiverCaptor.getValue().onReceive(mContext, intent);
- }
-
@Test
public void testAddSuggestionWithValidCarrierIdWithCarrierProvisionPermission() {
WifiConfiguration config = WifiConfigurationTestUtil.createOpenNetwork();
@@ -3561,7 +3506,9 @@ public class WifiNetworkSuggestionsManagerTest extends WifiBaseTest {
}
/**
- * Test the IMSI protection notification and user click on the allow.
+ * Verify when matching a SIM-Based network without IMSI protection, framework will mark it
+ * auto-join disable and send notification. If user click on allow, will restore the auto-join
+ * config.
*/
@Test
public void testSendImsiProtectionNotificationOnUserAllowed() {
@@ -3571,6 +3518,8 @@ public class WifiNetworkSuggestionsManagerTest extends WifiBaseTest {
when(mWifiCarrierInfoManager.getCarrierNameforSubId(TEST_SUBID))
.thenReturn(TEST_CARRIER_NAME);
when(mWifiCarrierInfoManager.requiresImsiEncryption(TEST_SUBID)).thenReturn(false);
+ when(mWifiCarrierInfoManager.hasUserApprovedImsiPrivacyExemptionForCarrier(TEST_CARRIER_ID))
+ .thenReturn(false);
WifiConfiguration eapSimConfig = WifiConfigurationTestUtil.createEapNetwork(
WifiEnterpriseConfig.Eap.SIM, WifiEnterpriseConfig.Phase2.NONE);
WifiNetworkSuggestion networkSuggestion = new WifiNetworkSuggestion(
@@ -3585,114 +3534,21 @@ public class WifiNetworkSuggestionsManagerTest extends WifiBaseTest {
verifyNoMoreInteractions(mNotificationManger);
Set<ExtendedWifiNetworkSuggestion> matchedSuggestion = mWifiNetworkSuggestionsManager
.getNetworkSuggestionsForScanDetail(createScanDetailForNetwork(eapSimConfig));
- validateImsiProtectionNotification(TEST_CARRIER_NAME);
+ verify(mWifiCarrierInfoManager)
+ .sendImsiProtectionExemptionNotificationIfRequired(TEST_CARRIER_ID);
for (ExtendedWifiNetworkSuggestion ewns : matchedSuggestion) {
assertFalse(ewns.isAutojoinEnabled);
}
- sendBroadcastForUserActionOnImsi(NOTIFICATION_USER_ALLOWED_CARRIER_INTENT_ACTION,
- TEST_CARRIER_NAME, TEST_CARRIER_ID);
- verify(mNotificationManger).cancel(SystemMessage.NOTE_NETWORK_SUGGESTION_AVAILABLE);
- validateUserApprovalDialog(TEST_CARRIER_NAME);
- // Simulate user clicking on allow in the dialog.
- ArgumentCaptor<DialogInterface.OnClickListener> clickListenerCaptor =
- ArgumentCaptor.forClass(DialogInterface.OnClickListener.class);
- verify(mAlertDialogBuilder, atLeastOnce()).setPositiveButton(
- any(), clickListenerCaptor.capture());
- assertNotNull(clickListenerCaptor.getValue());
- clickListenerCaptor.getValue().onClick(mAlertDialog, 0);
- mLooper.dispatchAll();
- ArgumentCaptor<Intent> intentCaptor = ArgumentCaptor.forClass(Intent.class);
- verify(mContext).sendBroadcast(intentCaptor.capture());
- assertEquals(Intent.ACTION_CLOSE_SYSTEM_DIALOGS, intentCaptor.getValue().getAction());
- verify(mWifiConfigManager, times(2)).saveToStore(true);
- assertTrue(mImsiDataSource.hasNewDataToSerialize());
- matchedSuggestion = mWifiNetworkSuggestionsManager
- .getNetworkSuggestionsForScanDetail(createScanDetailForNetwork(eapSimConfig));
- verifyNoMoreInteractions(mNotificationManger);
- assertTrue(mWifiNetworkSuggestionsManager
- .hasUserApprovedImsiPrivacyExemptionForCarrier(TEST_CARRIER_ID));
-
- for (ExtendedWifiNetworkSuggestion ewns : matchedSuggestion) {
- assertTrue(ewns.isAutojoinEnabled);
- }
- }
-
- /**
- * Test the IMSI protection notification and user click on the disallow.
- */
- @Test
- public void testSendImsiProtectionNotificationOnUserDisallowed() {
- when(mWifiCarrierInfoManager.getCarrierIdForPackageWithCarrierPrivileges(TEST_PACKAGE_1))
- .thenReturn(TEST_CARRIER_ID);
- when(mWifiCarrierInfoManager.getMatchingSubId(TEST_CARRIER_ID)).thenReturn(TEST_SUBID);
- when(mWifiCarrierInfoManager.getCarrierNameforSubId(TEST_SUBID))
- .thenReturn(TEST_CARRIER_NAME);
- when(mWifiCarrierInfoManager.requiresImsiEncryption(TEST_SUBID)).thenReturn(false);
- WifiConfiguration eapSimConfig = WifiConfigurationTestUtil.createEapNetwork(
- WifiEnterpriseConfig.Eap.SIM, WifiEnterpriseConfig.Phase2.NONE);
- WifiNetworkSuggestion networkSuggestion = new WifiNetworkSuggestion(
- eapSimConfig, null, true, false, true, true);
- List<WifiNetworkSuggestion> networkSuggestionList =
- new ArrayList<WifiNetworkSuggestion>() {{
- add(networkSuggestion);
- }};
- assertEquals(WifiManager.STATUS_NETWORK_SUGGESTIONS_SUCCESS,
- mWifiNetworkSuggestionsManager.add(networkSuggestionList, TEST_UID_1,
- TEST_PACKAGE_1, TEST_FEATURE));
- Set<ExtendedWifiNetworkSuggestion> matchedSuggestion = mWifiNetworkSuggestionsManager
- .getNetworkSuggestionsForScanDetail(createScanDetailForNetwork(eapSimConfig));
- validateImsiProtectionNotification(TEST_CARRIER_NAME);
- for (ExtendedWifiNetworkSuggestion ewns : matchedSuggestion) {
- assertFalse(ewns.isAutojoinEnabled);
- }
- sendBroadcastForUserActionOnImsi(NOTIFICATION_USER_DISALLOWED_CARRIER_INTENT_ACTION,
- TEST_CARRIER_NAME, TEST_CARRIER_ID);
- verify(mNotificationManger).cancel(SystemMessage.NOTE_NETWORK_SUGGESTION_AVAILABLE);
+ // Simulate user approved carrier
+ mUserApproveCarrierListenerArgumentCaptor.getValue().onUserAllowed(TEST_CARRIER_ID);
+ when(mWifiCarrierInfoManager.hasUserApprovedImsiPrivacyExemptionForCarrier(TEST_CARRIER_ID))
+ .thenReturn(true);
- verify(mWifiConfigManager, times(2)).saveToStore(true);
- assertTrue(mImsiDataSource.hasNewDataToSerialize());
matchedSuggestion = mWifiNetworkSuggestionsManager
.getNetworkSuggestionsForScanDetail(createScanDetailForNetwork(eapSimConfig));
- verifyNoMoreInteractions(mNotificationManger);
- assertFalse(mWifiNetworkSuggestionsManager
- .hasUserApprovedImsiPrivacyExemptionForCarrier(TEST_CARRIER_ID));
for (ExtendedWifiNetworkSuggestion ewns : matchedSuggestion) {
- assertFalse(ewns.isAutojoinEnabled);
- }
- }
-
- /**
- * Test when carrier start to support IMSI protection, imsiExemptionMap will update too.
- */
- @Test
- public void testUpdateImsiExemptionMapWhenCarrierFromWithoutProtectionToWithProtection() {
- // Simulate user click on disallow before.
- mWifiNetworkSuggestionsManager
- .setHasUserApprovedImsiPrivacyExemptionForCarrier(false, TEST_CARRIER_ID);
- verifyNoMoreInteractions(mNotificationManger);
- // Now carrier upgrade to support Imsi protection
- when(mWifiCarrierInfoManager.getCarrierIdForPackageWithCarrierPrivileges(TEST_PACKAGE_1))
- .thenReturn(TEST_CARRIER_ID);
- when(mWifiCarrierInfoManager.getMatchingSubId(TEST_CARRIER_ID)).thenReturn(TEST_SUBID);
- when(mWifiCarrierInfoManager.requiresImsiEncryption(TEST_SUBID)).thenReturn(true);
- WifiConfiguration eapSimConfig = WifiConfigurationTestUtil.createEapNetwork(
- WifiEnterpriseConfig.Eap.SIM, WifiEnterpriseConfig.Phase2.NONE);
- WifiNetworkSuggestion networkSuggestion = new WifiNetworkSuggestion(
- eapSimConfig, null, true, false, true, true);
- List<WifiNetworkSuggestion> networkSuggestionList =
- new ArrayList<WifiNetworkSuggestion>() {{
- add(networkSuggestion);
- }};
- assertEquals(WifiManager.STATUS_NETWORK_SUGGESTIONS_SUCCESS,
- mWifiNetworkSuggestionsManager.add(networkSuggestionList, TEST_UID_1,
- TEST_PACKAGE_1, TEST_FEATURE));
- Set<ExtendedWifiNetworkSuggestion> matchedSuggestion = mWifiNetworkSuggestionsManager
- .getNetworkSuggestionsForScanDetail(createScanDetailForNetwork(eapSimConfig));
- // Should be no more notification and suggestion restore to the initial auto join configure.
- verifyNoMoreInteractions(mNotificationManger);
- for (ExtendedWifiNetworkSuggestion ewns : matchedSuggestion) {
assertTrue(ewns.isAutojoinEnabled);
}
}
diff --git a/tests/wifitests/src/com/android/server/wifi/hotspot2/PasspointManagerTest.java b/tests/wifitests/src/com/android/server/wifi/hotspot2/PasspointManagerTest.java
index aba3176a3..73c5713ac 100644
--- a/tests/wifitests/src/com/android/server/wifi/hotspot2/PasspointManagerTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/hotspot2/PasspointManagerTest.java
@@ -96,6 +96,7 @@ import com.android.server.wifi.WifiCarrierInfoManager;
import com.android.server.wifi.WifiConfigManager;
import com.android.server.wifi.WifiConfigStore;
import com.android.server.wifi.WifiConfigurationTestUtil;
+import com.android.server.wifi.WifiContext;
import com.android.server.wifi.WifiInjector;
import com.android.server.wifi.WifiKeyStore;
import com.android.server.wifi.WifiMetrics;
@@ -227,8 +228,8 @@ public class PasspointManagerTest extends WifiBaseTest {
when(mWifiInjector.getWifiNetworkSuggestionsManager())
.thenReturn(mWifiNetworkSuggestionsManager);
mWifiCarrierInfoManager = new WifiCarrierInfoManager(mTelephonyManager,
- mSubscriptionManager, mock(FrameworkFacade.class), mock(Context.class),
- mock(Handler.class));
+ mSubscriptionManager, mWifiInjector, mock(FrameworkFacade.class),
+ mock(WifiContext.class), mWifiConfigStore, mock(Handler.class));
mLooper = new TestLooper();
mHandler = new Handler(mLooper.getLooper());
mManager = new PasspointManager(mContext, mWifiInjector, mHandler, mWifiNative,