From 46d1795276848febc04d611a8c6b4007af7a510f Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Thu, 27 Oct 2022 16:16:54 +0200 Subject: [PATCH] Fix crash due to missing notification Thread: main, Exception: java.lang.RuntimeException: Unable to start service org.jitsi.meet.sdk.JitsiMeetOngoingConferenceService@3d1f0bc with Intent { cmp=im.vector.app.debug/org.jitsi.meet.sdk.JitsiMeetOngoingConferenceService (has extras) }: java.lang.IllegalArgumentException: Invalid notification (no valid small icon): Notification(channel=JitsiOngoingConferenceChannel pri=0 contentView=null vibrate=null sound=null defaults=0x0 flags=0xa color=0x00000000 category=call actions=2 vis=PUBLIC semFlags=0x0 semPriority=0 semMissedCount=0) --- .../vector/app/features/debug/DebugMenuActivity.kt | 6 +++--- .../app/features/notifications/NotificationUtils.kt | 10 +++++----- .../{ic_status_bar.png => ic_notification.png} | Bin .../{ic_status_bar.png => ic_notification.png} | Bin .../{ic_status_bar.png => ic_notification.png} | Bin .../{ic_status_bar.png => ic_notification.png} | Bin .../{ic_status_bar.png => ic_notification.png} | Bin 7 files changed, 8 insertions(+), 8 deletions(-) rename vector/src/main/res/drawable-hdpi/{ic_status_bar.png => ic_notification.png} (100%) rename vector/src/main/res/drawable-mdpi/{ic_status_bar.png => ic_notification.png} (100%) rename vector/src/main/res/drawable-xhdpi/{ic_status_bar.png => ic_notification.png} (100%) rename vector/src/main/res/drawable-xxhdpi/{ic_status_bar.png => ic_notification.png} (100%) rename vector/src/main/res/drawable-xxxhdpi/{ic_status_bar.png => ic_notification.png} (100%) diff --git a/vector-app/src/debug/java/im/vector/app/features/debug/DebugMenuActivity.kt b/vector-app/src/debug/java/im/vector/app/features/debug/DebugMenuActivity.kt index 92c7ebffdc..af63e6eae0 100644 --- a/vector-app/src/debug/java/im/vector/app/features/debug/DebugMenuActivity.kt +++ b/vector-app/src/debug/java/im/vector/app/features/debug/DebugMenuActivity.kt @@ -179,7 +179,7 @@ class DebugMenuActivity : VectorBaseActivity() { .setContentText("Content") // No effect because it's a group summary notif .setNumber(33) - .setSmallIcon(R.drawable.ic_status_bar) + .setSmallIcon(R.drawable.ic_notification) // This provocate the badge issue: no badge for group notification .setGroup("GroupKey") .setGroupSummary(true) @@ -212,7 +212,7 @@ class DebugMenuActivity : VectorBaseActivity() { // For shortcut on long press on launcher icon .setBadgeIconType(NotificationCompat.BADGE_ICON_NONE) .setStyle(messagingStyle1) - .setSmallIcon(R.drawable.ic_status_bar) + .setSmallIcon(R.drawable.ic_notification) .setGroup("GroupKey") .build() ) @@ -224,7 +224,7 @@ class DebugMenuActivity : VectorBaseActivity() { .setContentTitle("Title 2") .setContentText("Content 2") .setStyle(messagingStyle2) - .setSmallIcon(R.drawable.ic_status_bar) + .setSmallIcon(R.drawable.ic_notification) .setGroup("GroupKey") .build() ) diff --git a/vector/src/main/java/im/vector/app/features/notifications/NotificationUtils.kt b/vector/src/main/java/im/vector/app/features/notifications/NotificationUtils.kt index 7e91a89603..bf1b23093d 100755 --- a/vector/src/main/java/im/vector/app/features/notifications/NotificationUtils.kt +++ b/vector/src/main/java/im/vector/app/features/notifications/NotificationUtils.kt @@ -582,7 +582,7 @@ class NotificationUtils @Inject constructor( val accentColor = ContextCompat.getColor(context, R.color.notification_accent_color) // Build the pending intent for when the notification is clicked val openRoomIntent = buildOpenRoomIntent(roomInfo.roomId) - val smallIcon = R.drawable.ic_status_bar + val smallIcon = R.drawable.ic_notification val channelID = if (roomInfo.shouldBing) NOISY_NOTIFICATION_CHANNEL_ID else SILENT_NOTIFICATION_CHANNEL_ID return NotificationCompat.Builder(context, channelID) @@ -695,7 +695,7 @@ class NotificationUtils @Inject constructor( ): Notification { val accentColor = ContextCompat.getColor(context, R.color.notification_accent_color) // Build the pending intent for when the notification is clicked - val smallIcon = R.drawable.ic_status_bar + val smallIcon = R.drawable.ic_notification val channelID = if (inviteNotifiableEvent.noisy) NOISY_NOTIFICATION_CHANNEL_ID else SILENT_NOTIFICATION_CHANNEL_ID @@ -775,7 +775,7 @@ class NotificationUtils @Inject constructor( ): Notification { val accentColor = ContextCompat.getColor(context, R.color.notification_accent_color) // Build the pending intent for when the notification is clicked - val smallIcon = R.drawable.ic_status_bar + val smallIcon = R.drawable.ic_notification val channelID = if (simpleNotifiableEvent.noisy) NOISY_NOTIFICATION_CHANNEL_ID else SILENT_NOTIFICATION_CHANNEL_ID @@ -890,7 +890,7 @@ class NotificationUtils @Inject constructor( lastMessageTimestamp: Long ): Notification { val accentColor = ContextCompat.getColor(context, R.color.notification_accent_color) - val smallIcon = R.drawable.ic_status_bar + val smallIcon = R.drawable.ic_notification return NotificationCompat.Builder(context, if (noisy) NOISY_NOTIFICATION_CHANNEL_ID else SILENT_NOTIFICATION_CHANNEL_ID) .setOnlyAlertOnce(true) @@ -980,7 +980,7 @@ class NotificationUtils @Inject constructor( NotificationCompat.Builder(context, NOISY_NOTIFICATION_CHANNEL_ID) .setContentTitle(stringProvider.getString(R.string.app_name)) .setContentText(stringProvider.getString(R.string.settings_troubleshoot_test_push_notification_content)) - .setSmallIcon(R.drawable.ic_status_bar) + .setSmallIcon(R.drawable.ic_notification) .setLargeIcon(getBitmap(context, R.drawable.element_logo_green)) .setColor(ContextCompat.getColor(context, R.color.notification_accent_color)) .setPriority(NotificationCompat.PRIORITY_MAX) diff --git a/vector/src/main/res/drawable-hdpi/ic_status_bar.png b/vector/src/main/res/drawable-hdpi/ic_notification.png similarity index 100% rename from vector/src/main/res/drawable-hdpi/ic_status_bar.png rename to vector/src/main/res/drawable-hdpi/ic_notification.png diff --git a/vector/src/main/res/drawable-mdpi/ic_status_bar.png b/vector/src/main/res/drawable-mdpi/ic_notification.png similarity index 100% rename from vector/src/main/res/drawable-mdpi/ic_status_bar.png rename to vector/src/main/res/drawable-mdpi/ic_notification.png diff --git a/vector/src/main/res/drawable-xhdpi/ic_status_bar.png b/vector/src/main/res/drawable-xhdpi/ic_notification.png similarity index 100% rename from vector/src/main/res/drawable-xhdpi/ic_status_bar.png rename to vector/src/main/res/drawable-xhdpi/ic_notification.png diff --git a/vector/src/main/res/drawable-xxhdpi/ic_status_bar.png b/vector/src/main/res/drawable-xxhdpi/ic_notification.png similarity index 100% rename from vector/src/main/res/drawable-xxhdpi/ic_status_bar.png rename to vector/src/main/res/drawable-xxhdpi/ic_notification.png diff --git a/vector/src/main/res/drawable-xxxhdpi/ic_status_bar.png b/vector/src/main/res/drawable-xxxhdpi/ic_notification.png similarity index 100% rename from vector/src/main/res/drawable-xxxhdpi/ic_status_bar.png rename to vector/src/main/res/drawable-xxxhdpi/ic_notification.png