[Autofill PCC Metrics]: Update existing loggers
Update existing loggers to accomodate fields for PCC metrics. Test: m Bug: 265037574 Change-Id: I18c18ea7542a6605150ff242bdf0aaa3c8e486cf
This commit is contained in:
@@ -17,16 +17,16 @@
|
||||
package com.android.server.autofill;
|
||||
|
||||
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_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_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__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_FAILURE;
|
||||
import static com.android.internal.util.FrameworkStatsLog.AUTOFILL_FILL_RESPONSE_REPORTED__RESPONSE_STATUS__RESPONSE_STATUS_SESSION_DESTROYED;
|
||||
@@ -318,6 +318,24 @@ 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;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Log an AUTOFILL_FILL_RESPONSE_REPORTED event.
|
||||
@@ -344,7 +362,9 @@ public final class FillResponseEventLogger {
|
||||
+ " mLatencyAuthenticationUiDisplayMillis=" + event.mLatencyAuthenticationUiDisplayMillis
|
||||
+ " mLatencyDatasetDisplayMillis=" + event.mLatencyDatasetDisplayMillis
|
||||
+ " mResponseStatus=" + event.mResponseStatus
|
||||
+ " mLatencyResponseProcessingMillis=" + event.mLatencyResponseProcessingMillis);
|
||||
+ " mLatencyResponseProcessingMillis=" + event.mLatencyResponseProcessingMillis
|
||||
+ " mAvailablePccCount=" + event.mAvailablePccCount
|
||||
+ " mAvailablePccOnlyCount=" + event.mAvailablePccOnlyCount);
|
||||
}
|
||||
FrameworkStatsLog.write(
|
||||
AUTOFILL_FILL_RESPONSE_REPORTED,
|
||||
@@ -361,7 +381,9 @@ public final class FillResponseEventLogger {
|
||||
event.mLatencyAuthenticationUiDisplayMillis,
|
||||
event.mLatencyDatasetDisplayMillis,
|
||||
event.mResponseStatus,
|
||||
event.mLatencyResponseProcessingMillis);
|
||||
event.mLatencyResponseProcessingMillis,
|
||||
event.mAvailablePccCount,
|
||||
event.mAvailablePccOnlyCount);
|
||||
mEventInternal = Optional.empty();
|
||||
}
|
||||
|
||||
@@ -379,6 +401,8 @@ public final class FillResponseEventLogger {
|
||||
int mLatencyDatasetDisplayMillis = 0;
|
||||
int mResponseStatus = RESPONSE_STATUS_UNKNOWN;
|
||||
int mLatencyResponseProcessingMillis = 0;
|
||||
int mAvailablePccCount;
|
||||
int mAvailablePccOnlyCount;
|
||||
|
||||
FillResponseEventInternal() {
|
||||
}
|
||||
|
||||
@@ -46,6 +46,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_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__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 android.annotation.IntDef;
|
||||
@@ -116,6 +122,22 @@ public final class PresentationStatsEventLogger {
|
||||
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 =
|
||||
AUTOFILL_PRESENTATION_EVENT_REPORTED__PRESENTATION_EVENT_RESULT__ANY_SHOWN;
|
||||
public static final int NOT_SHOWN_REASON_VIEW_FOCUS_CHANGED =
|
||||
@@ -151,6 +173,18 @@ public final class PresentationStatsEventLogger {
|
||||
public static final int AUTHENTICATION_RESULT_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 Optional<PresentationStatsEventInternal> mEventInternal;
|
||||
|
||||
@@ -375,6 +409,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() {
|
||||
if (!mEventInternal.isPresent()) {
|
||||
@@ -410,7 +484,10 @@ public final class PresentationStatsEventLogger {
|
||||
+ " mAuthenticationResult=" + event.mAuthenticationResult
|
||||
+ " 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.
|
||||
@@ -443,7 +520,10 @@ public final class PresentationStatsEventLogger {
|
||||
event.mAuthenticationType,
|
||||
event.mAuthenticationResult,
|
||||
event.mLatencyAuthenticationUiDisplayMillis,
|
||||
event.mLatencyDatasetDisplayMillis);
|
||||
event.mLatencyDatasetDisplayMillis,
|
||||
event.mAvailablePccCount,
|
||||
event.mAvailablePccOnlyCount,
|
||||
event.mSelectedDatasetPickedReason);
|
||||
mEventInternal = Optional.empty();
|
||||
}
|
||||
|
||||
@@ -472,6 +552,9 @@ public final class PresentationStatsEventLogger {
|
||||
int mAuthenticationResult = AUTHENTICATION_RESULT_UNKNOWN;
|
||||
int mLatencyAuthenticationUiDisplayMillis = -1;
|
||||
int mLatencyDatasetDisplayMillis = -1;
|
||||
int mAvailablePccCount = -1;
|
||||
int mAvailablePccOnlyCount = -1;
|
||||
@DatasetPickedReason int mSelectedDatasetPickedReason = PICK_REASON_UNKNOWN;
|
||||
|
||||
PresentationStatsEventInternal() {}
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
*/
|
||||
@@ -277,7 +286,8 @@ public final class SaveEventLogger {
|
||||
+ " mIsSaved=" + event.mIsSaved
|
||||
+ " mLatencySaveUiDisplayMillis=" + event.mLatencySaveUiDisplayMillis
|
||||
+ " mLatencySaveRequestMillis=" + event.mLatencySaveRequestMillis
|
||||
+ " mLatencySaveFinishMillis=" + event.mLatencySaveFinishMillis);
|
||||
+ " mLatencySaveFinishMillis=" + event.mLatencySaveFinishMillis
|
||||
+ " mIsFrameworkCreatedSaveInfo=" + event.mIsFrameworkCreatedSaveInfo);
|
||||
}
|
||||
FrameworkStatsLog.write(
|
||||
AUTOFILL_SAVE_EVENT_REPORTED,
|
||||
@@ -295,7 +305,8 @@ public final class SaveEventLogger {
|
||||
event.mIsSaved,
|
||||
event.mLatencySaveUiDisplayMillis,
|
||||
event.mLatencySaveRequestMillis,
|
||||
event.mLatencySaveFinishMillis);
|
||||
event.mLatencySaveFinishMillis,
|
||||
event.mIsFrameworkCreatedSaveInfo);
|
||||
mEventInternal = Optional.empty();
|
||||
}
|
||||
|
||||
@@ -314,6 +325,7 @@ public final class SaveEventLogger {
|
||||
long mLatencySaveUiDisplayMillis = 0;
|
||||
long mLatencySaveRequestMillis = 0;
|
||||
long mLatencySaveFinishMillis = 0;
|
||||
boolean mIsFrameworkCreatedSaveInfo = false;
|
||||
|
||||
SaveEventInternal() {
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user