Autofill: Add logs for better debugging Add logs to identify issues from logcat. BUG: 325318537 Test: build, logging only Change-Id: I014f3e02471a86b49f0cd24d5f92fdb788ec7832
diff --git a/core/java/android/view/autofill/AutofillManager.java b/core/java/android/view/autofill/AutofillManager.java index bd9f504..83683ca 100644 --- a/core/java/android/view/autofill/AutofillManager.java +++ b/core/java/android/view/autofill/AutofillManager.java
@@ -2364,6 +2364,7 @@ synchronized (mLock) { if (!isActiveLocked()) { + Log.w(TAG, "onAuthenticationResult(): sessionId=" + mSessionId + " not active"); return; } mState = STATE_ACTIVE; @@ -2380,6 +2381,7 @@ } if (data == null) { // data is set to null when result is not RESULT_OK + Log.i(TAG, "onAuthenticationResult(): empty intent"); return; }
diff --git a/services/autofill/java/com/android/server/autofill/Session.java b/services/autofill/java/com/android/server/autofill/Session.java index d47245e..5a34217 100644 --- a/services/autofill/java/com/android/server/autofill/Session.java +++ b/services/autofill/java/com/android/server/autofill/Session.java
@@ -2770,6 +2770,10 @@ + id + " destroyed"); return; } + if (sDebug) { + Slog.d(TAG, "setAuthenticationResultLocked(): id= " + authenticationId + + ", data=" + data); + } final int requestId = AutofillManager.getRequestIdFromAuthenticationId(authenticationId); if (requestId == AUGMENTED_AUTOFILL_REQUEST_ID) { setAuthenticationResultForAugmentedAutofillLocked(data, authenticationId); @@ -2823,12 +2827,18 @@ + ", clientState=" + newClientState + ", authenticationId=" + authenticationId); } if (result instanceof FillResponse) { + if (sDebug) { + Slog.d(TAG, "setAuthenticationResultLocked(): received FillResponse from" + + " authentication flow"); + } logAuthenticationStatusLocked(requestId, MetricsEvent.AUTOFILL_AUTHENTICATED); mPresentationStatsEventLogger.maybeSetAuthenticationResult( AUTHENTICATION_RESULT_SUCCESS); replaceResponseLocked(authenticatedResponse, (FillResponse) result, newClientState); } else if (result instanceof GetCredentialResponse) { - Slog.d(TAG, "Received GetCredentialResponse from authentication flow"); + if (sDebug) { + Slog.d(TAG, "Received GetCredentialResponse from authentication flow"); + } boolean isCredmanCallbackInvoked = false; if (Flags.autofillCredmanIntegration()) { GetCredentialResponse response = (GetCredentialResponse) result; @@ -2843,6 +2853,10 @@ } } } else if (result instanceof Dataset) { + if (sDebug) { + Slog.d(TAG, "setAuthenticationResultLocked(): received Dataset from" + + " authentication flow"); + } if (datasetIdx != AutofillManager.AUTHENTICATION_ID_DATASET_ID_UNDEFINED) { logAuthenticationStatusLocked(requestId, MetricsEvent.AUTOFILL_DATASET_AUTHENTICATED);