Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a68c461c authored by Reema Bajwa's avatar Reema Bajwa
Browse files

Add config for cedman-autofill service

Test: Cts tests
Bug: 329664717

Change-Id: I4a6567d874863766228921e144d9d15ef415ddbf
parent 65f13a35
Loading
Loading
Loading
Loading
+15 −2
Original line number Diff line number Diff line
@@ -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
+12 −0
Original line number Diff line number Diff line
@@ -4796,6 +4796,18 @@
    -->
    <string name="config_defaultCredentialManagerHybridService" translatable="false"></string>
    
    <!-- The component name, flattened to a string, for the system's credential manager
      autofill service. This service allows interceding autofill requests and routing
      them to credential manager.

     This service must be trusted, as it can be activated without explicit consent of the user.
     If no service with the specified name exists on the device, autofill will still
     work with the user configured autofill service

     See android.credentials.CredentialManager
    -->
    <string name="config_defaultCredentialManagerAutofillService" translatable="false"></string>

    <!-- The component name(s), flattened to a string, for the system's credential manager
      provider services. These services allow retrieving and storing credentials.

+1 −0
Original line number Diff line number Diff line
@@ -3897,6 +3897,7 @@
  <java-symbol type="string" name="config_defaultAppPredictionService" />
  <java-symbol type="string" name="config_defaultContentSuggestionsService" />
  <java-symbol type="string" name="config_defaultCredentialManagerHybridService" />
  <java-symbol type="string" name="config_defaultCredentialManagerAutofillService" />
  <java-symbol type="array" name="config_enabledCredentialProviderService" />
  <java-symbol type="array" name="config_primaryCredentialProviderService" />
  <java-symbol type="string" name="config_defaultSearchUiService" />
+12 −1
Original line number Diff line number Diff line
@@ -79,6 +79,7 @@ import android.view.autofill.AutofillValue;
import android.view.autofill.IAutoFillManager;
import android.view.autofill.IAutoFillManagerClient;

import com.android.internal.R;
import com.android.internal.annotations.GuardedBy;
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.infra.AbstractRemoteService;
@@ -159,6 +160,7 @@ public final class AutofillManagerService
    final FrameworkResourcesServiceNameResolver mFieldClassificationResolver;

    private final AutoFillUI mUi;
    final ComponentName mCredentialAutofillService;

    private final LocalLog mRequestsHistory = new LocalLog(20);
    private final LocalLog mUiLatencyHistory = new LocalLog(20);
@@ -288,6 +290,16 @@ public final class AutofillManagerService
                        mAugmentedAutofillResolver.isTemporary(userId));
            }
        }
        String credentialManagerAutofillCompName = context.getResources().getString(
                R.string.config_defaultCredentialManagerAutofillService);
        if (credentialManagerAutofillCompName != null
                && !credentialManagerAutofillCompName.isEmpty()) {
            mCredentialAutofillService = ComponentName.unflattenFromString(
                    credentialManagerAutofillCompName);
        } else {
            mCredentialAutofillService = null;
            Slog.w(TAG, "Invalid CredentialAutofillService");
        }
    }

    @Override // from AbstractMasterSystemService
@@ -416,7 +428,6 @@ public final class AutofillManagerService
        } finally {
            Binder.restoreCallingIdentity(token);
        }

        return managerService;
    }

+2 −1
Original line number Diff line number Diff line
@@ -1264,7 +1264,8 @@ final class AutofillManagerServiceImpl
        RemoteFillService remoteService =
                new RemoteFillService(
                        getContext(), mInfo.getServiceInfo().getComponentName(), mUserId,
                        /* callbacks= */ null, mMaster.isInstantServiceAllowed());
                        /* callbacks= */ null, mMaster.isInstantServiceAllowed(),
                        mMaster.mCredentialAutofillService);
        remoteService.onSavedPasswordCountRequest(receiver);
    }

Loading