summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--packages/CredentialManager/res/values/dimens.xml2
-rw-r--r--packages/CredentialManager/src/com/android/credentialmanager/autofill/CredentialAutofillService.kt30
2 files changed, 12 insertions, 20 deletions
diff --git a/packages/CredentialManager/res/values/dimens.xml b/packages/CredentialManager/res/values/dimens.xml
index 350920b23c69..82dee5c22736 100644
--- a/packages/CredentialManager/res/values/dimens.xml
+++ b/packages/CredentialManager/res/values/dimens.xml
@@ -26,7 +26,7 @@
<dimen name="autofill_dropdown_textview_min_width">112dp</dimen>
<dimen name="autofill_dropdown_textview_max_width">230dp</dimen>
<dimen name="dropdown_layout_horizontal_margin">24dp</dimen>
- <integer name="autofill_max_visible_datasets">5</integer>
+ <integer name="autofill_max_visible_datasets">4</integer>
<dimen name="dropdown_touch_target_min_height">48dp</dimen>
<dimen name="horizontal_chip_padding">8dp</dimen>
<dimen name="vertical_chip_padding">6dp</dimen>
diff --git a/packages/CredentialManager/src/com/android/credentialmanager/autofill/CredentialAutofillService.kt b/packages/CredentialManager/src/com/android/credentialmanager/autofill/CredentialAutofillService.kt
index c118f886a331..293e1112636e 100644
--- a/packages/CredentialManager/src/com/android/credentialmanager/autofill/CredentialAutofillService.kt
+++ b/packages/CredentialManager/src/com/android/credentialmanager/autofill/CredentialAutofillService.kt
@@ -240,17 +240,11 @@ class CredentialAutofillService : AutofillService() {
val providerDisplayInfo: ProviderDisplayInfo = toProviderDisplayInfo(providerList)
var totalEntryCount = providerDisplayInfo.sortedUserNameToCredentialEntryList.size
val inlineSuggestionsRequest = filLRequest.inlineSuggestionsRequest
- val inlineMaxSuggestedCount = inlineSuggestionsRequest?.maxSuggestionCount ?: 0
val inlinePresentationSpecs = inlineSuggestionsRequest?.inlinePresentationSpecs
val inlinePresentationSpecsCount = inlinePresentationSpecs?.size ?: 0
- val maxDropdownDisplayLimit = this.resources.getInteger(
+ val maxDatasetDisplayLimit = this.resources.getInteger(
com.android.credentialmanager.R.integer.autofill_max_visible_datasets)
- var maxInlineItemCount = totalEntryCount
- maxInlineItemCount = maxInlineItemCount.coerceAtMost(inlineMaxSuggestedCount)
- val lastDropdownDatasetIndex = Settings.Global.getInt(this.contentResolver,
- Settings.Global.AUTOFILL_MAX_VISIBLE_DATASETS,
- (maxDropdownDisplayLimit - 1)).coerceAtMost(totalEntryCount)
-
+ .coerceAtMost(totalEntryCount)
var i = 0
var datasetAdded = false
@@ -275,7 +269,7 @@ class CredentialAutofillService : AutofillService() {
Log.e(TAG, "PendingIntent was missing from the entry.")
return@usernameLoop
}
- if (i >= maxInlineItemCount && i >= lastDropdownDatasetIndex) {
+ if (i >= maxDatasetDisplayLimit) {
return@usernameLoop
}
val icon: Icon = if (primaryEntry.icon == null) {
@@ -288,7 +282,7 @@ class CredentialAutofillService : AutofillService() {
}
// Create inline presentation
var inlinePresentation: InlinePresentation? = null
- if (inlinePresentationSpecs != null && i < maxInlineItemCount) {
+ if (inlinePresentationSpecs != null && i < maxDatasetDisplayLimit) {
val spec: InlinePresentationSpec? = if (i < inlinePresentationSpecsCount) {
inlinePresentationSpecs[i]
} else {
@@ -302,7 +296,7 @@ class CredentialAutofillService : AutofillService() {
}
}
var dropdownPresentation: RemoteViews? = null
- if (i < lastDropdownDatasetIndex) {
+ if (i < maxDatasetDisplayLimit) {
dropdownPresentation = RemoteViewsFactory
.createDropdownPresentation(this, icon, primaryEntry)
}
@@ -328,17 +322,15 @@ class CredentialAutofillService : AutofillService() {
.build())
datasetAdded = true
i++
-
- if (i == lastDropdownDatasetIndex) {
- addDropdownMoreOptionsPresentation(bottomSheetIntent, autofillId,
- fillResponseBuilder)
- }
}
val pinnedSpec = getLastInlinePresentationSpec(inlinePresentationSpecs,
inlinePresentationSpecsCount)
- if (datasetAdded && pinnedSpec != null) {
- addPinnedInlineSuggestion(pinnedSpec, autofillId,
- fillResponseBuilder, bottomSheetIntent)
+ if (datasetAdded) {
+ addDropdownMoreOptionsPresentation(bottomSheetIntent, autofillId, fillResponseBuilder)
+ if (pinnedSpec != null) {
+ addPinnedInlineSuggestion(pinnedSpec, autofillId,
+ fillResponseBuilder, bottomSheetIntent)
+ }
}
return datasetAdded
}