From f89d3f9f6459b4a3a871116a2242b81fd56ac06e Mon Sep 17 00:00:00 2001 From: Pavel Grafov Date: Thu, 7 May 2020 11:01:58 +0100 Subject: [PATCH] Make notification match the mocks. * Now it is of nice blue colour, lighter in night theme. * Uses suitcase icon instead of warning sign. * Shows "Work profile" instead of "Android system" as the source. note: I reused a string for "Work profile", which has the same content, but different purpose. This is not ideal, but we are way past the deadline. Bug: 155612405 Test: manual, with TestDPC Change-Id: I8298401742085b1738de384e3fe0e612a8142607 --- core/res/res/values-night/colors.xml | 2 ++ core/res/res/values/colors.xml | 3 +++ core/res/res/values/symbols.xml | 3 +++ .../devicepolicy/DevicePolicyManagerService.java | 10 ++++++++-- 4 files changed, 16 insertions(+), 2 deletions(-) diff --git a/core/res/res/values-night/colors.xml b/core/res/res/values-night/colors.xml index 708b4f352112e..98fece3b3c6c2 100644 --- a/core/res/res/values-night/colors.xml +++ b/core/res/res/values-night/colors.xml @@ -35,4 +35,6 @@ #FFFFFF #FFFFFF + + #8AB4F8 diff --git a/core/res/res/values/colors.xml b/core/res/res/values/colors.xml index 831da6f7ce4e5..38bcf18d5a2d1 100644 --- a/core/res/res/values/colors.xml +++ b/core/res/res/values/colors.xml @@ -227,5 +227,8 @@ #FF202124 #FF5F6368 + + #1A73E8 + #F9AB00 diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml index 9a7f07f14cb1d..e2875429bd2f9 100644 --- a/core/res/res/values/symbols.xml +++ b/core/res/res/values/symbols.xml @@ -1203,6 +1203,7 @@ + @@ -4003,6 +4004,8 @@ + + diff --git a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java index 966694ad346c0..e44f862323150 100644 --- a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java +++ b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java @@ -16150,18 +16150,24 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager { ? R.string.personal_apps_suspension_tomorrow_text : R.string.personal_apps_suspension_text); final boolean ongoing = notificationState == PROFILE_OFF_DEADLINE_REACHED; + final int color = mContext.getColor(R.color.personal_apps_suspension_notification_color); + final Bundle extras = new Bundle(); + // TODO: Create a separate string for this. + extras.putString(Notification.EXTRA_SUBSTITUTE_APP_NAME, + mContext.getString(R.string.notification_work_profile_content_description)); final Notification notification = new Notification.Builder(mContext, SystemNotificationChannels.DEVICE_ADMIN) - .setSmallIcon(android.R.drawable.stat_sys_warning) + .setSmallIcon(R.drawable.ic_corp_badge_no_background) .setOngoing(ongoing) .setAutoCancel(false) .setContentTitle(mContext.getString( R.string.personal_apps_suspension_title)) .setContentText(text) .setStyle(new Notification.BigTextStyle().bigText(text)) - .setColor(mContext.getColor(R.color.system_notification_accent_color)) + .setColor(color) .addAction(turnProfileOnButton) + .addExtras(extras) .build(); mInjector.getNotificationManager().notify( SystemMessage.NOTE_PERSONAL_APPS_SUSPENDED, notification);