From 1ad95f06a95b30f6a345eef7a55f18096fabf53f Mon Sep 17 00:00:00 2001 From: Felipe Leme Date: Fri, 15 Jun 2018 13:07:34 -0700 Subject: [PATCH] Improved logging on autofill authentication. These are particular useful when the service created a wrong authentication result. Bug: 77641784 Test: manual verification Change-Id: I420c8ff88137b9e410cbaff56f10a6a70d8311e5 --- core/java/android/view/autofill/AutofillManager.java | 4 +++- .../autofill/java/com/android/server/autofill/Session.java | 6 +++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/core/java/android/view/autofill/AutofillManager.java b/core/java/android/view/autofill/AutofillManager.java index e989e1af742d8..8f28102016d77 100644 --- a/core/java/android/view/autofill/AutofillManager.java +++ b/core/java/android/view/autofill/AutofillManager.java @@ -1435,7 +1435,9 @@ public final class AutofillManager { // set the EXTRA_AUTHENTICATION_RESULT extra, but it could cause weird results if the // service set the extra and returned RESULT_CANCELED... - if (sDebug) Log.d(TAG, "onAuthenticationResult(): d=" + data); + if (sDebug) { + Log.d(TAG, "onAuthenticationResult(): id= " + authenticationId + ", data=" + data); + } synchronized (mLock) { if (!isActiveLocked()) { diff --git a/services/autofill/java/com/android/server/autofill/Session.java b/services/autofill/java/com/android/server/autofill/Session.java index 79fd29aea7199..48f27d8aa7bcd 100644 --- a/services/autofill/java/com/android/server/autofill/Session.java +++ b/services/autofill/java/com/android/server/autofill/Session.java @@ -993,6 +993,7 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState final int requestId = AutofillManager.getRequestIdFromAuthenticationId(authenticationId); final FillResponse authenticatedResponse = mResponses.get(requestId); if (authenticatedResponse == null || data == null) { + Slog.w(TAG, "no authenticated response"); removeSelf(); return; } @@ -1003,6 +1004,7 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState if (datasetIdx != AutofillManager.AUTHENTICATION_ID_DATASET_ID_UNDEFINED) { final Dataset dataset = authenticatedResponse.getDatasets().get(datasetIdx); if (dataset == null) { + Slog.w(TAG, "no dataset with index " + datasetIdx + " on fill response"); removeSelf(); return; } @@ -1012,7 +1014,7 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState final Bundle newClientState = data.getBundle(AutofillManager.EXTRA_CLIENT_STATE); if (sDebug) { Slog.d(TAG, "setAuthenticationResultLocked(): result=" + result - + ", clientState=" + newClientState); + + ", clientState=" + newClientState + ", authenticationId=" + authenticationId); } if (result instanceof FillResponse) { logAuthenticationStatusLocked(requestId, MetricsEvent.AUTOFILL_AUTHENTICATED); @@ -1029,6 +1031,8 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState authenticatedResponse.getDatasets().set(datasetIdx, dataset); autoFill(requestId, datasetIdx, dataset, false); } else { + Slog.w(TAG, "invalid index (" + datasetIdx + ") for authentication id " + + authenticationId); logAuthenticationStatusLocked(requestId, MetricsEvent.AUTOFILL_INVALID_DATASET_AUTHENTICATION); }