summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--service/java/com/android/server/wifi/WrongPasswordNotifier.java9
-rw-r--r--tests/wifitests/src/com/android/server/wifi/WrongPasswordNotifierTest.java8
2 files changed, 13 insertions, 4 deletions
diff --git a/service/java/com/android/server/wifi/WrongPasswordNotifier.java b/service/java/com/android/server/wifi/WrongPasswordNotifier.java
index 5447322d3..37e23da64 100644
--- a/service/java/com/android/server/wifi/WrongPasswordNotifier.java
+++ b/service/java/com/android/server/wifi/WrongPasswordNotifier.java
@@ -21,11 +21,12 @@ import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
-import android.net.wifi.WifiManager;
+import android.provider.Settings;
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.messages.nano.SystemMessageProto.SystemMessage;
import com.android.internal.notification.SystemNotificationChannels;
+import com.android.server.wifi.util.NativeUtil;
/**
* Responsible for notifying user for wrong password errors.
@@ -78,6 +79,8 @@ public class WrongPasswordNotifier {
* @param ssid SSID of the Wi-FI network
*/
private void showNotification(String ssid) {
+ Intent intent = new Intent(Settings.ACTION_WIFI_SETTINGS);
+ intent.putExtra("wifi_start_connect_ssid", NativeUtil.removeEnclosingQuotes(ssid));
Notification.Builder builder = mFrameworkFacade.makeNotificationBuilder(mContext,
SystemNotificationChannels.NETWORK_ALERTS)
.setAutoCancel(true)
@@ -87,10 +90,8 @@ public class WrongPasswordNotifier {
.setContentTitle(mContext.getString(
com.android.internal.R.string.wifi_available_title_failed_to_connect))
.setContentText(ssid)
- // TODO(zqiu): update to point to the new activity when it is ready.
.setContentIntent(mFrameworkFacade.getActivity(
- mContext, 0, new Intent(WifiManager.ACTION_PICK_WIFI_NETWORK),
- PendingIntent.FLAG_UPDATE_CURRENT))
+ mContext, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT))
.setColor(mContext.getResources().getColor(
com.android.internal.R.color.system_notification_accent_color));
mNotificationManager.notify(NOTIFICATION_ID, builder.build());
diff --git a/tests/wifitests/src/com/android/server/wifi/WrongPasswordNotifierTest.java b/tests/wifitests/src/com/android/server/wifi/WrongPasswordNotifierTest.java
index 405ab65c2..74bfdeba5 100644
--- a/tests/wifitests/src/com/android/server/wifi/WrongPasswordNotifierTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/WrongPasswordNotifierTest.java
@@ -22,13 +22,16 @@ import static org.mockito.Mockito.*;
import android.app.Notification;
import android.app.NotificationManager;
import android.content.Context;
+import android.content.Intent;
import android.content.res.Resources;
+import android.provider.Settings;
import com.android.internal.notification.SystemNotificationChannels;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Answers;
+import org.mockito.ArgumentCaptor;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
@@ -70,6 +73,11 @@ public class WrongPasswordNotifierTest {
eq(SystemNotificationChannels.NETWORK_ALERTS))).thenReturn(mNotificationBuilder);
mWrongPassNotifier.onWrongPasswordError(TEST_SSID);
verify(mNotificationManager).notify(eq(WrongPasswordNotifier.NOTIFICATION_ID), any());
+ ArgumentCaptor<Intent> intent = ArgumentCaptor.forClass(Intent.class);
+ verify(mFrameworkFacade).getActivity(
+ any(Context.class), anyInt(), intent.capture(), anyInt());
+ assertEquals(Settings.ACTION_WIFI_SETTINGS, intent.getValue().getAction());
+ assertEquals(TEST_SSID, intent.getValue().getStringExtra("wifi_start_connect_ssid"));
}
/**