From 725ac0e2ead1ef7987a2a022bd3300047162629b Mon Sep 17 00:00:00 2001 From: Jiaming Liu Date: Wed, 1 Feb 2023 01:16:43 +0000 Subject: [PATCH] Update icons for concurrent display notifications Update icons for concurrent display notifications Fix: 266833171 Test: Manual Change-Id: I27c59031ac2537e73275870e023f73e10a4653a1 --- core/res/res/drawable/ic_dual_screen.xml | 25 +++++++++++++++++++ core/res/res/drawable/ic_thermostat.xml | 25 +++++++++++++++++++ core/res/res/values/symbols.xml | 2 ++ .../DeviceStateNotificationController.java | 11 +++++--- 4 files changed, 59 insertions(+), 4 deletions(-) create mode 100644 core/res/res/drawable/ic_dual_screen.xml create mode 100644 core/res/res/drawable/ic_thermostat.xml diff --git a/core/res/res/drawable/ic_dual_screen.xml b/core/res/res/drawable/ic_dual_screen.xml new file mode 100644 index 0000000000000..26d97b7e837f5 --- /dev/null +++ b/core/res/res/drawable/ic_dual_screen.xml @@ -0,0 +1,25 @@ + + + + diff --git a/core/res/res/drawable/ic_thermostat.xml b/core/res/res/drawable/ic_thermostat.xml new file mode 100644 index 0000000000000..23e5792506e71 --- /dev/null +++ b/core/res/res/drawable/ic_thermostat.xml @@ -0,0 +1,25 @@ + + + + diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml index 2af91e1adaa5d..2ef48e91ac7a9 100644 --- a/core/res/res/values/symbols.xml +++ b/core/res/res/values/symbols.xml @@ -1438,6 +1438,8 @@ + + diff --git a/services/core/java/com/android/server/devicestate/DeviceStateNotificationController.java b/services/core/java/com/android/server/devicestate/DeviceStateNotificationController.java index 2f149987e91a8..900874044881c 100644 --- a/services/core/java/com/android/server/devicestate/DeviceStateNotificationController.java +++ b/services/core/java/com/android/server/devicestate/DeviceStateNotificationController.java @@ -16,6 +16,7 @@ package com.android.server.devicestate; +import android.annotation.DrawableRes; import android.annotation.NonNull; import android.annotation.Nullable; import android.app.Notification; @@ -103,7 +104,7 @@ class DeviceStateNotificationController extends BroadcastReceiver { showNotification( info.name, info.activeNotificationTitle, String.format(info.activeNotificationContent, requesterApplicationLabel), - true /* ongoing */ + true /* ongoing */, R.drawable.ic_dual_screen ); } else { Slog.e(TAG, "Cannot determine the requesting app name when showing state active " @@ -124,7 +125,8 @@ class DeviceStateNotificationController extends BroadcastReceiver { } showNotification( info.name, info.thermalCriticalNotificationTitle, - info.thermalCriticalNotificationContent, false /* ongoing */ + info.thermalCriticalNotificationContent, false /* ongoing */, + R.drawable.ic_thermostat ); } @@ -158,11 +160,12 @@ class DeviceStateNotificationController extends BroadcastReceiver { * @param ongoing if true, display an ongoing (sticky) notification with a turn off button. */ private void showNotification( - @NonNull String name, @NonNull String title, @NonNull String content, boolean ongoing) { + @NonNull String name, @NonNull String title, @NonNull String content, boolean ongoing, + @DrawableRes int iconRes) { final NotificationChannel channel = new NotificationChannel( CHANNEL_ID, name, NotificationManager.IMPORTANCE_HIGH); final Notification.Builder builder = new Notification.Builder(mContext, CHANNEL_ID) - .setSmallIcon(R.drawable.ic_lock) // TODO(b/266833171) update icons when available. + .setSmallIcon(iconRes) .setContentTitle(title) .setContentText(content) .setSubText(name)