diff options
4 files changed, 23 insertions, 28 deletions
diff --git a/services/autofill/java/com/android/server/autofill/FillResponseEventLogger.java b/services/autofill/java/com/android/server/autofill/FillResponseEventLogger.java index a69e33ab4bf3..23912689a1d1 100644 --- a/services/autofill/java/com/android/server/autofill/FillResponseEventLogger.java +++ b/services/autofill/java/com/android/server/autofill/FillResponseEventLogger.java @@ -36,6 +36,7 @@ import static com.android.internal.util.FrameworkStatsLog.AUTOFILL_FILL_RESPONSE import static com.android.internal.util.FrameworkStatsLog.AUTOFILL_FILL_RESPONSE_REPORTED__RESPONSE_STATUS__RESPONSE_STATUS_CANCELLED; import static com.android.internal.util.FrameworkStatsLog.AUTOFILL_FILL_RESPONSE_REPORTED__RESPONSE_STATUS__RESPONSE_STATUS_FAILURE; import static com.android.internal.util.FrameworkStatsLog.AUTOFILL_FILL_RESPONSE_REPORTED__RESPONSE_STATUS__RESPONSE_STATUS_SESSION_DESTROYED; +import static com.android.internal.util.FrameworkStatsLog.AUTOFILL_FILL_RESPONSE_REPORTED__RESPONSE_STATUS__RESPONSE_STATUS_TRANSACTION_TOO_LARGE; import static com.android.internal.util.FrameworkStatsLog.AUTOFILL_FILL_RESPONSE_REPORTED__RESPONSE_STATUS__RESPONSE_STATUS_SUCCESS; import static com.android.internal.util.FrameworkStatsLog.AUTOFILL_FILL_RESPONSE_REPORTED__RESPONSE_STATUS__RESPONSE_STATUS_TIMEOUT; import static com.android.internal.util.FrameworkStatsLog.AUTOFILL_FILL_RESPONSE_REPORTED__RESPONSE_STATUS__RESPONSE_STATUS_UNKNOWN; @@ -162,6 +163,8 @@ public final class FillResponseEventLogger { AUTOFILL_FILL_RESPONSE_REPORTED__RESPONSE_STATUS__RESPONSE_STATUS_CANCELLED; public static final int RESPONSE_STATUS_FAILURE = AUTOFILL_FILL_RESPONSE_REPORTED__RESPONSE_STATUS__RESPONSE_STATUS_FAILURE; + public static final int RESPONSE_STATUS_TRANSACTION_TOO_LARGE = + AUTOFILL_FILL_RESPONSE_REPORTED__RESPONSE_STATUS__RESPONSE_STATUS_TRANSACTION_TOO_LARGE; public static final int RESPONSE_STATUS_SESSION_DESTROYED = AUTOFILL_FILL_RESPONSE_REPORTED__RESPONSE_STATUS__RESPONSE_STATUS_SESSION_DESTROYED; public static final int RESPONSE_STATUS_SUCCESS = diff --git a/services/autofill/java/com/android/server/autofill/RemoteFillService.java b/services/autofill/java/com/android/server/autofill/RemoteFillService.java index 7ceb3bb56403..07f5dcc3cb0a 100644 --- a/services/autofill/java/com/android/server/autofill/RemoteFillService.java +++ b/services/autofill/java/com/android/server/autofill/RemoteFillService.java @@ -82,9 +82,7 @@ final class RemoteFillService extends ServiceConnector.Impl<IAutoFillService> { void onFillRequestSuccess(int requestId, @Nullable FillResponse response, @NonNull String servicePackageName, int requestFlags); - void onFillRequestFailure(int requestId, @Nullable CharSequence message); - - void onFillRequestTimeout(int requestId); + void onFillRequestFailure(int requestId, Throwable t); void onSaveRequestSuccess(@NonNull String servicePackageName, @Nullable IntentSender intentSender); @@ -345,11 +343,12 @@ final class RemoteFillService extends ServiceConnector.Impl<IAutoFillService> { Slog.e(TAG, "Error calling on fill request", err); if (err instanceof TimeoutException) { dispatchCancellationSignal(cancellationSink.get()); - mCallbacks.onFillRequestTimeout(request.getId()); + mCallbacks.onFillRequestFailure(request.getId(), err); } else if (err instanceof CancellationException) { + // Cancellation is a part of the user flow - don't mark as failure dispatchCancellationSignal(cancellationSink.get()); } else { - mCallbacks.onFillRequestFailure(request.getId(), err.getMessage()); + mCallbacks.onFillRequestFailure(request.getId(), err); } } })); @@ -413,11 +412,12 @@ final class RemoteFillService extends ServiceConnector.Impl<IAutoFillService> { Slog.e(TAG, "Error calling on fill request", err); if (err instanceof TimeoutException) { dispatchCancellationSignal(cancellationSink.get()); - mCallbacks.onFillRequestTimeout(request.getId()); + mCallbacks.onFillRequestFailure(request.getId(), err); } else if (err instanceof CancellationException) { + // Cancellation is a part of the user flow - don't mark as failure dispatchCancellationSignal(cancellationSink.get()); } else { - mCallbacks.onFillRequestFailure(request.getId(), err.getMessage()); + mCallbacks.onFillRequestFailure(request.getId(), err); } } })); diff --git a/services/autofill/java/com/android/server/autofill/SecondaryProviderHandler.java b/services/autofill/java/com/android/server/autofill/SecondaryProviderHandler.java index 044a06417c00..a6638965a787 100644 --- a/services/autofill/java/com/android/server/autofill/SecondaryProviderHandler.java +++ b/services/autofill/java/com/android/server/autofill/SecondaryProviderHandler.java @@ -75,12 +75,7 @@ final class SecondaryProviderHandler implements RemoteFillService.FillServiceCal } @Override - public void onFillRequestFailure(int requestId, @Nullable CharSequence message) { - - } - - @Override - public void onFillRequestTimeout(int requestId) { + public void onFillRequestFailure(int requestId, Throwable t) { } diff --git a/services/autofill/java/com/android/server/autofill/Session.java b/services/autofill/java/com/android/server/autofill/Session.java index 1c544c8e2567..933faac3ab3d 100644 --- a/services/autofill/java/com/android/server/autofill/Session.java +++ b/services/autofill/java/com/android/server/autofill/Session.java @@ -66,6 +66,7 @@ import static com.android.server.autofill.FillResponseEventLogger.RESPONSE_STATU import static com.android.server.autofill.FillResponseEventLogger.RESPONSE_STATUS_SESSION_DESTROYED; import static com.android.server.autofill.FillResponseEventLogger.RESPONSE_STATUS_SUCCESS; import static com.android.server.autofill.FillResponseEventLogger.RESPONSE_STATUS_TIMEOUT; +import static com.android.server.autofill.FillResponseEventLogger.RESPONSE_STATUS_TRANSACTION_TOO_LARGE; import static com.android.server.autofill.Helper.containsCharsInOrder; import static com.android.server.autofill.Helper.createSanitizers; import static com.android.server.autofill.Helper.getNumericValue; @@ -137,6 +138,7 @@ import android.os.RemoteCallback; import android.os.RemoteException; import android.os.ResultReceiver; import android.os.SystemClock; +import android.os.TransactionTooLargeException; import android.service.assist.classification.FieldClassificationRequest; import android.service.assist.classification.FieldClassificationResponse; import android.service.autofill.AutofillFieldClassificationService.Scores; @@ -211,6 +213,7 @@ import java.util.Map; import java.util.Objects; import java.util.Optional; import java.util.Set; +import java.util.concurrent.TimeoutException; import java.util.concurrent.atomic.AtomicInteger; import java.util.function.Consumer; import java.util.function.Function; @@ -2346,20 +2349,9 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState // FillServiceCallbacks @Override @SuppressWarnings("GuardedBy") - public void onFillRequestFailure(int requestId, @Nullable CharSequence message) { - onFillRequestFailureOrTimeout(requestId, false, message); - } - - // FillServiceCallbacks - @Override - @SuppressWarnings("GuardedBy") - public void onFillRequestTimeout(int requestId) { - onFillRequestFailureOrTimeout(requestId, true, null); - } - - @SuppressWarnings("GuardedBy") - private void onFillRequestFailureOrTimeout(int requestId, boolean timedOut, - @Nullable CharSequence message) { + public void onFillRequestFailure(int requestId, Throwable t) { + CharSequence message = t.getMessage(); + boolean timedOut = (t instanceof TimeoutException); boolean showMessage = !TextUtils.isEmpty(message); synchronized (mLock) { @@ -2412,10 +2404,15 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState } } - if (timedOut) { + if (t instanceof TimeoutException) { mPresentationStatsEventLogger.maybeSetNoPresentationEventReason( NOT_SHOWN_REASON_REQUEST_TIMEOUT); mFillResponseEventLogger.maybeSetResponseStatus(RESPONSE_STATUS_TIMEOUT); + } else if (t instanceof TransactionTooLargeException) { + mPresentationStatsEventLogger.maybeSetNoPresentationEventReason( + NOT_SHOWN_REASON_REQUEST_FAILED); + mFillResponseEventLogger.maybeSetResponseStatus( + RESPONSE_STATUS_TRANSACTION_TOO_LARGE); } else { mPresentationStatsEventLogger.maybeSetNoPresentationEventReason( NOT_SHOWN_REASON_REQUEST_FAILED); |