Loading packages/CredentialManager/src/com/android/credentialmanager/autofill/CredentialAutofillService.kt +13 −6 Original line number Diff line number Diff line Loading @@ -39,6 +39,7 @@ import android.service.autofill.SaveRequest import android.service.credentials.CredentialProviderService import android.util.Log import android.view.autofill.AutofillId import org.json.JSONException import android.widget.inline.InlinePresentationSpec import androidx.autofill.inline.v1.InlineSuggestionUi import com.android.credentialmanager.GetFlowUtils Loading @@ -56,11 +57,9 @@ class CredentialAutofillService : AutofillService() { private const val SYS_PROVIDER_REQ_KEY = "isSystemProviderRequired" private const val CRED_OPTIONS_KEY = "credentialOptions" private const val TYPE_KEY = "type" private const val REQ_TYPE_KEY = "get" } private val credentialManager: CredentialManager = getSystemService(Context.CREDENTIAL_SERVICE) as CredentialManager override fun onFillRequest( request: FillRequest, cancellationSignal: CancellationSignal, Loading @@ -73,9 +72,12 @@ class CredentialAutofillService : AutofillService() { val getCredRequest: GetCredentialRequest? = getCredManRequest(structure) if (getCredRequest == null) { Log.i(TAG, "No credential manager request found") callback.onFailure("No credential manager request found") return } val credentialManager: CredentialManager = getSystemService(Context.CREDENTIAL_SERVICE) as CredentialManager val outcome = object : OutcomeReceiver<GetCandidateCredentialsResponse, GetCandidateCredentialsException> { Loading Loading @@ -244,8 +246,12 @@ class CredentialAutofillService : AutofillService() { val credentialOptions: MutableList<CredentialOption> = mutableListOf() for (credentialHint in credentialHints) { try { convertJsonToCredentialOption(credentialHint, autofillId) .let { credentialOptions.addAll(it) } } catch (e: JSONException) { Log.i(TAG, "Exception while parsing response: " + e.message) } } return credentialOptions } Loading @@ -257,7 +263,8 @@ class CredentialAutofillService : AutofillService() { val credentialOptions: MutableList<CredentialOption> = mutableListOf() val json = JSONObject(jsonString) val options = json.getJSONArray(CRED_OPTIONS_KEY) val jsonGet = json.getJSONObject(REQ_TYPE_KEY) val options = jsonGet.getJSONArray(CRED_OPTIONS_KEY) for (i in 0 until options.length()) { val option = options.getJSONObject(i) val candidateBundle = convertJsonToBundle(option.getJSONObject(CANDIDATE_DATA_KEY)) Loading services/autofill/java/com/android/server/autofill/AutofillManagerService.java +19 −1 Original line number Diff line number Diff line Loading @@ -227,6 +227,9 @@ public final class AutofillManagerService @GuardedBy("mFlagLock") private int mMaxInputLengthForAutofill; @GuardedBy("mFlagLock") private boolean mAutofillCredmanIntegrationEnabled; @GuardedBy("mFlagLock") private boolean mIsFillFieldsFromCurrentSessionOnly; Loading Loading @@ -705,13 +708,16 @@ public final class AutofillManagerService DeviceConfig.NAMESPACE_AUTOFILL, AutofillFeatureFlags.DEVICE_CONFIG_MAX_INPUT_LENGTH_FOR_AUTOFILL, AutofillFeatureFlags.DEFAULT_MAX_INPUT_LENGTH_FOR_AUTOFILL); mAutofillCredmanIntegrationEnabled = Flags.autofillCredmanIntegration(); mIsFillFieldsFromCurrentSessionOnly = Flags.fillFieldsFromCurrentSessionOnly(); if (verbose) { Slog.v(mTag, "setDeviceConfigProperties() for PCC: " + "mPccClassificationEnabled=" + mPccClassificationEnabled + ", mPccPreferProviderOverPcc=" + mPccPreferProviderOverPcc + ", mPccUseFallbackDetection=" + mPccUseFallbackDetection + ", mPccProviderHints=" + mPccProviderHints); + ", mPccProviderHints=" + mPccProviderHints + ", mAutofillCredmanIntegrationEnabled=" + mAutofillCredmanIntegrationEnabled); } } } Loading Loading @@ -969,6 +975,15 @@ public final class AutofillManagerService } } /** * Whether the Autofill-Credman integration feature flag is enabled. */ public boolean isAutofillCredmanIntegrationEnabled() { synchronized (mFlagLock) { return mAutofillCredmanIntegrationEnabled; } } /** * Whether the Autofill Provider shouldbe preferred over PCC results for selecting datasets. */ Loading Loading @@ -2110,6 +2125,9 @@ public final class AutofillManagerService pw.print(";"); pw.print("mPccProviderHints="); pw.println(mPccProviderHints); pw.print(";"); pw.print("mAutofillCredmanIntegrationEnabled="); pw.println(mAutofillCredmanIntegrationEnabled); } // Dump per-user services dumpLocked("", pw); Loading services/autofill/java/com/android/server/autofill/AutofillManagerServiceImpl.java +18 −2 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ package com.android.server.autofill; import static android.service.autofill.FillEventHistory.Event.NO_SAVE_UI_REASON_NONE; import static android.service.autofill.FillEventHistory.Event.UI_TYPE_INLINE; import static android.service.autofill.FillRequest.FLAG_MANUAL_REQUEST; import static android.service.autofill.FillRequest.FLAG_SCREEN_HAS_CREDMAN_FIELD; import static android.view.autofill.AutofillManager.ACTION_START_SESSION; import static android.view.autofill.AutofillManager.FLAG_ADD_CLIENT_ENABLED; import static android.view.autofill.AutofillManager.FLAG_ADD_CLIENT_ENABLED_FOR_AUGMENTED_AUTOFILL_ONLY; Loading Loading @@ -103,6 +104,10 @@ final class AutofillManagerServiceImpl extends AbstractPerUserSystemService<AutofillManagerServiceImpl, AutofillManagerService> { private static final String TAG = "AutofillManagerServiceImpl"; private static final ComponentName CREDMAN_SERVICE_COMPONENT_NAME = new ComponentName("com.android.credentialmanager", "com.android.credentialmanager.autofill.CredentialAutofillService"); private static final int MAX_SESSION_ID_CREATE_TRIES = 2048; /** Minimum interval to prune abandoned sessions */ Loading Loading @@ -532,9 +537,16 @@ final class AutofillManagerServiceImpl assertCallerLocked(clientActivity, compatMode); // It's null when the session is just for augmented autofill final ComponentName serviceComponentName = mInfo == null ? null ComponentName serviceComponentName = mInfo == null ? null : mInfo.getServiceInfo().getComponentName(); if (isAutofillCredmanIntegrationEnabled() && ((flags & FLAG_SCREEN_HAS_CREDMAN_FIELD) != 0)) { // Hardcode to credential manager proxy service Slog.i(TAG, "Routing to CredentialAutofillService"); serviceComponentName = CREDMAN_SERVICE_COMPONENT_NAME; } final Session newSession = new Session(this, mUi, getContext(), mHandler, mUserId, mLock, sessionId, taskId, clientUid, clientActivityToken, clientCallback, hasCallback, mUiLatencyHistory, mWtfHistory, serviceComponentName, Loading Loading @@ -1747,6 +1759,10 @@ final class AutofillManagerServiceImpl } } public boolean isAutofillCredmanIntegrationEnabled() { return mMaster.isAutofillCredmanIntegrationEnabled(); } /** * Called when the {@link AutofillManagerService#mFieldClassificationResolver} * changed (among other places). Loading Loading
packages/CredentialManager/src/com/android/credentialmanager/autofill/CredentialAutofillService.kt +13 −6 Original line number Diff line number Diff line Loading @@ -39,6 +39,7 @@ import android.service.autofill.SaveRequest import android.service.credentials.CredentialProviderService import android.util.Log import android.view.autofill.AutofillId import org.json.JSONException import android.widget.inline.InlinePresentationSpec import androidx.autofill.inline.v1.InlineSuggestionUi import com.android.credentialmanager.GetFlowUtils Loading @@ -56,11 +57,9 @@ class CredentialAutofillService : AutofillService() { private const val SYS_PROVIDER_REQ_KEY = "isSystemProviderRequired" private const val CRED_OPTIONS_KEY = "credentialOptions" private const val TYPE_KEY = "type" private const val REQ_TYPE_KEY = "get" } private val credentialManager: CredentialManager = getSystemService(Context.CREDENTIAL_SERVICE) as CredentialManager override fun onFillRequest( request: FillRequest, cancellationSignal: CancellationSignal, Loading @@ -73,9 +72,12 @@ class CredentialAutofillService : AutofillService() { val getCredRequest: GetCredentialRequest? = getCredManRequest(structure) if (getCredRequest == null) { Log.i(TAG, "No credential manager request found") callback.onFailure("No credential manager request found") return } val credentialManager: CredentialManager = getSystemService(Context.CREDENTIAL_SERVICE) as CredentialManager val outcome = object : OutcomeReceiver<GetCandidateCredentialsResponse, GetCandidateCredentialsException> { Loading Loading @@ -244,8 +246,12 @@ class CredentialAutofillService : AutofillService() { val credentialOptions: MutableList<CredentialOption> = mutableListOf() for (credentialHint in credentialHints) { try { convertJsonToCredentialOption(credentialHint, autofillId) .let { credentialOptions.addAll(it) } } catch (e: JSONException) { Log.i(TAG, "Exception while parsing response: " + e.message) } } return credentialOptions } Loading @@ -257,7 +263,8 @@ class CredentialAutofillService : AutofillService() { val credentialOptions: MutableList<CredentialOption> = mutableListOf() val json = JSONObject(jsonString) val options = json.getJSONArray(CRED_OPTIONS_KEY) val jsonGet = json.getJSONObject(REQ_TYPE_KEY) val options = jsonGet.getJSONArray(CRED_OPTIONS_KEY) for (i in 0 until options.length()) { val option = options.getJSONObject(i) val candidateBundle = convertJsonToBundle(option.getJSONObject(CANDIDATE_DATA_KEY)) Loading
services/autofill/java/com/android/server/autofill/AutofillManagerService.java +19 −1 Original line number Diff line number Diff line Loading @@ -227,6 +227,9 @@ public final class AutofillManagerService @GuardedBy("mFlagLock") private int mMaxInputLengthForAutofill; @GuardedBy("mFlagLock") private boolean mAutofillCredmanIntegrationEnabled; @GuardedBy("mFlagLock") private boolean mIsFillFieldsFromCurrentSessionOnly; Loading Loading @@ -705,13 +708,16 @@ public final class AutofillManagerService DeviceConfig.NAMESPACE_AUTOFILL, AutofillFeatureFlags.DEVICE_CONFIG_MAX_INPUT_LENGTH_FOR_AUTOFILL, AutofillFeatureFlags.DEFAULT_MAX_INPUT_LENGTH_FOR_AUTOFILL); mAutofillCredmanIntegrationEnabled = Flags.autofillCredmanIntegration(); mIsFillFieldsFromCurrentSessionOnly = Flags.fillFieldsFromCurrentSessionOnly(); if (verbose) { Slog.v(mTag, "setDeviceConfigProperties() for PCC: " + "mPccClassificationEnabled=" + mPccClassificationEnabled + ", mPccPreferProviderOverPcc=" + mPccPreferProviderOverPcc + ", mPccUseFallbackDetection=" + mPccUseFallbackDetection + ", mPccProviderHints=" + mPccProviderHints); + ", mPccProviderHints=" + mPccProviderHints + ", mAutofillCredmanIntegrationEnabled=" + mAutofillCredmanIntegrationEnabled); } } } Loading Loading @@ -969,6 +975,15 @@ public final class AutofillManagerService } } /** * Whether the Autofill-Credman integration feature flag is enabled. */ public boolean isAutofillCredmanIntegrationEnabled() { synchronized (mFlagLock) { return mAutofillCredmanIntegrationEnabled; } } /** * Whether the Autofill Provider shouldbe preferred over PCC results for selecting datasets. */ Loading Loading @@ -2110,6 +2125,9 @@ public final class AutofillManagerService pw.print(";"); pw.print("mPccProviderHints="); pw.println(mPccProviderHints); pw.print(";"); pw.print("mAutofillCredmanIntegrationEnabled="); pw.println(mAutofillCredmanIntegrationEnabled); } // Dump per-user services dumpLocked("", pw); Loading
services/autofill/java/com/android/server/autofill/AutofillManagerServiceImpl.java +18 −2 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ package com.android.server.autofill; import static android.service.autofill.FillEventHistory.Event.NO_SAVE_UI_REASON_NONE; import static android.service.autofill.FillEventHistory.Event.UI_TYPE_INLINE; import static android.service.autofill.FillRequest.FLAG_MANUAL_REQUEST; import static android.service.autofill.FillRequest.FLAG_SCREEN_HAS_CREDMAN_FIELD; import static android.view.autofill.AutofillManager.ACTION_START_SESSION; import static android.view.autofill.AutofillManager.FLAG_ADD_CLIENT_ENABLED; import static android.view.autofill.AutofillManager.FLAG_ADD_CLIENT_ENABLED_FOR_AUGMENTED_AUTOFILL_ONLY; Loading Loading @@ -103,6 +104,10 @@ final class AutofillManagerServiceImpl extends AbstractPerUserSystemService<AutofillManagerServiceImpl, AutofillManagerService> { private static final String TAG = "AutofillManagerServiceImpl"; private static final ComponentName CREDMAN_SERVICE_COMPONENT_NAME = new ComponentName("com.android.credentialmanager", "com.android.credentialmanager.autofill.CredentialAutofillService"); private static final int MAX_SESSION_ID_CREATE_TRIES = 2048; /** Minimum interval to prune abandoned sessions */ Loading Loading @@ -532,9 +537,16 @@ final class AutofillManagerServiceImpl assertCallerLocked(clientActivity, compatMode); // It's null when the session is just for augmented autofill final ComponentName serviceComponentName = mInfo == null ? null ComponentName serviceComponentName = mInfo == null ? null : mInfo.getServiceInfo().getComponentName(); if (isAutofillCredmanIntegrationEnabled() && ((flags & FLAG_SCREEN_HAS_CREDMAN_FIELD) != 0)) { // Hardcode to credential manager proxy service Slog.i(TAG, "Routing to CredentialAutofillService"); serviceComponentName = CREDMAN_SERVICE_COMPONENT_NAME; } final Session newSession = new Session(this, mUi, getContext(), mHandler, mUserId, mLock, sessionId, taskId, clientUid, clientActivityToken, clientCallback, hasCallback, mUiLatencyHistory, mWtfHistory, serviceComponentName, Loading Loading @@ -1747,6 +1759,10 @@ final class AutofillManagerServiceImpl } } public boolean isAutofillCredmanIntegrationEnabled() { return mMaster.isAutofillCredmanIntegrationEnabled(); } /** * Called when the {@link AutofillManagerService#mFieldClassificationResolver} * changed (among other places). Loading