Merge changes from topic "autofill-pcc-metrics" into udc-dev

* changes:
  [Autofill PCC Metrics]: Populate PCC relevant metrics
  [Autofill PCC Metrics]: Update existing loggers
This commit is contained in:
Simranjit Kohli
2023-05-13 08:51:52 +00:00
committed by Android (Google) Code Review
4 changed files with 218 additions and 30 deletions

View File

@@ -16,17 +16,20 @@
package com.android.server.autofill; package com.android.server.autofill;
import static android.service.autofill.Dataset.PICK_REASON_PCC_DETECTION_ONLY;
import static android.service.autofill.Dataset.PICK_REASON_PCC_DETECTION_PREFERRED_WITH_PROVIDER;
import static com.android.internal.util.FrameworkStatsLog.AUTOFILL_FILL_RESPONSE_REPORTED; import static com.android.internal.util.FrameworkStatsLog.AUTOFILL_FILL_RESPONSE_REPORTED;
import static com.android.internal.util.FrameworkStatsLog.AUTOFILL_FILL_RESPONSE_REPORTED__DISPLAY_PRESENTATION_TYPE__DIALOG;
import static com.android.internal.util.FrameworkStatsLog.AUTOFILL_FILL_RESPONSE_REPORTED__DISPLAY_PRESENTATION_TYPE__INLINE;
import static com.android.internal.util.FrameworkStatsLog.AUTOFILL_FILL_RESPONSE_REPORTED__DISPLAY_PRESENTATION_TYPE__MENU;
import static com.android.internal.util.FrameworkStatsLog.AUTOFILL_FILL_RESPONSE_REPORTED__DISPLAY_PRESENTATION_TYPE__UNKNOWN_AUTOFILL_DISPLAY_PRESENTATION_TYPE;
import static com.android.internal.util.FrameworkStatsLog.AUTOFILL_FILL_RESPONSE_REPORTED__AUTHENTICATION_RESULT__AUTHENTICATION_FAILURE; import static com.android.internal.util.FrameworkStatsLog.AUTOFILL_FILL_RESPONSE_REPORTED__AUTHENTICATION_RESULT__AUTHENTICATION_FAILURE;
import static com.android.internal.util.FrameworkStatsLog.AUTOFILL_FILL_RESPONSE_REPORTED__AUTHENTICATION_RESULT__AUTHENTICATION_RESULT_UNKNOWN; import static com.android.internal.util.FrameworkStatsLog.AUTOFILL_FILL_RESPONSE_REPORTED__AUTHENTICATION_RESULT__AUTHENTICATION_RESULT_UNKNOWN;
import static com.android.internal.util.FrameworkStatsLog.AUTOFILL_FILL_RESPONSE_REPORTED__AUTHENTICATION_RESULT__AUTHENTICATION_SUCCESS; import static com.android.internal.util.FrameworkStatsLog.AUTOFILL_FILL_RESPONSE_REPORTED__AUTHENTICATION_RESULT__AUTHENTICATION_SUCCESS;
import static com.android.internal.util.FrameworkStatsLog.AUTOFILL_FILL_RESPONSE_REPORTED__AUTHENTICATION_TYPE__AUTHENTICATION_TYPE_UNKNOWN; import static com.android.internal.util.FrameworkStatsLog.AUTOFILL_FILL_RESPONSE_REPORTED__AUTHENTICATION_TYPE__AUTHENTICATION_TYPE_UNKNOWN;
import static com.android.internal.util.FrameworkStatsLog.AUTOFILL_FILL_RESPONSE_REPORTED__AUTHENTICATION_TYPE__DATASET_AUTHENTICATION; import static com.android.internal.util.FrameworkStatsLog.AUTOFILL_FILL_RESPONSE_REPORTED__AUTHENTICATION_TYPE__DATASET_AUTHENTICATION;
import static com.android.internal.util.FrameworkStatsLog.AUTOFILL_FILL_RESPONSE_REPORTED__AUTHENTICATION_TYPE__FULL_AUTHENTICATION; import static com.android.internal.util.FrameworkStatsLog.AUTOFILL_FILL_RESPONSE_REPORTED__AUTHENTICATION_TYPE__FULL_AUTHENTICATION;
import static com.android.internal.util.FrameworkStatsLog.AUTOFILL_FILL_RESPONSE_REPORTED__DISPLAY_PRESENTATION_TYPE__DIALOG;
import static com.android.internal.util.FrameworkStatsLog.AUTOFILL_FILL_RESPONSE_REPORTED__DISPLAY_PRESENTATION_TYPE__INLINE;
import static com.android.internal.util.FrameworkStatsLog.AUTOFILL_FILL_RESPONSE_REPORTED__DISPLAY_PRESENTATION_TYPE__MENU;
import static com.android.internal.util.FrameworkStatsLog.AUTOFILL_FILL_RESPONSE_REPORTED__DISPLAY_PRESENTATION_TYPE__UNKNOWN_AUTOFILL_DISPLAY_PRESENTATION_TYPE;
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;
@@ -218,7 +221,16 @@ public final class FillResponseEventLogger {
public void maybeSetAvailableCount(int val) { public void maybeSetAvailableCount(int val) {
mEventInternal.ifPresent(event -> { mEventInternal.ifPresent(event -> {
event.mAvailableCount = val; // Don't reset if it's already populated.
// This is just a technical limitation of not having complicated logic.
// Autofill Provider may return some datasets which are applicable to data types.
// In such a case, we set available count to the number of datasets provided.
// However, it's possible that those data types aren't detected by PCC, so in effect, there
// are 0 datasets. In the codebase, we treat it as null response, which may call this again
// to set 0. But we don't want to overwrite this value.
if (event.mAvailableCount == 0) {
event.mAvailableCount = val;
}
}); });
} }
@@ -318,6 +330,50 @@ public final class FillResponseEventLogger {
}); });
} }
/**
* Set available_pcc_count.
*/
public void maybeSetAvailablePccCount(int val) {
mEventInternal.ifPresent(event -> {
event.mAvailablePccCount = val;
});
}
/**
* Set available_pcc_only_count.
*/
public void maybeSetAvailablePccOnlyCount(int val) {
mEventInternal.ifPresent(event -> {
event.mAvailablePccOnlyCount = val;
});
}
/**
* Set available_pcc_count.
*/
public void maybeSetAvailableDatasetsPccCount(@Nullable List<Dataset> datasetList) {
mEventInternal.ifPresent(event -> {
int pccOnlyCount = 0;
int pccCount = 0;
if (datasetList != null) {
for (int i = 0; i < datasetList.size(); i++) {
Dataset dataset = datasetList.get(i);
if (dataset != null) {
if (dataset.getEligibleReason() == PICK_REASON_PCC_DETECTION_ONLY) {
pccOnlyCount++;
pccCount++;
} else if (dataset.getEligibleReason()
== PICK_REASON_PCC_DETECTION_PREFERRED_WITH_PROVIDER) {
pccCount++;
}
}
}
}
event.mAvailablePccOnlyCount = pccOnlyCount;
event.mAvailablePccCount = pccCount;
});
}
/** /**
* Log an AUTOFILL_FILL_RESPONSE_REPORTED event. * Log an AUTOFILL_FILL_RESPONSE_REPORTED event.
@@ -344,7 +400,9 @@ public final class FillResponseEventLogger {
+ " mLatencyAuthenticationUiDisplayMillis=" + event.mLatencyAuthenticationUiDisplayMillis + " mLatencyAuthenticationUiDisplayMillis=" + event.mLatencyAuthenticationUiDisplayMillis
+ " mLatencyDatasetDisplayMillis=" + event.mLatencyDatasetDisplayMillis + " mLatencyDatasetDisplayMillis=" + event.mLatencyDatasetDisplayMillis
+ " mResponseStatus=" + event.mResponseStatus + " mResponseStatus=" + event.mResponseStatus
+ " mLatencyResponseProcessingMillis=" + event.mLatencyResponseProcessingMillis); + " mLatencyResponseProcessingMillis=" + event.mLatencyResponseProcessingMillis
+ " mAvailablePccCount=" + event.mAvailablePccCount
+ " mAvailablePccOnlyCount=" + event.mAvailablePccOnlyCount);
} }
FrameworkStatsLog.write( FrameworkStatsLog.write(
AUTOFILL_FILL_RESPONSE_REPORTED, AUTOFILL_FILL_RESPONSE_REPORTED,
@@ -361,7 +419,9 @@ public final class FillResponseEventLogger {
event.mLatencyAuthenticationUiDisplayMillis, event.mLatencyAuthenticationUiDisplayMillis,
event.mLatencyDatasetDisplayMillis, event.mLatencyDatasetDisplayMillis,
event.mResponseStatus, event.mResponseStatus,
event.mLatencyResponseProcessingMillis); event.mLatencyResponseProcessingMillis,
event.mAvailablePccCount,
event.mAvailablePccOnlyCount);
mEventInternal = Optional.empty(); mEventInternal = Optional.empty();
} }
@@ -379,6 +439,8 @@ public final class FillResponseEventLogger {
int mLatencyDatasetDisplayMillis = 0; int mLatencyDatasetDisplayMillis = 0;
int mResponseStatus = RESPONSE_STATUS_UNKNOWN; int mResponseStatus = RESPONSE_STATUS_UNKNOWN;
int mLatencyResponseProcessingMillis = 0; int mLatencyResponseProcessingMillis = 0;
int mAvailablePccCount;
int mAvailablePccOnlyCount;
FillResponseEventInternal() { FillResponseEventInternal() {
} }

View File

@@ -16,6 +16,8 @@
package com.android.server.autofill; package com.android.server.autofill;
import static android.service.autofill.Dataset.PICK_REASON_PCC_DETECTION_ONLY;
import static android.service.autofill.Dataset.PICK_REASON_PCC_DETECTION_PREFERRED_WITH_PROVIDER;
import static android.service.autofill.FillEventHistory.Event.UI_TYPE_DIALOG; import static android.service.autofill.FillEventHistory.Event.UI_TYPE_DIALOG;
import static android.service.autofill.FillEventHistory.Event.UI_TYPE_INLINE; import static android.service.autofill.FillEventHistory.Event.UI_TYPE_INLINE;
import static android.service.autofill.FillEventHistory.Event.UI_TYPE_MENU; import static android.service.autofill.FillEventHistory.Event.UI_TYPE_MENU;
@@ -46,6 +48,12 @@ import static com.android.internal.util.FrameworkStatsLog.AUTOFILL_PRESENTATION_
import static com.android.internal.util.FrameworkStatsLog.AUTOFILL_PRESENTATION_EVENT_REPORTED__PRESENTATION_EVENT_RESULT__NONE_SHOWN_VIEW_CHANGED; import static com.android.internal.util.FrameworkStatsLog.AUTOFILL_PRESENTATION_EVENT_REPORTED__PRESENTATION_EVENT_RESULT__NONE_SHOWN_VIEW_CHANGED;
import static com.android.internal.util.FrameworkStatsLog.AUTOFILL_PRESENTATION_EVENT_REPORTED__PRESENTATION_EVENT_RESULT__NONE_SHOWN_VIEW_FOCUSED_BEFORE_FILL_DIALOG_RESPONSE; import static com.android.internal.util.FrameworkStatsLog.AUTOFILL_PRESENTATION_EVENT_REPORTED__PRESENTATION_EVENT_RESULT__NONE_SHOWN_VIEW_FOCUSED_BEFORE_FILL_DIALOG_RESPONSE;
import static com.android.internal.util.FrameworkStatsLog.AUTOFILL_PRESENTATION_EVENT_REPORTED__PRESENTATION_EVENT_RESULT__NONE_SHOWN_VIEW_FOCUS_CHANGED; import static com.android.internal.util.FrameworkStatsLog.AUTOFILL_PRESENTATION_EVENT_REPORTED__PRESENTATION_EVENT_RESULT__NONE_SHOWN_VIEW_FOCUS_CHANGED;
import static com.android.internal.util.FrameworkStatsLog.AUTOFILL_PRESENTATION_EVENT_REPORTED__SELECTED_DATASET_PICKED_REASON__PICK_REASON_NO_PCC;
import static com.android.internal.util.FrameworkStatsLog.AUTOFILL_PRESENTATION_EVENT_REPORTED__SELECTED_DATASET_PICKED_REASON__PICK_REASON_PCC_DETECTION_ONLY;
import static com.android.internal.util.FrameworkStatsLog.AUTOFILL_PRESENTATION_EVENT_REPORTED__SELECTED_DATASET_PICKED_REASON__PICK_REASON_PCC_DETECTION_PREFERRED_WITH_PROVIDER;
import static com.android.internal.util.FrameworkStatsLog.AUTOFILL_PRESENTATION_EVENT_REPORTED__SELECTED_DATASET_PICKED_REASON__PICK_REASON_PROVIDER_DETECTION_ONLY;
import static com.android.internal.util.FrameworkStatsLog.AUTOFILL_PRESENTATION_EVENT_REPORTED__SELECTED_DATASET_PICKED_REASON__PICK_REASON_PROVIDER_DETECTION_PREFERRED_WITH_PCC;
import static com.android.internal.util.FrameworkStatsLog.AUTOFILL_PRESENTATION_EVENT_REPORTED__SELECTED_DATASET_PICKED_REASON__PICK_REASON_UNKNOWN;
import static com.android.server.autofill.Helper.sVerbose; import static com.android.server.autofill.Helper.sVerbose;
import android.annotation.IntDef; import android.annotation.IntDef;
@@ -116,6 +124,22 @@ public final class PresentationStatsEventLogger {
public @interface AuthenticationResult { public @interface AuthenticationResult {
} }
/**
* Reasons why the picked dataset was present. These are wrappers around
* {@link com.android.os.AtomsProto.AutofillPresentationEventReported.DatasetPickedReason}.
* This enum is similar to {@link android.service.autofill.Dataset.DatasetEligibleReason}
*/
@IntDef(prefix = {"PICK_REASON"}, value = {
PICK_REASON_UNKNOWN,
PICK_REASON_NO_PCC,
PICK_REASON_PROVIDER_DETECTION_ONLY,
PICK_REASON_PROVIDER_DETECTION_PREFERRED_WITH_PCC,
PICK_REASON_PCC_DETECTION_ONLY,
PICK_REASON_PCC_DETECTION_PREFERRED_WITH_PROVIDER,
})
@Retention(RetentionPolicy.SOURCE)
public @interface DatasetPickedReason {}
public static final int NOT_SHOWN_REASON_ANY_SHOWN = public static final int NOT_SHOWN_REASON_ANY_SHOWN =
AUTOFILL_PRESENTATION_EVENT_REPORTED__PRESENTATION_EVENT_RESULT__ANY_SHOWN; AUTOFILL_PRESENTATION_EVENT_REPORTED__PRESENTATION_EVENT_RESULT__ANY_SHOWN;
public static final int NOT_SHOWN_REASON_VIEW_FOCUS_CHANGED = public static final int NOT_SHOWN_REASON_VIEW_FOCUS_CHANGED =
@@ -151,6 +175,18 @@ public final class PresentationStatsEventLogger {
public static final int AUTHENTICATION_RESULT_FAILURE = public static final int AUTHENTICATION_RESULT_FAILURE =
AUTOFILL_PRESENTATION_EVENT_REPORTED__AUTHENTICATION_RESULT__AUTHENTICATION_FAILURE; AUTOFILL_PRESENTATION_EVENT_REPORTED__AUTHENTICATION_RESULT__AUTHENTICATION_FAILURE;
public static final int PICK_REASON_UNKNOWN =
AUTOFILL_PRESENTATION_EVENT_REPORTED__SELECTED_DATASET_PICKED_REASON__PICK_REASON_UNKNOWN;
public static final int PICK_REASON_NO_PCC =
AUTOFILL_PRESENTATION_EVENT_REPORTED__SELECTED_DATASET_PICKED_REASON__PICK_REASON_NO_PCC;
public static final int PICK_REASON_PROVIDER_DETECTION_ONLY =
AUTOFILL_PRESENTATION_EVENT_REPORTED__SELECTED_DATASET_PICKED_REASON__PICK_REASON_PROVIDER_DETECTION_ONLY;
public static final int PICK_REASON_PROVIDER_DETECTION_PREFERRED_WITH_PCC =
AUTOFILL_PRESENTATION_EVENT_REPORTED__SELECTED_DATASET_PICKED_REASON__PICK_REASON_PROVIDER_DETECTION_PREFERRED_WITH_PCC;
public static final int PICK_REASON_PCC_DETECTION_ONLY =
AUTOFILL_PRESENTATION_EVENT_REPORTED__SELECTED_DATASET_PICKED_REASON__PICK_REASON_PCC_DETECTION_ONLY;
public static final int PICK_REASON_PCC_DETECTION_PREFERRED_WITH_PROVIDER =
AUTOFILL_PRESENTATION_EVENT_REPORTED__SELECTED_DATASET_PICKED_REASON__PICK_REASON_PCC_DETECTION_PREFERRED_WITH_PROVIDER;
private final int mSessionId; private final int mSessionId;
private Optional<PresentationStatsEventInternal> mEventInternal; private Optional<PresentationStatsEventInternal> mEventInternal;
@@ -194,36 +230,61 @@ public final class PresentationStatsEventLogger {
public void maybeSetAvailableCount(@Nullable List<Dataset> datasetList, public void maybeSetAvailableCount(@Nullable List<Dataset> datasetList,
AutofillId currentViewId) { AutofillId currentViewId) {
mEventInternal.ifPresent(event -> { mEventInternal.ifPresent(event -> {
int availableCount = getDatasetCountForAutofillId(datasetList, currentViewId); CountContainer container = getDatasetCountForAutofillId(datasetList, currentViewId);
event.mAvailableCount = availableCount; event.mAvailableCount = container.mAvailableCount;
event.mIsDatasetAvailable = availableCount > 0; event.mAvailablePccCount = container.mAvailablePccCount;
event.mAvailablePccOnlyCount = container.mAvailablePccOnlyCount;
event.mIsDatasetAvailable = container.mAvailableCount > 0;
}); });
} }
public void maybeSetCountShown(@Nullable List<Dataset> datasetList, public void maybeSetCountShown(@Nullable List<Dataset> datasetList,
AutofillId currentViewId) { AutofillId currentViewId) {
mEventInternal.ifPresent(event -> { mEventInternal.ifPresent(event -> {
int countShown = getDatasetCountForAutofillId(datasetList, currentViewId); CountContainer container = getDatasetCountForAutofillId(datasetList, currentViewId);
event.mCountShown = countShown; event.mCountShown = container.mAvailableCount;
if (countShown > 0) { if (container.mAvailableCount > 0) {
event.mNoPresentationReason = NOT_SHOWN_REASON_ANY_SHOWN; event.mNoPresentationReason = NOT_SHOWN_REASON_ANY_SHOWN;
} }
}); });
} }
private static int getDatasetCountForAutofillId(@Nullable List<Dataset> datasetList, private static CountContainer getDatasetCountForAutofillId(@Nullable List<Dataset> datasetList,
AutofillId currentViewId) { AutofillId currentViewId) {
int availableCount = 0;
CountContainer container = new CountContainer();
if (datasetList != null) { if (datasetList != null) {
for (int i = 0; i < datasetList.size(); i++) { for (int i = 0; i < datasetList.size(); i++) {
Dataset data = datasetList.get(i); Dataset data = datasetList.get(i);
if (data != null && data.getFieldIds() != null if (data != null && data.getFieldIds() != null
&& data.getFieldIds().contains(currentViewId)) { && data.getFieldIds().contains(currentViewId)) {
availableCount += 1; container.mAvailableCount += 1;
if (data.getEligibleReason() == PICK_REASON_PCC_DETECTION_ONLY) {
container.mAvailablePccOnlyCount++;
container.mAvailablePccCount++;
} else if (data.getEligibleReason()
== PICK_REASON_PCC_DETECTION_PREFERRED_WITH_PROVIDER) {
container.mAvailablePccCount++;
}
} }
} }
} }
return availableCount; return container;
}
private static class CountContainer{
int mAvailableCount = 0;
int mAvailablePccCount = 0;
int mAvailablePccOnlyCount = 0;
CountContainer() {}
CountContainer(int availableCount, int availablePccCount,
int availablePccOnlyCount) {
mAvailableCount = availableCount;
mAvailablePccCount = availablePccCount;
mAvailablePccOnlyCount = availablePccOnlyCount;
}
} }
public void maybeSetCountFilteredUserTyping(int countFilteredUserTyping) { public void maybeSetCountFilteredUserTyping(int countFilteredUserTyping) {
@@ -375,6 +436,46 @@ public final class PresentationStatsEventLogger {
}); });
} }
/**
* Set available_pcc_count.
*/
public void maybeSetAvailablePccCount(int val) {
mEventInternal.ifPresent(event -> {
event.mAvailablePccCount = val;
});
}
/**
* Set available_pcc_only_count.
*/
public void maybeSetAvailablePccOnlyCount(int val) {
mEventInternal.ifPresent(event -> {
event.mAvailablePccOnlyCount = val;
});
}
/**
* Set selected_dataset_picked_reason.
*/
public void maybeSetSelectedDatasetPickReason(@Dataset.DatasetEligibleReason int val) {
mEventInternal.ifPresent(event -> {
event.mSelectedDatasetPickedReason = convertDatasetPickReason(val);
});
}
private int convertDatasetPickReason(@Dataset.DatasetEligibleReason int val) {
switch (val) {
case 0:
case 1:
case 2:
case 3:
case 4:
case 5:
return val;
}
return PICK_REASON_UNKNOWN;
}
public void logAndEndEvent() { public void logAndEndEvent() {
if (!mEventInternal.isPresent()) { if (!mEventInternal.isPresent()) {
@@ -410,7 +511,10 @@ public final class PresentationStatsEventLogger {
+ " mAuthenticationResult=" + event.mAuthenticationResult + " mAuthenticationResult=" + event.mAuthenticationResult
+ " mLatencyAuthenticationUiDisplayMillis=" + " mLatencyAuthenticationUiDisplayMillis="
+ event.mLatencyAuthenticationUiDisplayMillis + event.mLatencyAuthenticationUiDisplayMillis
+ " mLatencyDatasetDisplayMillis=" + event.mLatencyDatasetDisplayMillis); + " mLatencyDatasetDisplayMillis=" + event.mLatencyDatasetDisplayMillis
+ " mAvailablePccCount=" + event.mAvailablePccCount
+ " mAvailablePccOnlyCount=" + event.mAvailablePccOnlyCount
+ " mSelectedDatasetPickedReason=" + event.mSelectedDatasetPickedReason);
} }
// TODO(b/234185326): Distinguish empty responses from other no presentation reasons. // TODO(b/234185326): Distinguish empty responses from other no presentation reasons.
@@ -443,7 +547,10 @@ public final class PresentationStatsEventLogger {
event.mAuthenticationType, event.mAuthenticationType,
event.mAuthenticationResult, event.mAuthenticationResult,
event.mLatencyAuthenticationUiDisplayMillis, event.mLatencyAuthenticationUiDisplayMillis,
event.mLatencyDatasetDisplayMillis); event.mLatencyDatasetDisplayMillis,
event.mAvailablePccCount,
event.mAvailablePccOnlyCount,
event.mSelectedDatasetPickedReason);
mEventInternal = Optional.empty(); mEventInternal = Optional.empty();
} }
@@ -472,6 +579,9 @@ public final class PresentationStatsEventLogger {
int mAuthenticationResult = AUTHENTICATION_RESULT_UNKNOWN; int mAuthenticationResult = AUTHENTICATION_RESULT_UNKNOWN;
int mLatencyAuthenticationUiDisplayMillis = -1; int mLatencyAuthenticationUiDisplayMillis = -1;
int mLatencyDatasetDisplayMillis = -1; int mLatencyDatasetDisplayMillis = -1;
int mAvailablePccCount = -1;
int mAvailablePccOnlyCount = -1;
@DatasetPickedReason int mSelectedDatasetPickedReason = PICK_REASON_UNKNOWN;
PresentationStatsEventInternal() {} PresentationStatsEventInternal() {}
} }

View File

@@ -251,6 +251,15 @@ public final class SaveEventLogger {
}); });
} }
/**
* Set is_framework_created_save_info as long as mEventInternal presents.
*/
public void maybeSetIsFrameworkCreatedSaveInfo(boolean val) {
mEventInternal.ifPresent(event -> {
event.mIsFrameworkCreatedSaveInfo = val;
});
}
/** /**
* Log an AUTOFILL_SAVE_EVENT_REPORTED event. * Log an AUTOFILL_SAVE_EVENT_REPORTED event.
*/ */
@@ -277,7 +286,8 @@ public final class SaveEventLogger {
+ " mIsSaved=" + event.mIsSaved + " mIsSaved=" + event.mIsSaved
+ " mLatencySaveUiDisplayMillis=" + event.mLatencySaveUiDisplayMillis + " mLatencySaveUiDisplayMillis=" + event.mLatencySaveUiDisplayMillis
+ " mLatencySaveRequestMillis=" + event.mLatencySaveRequestMillis + " mLatencySaveRequestMillis=" + event.mLatencySaveRequestMillis
+ " mLatencySaveFinishMillis=" + event.mLatencySaveFinishMillis); + " mLatencySaveFinishMillis=" + event.mLatencySaveFinishMillis
+ " mIsFrameworkCreatedSaveInfo=" + event.mIsFrameworkCreatedSaveInfo);
} }
FrameworkStatsLog.write( FrameworkStatsLog.write(
AUTOFILL_SAVE_EVENT_REPORTED, AUTOFILL_SAVE_EVENT_REPORTED,
@@ -295,7 +305,8 @@ public final class SaveEventLogger {
event.mIsSaved, event.mIsSaved,
event.mLatencySaveUiDisplayMillis, event.mLatencySaveUiDisplayMillis,
event.mLatencySaveRequestMillis, event.mLatencySaveRequestMillis,
event.mLatencySaveFinishMillis); event.mLatencySaveFinishMillis,
event.mIsFrameworkCreatedSaveInfo);
mEventInternal = Optional.empty(); mEventInternal = Optional.empty();
} }
@@ -314,6 +325,7 @@ public final class SaveEventLogger {
long mLatencySaveUiDisplayMillis = 0; long mLatencySaveUiDisplayMillis = 0;
long mLatencySaveRequestMillis = 0; long mLatencySaveRequestMillis = 0;
long mLatencySaveFinishMillis = 0; long mLatencySaveFinishMillis = 0;
boolean mIsFrameworkCreatedSaveInfo = false;
SaveEventInternal() { SaveEventInternal() {
} }

View File

@@ -1561,9 +1561,8 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState
Slog.d(TAG, message.toString()); Slog.d(TAG, message.toString());
} }
} }
List<Dataset> datasetList = response.getDatasets();
if (((response.getDatasets() == null || response.getDatasets().isEmpty()) if (((datasetList == null || datasetList.isEmpty()) && response.getAuthentication() == null)
&& response.getAuthentication() == null)
|| autofillDisabled) { || autofillDisabled) {
// Response is "empty" from a UI point of view, need to notify client. // Response is "empty" from a UI point of view, need to notify client.
notifyUnavailableToClient( notifyUnavailableToClient(
@@ -1585,6 +1584,9 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState
} }
} }
mFillResponseEventLogger.maybeSetAvailableCount(
datasetList == null ? 0 : datasetList.size());
// TODO(b/266379948): Ideally wait for PCC request to finish for a while more // TODO(b/266379948): Ideally wait for PCC request to finish for a while more
// (say 100ms) before proceeding further on. // (say 100ms) before proceeding further on.
@@ -1735,6 +1737,7 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState
} }
if (ids.isEmpty()) return saveInfo; if (ids.isEmpty()) return saveInfo;
AutofillId[] autofillIds = new AutofillId[ids.size()]; AutofillId[] autofillIds = new AutofillId[ids.size()];
mSaveEventLogger.maybeSetIsFrameworkCreatedSaveInfo(true);
ids.toArray(autofillIds); ids.toArray(autofillIds);
return SaveInfo.copy(saveInfo, autofillIds); return SaveInfo.copy(saveInfo, autofillIds);
} }
@@ -4041,8 +4044,6 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState
mPresentationStatsEventLogger.maybeSetRequestId(response.getRequestId()); mPresentationStatsEventLogger.maybeSetRequestId(response.getRequestId());
mPresentationStatsEventLogger.maybeSetAvailableCount( mPresentationStatsEventLogger.maybeSetAvailableCount(
response.getDatasets(), mCurrentViewId); response.getDatasets(), mCurrentViewId);
mFillResponseEventLogger.maybeSetAvailableCount(
response.getDatasets(), mCurrentViewId);
} }
if (isSameViewEntered) { if (isSameViewEntered) {
@@ -4733,6 +4734,7 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState
autofillableIds = null; autofillableIds = null;
} }
// Log the existing FillResponse event. // Log the existing FillResponse event.
mFillResponseEventLogger.maybeSetAvailableCount(0);
mFillResponseEventLogger.logAndEndEvent(); mFillResponseEventLogger.logAndEndEvent();
mService.resetLastResponse(); mService.resetLastResponse();
@@ -4961,10 +4963,10 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState
mResponses.put(requestId, newResponse); mResponses.put(requestId, newResponse);
mClientState = newClientState != null ? newClientState : newResponse.getClientState(); mClientState = newClientState != null ? newClientState : newResponse.getClientState();
mPresentationStatsEventLogger.maybeSetAvailableCount( List<Dataset> datasetList = newResponse.getDatasets();
newResponse.getDatasets(), mCurrentViewId);
mFillResponseEventLogger.maybeSetAvailableCount( mPresentationStatsEventLogger.maybeSetAvailableCount(datasetList, mCurrentViewId);
newResponse.getDatasets(), mCurrentViewId); mFillResponseEventLogger.maybeSetAvailableDatasetsPccCount(datasetList);
setViewStatesLocked(newResponse, ViewState.STATE_FILLABLE, false); setViewStatesLocked(newResponse, ViewState.STATE_FILLABLE, false);
updateFillDialogTriggerIdsLocked(); updateFillDialogTriggerIdsLocked();
@@ -5089,6 +5091,8 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState
if (generateEvent) { if (generateEvent) {
mService.logDatasetSelected(dataset.getId(), id, mClientState, uiType); mService.logDatasetSelected(dataset.getId(), id, mClientState, uiType);
mPresentationStatsEventLogger.maybeSetSelectedDatasetId(datasetIndex); mPresentationStatsEventLogger.maybeSetSelectedDatasetId(datasetIndex);
mPresentationStatsEventLogger.maybeSetSelectedDatasetPickReason(
dataset.getEligibleReason());
} }
if (mCurrentViewId != null) { if (mCurrentViewId != null) {
mInlineSessionController.hideInlineSuggestionsUiLocked(mCurrentViewId); mInlineSessionController.hideInlineSuggestionsUiLocked(mCurrentViewId);