Commit f8e6b326 authored by Clemens Arbesser's avatar Clemens Arbesser Committed by Chromium LUCI CQ

[Autofill Assistant] Use original deeplink instead of initial url.

The initial url can and often is a redirect to the deeplink, rather than
the deeplink itself. That can lead the client to believe that we are
triggering on the wrong domain.

Bug: b/178082640
Change-Id: Ife02a1acbb17d52042b016501a1eb9abdd01b3f1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2642787Reviewed-by: default avatarMathias Carlen <mcarlen@chromium.org>
Reviewed-by: default avatarMarian Fechete <marianfe@google.com>
Commit-Queue: Clemens Arbesser <arbesser@google.com>
Cr-Commit-Position: refs/heads/master@{#846252}
parent aed78260
......@@ -53,7 +53,8 @@ public class AutofillAssistantModuleEntryImpl implements AutofillAssistantModule
ApplicationViewportInsetSupplier bottomInsetProvider,
ActivityTabProvider activityTabProvider, boolean isChromeCustomTab,
@NonNull String initialUrl, Map<String, String> parameters, String experimentIds,
@Nullable String callerAccount, @Nullable String userName) {
@Nullable String callerAccount, @Nullable String userName,
@Nullable String originalDeeplink) {
if (shouldStartTriggerScript(parameters)) {
if (!AutofillAssistantPreferencesUtil.isProactiveHelpOn()) {
// Opt-out users who have disabled the proactive help Chrome setting.
......@@ -91,8 +92,9 @@ public class AutofillAssistantModuleEntryImpl implements AutofillAssistantModule
new AssistantTriggerScriptBridge();
triggerScriptBridge.start(bottomSheetController, browserControls,
compositorViewHolder, context, keyboardVisibilityDelegate,
bottomInsetProvider, activityTabProvider, webContents, initialUrl,
parameters, experimentIds, new AssistantTriggerScriptBridge.Delegate() {
bottomInsetProvider, activityTabProvider, webContents,
originalDeeplink != null ? originalDeeplink : initialUrl, parameters,
experimentIds, new AssistantTriggerScriptBridge.Delegate() {
@Override
public void onTriggerScriptFinished(
@LiteScriptFinishedState int finishedState) {
......
......@@ -72,7 +72,8 @@ class TestingAutofillAssistantModuleEntryProvider extends AutofillAssistantModul
ApplicationViewportInsetSupplier bottomInsetProvider,
ActivityTabProvider activityTabProvider, boolean isChromeCustomTab,
@NonNull String initialUrl, Map<String, String> parameters, String experimentIds,
@Nullable String callerAccount, @Nullable String userName) {}
@Nullable String callerAccount, @Nullable String userName,
@Nullable String originalDeeplink) {}
@Override
public AutofillAssistantActionHandler createActionHandler(Context context,
......
......@@ -139,6 +139,13 @@ public class AutofillAssistantArguments {
*/
private static final String PARAMETER_EXPERIMENT_IDS = "EXPERIMENT_IDS";
/**
* The original deeplink as indicated by the caller. Use this parameter instead of the
* initial URL when available to avoid issues where the initial URL points to a redirect
* rather than the actual deeplink.
*/
private static final String PARAMETER_ORIGINAL_DEEPLINK = "ORIGINAL_DEEPLINK";
private Map<String, Object> mAutofillAssistantParameters;
private Map<String, Object> mIntentExtras;
private StringBuilder mExperimentIds;
......@@ -267,6 +274,10 @@ public class AutofillAssistantArguments {
return mInitialUrl;
}
public String getOriginalDeeplink() {
return getStringParameter(PARAMETER_ORIGINAL_DEEPLINK);
}
/** Whether the caller requests the client to fetch trigger scripts from a remote endpoint. */
public boolean requestsTriggerScript() {
return getBooleanParameter(PARAMETER_REQUEST_TRIGGER_SCRIPT);
......
......@@ -178,7 +178,8 @@ public class AutofillAssistantFacade {
activity.getWindowAndroid().getApplicationBottomInsetProvider(),
activity.getActivityTabProvider(), activity instanceof CustomTabActivity,
arguments.getInitialUrl(), arguments.getParameters(), arguments.getExperimentIds(),
arguments.getCallerAccount(), arguments.getUserName());
arguments.getCallerAccount(), arguments.getUserName(),
arguments.getOriginalDeeplink());
}
/**
......
......@@ -40,7 +40,8 @@ interface AutofillAssistantModuleEntry {
ApplicationViewportInsetSupplier bottomInsetProvider,
ActivityTabProvider activityTabProvider, boolean isChromeCustomTab,
@NonNull String initialUrl, Map<String, String> parameters, String experimentIds,
@Nullable String callerAccount, @Nullable String userName);
@Nullable String callerAccount, @Nullable String userName,
@Nullable String originalDeeplink);
/**
* Returns a {@link AutofillAssistantActionHandler} instance tied to the activity owning the
* given bottom sheet, and scrim view.
......
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