Loading core/java/android/service/autofill/AutofillServiceInfo.java +15 −2 Original line number Original line Diff line number Diff line Loading @@ -312,6 +312,7 @@ public final class AutofillServiceInfo { final ServiceInfo serviceInfo = resolveInfo.serviceInfo; final ServiceInfo serviceInfo = resolveInfo.serviceInfo; try { try { if (serviceInfo != null && isCredentialManagerAutofillService( if (serviceInfo != null && isCredentialManagerAutofillService( context, serviceInfo.getComponentName())) { serviceInfo.getComponentName())) { // Skip this service as it is for internal use only // Skip this service as it is for internal use only continue; continue; Loading @@ -325,11 +326,23 @@ public final class AutofillServiceInfo { return services; return services; } } private static boolean isCredentialManagerAutofillService(ComponentName componentName) { private static boolean isCredentialManagerAutofillService(Context context, ComponentName componentName) { if (componentName == null) { if (componentName == null) { return false; 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 @Override Loading core/res/res/values/config.xml +12 −0 Original line number Original line Diff line number Diff line Loading @@ -4808,6 +4808,18 @@ --> --> <string name="config_defaultCredentialManagerHybridService" translatable="false"></string> <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 <!-- The component name(s), flattened to a string, for the system's credential manager provider services. These services allow retrieving and storing credentials. provider services. These services allow retrieving and storing credentials. Loading core/res/res/values/symbols.xml +1 −0 Original line number Original line Diff line number Diff line Loading @@ -3905,6 +3905,7 @@ <java-symbol type="string" name="config_defaultAppPredictionService" /> <java-symbol type="string" name="config_defaultAppPredictionService" /> <java-symbol type="string" name="config_defaultContentSuggestionsService" /> <java-symbol type="string" name="config_defaultContentSuggestionsService" /> <java-symbol type="string" name="config_defaultCredentialManagerHybridService" /> <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_enabledCredentialProviderService" /> <java-symbol type="array" name="config_primaryCredentialProviderService" /> <java-symbol type="array" name="config_primaryCredentialProviderService" /> <java-symbol type="string" name="config_defaultSearchUiService" /> <java-symbol type="string" name="config_defaultSearchUiService" /> Loading services/autofill/java/com/android/server/autofill/AutofillManagerService.java +12 −1 Original line number Original line Diff line number Diff line Loading @@ -79,6 +79,7 @@ import android.view.autofill.AutofillValue; import android.view.autofill.IAutoFillManager; import android.view.autofill.IAutoFillManager; import android.view.autofill.IAutoFillManagerClient; import android.view.autofill.IAutoFillManagerClient; import com.android.internal.R; import com.android.internal.annotations.GuardedBy; import com.android.internal.annotations.GuardedBy; import com.android.internal.annotations.VisibleForTesting; import com.android.internal.annotations.VisibleForTesting; import com.android.internal.infra.AbstractRemoteService; import com.android.internal.infra.AbstractRemoteService; Loading Loading @@ -159,6 +160,7 @@ public final class AutofillManagerService final FrameworkResourcesServiceNameResolver mFieldClassificationResolver; final FrameworkResourcesServiceNameResolver mFieldClassificationResolver; private final AutoFillUI mUi; private final AutoFillUI mUi; final ComponentName mCredentialAutofillService; private final LocalLog mRequestsHistory = new LocalLog(20); private final LocalLog mRequestsHistory = new LocalLog(20); private final LocalLog mUiLatencyHistory = new LocalLog(20); private final LocalLog mUiLatencyHistory = new LocalLog(20); Loading Loading @@ -288,6 +290,16 @@ public final class AutofillManagerService mAugmentedAutofillResolver.isTemporary(userId)); 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 @Override // from AbstractMasterSystemService Loading Loading @@ -417,7 +429,6 @@ public final class AutofillManagerService } finally { } finally { Binder.restoreCallingIdentity(token); Binder.restoreCallingIdentity(token); } } return managerService; return managerService; } } Loading services/autofill/java/com/android/server/autofill/AutofillManagerServiceImpl.java +2 −1 Original line number Original line Diff line number Diff line Loading @@ -1291,7 +1291,8 @@ final class AutofillManagerServiceImpl RemoteFillService remoteService = RemoteFillService remoteService = new RemoteFillService( new RemoteFillService( getContext(), mInfo.getServiceInfo().getComponentName(), mUserId, getContext(), mInfo.getServiceInfo().getComponentName(), mUserId, /* callbacks= */ null, mMaster.isInstantServiceAllowed()); /* callbacks= */ null, mMaster.isInstantServiceAllowed(), mMaster.mCredentialAutofillService); remoteService.onSavedPasswordCountRequest(receiver); remoteService.onSavedPasswordCountRequest(receiver); } } Loading Loading
core/java/android/service/autofill/AutofillServiceInfo.java +15 −2 Original line number Original line Diff line number Diff line Loading @@ -312,6 +312,7 @@ public final class AutofillServiceInfo { final ServiceInfo serviceInfo = resolveInfo.serviceInfo; final ServiceInfo serviceInfo = resolveInfo.serviceInfo; try { try { if (serviceInfo != null && isCredentialManagerAutofillService( if (serviceInfo != null && isCredentialManagerAutofillService( context, serviceInfo.getComponentName())) { serviceInfo.getComponentName())) { // Skip this service as it is for internal use only // Skip this service as it is for internal use only continue; continue; Loading @@ -325,11 +326,23 @@ public final class AutofillServiceInfo { return services; return services; } } private static boolean isCredentialManagerAutofillService(ComponentName componentName) { private static boolean isCredentialManagerAutofillService(Context context, ComponentName componentName) { if (componentName == null) { if (componentName == null) { return false; 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 @Override Loading
core/res/res/values/config.xml +12 −0 Original line number Original line Diff line number Diff line Loading @@ -4808,6 +4808,18 @@ --> --> <string name="config_defaultCredentialManagerHybridService" translatable="false"></string> <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 <!-- The component name(s), flattened to a string, for the system's credential manager provider services. These services allow retrieving and storing credentials. provider services. These services allow retrieving and storing credentials. Loading
core/res/res/values/symbols.xml +1 −0 Original line number Original line Diff line number Diff line Loading @@ -3905,6 +3905,7 @@ <java-symbol type="string" name="config_defaultAppPredictionService" /> <java-symbol type="string" name="config_defaultAppPredictionService" /> <java-symbol type="string" name="config_defaultContentSuggestionsService" /> <java-symbol type="string" name="config_defaultContentSuggestionsService" /> <java-symbol type="string" name="config_defaultCredentialManagerHybridService" /> <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_enabledCredentialProviderService" /> <java-symbol type="array" name="config_primaryCredentialProviderService" /> <java-symbol type="array" name="config_primaryCredentialProviderService" /> <java-symbol type="string" name="config_defaultSearchUiService" /> <java-symbol type="string" name="config_defaultSearchUiService" /> Loading
services/autofill/java/com/android/server/autofill/AutofillManagerService.java +12 −1 Original line number Original line Diff line number Diff line Loading @@ -79,6 +79,7 @@ import android.view.autofill.AutofillValue; import android.view.autofill.IAutoFillManager; import android.view.autofill.IAutoFillManager; import android.view.autofill.IAutoFillManagerClient; import android.view.autofill.IAutoFillManagerClient; import com.android.internal.R; import com.android.internal.annotations.GuardedBy; import com.android.internal.annotations.GuardedBy; import com.android.internal.annotations.VisibleForTesting; import com.android.internal.annotations.VisibleForTesting; import com.android.internal.infra.AbstractRemoteService; import com.android.internal.infra.AbstractRemoteService; Loading Loading @@ -159,6 +160,7 @@ public final class AutofillManagerService final FrameworkResourcesServiceNameResolver mFieldClassificationResolver; final FrameworkResourcesServiceNameResolver mFieldClassificationResolver; private final AutoFillUI mUi; private final AutoFillUI mUi; final ComponentName mCredentialAutofillService; private final LocalLog mRequestsHistory = new LocalLog(20); private final LocalLog mRequestsHistory = new LocalLog(20); private final LocalLog mUiLatencyHistory = new LocalLog(20); private final LocalLog mUiLatencyHistory = new LocalLog(20); Loading Loading @@ -288,6 +290,16 @@ public final class AutofillManagerService mAugmentedAutofillResolver.isTemporary(userId)); 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 @Override // from AbstractMasterSystemService Loading Loading @@ -417,7 +429,6 @@ public final class AutofillManagerService } finally { } finally { Binder.restoreCallingIdentity(token); Binder.restoreCallingIdentity(token); } } return managerService; return managerService; } } Loading
services/autofill/java/com/android/server/autofill/AutofillManagerServiceImpl.java +2 −1 Original line number Original line Diff line number Diff line Loading @@ -1291,7 +1291,8 @@ final class AutofillManagerServiceImpl RemoteFillService remoteService = RemoteFillService remoteService = new RemoteFillService( new RemoteFillService( getContext(), mInfo.getServiceInfo().getComponentName(), mUserId, getContext(), mInfo.getServiceInfo().getComponentName(), mUserId, /* callbacks= */ null, mMaster.isInstantServiceAllowed()); /* callbacks= */ null, mMaster.isInstantServiceAllowed(), mMaster.mCredentialAutofillService); remoteService.onSavedPasswordCountRequest(receiver); remoteService.onSavedPasswordCountRequest(receiver); } } Loading