Merge "Fix the comments left on aosp/1481197"

This commit is contained in:
Lucas Lin
2020-11-17 07:06:46 +00:00
committed by Gerrit Code Review
3 changed files with 10 additions and 9 deletions

View File

@@ -75,10 +75,11 @@ public class NetworkNotificationManager {
private static final boolean DBG = true; private static final boolean DBG = true;
// Notification channels used by ConnectivityService mainline module, it should be aligned with // Notification channels used by ConnectivityService mainline module, it should be aligned with
// SystemNotificationChannels. // SystemNotificationChannels so the channels are the same as the ones used as the system
public static final String NOTIFICATION_NETWORK_STATUS = "NETWORK_STATUS"; // server.
public static final String NOTIFICATION_NETWORK_ALERTS = "NETWORK_ALERTS"; public static final String NOTIFICATION_CHANNEL_NETWORK_STATUS = "NETWORK_STATUS";
public static final String NOTIFICATION_VPN = "VPN"; public static final String NOTIFICATION_CHANNEL_NETWORK_ALERTS = "NETWORK_ALERTS";
public static final String NOTIFICATION_CHANNEL_VPN = "VPN";
// The context is for the current user (system server) // The context is for the current user (system server)
private final Context mContext; private final Context mContext;
@@ -263,7 +264,7 @@ public class NetworkNotificationManager {
// the tag. // the tag.
final boolean hasPreviousNotification = previousNotifyType != null; final boolean hasPreviousNotification = previousNotifyType != null;
final String channelId = (highPriority && !hasPreviousNotification) final String channelId = (highPriority && !hasPreviousNotification)
? NOTIFICATION_NETWORK_ALERTS : NOTIFICATION_NETWORK_STATUS; ? NOTIFICATION_CHANNEL_NETWORK_ALERTS : NOTIFICATION_CHANNEL_NETWORK_STATUS;
Notification.Builder builder = new Notification.Builder(mContext, channelId) Notification.Builder builder = new Notification.Builder(mContext, channelId)
.setWhen(System.currentTimeMillis()) .setWhen(System.currentTimeMillis())
.setShowWhen(notifyType == NotificationType.NETWORK_SWITCH) .setShowWhen(notifyType == NotificationType.NETWORK_SWITCH)

View File

@@ -27,7 +27,7 @@ import static android.net.RouteInfo.RTN_UNREACHABLE;
import static com.android.internal.util.Preconditions.checkArgument; import static com.android.internal.util.Preconditions.checkArgument;
import static com.android.internal.util.Preconditions.checkNotNull; import static com.android.internal.util.Preconditions.checkNotNull;
import static com.android.server.connectivity.NetworkNotificationManager.NOTIFICATION_VPN; import static com.android.server.connectivity.NetworkNotificationManager.NOTIFICATION_CHANNEL_VPN;
import android.Manifest; import android.Manifest;
import android.annotation.NonNull; import android.annotation.NonNull;
@@ -1945,7 +1945,7 @@ public class Vpn {
final PendingIntent configIntent = mSystemServices.pendingIntentGetActivityAsUser( final PendingIntent configIntent = mSystemServices.pendingIntentGetActivityAsUser(
intent, PendingIntent.FLAG_IMMUTABLE | PendingIntent.FLAG_UPDATE_CURRENT, user); intent, PendingIntent.FLAG_IMMUTABLE | PendingIntent.FLAG_UPDATE_CURRENT, user);
final Notification.Builder builder = final Notification.Builder builder =
new Notification.Builder(mContext, NOTIFICATION_VPN) new Notification.Builder(mContext, NOTIFICATION_CHANNEL_VPN)
.setSmallIcon(R.drawable.vpn_connected) .setSmallIcon(R.drawable.vpn_connected)
.setContentTitle(mContext.getString(R.string.vpn_lockdown_disconnected)) .setContentTitle(mContext.getString(R.string.vpn_lockdown_disconnected))
.setContentText(mContext.getString(R.string.vpn_lockdown_config)) .setContentText(mContext.getString(R.string.vpn_lockdown_config))

View File

@@ -18,7 +18,7 @@ package com.android.server.net;
import static android.provider.Settings.ACTION_VPN_SETTINGS; import static android.provider.Settings.ACTION_VPN_SETTINGS;
import static com.android.server.connectivity.NetworkNotificationManager.NOTIFICATION_VPN; import static com.android.server.connectivity.NetworkNotificationManager.NOTIFICATION_CHANNEL_VPN;
import android.annotation.NonNull; import android.annotation.NonNull;
import android.annotation.Nullable; import android.annotation.Nullable;
@@ -257,7 +257,7 @@ public class LockdownVpnTracker {
private void showNotification(int titleRes, int iconRes) { private void showNotification(int titleRes, int iconRes) {
final Notification.Builder builder = final Notification.Builder builder =
new Notification.Builder(mContext, NOTIFICATION_VPN) new Notification.Builder(mContext, NOTIFICATION_CHANNEL_VPN)
.setWhen(0) .setWhen(0)
.setSmallIcon(iconRes) .setSmallIcon(iconRes)
.setContentTitle(mContext.getString(titleRes)) .setContentTitle(mContext.getString(titleRes))