diff --git a/services/autofill/java/com/android/server/autofill/PresentationStatsEventLogger.java b/services/autofill/java/com/android/server/autofill/PresentationStatsEventLogger.java index 231d1ffac4272..6bb19ce058137 100644 --- a/services/autofill/java/com/android/server/autofill/PresentationStatsEventLogger.java +++ b/services/autofill/java/com/android/server/autofill/PresentationStatsEventLogger.java @@ -133,6 +133,14 @@ public final class PresentationStatsEventLogger { }); } + public void maybeSetNoPresentationEventReasonIfNoReasonExists(@NotShownReason int reason) { + mEventInternal.ifPresent(event -> { + if (event.mCountShown == 0 && event.mNoPresentationReason == NOT_SHOWN_REASON_UNKNOWN) { + event.mNoPresentationReason = reason; + } + }); + } + public void maybeSetAvailableCount(@Nullable List datasetList, AutofillId currentViewId) { mEventInternal.ifPresent(event -> { diff --git a/services/autofill/java/com/android/server/autofill/Session.java b/services/autofill/java/com/android/server/autofill/Session.java index f71cb5bc903ca..47ce5928c0be8 100644 --- a/services/autofill/java/com/android/server/autofill/Session.java +++ b/services/autofill/java/com/android/server/autofill/Session.java @@ -3009,7 +3009,7 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState if (sDebug) { Slog.d(TAG, "Set the response has expired."); } - mPresentationStatsEventLogger.maybeSetNoPresentationEventReason( + mPresentationStatsEventLogger.maybeSetNoPresentationEventReasonIfNoReasonExists( NOT_SHOWN_REASON_VIEW_CHANGED); mPresentationStatsEventLogger.logAndEndEvent(); return;