Merge "Bump several device admin notifications to high priority" into qt-dev am: c3c30eefb2
am: df396d12ab

Change-Id: I4212fbc4cf9eb3dce1f156f32739f0d80fb66c3f
diff --git a/core/java/com/android/internal/notification/SystemNotificationChannels.java b/core/java/com/android/internal/notification/SystemNotificationChannels.java
index accfc87..a35e42e 100644
--- a/core/java/com/android/internal/notification/SystemNotificationChannels.java
+++ b/core/java/com/android/internal/notification/SystemNotificationChannels.java
@@ -43,7 +43,12 @@
     public static String NETWORK_ALERTS = "NETWORK_ALERTS";
     public static String NETWORK_AVAILABLE = "NETWORK_AVAILABLE";
     public static String VPN = "VPN";
-    public static String DEVICE_ADMIN = "DEVICE_ADMIN";
+    /**
+     * @deprecated Legacy device admin channel with low importance which is no longer used,
+     *  Use the high importance {@link #DEVICE_ADMIN} channel instead.
+     */
+    @Deprecated public static String DEVICE_ADMIN_DEPRECATED = "DEVICE_ADMIN";
+    public static String DEVICE_ADMIN = "DEVICE_ADMIN_ALERTS";
     public static String ALERTS = "ALERTS";
     public static String RETAIL_MODE = "RETAIL_MODE";
     public static String USB = "USB";
@@ -128,7 +133,7 @@
         final NotificationChannel deviceAdmin = new NotificationChannel(
                 DEVICE_ADMIN,
                 context.getString(R.string.notification_channel_device_admin),
-                NotificationManager.IMPORTANCE_LOW);
+                NotificationManager.IMPORTANCE_HIGH);
         channelsList.add(deviceAdmin);
 
         final NotificationChannel alertsChannel = new NotificationChannel(
@@ -180,6 +185,12 @@
         nm.createNotificationChannels(channelsList);
     }
 
+    /** Remove notification channels which are no longer used */
+    public static void removeDeprecated(Context context) {
+        final NotificationManager nm = context.getSystemService(NotificationManager.class);
+        nm.deleteNotificationChannel(DEVICE_ADMIN_DEPRECATED);
+    }
+
     public static void createAccountChannelForPackage(String pkg, int uid, Context context) {
         final INotificationManager iNotificationManager = NotificationManager.getService();
         try {
diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml
index b07e7ef..5652c85 100644
--- a/core/res/res/values/strings.xml
+++ b/core/res/res/values/strings.xml
@@ -633,8 +633,8 @@
     <!-- Text shown when viewing channel settings for notifications related to vpn status -->
     <string name="notification_channel_vpn">VPN status</string>
 
-    <!-- Text shown when viewing channel settings for notifications related to remote device administration -->
-    <string name="notification_channel_device_admin">Device administration</string>
+    <!-- Notification channel name. This channel sends high-priority alerts from the user's IT admin for key updates about the user's work device or work profile. -->
+    <string name="notification_channel_device_admin">Alerts from your IT admin</string>
 
     <!-- Text shown when viewing channel settings for notifications related to important alerts -->
     <string name="notification_channel_alerts">Alerts</string>
@@ -5035,13 +5035,8 @@
     <!-- Notification content shown when new SMS/MMS is received while the device is locked [CHAR LIMIT=NONE] -->
     <string name="new_sms_notification_content">Open SMS app to view</string>
 
-    <!-- Notification title shown when user profile is credential encrypted and requires the user to unlock before some features are usable [CHAR LIMIT=30] -->
-    <string name="user_encrypted_title">Some functionality may be limited</string>
-    <!-- Notification message shown when user profile is credential encrypted and requires the user to unlock before some features are usable [CHAR LIMIT=30] -->
-    <string name="user_encrypted_message">Tap to unlock</string>
-    <!-- Notification detail shown when user profile is credential encrypted and requires the user to unlock before some features are usable [CHAR LIMIT=30] -->
-    <string name="user_encrypted_detail">User data locked</string>
-
+    <!-- Notification title shown when user profile is credential encrypted and requires the user to unlock before some features are usable [CHAR LIMIT=36] -->
+    <string name="profile_encrypted_title">Some functionality may be limited</string>
     <!-- Notification detail shown when work profile is credential encrypted and requires the user to unlock before some features are usable [CHAR LIMIT=30] -->
     <string name="profile_encrypted_detail">Work profile locked</string>
     <!-- Notification message shown when work profile is credential encrypted and requires the user to unlock before some features are usable [CHAR LIMIT=30] -->
diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml
index d91036a3..77988de 100644
--- a/core/res/res/values/symbols.xml
+++ b/core/res/res/values/symbols.xml
@@ -3027,9 +3027,7 @@
   <java-symbol type="string" name="now_string_shortest" />
 
   <!-- Encryption notification while accounts are locked by credential encryption -->
-  <java-symbol type="string" name="user_encrypted_title" />
-  <java-symbol type="string" name="user_encrypted_message" />
-  <java-symbol type="string" name="user_encrypted_detail" />
+  <java-symbol type="string" name="profile_encrypted_title" />
   <java-symbol type="string" name="profile_encrypted_detail" />
   <java-symbol type="string" name="profile_encrypted_message" />
   <java-symbol type="drawable" name="ic_user_secure" />
diff --git a/services/core/java/com/android/server/locksettings/LockSettingsService.java b/services/core/java/com/android/server/locksettings/LockSettingsService.java
index b13cd1e..c2125b0 100644
--- a/services/core/java/com/android/server/locksettings/LockSettingsService.java
+++ b/services/core/java/com/android/server/locksettings/LockSettingsService.java
@@ -506,7 +506,7 @@
     private void showEncryptionNotificationForProfile(UserHandle user) {
         Resources r = mContext.getResources();
         CharSequence title = r.getText(
-                com.android.internal.R.string.user_encrypted_title);
+                com.android.internal.R.string.profile_encrypted_title);
         CharSequence message = r.getText(
                 com.android.internal.R.string.profile_encrypted_message);
         CharSequence detail = r.getText(
@@ -534,7 +534,7 @@
         if (!StorageManager.isFileEncryptedNativeOrEmulated()) return;
 
         Notification notification =
-                new Notification.Builder(mContext, SystemNotificationChannels.SECURITY)
+                new Notification.Builder(mContext, SystemNotificationChannels.DEVICE_ADMIN)
                         .setSmallIcon(com.android.internal.R.drawable.ic_user_secure)
                         .setWhen(0)
                         .setOngoing(true)
diff --git a/services/devicepolicy/java/com/android/server/devicepolicy/RemoteBugreportUtils.java b/services/devicepolicy/java/com/android/server/devicepolicy/RemoteBugreportUtils.java
index 344077c..0838fbc 100644
--- a/services/devicepolicy/java/com/android/server/devicepolicy/RemoteBugreportUtils.java
+++ b/services/devicepolicy/java/com/android/server/devicepolicy/RemoteBugreportUtils.java
@@ -20,7 +20,6 @@
 import android.app.Notification;
 import android.app.PendingIntent;
 import android.app.admin.DevicePolicyManager;
-import android.content.ComponentName;
 import android.content.Context;
 import android.content.Intent;
 import android.os.UserHandle;
@@ -65,7 +64,7 @@
                 dialogIntent, 0, null, UserHandle.CURRENT);
 
         Notification.Builder builder =
-                new Notification.Builder(context, SystemNotificationChannels.DEVELOPER)
+                new Notification.Builder(context, SystemNotificationChannels.DEVICE_ADMIN)
                         .setSmallIcon(com.android.internal.R.drawable.stat_sys_adb)
                         .setOngoing(true)
                         .setLocalOnly(true)
diff --git a/services/java/com/android/server/SystemServer.java b/services/java/com/android/server/SystemServer.java
index ad518d0..24bdf87 100644
--- a/services/java/com/android/server/SystemServer.java
+++ b/services/java/com/android/server/SystemServer.java
@@ -1406,6 +1406,7 @@
 
             traceBeginAndSlog("StartNotificationManager");
             mSystemServiceManager.startService(NotificationManagerService.class);
+            SystemNotificationChannels.removeDeprecated(context);
             SystemNotificationChannels.createAll(context);
             notification = INotificationManager.Stub.asInterface(
                     ServiceManager.getService(Context.NOTIFICATION_SERVICE));