summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoshan Pius <rpius@google.com>2019-11-14 13:43:24 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2019-11-14 13:43:24 +0000
commit76012840c6b576a75a42e26ffc15716e66bbfd0c (patch)
tree5fefa83bd08b3e908b932fd0ddd19b3d43f91dad
parentca689352d5ad9845c12b0efbdf43d04e1803cd9f (diff)
parent1691b1fa094be104dca0adc32a5deb9236eef57b (diff)
Merge "WifiStackService: Use local constants for notification channels"
-rw-r--r--service/java/com/android/server/wifi/ConnectToNetworkNotificationBuilder.java3
-rw-r--r--service/java/com/android/server/wifi/WakeupNotificationFactory.java3
-rw-r--r--service/java/com/android/server/wifi/WifiApConfigStore.java3
-rw-r--r--service/java/com/android/server/wifi/WifiNetworkSuggestionsManager.java3
-rw-r--r--service/java/com/android/server/wifi/WifiStackService.java16
-rw-r--r--service/java/com/android/server/wifi/WrongPasswordNotifier.java3
-rw-r--r--tests/wifitests/src/com/android/server/wifi/WrongPasswordNotifierTest.java4
7 files changed, 15 insertions, 20 deletions
diff --git a/service/java/com/android/server/wifi/ConnectToNetworkNotificationBuilder.java b/service/java/com/android/server/wifi/ConnectToNetworkNotificationBuilder.java
index 53520d26c..3350739bb 100644
--- a/service/java/com/android/server/wifi/ConnectToNetworkNotificationBuilder.java
+++ b/service/java/com/android/server/wifi/ConnectToNetworkNotificationBuilder.java
@@ -24,7 +24,6 @@ import android.content.res.Resources;
import android.net.wifi.ScanResult;
import android.util.Log;
-import com.android.internal.notification.SystemNotificationChannels;
import com.android.wifi.R;
/**
@@ -160,7 +159,7 @@ public class ConnectToNetworkNotificationBuilder {
private Notification.Builder createNotificationBuilder(
CharSequence title, CharSequence content, String extraData) {
return mFrameworkFacade.makeNotificationBuilder(mContext,
- SystemNotificationChannels.NETWORK_AVAILABLE)
+ WifiStackService.NOTIFICATION_NETWORK_AVAILABLE)
.setSmallIcon(android.R.drawable.stat_notify_wifi_in_range)
.setTicker(title)
.setContentTitle(title)
diff --git a/service/java/com/android/server/wifi/WakeupNotificationFactory.java b/service/java/com/android/server/wifi/WakeupNotificationFactory.java
index 1248d9d53..60b32c042 100644
--- a/service/java/com/android/server/wifi/WakeupNotificationFactory.java
+++ b/service/java/com/android/server/wifi/WakeupNotificationFactory.java
@@ -22,7 +22,6 @@ import android.content.Context;
import android.content.Intent;
import com.android.internal.messages.nano.SystemMessageProto.SystemMessage;
-import com.android.internal.notification.SystemNotificationChannels;
import com.android.wifi.R;
@@ -67,7 +66,7 @@ public class WakeupNotificationFactory {
.build();
return mFrameworkFacade.makeNotificationBuilder(mContext,
- SystemNotificationChannels.NETWORK_STATUS)
+ WifiStackService.NOTIFICATION_NETWORK_STATUS)
.setSmallIcon(R.drawable.ic_wifi_settings)
.setTicker(title)
.setContentTitle(title)
diff --git a/service/java/com/android/server/wifi/WifiApConfigStore.java b/service/java/com/android/server/wifi/WifiApConfigStore.java
index 4f152b057..c7499af3c 100644
--- a/service/java/com/android/server/wifi/WifiApConfigStore.java
+++ b/service/java/com/android/server/wifi/WifiApConfigStore.java
@@ -35,7 +35,6 @@ import android.util.Log;
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.messages.nano.SystemMessageProto.SystemMessage;
-import com.android.internal.notification.SystemNotificationChannels;
import com.android.wifi.R;
import java.io.BufferedInputStream;
@@ -219,7 +218,7 @@ public class WifiApConfigStore {
mContext.getResources().getColor(
android.R.color.system_notification_accent_color, mContext.getTheme());
- return new Notification.Builder(mContext, SystemNotificationChannels.NETWORK_STATUS)
+ return new Notification.Builder(mContext, WifiStackService.NOTIFICATION_NETWORK_STATUS)
.setSmallIcon(R.drawable.ic_wifi_settings)
.setPriority(Notification.PRIORITY_HIGH)
.setCategory(Notification.CATEGORY_SYSTEM)
diff --git a/service/java/com/android/server/wifi/WifiNetworkSuggestionsManager.java b/service/java/com/android/server/wifi/WifiNetworkSuggestionsManager.java
index 0d400c576..04b8468fb 100644
--- a/service/java/com/android/server/wifi/WifiNetworkSuggestionsManager.java
+++ b/service/java/com/android/server/wifi/WifiNetworkSuggestionsManager.java
@@ -50,7 +50,6 @@ import android.util.Pair;
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.ExternalCallbackTracker;
import com.android.server.wifi.util.TelephonyUtil;
import com.android.server.wifi.util.WifiPermissionsUtil;
@@ -902,7 +901,7 @@ public class WifiNetworkSuggestionsManager {
CharSequence appName = getAppName(packageName, uid);
Notification notification = new Notification.Builder(
- mContext, SystemNotificationChannels.NETWORK_STATUS)
+ mContext, WifiStackService.NOTIFICATION_NETWORK_STATUS)
.setSmallIcon(android.R.drawable.stat_notify_wifi_in_range)
.setTicker(mResources.getString(R.string.wifi_suggestion_title))
.setContentTitle(mResources.getString(R.string.wifi_suggestion_title))
diff --git a/service/java/com/android/server/wifi/WifiStackService.java b/service/java/com/android/server/wifi/WifiStackService.java
index 90b509674..b673620d9 100644
--- a/service/java/com/android/server/wifi/WifiStackService.java
+++ b/service/java/com/android/server/wifi/WifiStackService.java
@@ -16,10 +16,6 @@
package com.android.server.wifi;
-import static com.android.internal.notification.SystemNotificationChannels.NETWORK_ALERTS;
-import static com.android.internal.notification.SystemNotificationChannels.NETWORK_AVAILABLE;
-import static com.android.internal.notification.SystemNotificationChannels.NETWORK_STATUS;
-
import android.annotation.NonNull;
import android.app.ActivityManager;
import android.app.NotificationChannel;
@@ -56,6 +52,12 @@ import java.util.stream.Collectors;
*/
public class WifiStackService extends Service {
private static final String TAG = WifiStackService.class.getSimpleName();
+
+ // Notification channels used by the wifi stack.
+ public static final String NOTIFICATION_NETWORK_STATUS = "NETWORK_STATUS";
+ public static final String NOTIFICATION_NETWORK_ALERTS = "NETWORK_ALERTS";
+ public static final String NOTIFICATION_NETWORK_AVAILABLE = "NETWORK_AVAILABLE";
+
// Ordered list of wifi services. The ordering determines the order in which the events
// are delivered to the services.
@GuardedBy("mApiServices")
@@ -139,20 +141,20 @@ public class WifiStackService extends Service {
final NotificationManager nm = getSystemService(NotificationManager.class);
List<NotificationChannel> channelsList = new ArrayList<>();
final NotificationChannel networkStatusChannel = new NotificationChannel(
- NETWORK_STATUS,
+ NOTIFICATION_NETWORK_STATUS,
getString(android.R.string.notification_channel_network_status),
NotificationManager.IMPORTANCE_LOW);
channelsList.add(networkStatusChannel);
final NotificationChannel networkAlertsChannel = new NotificationChannel(
- NETWORK_ALERTS,
+ NOTIFICATION_NETWORK_ALERTS,
getString(android.R.string.notification_channel_network_alerts),
NotificationManager.IMPORTANCE_HIGH);
networkAlertsChannel.setBlockableSystem(true);
channelsList.add(networkAlertsChannel);
final NotificationChannel networkAvailable = new NotificationChannel(
- NETWORK_AVAILABLE,
+ NOTIFICATION_NETWORK_AVAILABLE,
getString(android.R.string.notification_channel_network_available),
NotificationManager.IMPORTANCE_LOW);
networkAvailable.setBlockableSystem(true);
diff --git a/service/java/com/android/server/wifi/WrongPasswordNotifier.java b/service/java/com/android/server/wifi/WrongPasswordNotifier.java
index b25549a50..253af5e4f 100644
--- a/service/java/com/android/server/wifi/WrongPasswordNotifier.java
+++ b/service/java/com/android/server/wifi/WrongPasswordNotifier.java
@@ -25,7 +25,6 @@ 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;
/**
@@ -82,7 +81,7 @@ public class WrongPasswordNotifier {
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)
+ WifiStackService.NOTIFICATION_NETWORK_ALERTS)
.setAutoCancel(true)
.setTimeoutAfter(CANCEL_TIMEOUT_MILLISECONDS)
// TODO(zqiu): consider creating a new icon.
diff --git a/tests/wifitests/src/com/android/server/wifi/WrongPasswordNotifierTest.java b/tests/wifitests/src/com/android/server/wifi/WrongPasswordNotifierTest.java
index 28fbc9371..ae184bec7 100644
--- a/tests/wifitests/src/com/android/server/wifi/WrongPasswordNotifierTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/WrongPasswordNotifierTest.java
@@ -28,8 +28,6 @@ import android.provider.Settings;
import androidx.test.filters.SmallTest;
-import com.android.internal.notification.SystemNotificationChannels;
-
import org.junit.Before;
import org.junit.Test;
import org.mockito.Answers;
@@ -73,7 +71,7 @@ public class WrongPasswordNotifierTest extends WifiBaseTest {
@Test
public void onWrongPasswordError() throws Exception {
when(mFrameworkFacade.makeNotificationBuilder(any(),
- eq(SystemNotificationChannels.NETWORK_ALERTS))).thenReturn(mNotificationBuilder);
+ eq(WifiStackService.NOTIFICATION_NETWORK_ALERTS))).thenReturn(mNotificationBuilder);
mWrongPassNotifier.onWrongPasswordError(TEST_SSID);
verify(mNotificationManager).notify(eq(WrongPasswordNotifier.NOTIFICATION_ID), any());
ArgumentCaptor<Intent> intent = ArgumentCaptor.forClass(Intent.class);