From 15297a67d3240157906a3fb3ed028043d7454d1a Mon Sep 17 00:00:00 2001 From: Charles He Date: Sat, 8 Apr 2017 22:03:42 +0100 Subject: [PATCH] VPN: cancel always-on notification with new id Previously we used 0 for the id of the "Always-on VPN disconnected" notification, as did many other system services. In a recent CL, an effort was made to assign a dedicated id to each of these system notifications. Unfortunately, this CL only changed the id in the call to NotificationManager#notify(), but not NotificationManager#cancel(). This causes the notification to persist even when always-on VPN is turned off by the user. This CL changes the id in the cancel() call, thus fixing the issue. Bug: 37175930 Test: manually enable and disable always-on and observe the notification Change-Id: I39c7325c78479afe3dc9e1764d54406bd721b067 --- services/core/java/com/android/server/connectivity/Vpn.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/core/java/com/android/server/connectivity/Vpn.java b/services/core/java/com/android/server/connectivity/Vpn.java index 2eb555754732..d8de0bddcf74 100644 --- a/services/core/java/com/android/server/connectivity/Vpn.java +++ b/services/core/java/com/android/server/connectivity/Vpn.java @@ -1287,7 +1287,7 @@ public class Vpn { try { final NotificationManager notificationManager = NotificationManager.from(mContext); if (!visible) { - notificationManager.cancelAsUser(TAG, 0, user); + notificationManager.cancelAsUser(TAG, SystemMessage.NOTE_VPN_DISCONNECTED, user); return; } final Intent intent = new Intent(Settings.ACTION_VPN_SETTINGS); -- 2.11.0