Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit da2d6c60 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Autofill Presentation Logging 4" into main

parents 738b19de c12e0fa7
Loading
Loading
Loading
Loading
+3 −0
Original line number Original line Diff line number Diff line
@@ -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_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_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_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_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_TIMEOUT;
import static com.android.internal.util.FrameworkStatsLog.AUTOFILL_FILL_RESPONSE_REPORTED__RESPONSE_STATUS__RESPONSE_STATUS_UNKNOWN;
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;
      AUTOFILL_FILL_RESPONSE_REPORTED__RESPONSE_STATUS__RESPONSE_STATUS_CANCELLED;
  public static final int RESPONSE_STATUS_FAILURE =
  public static final int RESPONSE_STATUS_FAILURE =
      AUTOFILL_FILL_RESPONSE_REPORTED__RESPONSE_STATUS__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 =
  public static final int RESPONSE_STATUS_SESSION_DESTROYED =
      AUTOFILL_FILL_RESPONSE_REPORTED__RESPONSE_STATUS__RESPONSE_STATUS_SESSION_DESTROYED;
      AUTOFILL_FILL_RESPONSE_REPORTED__RESPONSE_STATUS__RESPONSE_STATUS_SESSION_DESTROYED;
  public static final int RESPONSE_STATUS_SUCCESS =
  public static final int RESPONSE_STATUS_SUCCESS =
+7 −7
Original line number Original line Diff line number Diff line
@@ -82,9 +82,7 @@ final class RemoteFillService extends ServiceConnector.Impl<IAutoFillService> {
        void onFillRequestSuccess(int requestId, @Nullable FillResponse response,
        void onFillRequestSuccess(int requestId, @Nullable FillResponse response,
                @NonNull String servicePackageName, int requestFlags);
                @NonNull String servicePackageName, int requestFlags);


        void onFillRequestFailure(int requestId, @Nullable CharSequence message);
        void onFillRequestFailure(int requestId, Throwable t);

        void onFillRequestTimeout(int requestId);


        void onSaveRequestSuccess(@NonNull String servicePackageName,
        void onSaveRequestSuccess(@NonNull String servicePackageName,
                @Nullable IntentSender intentSender);
                @Nullable IntentSender intentSender);
@@ -345,11 +343,12 @@ final class RemoteFillService extends ServiceConnector.Impl<IAutoFillService> {
                Slog.e(TAG, "Error calling on fill request", err);
                Slog.e(TAG, "Error calling on fill request", err);
                if (err instanceof TimeoutException) {
                if (err instanceof TimeoutException) {
                    dispatchCancellationSignal(cancellationSink.get());
                    dispatchCancellationSignal(cancellationSink.get());
                    mCallbacks.onFillRequestTimeout(request.getId());
                    mCallbacks.onFillRequestFailure(request.getId(), err);
                } else if (err instanceof CancellationException) {
                } else if (err instanceof CancellationException) {
                    // Cancellation is a part of the user flow - don't mark as failure
                    dispatchCancellationSignal(cancellationSink.get());
                    dispatchCancellationSignal(cancellationSink.get());
                } else {
                } 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);
                Slog.e(TAG, "Error calling on fill request", err);
                if (err instanceof TimeoutException) {
                if (err instanceof TimeoutException) {
                    dispatchCancellationSignal(cancellationSink.get());
                    dispatchCancellationSignal(cancellationSink.get());
                    mCallbacks.onFillRequestTimeout(request.getId());
                    mCallbacks.onFillRequestFailure(request.getId(), err);
                } else if (err instanceof CancellationException) {
                } else if (err instanceof CancellationException) {
                    // Cancellation is a part of the user flow - don't mark as failure
                    dispatchCancellationSignal(cancellationSink.get());
                    dispatchCancellationSignal(cancellationSink.get());
                } else {
                } else {
                    mCallbacks.onFillRequestFailure(request.getId(), err.getMessage());
                    mCallbacks.onFillRequestFailure(request.getId(), err);
                }
                }
            }
            }
        }));
        }));
+1 −6
Original line number Original line Diff line number Diff line
@@ -75,12 +75,7 @@ final class SecondaryProviderHandler implements RemoteFillService.FillServiceCal
    }
    }


    @Override
    @Override
    public void onFillRequestFailure(int requestId, @Nullable CharSequence message) {
    public void onFillRequestFailure(int requestId, Throwable t) {

    }

    @Override
    public void onFillRequestTimeout(int requestId) {


    }
    }


+12 −15
Original line number Original line Diff line number Diff line
@@ -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_SESSION_DESTROYED;
import static com.android.server.autofill.FillResponseEventLogger.RESPONSE_STATUS_SUCCESS;
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_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.containsCharsInOrder;
import static com.android.server.autofill.Helper.createSanitizers;
import static com.android.server.autofill.Helper.createSanitizers;
import static com.android.server.autofill.Helper.getNumericValue;
import static com.android.server.autofill.Helper.getNumericValue;
@@ -137,6 +138,7 @@ import android.os.RemoteCallback;
import android.os.RemoteException;
import android.os.RemoteException;
import android.os.ResultReceiver;
import android.os.ResultReceiver;
import android.os.SystemClock;
import android.os.SystemClock;
import android.os.TransactionTooLargeException;
import android.service.assist.classification.FieldClassificationRequest;
import android.service.assist.classification.FieldClassificationRequest;
import android.service.assist.classification.FieldClassificationResponse;
import android.service.assist.classification.FieldClassificationResponse;
import android.service.autofill.AutofillFieldClassificationService.Scores;
import android.service.autofill.AutofillFieldClassificationService.Scores;
@@ -211,6 +213,7 @@ import java.util.Map;
import java.util.Objects;
import java.util.Objects;
import java.util.Optional;
import java.util.Optional;
import java.util.Set;
import java.util.Set;
import java.util.concurrent.TimeoutException;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.function.Consumer;
import java.util.function.Consumer;
import java.util.function.Function;
import java.util.function.Function;
@@ -2346,20 +2349,9 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState
    // FillServiceCallbacks
    // FillServiceCallbacks
    @Override
    @Override
    @SuppressWarnings("GuardedBy")
    @SuppressWarnings("GuardedBy")
    public void onFillRequestFailure(int requestId, @Nullable CharSequence message) {
    public void onFillRequestFailure(int requestId, Throwable t) {
        onFillRequestFailureOrTimeout(requestId, false, message);
        CharSequence message = t.getMessage();
    }
        boolean timedOut = (t instanceof TimeoutException);

    // 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) {
        boolean showMessage = !TextUtils.isEmpty(message);
        boolean showMessage = !TextUtils.isEmpty(message);


        synchronized (mLock) {
        synchronized (mLock) {
@@ -2412,10 +2404,15 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState
                }
                }
            }
            }


            if (timedOut) {
            if (t instanceof TimeoutException) {
                mPresentationStatsEventLogger.maybeSetNoPresentationEventReason(
                mPresentationStatsEventLogger.maybeSetNoPresentationEventReason(
                        NOT_SHOWN_REASON_REQUEST_TIMEOUT);
                        NOT_SHOWN_REASON_REQUEST_TIMEOUT);
                mFillResponseEventLogger.maybeSetResponseStatus(RESPONSE_STATUS_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 {
            } else {
                mPresentationStatsEventLogger.maybeSetNoPresentationEventReason(
                mPresentationStatsEventLogger.maybeSetNoPresentationEventReason(
                        NOT_SHOWN_REASON_REQUEST_FAILED);
                        NOT_SHOWN_REASON_REQUEST_FAILED);