Fix bug that filters out system providers

When setAllowedProvider is specified, currently we are filtering out all
the system providers. With this change, we will always ping the system providers
+ the providers specified in the allow list.

Bug: 277773297
Test: built locally & deployed on devive

Change-Id: I8a82f68edbd75b9a879d7e32aa32413af3a35cd9
This commit is contained in:
Reema Bajwa
2023-05-12 08:24:00 +00:00
parent c7515ae352
commit f7b23ffc4c

View File

@@ -150,7 +150,7 @@ public final class ProviderGetSession extends ProviderSession<BeginGetCredential
List<CredentialOption> filteredOptions = new ArrayList<>();
for (CredentialOption option : clientRequest.getCredentialOptions()) {
if (providerCapabilities.contains(option.getType())
&& isProviderAllowed(option, info.getComponentName())
&& isProviderAllowed(option, info)
&& checkSystemProviderRequirement(option, info.isSystemProvider())) {
Slog.i(TAG, "Option of type: " + option.getType() + " meets all filtering"
+ "conditions");
@@ -167,9 +167,14 @@ public final class ProviderGetSession extends ProviderSession<BeginGetCredential
return null;
}
private static boolean isProviderAllowed(CredentialOption option, ComponentName componentName) {
private static boolean isProviderAllowed(CredentialOption option,
CredentialProviderInfo providerInfo) {
if (providerInfo.isSystemProvider()) {
// Always allow system providers , including the remote provider
return true;
}
if (!option.getAllowedProviders().isEmpty() && !option.getAllowedProviders().contains(
componentName)) {
providerInfo.getComponentName())) {
Slog.i(TAG, "Provider allow list specified but does not contain this provider");
return false;
}