Hide "additional services" if there is only a single primary services

There is a case where there is a single primary service (e.g.
a fresh device) and we should hide additional services in that
case.

Test: unit + manual
Bug: 325077523
Change-Id: I9efb785ac3f7a328fdccd138e585f766d46fa282
This commit is contained in:
Becca Hughes
2024-02-13 18:47:01 +00:00
parent 5cbc60dcf3
commit c627cdbdba
2 changed files with 36 additions and 1 deletions

View File

@@ -166,7 +166,7 @@ public class CredentialManagerPreferenceController extends BasePreferenceControl
return CONDITIONALLY_UNAVAILABLE;
}
if (mServices.isEmpty()) {
if (!hasNonPrimaryServices()) {
return CONDITIONALLY_UNAVAILABLE;
}
@@ -428,6 +428,17 @@ public class CredentialManagerPreferenceController extends BasePreferenceControl
}
}
@VisibleForTesting
public boolean hasNonPrimaryServices() {
for (CredentialProviderInfo availableService : mServices) {
if (!availableService.isPrimary()) {
return true;
}
}
return false;
}
@Override
public void displayPreference(PreferenceScreen screen) {
super.displayPreference(screen);