From a68c461c04d54e00d49f2df9f50f70ab56279119 Mon Sep 17 00:00:00 2001 From: Reema Bajwa Date: Thu, 21 Mar 2024 13:56:01 +0000 Subject: Add config for cedman-autofill service Test: Cts tests Bug: 329664717 Change-Id: I4a6567d874863766228921e144d9d15ef415ddbf --- .../service/autofill/AutofillServiceInfo.java | 17 +++++++++-- core/res/res/values/config.xml | 12 ++++++++ core/res/res/values/symbols.xml | 1 + .../server/autofill/AutofillManagerService.java | 13 ++++++++- .../autofill/AutofillManagerServiceImpl.java | 3 +- .../android/server/autofill/RemoteFillService.java | 9 ++---- .../server/autofill/SecondaryProviderHandler.java | 5 ++-- .../java/com/android/server/autofill/Session.java | 33 ++++++++++++++++------ 8 files changed, 73 insertions(+), 20 deletions(-) diff --git a/core/java/android/service/autofill/AutofillServiceInfo.java b/core/java/android/service/autofill/AutofillServiceInfo.java index 83f96629a582..0e67477fbd8e 100644 --- a/core/java/android/service/autofill/AutofillServiceInfo.java +++ b/core/java/android/service/autofill/AutofillServiceInfo.java @@ -312,6 +312,7 @@ public final class AutofillServiceInfo { final ServiceInfo serviceInfo = resolveInfo.serviceInfo; try { if (serviceInfo != null && isCredentialManagerAutofillService( + context, serviceInfo.getComponentName())) { // Skip this service as it is for internal use only continue; @@ -325,11 +326,23 @@ public final class AutofillServiceInfo { return services; } - private static boolean isCredentialManagerAutofillService(ComponentName componentName) { + private static boolean isCredentialManagerAutofillService(Context context, + ComponentName componentName) { if (componentName == null) { return false; } - return componentName.equals(CREDMAN_SERVICE_COMPONENT_NAME); + ComponentName credAutofillService = null; + String credentialManagerAutofillCompName = context.getResources().getString( + R.string.config_defaultCredentialManagerAutofillService); + if (credentialManagerAutofillCompName != null && !credentialManagerAutofillCompName + .isEmpty()) { + credAutofillService = ComponentName.unflattenFromString( + credentialManagerAutofillCompName); + } else { + Log.w(TAG, "Invalid CredentialAutofillService"); + } + + return componentName.equals(credAutofillService); } @Override diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml index e3f1cb619eb5..15ae3734c670 100644 --- a/core/res/res/values/config.xml +++ b/core/res/res/values/config.xml @@ -4795,6 +4795,18 @@ See android.credentials.CredentialManager --> + + +