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

Commit 36ef222d authored by Daniel's avatar Daniel
Browse files

Log Presentation stats metrics for secondary provider

Currently, only the primary provider fields log presentation metrics
when the user focuses on a field. Also log when the user focuses on a
field that is backed by secondary provider.

Bug: 319170999
Test: m (build), manually verifying by going between primary and
secondary fields in AddressBook

Change-Id: I9300455caeeccc701a3718fd3cc941c05d80c294
parent 43387bfc
Loading
Loading
Loading
Loading
+21 −10
Original line number Diff line number Diff line
@@ -4269,13 +4269,19 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState
                if (value != null) {
                    viewState.setCurrentValue(value);
                }

                boolean isCredmanRequested = (flags & FLAG_VIEW_REQUESTS_CREDMAN_SERVICE) != 0;
                if (shouldRequestSecondaryProvider(flags)) {
                    if (requestNewFillResponseOnViewEnteredIfNecessaryLocked(
                            id, viewState, flags)) {
                        Slog.v(TAG, "Started a new fill request for secondary provider.");
                        return;
                    }

                    FillResponse response = viewState.getSecondaryResponse();
                    if (response != null) {
                        logPresentationStatsOnViewEntered(response, isCredmanRequested);
                    }

                    // If the ViewState is ready to be displayed, onReady() will be called.
                    viewState.update(value, virtualBounds, flags);

@@ -4361,15 +4367,9 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState
                    return;
                }

                if (viewState.getResponse() != null) {
                    boolean isCredmanRequested = (flags & FLAG_VIEW_REQUESTS_CREDMAN_SERVICE) != 0;
                FillResponse response = viewState.getResponse();
                    mPresentationStatsEventLogger.maybeSetRequestId(response.getRequestId());
                    mPresentationStatsEventLogger.maybeSetIsCredentialRequest(isCredmanRequested);
                    mPresentationStatsEventLogger.maybeSetFieldClassificationRequestId(
                            mFieldClassificationIdSnapshot);
                    mPresentationStatsEventLogger.maybeSetAvailableCount(
                            response.getDatasets(), mCurrentViewId);
                if (response != null) {
                    logPresentationStatsOnViewEntered(response, isCredmanRequested);
                }

                if (isSameViewEntered) {
@@ -4409,6 +4409,17 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState
        }
    }

    @GuardedBy("mLock")
    private void logPresentationStatsOnViewEntered(FillResponse response,
            boolean isCredmanRequested) {
        mPresentationStatsEventLogger.maybeSetRequestId(response.getRequestId());
        mPresentationStatsEventLogger.maybeSetIsCredentialRequest(isCredmanRequested);
        mPresentationStatsEventLogger.maybeSetFieldClassificationRequestId(
                mFieldClassificationIdSnapshot);
        mPresentationStatsEventLogger.maybeSetAvailableCount(
                response.getDatasets(), mCurrentViewId);
    }

    @GuardedBy("mLock")
    private void hideAugmentedAutofillLocked(@NonNull ViewState viewState) {
        if ((viewState.getState()