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
This commit is contained in:
Helen Qin
2023-05-09 04:42:12 +00:00
parent d7d9d4892c
commit e4cdeae925

View File

@@ -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,