Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fd574803 authored by Daniel Kim's avatar Daniel Kim
Browse files

Fix default icon

Credential entries with or without icons will always have non-null icon reference.
The valid icons will have non-null drawable reference but invalid
ones will have null drawable reference. If the drawable reference is null, then
use the default icon instead of the icon reference that is stored in the
map which won't display anything.

Bug: 299321128
Test: local device testing

Change-Id: Ib20046f5a8e3c66fb546bf6e8dde49388160739e
parent dc9ba485
Loading
Loading
Loading
Loading
+9 −3
Original line number Diff line number Diff line
@@ -219,9 +219,15 @@ class CredentialAutofillService : AutofillService() {
            val sliceBuilder = InlineSuggestionUi
                    .newContentBuilder(pendingIntent)
                    .setTitle(primaryEntry.userName)
            val icon: Icon =
                    entryIconMap[primaryEntry.entryKey + primaryEntry.entrySubkey]
            val icon: Icon
            if (primaryEntry.icon == null) {
                // The empty entry icon has non-null icon reference but null drawable reference.
                // If the drawable reference is null, then use the default icon.
                icon = getDefaultIcon()
            } else {
                icon = entryIconMap[primaryEntry.entryKey + primaryEntry.entrySubkey]
                        ?: getDefaultIcon()
            }
            sliceBuilder.setStartIcon(icon)
            val inlinePresentation = InlinePresentation(
                    sliceBuilder.build().slice, spec, /* pinned= */ false)