Commit 6778c4ba authored by Clemens Arbesser's avatar Clemens Arbesser Committed by Commit Bot

[Autofill Assistant] Legacy and metrics cleanup for trigger scripts.

This CL ensures that legacy lite scripts will continue to work and send
the correct metrics values. This is in case we have to deactivate the
new trigger scripts. Once the new trigger scripts are deemed stable,
we can remove those metrics and special handling.

Bug: b/171776026
Change-Id: If8f4fd56517b01f1aef7e908a096cf49788c208b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2532225
Commit-Queue: Clemens Arbesser <arbesser@google.com>
Auto-Submit: Clemens Arbesser <arbesser@google.com>
Reviewed-by: default avatarSandro Maggi <sandromaggi@google.com>
Cr-Commit-Position: refs/heads/master@{#826774}
parent 27b957f5
......@@ -51,6 +51,12 @@ public class AutofillAssistantModuleEntryImpl implements AutofillAssistantModule
return;
}
boolean isFirstTimeUser =
AutofillAssistantPreferencesUtil.isAutofillAssistantFirstTimeLiteScriptUser();
AutofillAssistantMetrics.recordLiteScriptStarted(webContents,
isFirstTimeUser ? LiteScriptStarted.LITE_SCRIPT_FIRST_TIME_USER
: LiteScriptStarted.LITE_SCRIPT_RETURNING_USER);
// Start trigger script and transition to regular flow on success.
if (TextUtils.equals(parameters.get(PARAMETER_REQUEST_TRIGGER_SCRIPT), "true")) {
AssistantTriggerScriptBridge triggerScriptBridge =
......@@ -75,13 +81,8 @@ public class AutofillAssistantModuleEntryImpl implements AutofillAssistantModule
}
// Legacy lite scripts, remove as soon as possible.
boolean isFirstTimeUser =
AutofillAssistantPreferencesUtil.isAutofillAssistantFirstTimeLiteScriptUser();
String firstTimeUserScriptPath = parameters.get(PARAMETER_TRIGGER_FIRST_TIME_USER);
String returningUserScriptPath = parameters.get(PARAMETER_TRIGGER_RETURNING_TIME_USER);
AutofillAssistantMetrics.recordLiteScriptStarted(webContents,
isFirstTimeUser ? LiteScriptStarted.LITE_SCRIPT_FIRST_TIME_USER
: LiteScriptStarted.LITE_SCRIPT_RETURNING_USER);
startAutofillAssistantLite(bottomSheetController, browserControls, compositorViewHolder,
webContents, firstTimeUserScriptPath, returningUserScriptPath, result -> {
if (result) {
......
......@@ -114,16 +114,29 @@ public class AutofillAssistantFacade {
arguments.isLiteScriptExperiment() ? LITE_SCRIPT_EXPERIMENT_TRIAL_EXPERIMENT
: LITE_SCRIPT_EXPERIMENT_TRIAL_CONTROL);
if (!AutofillAssistantPreferencesUtil.isProactiveHelpSwitchOn()) {
// Record this as soon as possible, to establish a baseline.
AutofillAssistantMetrics.recordLiteScriptStarted(
tab.getWebContents(), LiteScriptStarted.LITE_SCRIPT_INTENT_RECEIVED);
// For trigger scripts since M-88, there is a dedicated Chrome setting that can be
// used to forever opt-out.
if (arguments.requestsTriggerScript()
&& !AutofillAssistantPreferencesUtil.isProactiveHelpSwitchOn()) {
// Opt out users who have disabled the proactive help Chrome setting.
AutofillAssistantMetrics.recordLiteScriptStarted(tab.getWebContents(),
LiteScriptStarted.LITE_SCRIPT_PROACTIVE_TRIGGERING_DISABLED);
return;
}
if (!AutofillAssistantPreferencesUtil.isAutofillAssistantSwitchOn()) {
// Legacy. This should no longer happen, because the proactive help switch
// should only be 'on' if the autofill assistant switch is 'on' as well.
// Legacy, remove as soon as possible. Trigger scripts before M-88 were tied to the
// regular autofill assistant Chrome setting.
if (arguments.containsTriggerScript()
&& !AutofillAssistantPreferencesUtil.isAutofillAssistantSwitchOn()) {
if (AutofillAssistantPreferencesUtil
.isAutofillAssistantLiteScriptCancelThresholdReached()) {
AutofillAssistantMetrics.recordLiteScriptStarted(tab.getWebContents(),
LiteScriptStarted.LITE_SCRIPT_CANCELED_TWO_TIMES);
}
return;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment