Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/promoted/PromotedNotificationContentExtractor.kt +11 −1 Original line number Diff line number Diff line Loading @@ -36,6 +36,7 @@ import android.app.Notification.InboxStyle import android.app.Notification.ProgressStyle import android.app.Person import android.content.Context import android.content.pm.PackageManager.NameNotFoundException import android.graphics.drawable.Icon import android.service.notification.StatusBarNotification import com.android.systemui.Flags Loading Loading @@ -243,7 +244,16 @@ constructor( private fun StatusBarNotification.skeletonAppIcon(): NotifIcon.AppIcon? { if (!android.app.Flags.notificationsRedesignAppIcons()) return null if (!notificationIconStyleProvider.shouldShowAppIcon(this, context)) return null return NotifIcon.AppIcon(appIconProvider.getOrFetchSkeletonAppIcon(packageName, context)) return try { NotifIcon.AppIcon(appIconProvider.getOrFetchSkeletonAppIcon(packageName, context)) } catch (e: NameNotFoundException) { // TODO: b/416215382 - Because we're passing the SystemUI context to AppIconProvider // instead of the app's context, the fetch method can throw a NameNotFoundException // if the app is not installed on the main profile. When this happens, we fall back to // the small icon here as a temporary workaround, but this will be removed when the // AppIconProvided is updated to receive a userId instead of a context. null } } private fun Notification.title(): CharSequence? = getCharSequenceExtraUnlessEmpty(EXTRA_TITLE) Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/row/icon/AppIconProvider.kt +7 −0 Original line number Diff line number Diff line Loading @@ -64,6 +64,13 @@ interface AppIconProvider { /** * Loads the skeleton (black and white)-themed icon corresponding to [packageName] into cache, * or fetches it from there if already present. This should only be called from the background. * * @param packageName the name of the app's package * @param context the app's context (NOT SystemUI) * * TODO: b/416215382 - if we get the SystemUI context here instead of the app's, and the package * is not installed on the main profile, this will throw a [NameNotFoundException]. We should * update the API to take a userId directly to avoid such issues. */ @Throws(NameNotFoundException::class) @WorkerThread Loading Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/promoted/PromotedNotificationContentExtractor.kt +11 −1 Original line number Diff line number Diff line Loading @@ -36,6 +36,7 @@ import android.app.Notification.InboxStyle import android.app.Notification.ProgressStyle import android.app.Person import android.content.Context import android.content.pm.PackageManager.NameNotFoundException import android.graphics.drawable.Icon import android.service.notification.StatusBarNotification import com.android.systemui.Flags Loading Loading @@ -243,7 +244,16 @@ constructor( private fun StatusBarNotification.skeletonAppIcon(): NotifIcon.AppIcon? { if (!android.app.Flags.notificationsRedesignAppIcons()) return null if (!notificationIconStyleProvider.shouldShowAppIcon(this, context)) return null return NotifIcon.AppIcon(appIconProvider.getOrFetchSkeletonAppIcon(packageName, context)) return try { NotifIcon.AppIcon(appIconProvider.getOrFetchSkeletonAppIcon(packageName, context)) } catch (e: NameNotFoundException) { // TODO: b/416215382 - Because we're passing the SystemUI context to AppIconProvider // instead of the app's context, the fetch method can throw a NameNotFoundException // if the app is not installed on the main profile. When this happens, we fall back to // the small icon here as a temporary workaround, but this will be removed when the // AppIconProvided is updated to receive a userId instead of a context. null } } private fun Notification.title(): CharSequence? = getCharSequenceExtraUnlessEmpty(EXTRA_TITLE) Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/row/icon/AppIconProvider.kt +7 −0 Original line number Diff line number Diff line Loading @@ -64,6 +64,13 @@ interface AppIconProvider { /** * Loads the skeleton (black and white)-themed icon corresponding to [packageName] into cache, * or fetches it from there if already present. This should only be called from the background. * * @param packageName the name of the app's package * @param context the app's context (NOT SystemUI) * * TODO: b/416215382 - if we get the SystemUI context here instead of the app's, and the package * is not installed on the main profile, this will throw a [NameNotFoundException]. We should * update the API to take a userId directly to avoid such issues. */ @Throws(NameNotFoundException::class) @WorkerThread Loading