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

Commit 8a12f02b authored by Adam He's avatar Adam He
Browse files

Added TYPE_DATASETS_SHOWN event to FillEventHistory

Fixes: 137225017
Test: atest android.autofillservice.cts.FillEventHistoryTest
Test: atest CtsAutoFillServiceTestCases
Change-Id: I5f858a01c98993148f71d616e73419a1914f5a1b
parent 4cd75cb8
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -41046,6 +41046,7 @@ package android.service.autofill {
    method public int getType();
    field public static final int TYPE_AUTHENTICATION_SELECTED = 2; // 0x2
    field public static final int TYPE_CONTEXT_COMMITTED = 4; // 0x4
    field public static final int TYPE_DATASETS_SHOWN = 5; // 0x5
    field public static final int TYPE_DATASET_AUTHENTICATION_SELECTED = 1; // 0x1
    field public static final int TYPE_DATASET_SELECTED = 0; // 0x0
    field public static final int TYPE_SAVE_SHOWN = 3; // 0x3
+10 −2
Original line number Diff line number Diff line
@@ -224,13 +224,21 @@ public final class FillEventHistory implements Parcelable {
         */
        public static final int TYPE_CONTEXT_COMMITTED = 4;

        /**
         * A dataset selector was shown.
         *
         * <p>This event is fired whenever the autofill UI was presented to the user.</p>
         */
        public static final int TYPE_DATASETS_SHOWN = 5;

        /** @hide */
        @IntDef(prefix = { "TYPE_" }, value = {
                TYPE_DATASET_SELECTED,
                TYPE_DATASET_AUTHENTICATION_SELECTED,
                TYPE_AUTHENTICATION_SELECTED,
                TYPE_SAVE_SHOWN,
                TYPE_CONTEXT_COMMITTED
                TYPE_CONTEXT_COMMITTED,
                TYPE_DATASETS_SHOWN
        })
        @Retention(RetentionPolicy.SOURCE)
        @interface EventIds{}
@@ -473,7 +481,7 @@ public final class FillEventHistory implements Parcelable {
                @Nullable ArrayList<ArrayList<String>> manuallyFilledDatasetIds,
                @Nullable AutofillId[] detectedFieldIds,
                @Nullable FieldClassification[] detectedFieldClassifications) {
            mEventType = Preconditions.checkArgumentInRange(eventType, 0, TYPE_CONTEXT_COMMITTED,
            mEventType = Preconditions.checkArgumentInRange(eventType, 0, TYPE_DATASETS_SHOWN,
                    "eventType");
            mDatasetId = datasetId;
            mClientState = clientState;
+13 −0
Original line number Diff line number Diff line
@@ -768,6 +768,19 @@ final class AutofillManagerServiceImpl
        }
    }

    /**
     * Updates the last fill response when a dataset is shown.
     */
    void logDatasetShown(int sessionId, @Nullable Bundle clientState) {
        synchronized (mLock) {
            if (isValidEventLocked("logDatasetShown", sessionId)) {
                mEventHistory.addEvent(
                        new Event(Event.TYPE_DATASETS_SHOWN, null, clientState, null, null, null,
                                null, null, null, null, null));
            }
        }
    }

    /**
     * Updates the last fill response when an autofill context is committed.
     */
+2 −0
Original line number Diff line number Diff line
@@ -2497,6 +2497,8 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState
                mService.getServicePackageName(), mComponentName,
                serviceLabel, serviceIcon, this, id, mCompatMode);

        mService.logDatasetShown(id, mClientState);

        synchronized (mLock) {
            if (mUiShownTime == 0) {
                // Log first time UI is shown.