From 42f8a914cfca03312f75742ee34391890729025c Mon Sep 17 00:00:00 2001 From: lucaslin Date: Mon, 2 Nov 2020 11:53:16 +0800 Subject: [PATCH] Use local defined constants for notification channels ConnectivityService mainline module cannot call the members inside SystemNotificationChannels.java. So use the local defined constants instead. Bug: 172040168 Test: atest FrameworksNetTests Test: Manual test NO_INTERNET, SIGN_IN, PARTIAL_CONNECTIVITY, VPN_ALWAYS_ON notifications. Change-Id: I223b207c4346e8239dee78e50dd2b0532a3e55b0 --- .../connectivity/NetworkNotificationManager.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/services/core/java/com/android/server/connectivity/NetworkNotificationManager.java b/services/core/java/com/android/server/connectivity/NetworkNotificationManager.java index 3d22d6d37c..26eca19b90 100644 --- a/services/core/java/com/android/server/connectivity/NetworkNotificationManager.java +++ b/services/core/java/com/android/server/connectivity/NetworkNotificationManager.java @@ -41,7 +41,6 @@ import android.widget.Toast; import com.android.internal.R; import com.android.internal.annotations.VisibleForTesting; import com.android.internal.messages.nano.SystemMessageProto.SystemMessage; -import com.android.internal.notification.SystemNotificationChannels; public class NetworkNotificationManager { @@ -72,7 +71,12 @@ public class NetworkNotificationManager { private static final String TAG = NetworkNotificationManager.class.getSimpleName(); private static final boolean DBG = true; - private static final boolean VDBG = false; + + // Notification channels used by ConnectivityService mainline module, it should be aligned with + // SystemNotificationChannels. + public static final String NOTIFICATION_NETWORK_STATUS = "NETWORK_STATUS"; + public static final String NOTIFICATION_NETWORK_ALERTS = "NETWORK_ALERTS"; + public static final String NOTIFICATION_VPN = "VPN"; // The context is for the current user (system server) private final Context mContext; @@ -255,8 +259,7 @@ public class NetworkNotificationManager { // the tag. final boolean hasPreviousNotification = previousNotifyType != null; final String channelId = (highPriority && !hasPreviousNotification) - ? SystemNotificationChannels.NETWORK_ALERTS - : SystemNotificationChannels.NETWORK_STATUS; + ? NOTIFICATION_NETWORK_ALERTS : NOTIFICATION_NETWORK_STATUS; Notification.Builder builder = new Notification.Builder(mContext, channelId) .setWhen(System.currentTimeMillis()) .setShowWhen(notifyType == NotificationType.NETWORK_SWITCH)