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

Commit e4cdeae9 authored by Helen Qin's avatar Helen Qin
Browse files

Handle empty auth entry title

Use the provider label as title when the title is empty.

Test: manual (see bug for screenshots)
Bug: 281612710
Fix: 281612710
Change-Id: If8b7a765e331ed1d2c475f21fde7834c960e4b33
parent d7d9d489
Loading
Loading
Loading
Loading
+2 −7
Original line number Diff line number Diff line
@@ -17,7 +17,6 @@
package com.android.credentialmanager

import android.app.slice.Slice
import android.app.slice.SliceItem
import android.content.ComponentName
import android.content.Context
import android.content.pm.PackageManager
@@ -336,12 +335,8 @@ class GetFlowUtils {
                val structuredAuthEntry =
                    AuthenticationAction.fromSlice(entry.slice) ?: return@forEach

                // TODO: replace with official jetpack code.
                val titleItem: SliceItem? = entry.slice.items.firstOrNull {
                    it.hasHint(
                        "androidx.credentials.provider.authenticationAction.SLICE_HINT_TITLE")
                }
                val title: String = titleItem?.text?.toString() ?: providerDisplayName
                val title: String =
                    structuredAuthEntry.title.toString().ifEmpty { providerDisplayName }

                result.add(AuthenticationEntryInfo(
                    providerId = providerId,