From 2f36ab88d706965dae8c1eaafcd02abb3f0097c8 Mon Sep 17 00:00:00 2001 From: Dan Sandler Date: Thu, 25 May 2017 00:15:49 -0400 Subject: Updates to Dianne's Dungeon. - new EKG icon - set the notification timestamp to the oldest service start time, so you have some idea how long things have been this way - minor text fixes Bug: 36891897 Test: runtest -x cts/tests/app/src/android/app/cts/ServiceTest.java Change-Id: I99db280cde8ca3ecd7205cd44fac159d8f652ca2 --- .../notification/SystemNotificationChannels.java | 2 +- core/res/res/drawable/stat_sys_vitals.xml | 29 ++++++++++++++++++++++ core/res/res/values/symbols.xml | 1 + .../java/com/android/server/am/ActiveServices.java | 10 +++++--- 4 files changed, 38 insertions(+), 4 deletions(-) create mode 100644 core/res/res/drawable/stat_sys_vitals.xml diff --git a/core/java/com/android/internal/notification/SystemNotificationChannels.java b/core/java/com/android/internal/notification/SystemNotificationChannels.java index 797cf2b6de56..d327180c6e9d 100644 --- a/core/java/com/android/internal/notification/SystemNotificationChannels.java +++ b/core/java/com/android/internal/notification/SystemNotificationChannels.java @@ -135,7 +135,7 @@ public class SystemNotificationChannels { channelsList.add(new NotificationChannel( FOREGROUND_SERVICE, context.getString(R.string.notification_channel_foreground_service), - NotificationManager.IMPORTANCE_MIN)); + NotificationManager.IMPORTANCE_LOW)); nm.createNotificationChannels(channelsList); } diff --git a/core/res/res/drawable/stat_sys_vitals.xml b/core/res/res/drawable/stat_sys_vitals.xml new file mode 100644 index 000000000000..213dd5fbed6e --- /dev/null +++ b/core/res/res/drawable/stat_sys_vitals.xml @@ -0,0 +1,29 @@ + + + + + diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml index bfd40bd704e1..cd29c64df4d8 100644 --- a/core/res/res/values/symbols.xml +++ b/core/res/res/values/symbols.xml @@ -3024,4 +3024,5 @@ + diff --git a/services/core/java/com/android/server/am/ActiveServices.java b/services/core/java/com/android/server/am/ActiveServices.java index 2680b425ff3c..bad7091429a2 100644 --- a/services/core/java/com/android/server/am/ActiveServices.java +++ b/services/core/java/com/android/server/am/ActiveServices.java @@ -162,7 +162,7 @@ public final class ActiveServices { /** * Information about an app that is currently running one or more foreground services. - * (This mapps directly to the running apps we show in the notification.) + * (This maps directly to the running apps we show in the notification.) */ static final class ActiveForegroundApp { String mPackageName; @@ -813,6 +813,7 @@ public final class ActiveServices { String title; String msg; String[] pkgs; + long oldestStartTime = System.currentTimeMillis(); // now if (active.size() == 1) { intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS); intent.setData(Uri.fromParts("package", active.get(0).mPackageName, null)); @@ -820,11 +821,13 @@ public final class ActiveServices { R.string.foreground_service_app_in_background, active.get(0).mLabel); msg = context.getString(R.string.foreground_service_tap_for_details); pkgs = new String[] { active.get(0).mPackageName }; + oldestStartTime = active.get(0).mStartTime; } else { intent = new Intent(Settings.ACTION_FOREGROUND_SERVICES_SETTINGS); pkgs = new String[active.size()]; for (int i = 0; i < active.size(); i++) { pkgs[i] = active.get(i).mPackageName; + oldestStartTime = Math.min(oldestStartTime, active.get(i).mStartTime); } intent.putExtra("packages", pkgs); title = context.getString( @@ -841,9 +844,10 @@ public final class ActiveServices { new Notification.Builder(context, SystemNotificationChannels.FOREGROUND_SERVICE) .addExtras(notificationBundle) - .setSmallIcon(R.drawable.ic_check_circle_24px) + .setSmallIcon(R.drawable.stat_sys_vitals) .setOngoing(true) - .setShowWhen(false) + .setShowWhen(oldestStartTime > 0) + .setWhen(oldestStartTime) .setColor(context.getColor( com.android.internal.R.color.system_notification_accent_color)) .setContentTitle(title) -- cgit v1.2.3-59-g8ed1b