Commit 5737ebb1 authored by Clark DuVall's avatar Clark DuVall Committed by Chromium LUCI CQ

Fix autofill_assistant DFM crashing when inflating layouts

With isolated splits enabled, the classes from a DFM will not be
available in the base ClassLoader. This change makes sure all of the
calls to inflate in autofill_assistant are able to access the classes
defined in the DFM.

Bug: 1158028, b/174219371
Change-Id: I6e6599f0831b089d97d5041864ce9df41c00e0f3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2587872Reviewed-by: default avatarMathias Carlen <mcarlen@chromium.org>
Commit-Queue: Clark DuVall <cduvall@chromium.org>
Cr-Commit-Position: refs/heads/master@{#836722}
parent 47d4c253
...@@ -35,6 +35,7 @@ android_library("java") { ...@@ -35,6 +35,7 @@ android_library("java") {
":java_resources", ":java_resources",
"//base:base_java", "//base:base_java",
"//base:jni_java", "//base:jni_java",
"//chrome/android:base_module_java",
"//chrome/android:chrome_java", "//chrome/android:chrome_java",
"//chrome/browser/browser_controls/android:java", "//chrome/browser/browser_controls/android:java",
"//chrome/browser/feedback/android:java", "//chrome/browser/feedback/android:java",
...@@ -111,6 +112,7 @@ android_library("java") { ...@@ -111,6 +112,7 @@ android_library("java") {
"java/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantUiController.java", "java/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantUiController.java",
"java/src/org/chromium/chrome/browser/autofill_assistant/BottomSheetUtils.java", "java/src/org/chromium/chrome/browser/autofill_assistant/BottomSheetUtils.java",
"java/src/org/chromium/chrome/browser/autofill_assistant/FeedbackContext.java", "java/src/org/chromium/chrome/browser/autofill_assistant/FeedbackContext.java",
"java/src/org/chromium/chrome/browser/autofill_assistant/LayoutUtils.java",
"java/src/org/chromium/chrome/browser/autofill_assistant/SizeListenableLinearLayout.java", "java/src/org/chromium/chrome/browser/autofill_assistant/SizeListenableLinearLayout.java",
"java/src/org/chromium/chrome/browser/autofill_assistant/carousel/AssistantActionsCarouselCoordinator.java", "java/src/org/chromium/chrome/browser/autofill_assistant/carousel/AssistantActionsCarouselCoordinator.java",
"java/src/org/chromium/chrome/browser/autofill_assistant/carousel/AssistantActionsDecoration.java", "java/src/org/chromium/chrome/browser/autofill_assistant/carousel/AssistantActionsDecoration.java",
......
...@@ -9,7 +9,6 @@ import android.transition.ChangeBounds; ...@@ -9,7 +9,6 @@ import android.transition.ChangeBounds;
import android.transition.Fade; import android.transition.Fade;
import android.transition.TransitionManager; import android.transition.TransitionManager;
import android.transition.TransitionSet; import android.transition.TransitionSet;
import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.LinearLayout; import android.widget.LinearLayout;
...@@ -125,8 +124,9 @@ class AssistantBottomBarCoordinator implements AssistantPeekHeightCoordinator.De ...@@ -125,8 +124,9 @@ class AssistantBottomBarCoordinator implements AssistantPeekHeightCoordinator.De
} }
// Replace or set the content to the actual Autofill Assistant views. // Replace or set the content to the actual Autofill Assistant views.
mRootViewContainer = (AssistantRootViewContainer) LayoutInflater.from(activity).inflate( mRootViewContainer =
R.layout.autofill_assistant_bottom_sheet_content, /* root= */ null); (AssistantRootViewContainer) LayoutUtils.createInflater(activity).inflate(
R.layout.autofill_assistant_bottom_sheet_content, /* root= */ null);
mScrollableContent = mRootViewContainer.findViewById(R.id.scrollable_content); mScrollableContent = mRootViewContainer.findViewById(R.id.scrollable_content);
ViewGroup scrollableContentContainer = ViewGroup scrollableContentContainer =
mScrollableContent.findViewById(R.id.scrollable_content_container); mScrollableContent.findViewById(R.id.scrollable_content_container);
......
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
package org.chromium.chrome.browser.autofill_assistant; package org.chromium.chrome.browser.autofill_assistant;
import android.content.Context; import android.content.Context;
import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.ScrollView; import android.widget.ScrollView;
...@@ -31,7 +30,7 @@ public class AssistantBottomSheetContent implements BottomSheetContent { ...@@ -31,7 +30,7 @@ public class AssistantBottomSheetContent implements BottomSheetContent {
public AssistantBottomSheetContent( public AssistantBottomSheetContent(
Context context, Supplier<AssistantBottomBarDelegate> supplier) { Context context, Supplier<AssistantBottomBarDelegate> supplier) {
mToolbarView = LayoutInflater.from(context).inflate( mToolbarView = LayoutUtils.createInflater(context).inflate(
R.layout.autofill_assistant_bottom_sheet_toolbar, /* root= */ null); R.layout.autofill_assistant_bottom_sheet_toolbar, /* root= */ null);
mContentView = new SizeListenableLinearLayout(context); mContentView = new SizeListenableLinearLayout(context);
mContentView.setLayoutParams(new ViewGroup.LayoutParams( mContentView.setLayoutParams(new ViewGroup.LayoutParams(
......
...@@ -8,7 +8,6 @@ import android.content.Context; ...@@ -8,7 +8,6 @@ import android.content.Context;
import android.text.SpannableString; import android.text.SpannableString;
import android.text.TextUtils; import android.text.TextUtils;
import android.text.method.LinkMovementMethod; import android.text.method.LinkMovementMethod;
import android.view.LayoutInflater;
import android.widget.ScrollView; import android.widget.ScrollView;
import android.widget.TextView; import android.widget.TextView;
...@@ -258,7 +257,7 @@ class AssistantOnboardingCoordinator { ...@@ -258,7 +257,7 @@ class AssistantOnboardingCoordinator {
* Set the content of the bottom sheet to be the Autofill Assistant onboarding. * Set the content of the bottom sheet to be the Autofill Assistant onboarding.
*/ */
private void initContent(Callback<Boolean> callback) { private void initContent(Callback<Boolean> callback) {
mView = (ScrollView) LayoutInflater.from(mContext).inflate( mView = (ScrollView) LayoutUtils.createInflater(mContext).inflate(
R.layout.autofill_assistant_onboarding, /* root= */ null); R.layout.autofill_assistant_onboarding, /* root= */ null);
// Set focusable for accessibility. // Set focusable for accessibility.
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
package org.chromium.chrome.browser.autofill_assistant; package org.chromium.chrome.browser.autofill_assistant;
import android.app.Activity;
import android.content.Context; import android.content.Context;
import android.graphics.Rect; import android.graphics.Rect;
import android.util.AttributeSet; import android.util.AttributeSet;
...@@ -11,6 +12,7 @@ import android.widget.LinearLayout; ...@@ -11,6 +12,7 @@ import android.widget.LinearLayout;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import org.chromium.base.ContextUtils;
import org.chromium.chrome.browser.app.ChromeActivity; import org.chromium.chrome.browser.app.ChromeActivity;
import org.chromium.chrome.browser.browser_controls.BrowserControlsStateProvider; import org.chromium.chrome.browser.browser_controls.BrowserControlsStateProvider;
import org.chromium.chrome.browser.util.ChromeAccessibilityUtil; import org.chromium.chrome.browser.util.ChromeAccessibilityUtil;
...@@ -28,8 +30,9 @@ public class AssistantRootViewContainer ...@@ -28,8 +30,9 @@ public class AssistantRootViewContainer
public AssistantRootViewContainer(Context context, @Nullable AttributeSet attrs) { public AssistantRootViewContainer(Context context, @Nullable AttributeSet attrs) {
super(context, attrs); super(context, attrs);
assert context instanceof ChromeActivity; Activity activity = ContextUtils.activityFromContext(context);
mActivity = (ChromeActivity) context; assert activity instanceof ChromeActivity;
mActivity = (ChromeActivity) activity;
mBrowserControlsStateProvider = mActivity.getBrowserControlsManager(); mBrowserControlsStateProvider = mActivity.getBrowserControlsManager();
mBrowserControlsStateProvider.addObserver(this); mBrowserControlsStateProvider.addObserver(this);
} }
......
// Copyright 2020 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
package org.chromium.chrome.browser.autofill_assistant;
import android.content.Context;
import android.view.LayoutInflater;
import org.chromium.chrome.browser.base.SplitCompatUtils;
/** Utilities for dealing with layouts and inflation. */
public class LayoutUtils {
private static final String ASSISTANT_SPLIT_NAME = "autofill_assistant";
/**
* Creates a LayoutInflater which can be used to inflate layouts from the autofill_assistant
* module.
*/
public static LayoutInflater createInflater(Context context) {
return LayoutInflater.from(
SplitCompatUtils.createContextForInflation(context, ASSISTANT_SPLIT_NAME));
}
}
...@@ -14,6 +14,7 @@ import androidx.annotation.Nullable; ...@@ -14,6 +14,7 @@ import androidx.annotation.Nullable;
import androidx.recyclerview.widget.RecyclerView.ViewHolder; import androidx.recyclerview.widget.RecyclerView.ViewHolder;
import org.chromium.chrome.autofill_assistant.R; import org.chromium.chrome.autofill_assistant.R;
import org.chromium.chrome.browser.autofill_assistant.LayoutUtils;
/** /**
* The {@link ViewHolder} responsible for reflecting an {@link AssistantChip} to a {@link * The {@link ViewHolder} responsible for reflecting an {@link AssistantChip} to a {@link
...@@ -33,7 +34,7 @@ public class AssistantChipViewHolder extends ViewHolder { ...@@ -33,7 +34,7 @@ public class AssistantChipViewHolder extends ViewHolder {
} }
public static AssistantChipViewHolder create(ViewGroup parent, int viewType) { public static AssistantChipViewHolder create(ViewGroup parent, int viewType) {
LayoutInflater layoutInflater = LayoutInflater.from(parent.getContext()); LayoutInflater layoutInflater = LayoutUtils.createInflater(parent.getContext());
ButtonView view = null; ButtonView view = null;
switch (viewType) { switch (viewType) {
case AssistantChip.Type.CHIP_ASSISTIVE: case AssistantChip.Type.CHIP_ASSISTIVE:
......
...@@ -5,13 +5,13 @@ ...@@ -5,13 +5,13 @@
package org.chromium.chrome.browser.autofill_assistant.details; package org.chromium.chrome.browser.autofill_assistant.details;
import android.content.Context; import android.content.Context;
import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import androidx.annotation.VisibleForTesting; import androidx.annotation.VisibleForTesting;
import org.chromium.chrome.autofill_assistant.R; import org.chromium.chrome.autofill_assistant.R;
import org.chromium.chrome.browser.autofill_assistant.AutofillAssistantUiController; import org.chromium.chrome.browser.autofill_assistant.AutofillAssistantUiController;
import org.chromium.chrome.browser.autofill_assistant.LayoutUtils;
import org.chromium.chrome.browser.autofill_assistant.details.AssistantDetailsViewBinder.ViewHolder; import org.chromium.chrome.browser.autofill_assistant.details.AssistantDetailsViewBinder.ViewHolder;
import org.chromium.chrome.browser.image_fetcher.ImageFetcher; import org.chromium.chrome.browser.image_fetcher.ImageFetcher;
import org.chromium.chrome.browser.image_fetcher.ImageFetcherConfig; import org.chromium.chrome.browser.image_fetcher.ImageFetcherConfig;
...@@ -34,7 +34,7 @@ public class AssistantDetailsCoordinator { ...@@ -34,7 +34,7 @@ public class AssistantDetailsCoordinator {
@VisibleForTesting @VisibleForTesting
public AssistantDetailsCoordinator( public AssistantDetailsCoordinator(
Context context, AssistantDetailsModel model, ImageFetcher imageFetcher) { Context context, AssistantDetailsModel model, ImageFetcher imageFetcher) {
mView = LayoutInflater.from(context).inflate( mView = LayoutUtils.createInflater(context).inflate(
R.layout.autofill_assistant_details, /* root= */ null); R.layout.autofill_assistant_details, /* root= */ null);
mModel = model; mModel = model;
ViewHolder viewHolder = new ViewHolder(context, mView); ViewHolder viewHolder = new ViewHolder(context, mView);
......
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
package org.chromium.chrome.browser.autofill_assistant.form; package org.chromium.chrome.browser.autofill_assistant.form;
import android.content.Context; import android.content.Context;
import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.LinearLayout; import android.widget.LinearLayout;
...@@ -13,6 +12,7 @@ import android.widget.TextView; ...@@ -13,6 +12,7 @@ import android.widget.TextView;
import org.chromium.chrome.autofill_assistant.R; import org.chromium.chrome.autofill_assistant.R;
import org.chromium.chrome.browser.autofill_assistant.AssistantTextUtils; import org.chromium.chrome.browser.autofill_assistant.AssistantTextUtils;
import org.chromium.chrome.browser.autofill_assistant.LayoutUtils;
/** /**
* A coordinator responsible for showing a form to the user. * A coordinator responsible for showing a form to the user.
...@@ -32,7 +32,7 @@ public class AssistantFormCoordinator { ...@@ -32,7 +32,7 @@ public class AssistantFormCoordinator {
mFormView = makeLinearLayout(context); mFormView = makeLinearLayout(context);
mInfoView = (LinearLayout) LayoutInflater.from(context).inflate( mInfoView = (LinearLayout) LayoutUtils.createInflater(context).inflate(
R.layout.autofill_assistant_form_information, mRootView, R.layout.autofill_assistant_form_information, mRootView,
/* attachToRoot= */ false); /* attachToRoot= */ false);
......
...@@ -10,13 +10,13 @@ import android.transition.Fade; ...@@ -10,13 +10,13 @@ import android.transition.Fade;
import android.transition.Transition; import android.transition.Transition;
import android.transition.TransitionManager; import android.transition.TransitionManager;
import android.transition.TransitionSet; import android.transition.TransitionSet;
import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.TextView; import android.widget.TextView;
import org.chromium.chrome.autofill_assistant.R; import org.chromium.chrome.autofill_assistant.R;
import org.chromium.chrome.browser.autofill_assistant.AssistantTextUtils; import org.chromium.chrome.browser.autofill_assistant.AssistantTextUtils;
import org.chromium.chrome.browser.autofill_assistant.LayoutUtils;
import org.chromium.chrome.browser.util.ChromeAccessibilityUtil; import org.chromium.chrome.browser.util.ChromeAccessibilityUtil;
import java.util.ArrayList; import java.util.ArrayList;
...@@ -48,7 +48,7 @@ class AssistantFormCounterInput extends AssistantFormInput { ...@@ -48,7 +48,7 @@ class AssistantFormCounterInput extends AssistantFormInput {
private final View mIncreaseButtonView; private final View mIncreaseButtonView;
private CounterViewHolder(Context context) { private CounterViewHolder(Context context) {
mView = LayoutInflater.from(context).inflate( mView = LayoutUtils.createInflater(context).inflate(
R.layout.autofill_assistant_form_counter, /*root= */ null); R.layout.autofill_assistant_form_counter, /*root= */ null);
mLabelView = mView.findViewById(R.id.label); mLabelView = mView.findViewById(R.id.label);
mDescriptionLine1View = mView.findViewById(R.id.description_line_1); mDescriptionLine1View = mView.findViewById(R.id.description_line_1);
...@@ -95,7 +95,7 @@ class AssistantFormCounterInput extends AssistantFormInput { ...@@ -95,7 +95,7 @@ class AssistantFormCounterInput extends AssistantFormInput {
@Override @Override
public View createView(Context context, ViewGroup parent) { public View createView(Context context, ViewGroup parent) {
ViewGroup root = (ViewGroup) LayoutInflater.from(context).inflate( ViewGroup root = (ViewGroup) LayoutUtils.createInflater(context).inflate(
R.layout.autofill_assistant_form_counter_input, parent, /* attachToRoot= */ false); R.layout.autofill_assistant_form_counter_input, parent, /* attachToRoot= */ false);
TextView label = root.findViewById(R.id.label); TextView label = root.findViewById(R.id.label);
if (mLabel.isEmpty()) { if (mLabel.isEmpty()) {
......
...@@ -13,6 +13,7 @@ import android.widget.TextView; ...@@ -13,6 +13,7 @@ import android.widget.TextView;
import org.chromium.chrome.autofill_assistant.R; import org.chromium.chrome.autofill_assistant.R;
import org.chromium.chrome.browser.autofill_assistant.AssistantTextUtils; import org.chromium.chrome.browser.autofill_assistant.AssistantTextUtils;
import org.chromium.chrome.browser.autofill_assistant.LayoutUtils;
import org.chromium.chrome.browser.autofill_assistant.user_data.AssistantChoiceList; import org.chromium.chrome.browser.autofill_assistant.user_data.AssistantChoiceList;
import java.util.ArrayList; import java.util.ArrayList;
...@@ -41,7 +42,7 @@ class AssistantFormSelectionInput extends AssistantFormInput { ...@@ -41,7 +42,7 @@ class AssistantFormSelectionInput extends AssistantFormInput {
@Override @Override
public View createView(Context context, ViewGroup parent) { public View createView(Context context, ViewGroup parent) {
LayoutInflater inflater = LayoutInflater.from(context); LayoutInflater inflater = LayoutUtils.createInflater(context);
ViewGroup root = (ViewGroup) inflater.inflate( ViewGroup root = (ViewGroup) inflater.inflate(
R.layout.autofill_assistant_form_selection_input, parent, R.layout.autofill_assistant_form_selection_input, parent,
/* attachToRoot= */ false); /* attachToRoot= */ false);
......
...@@ -9,7 +9,6 @@ import static org.chromium.chrome.browser.autofill_assistant.AssistantAccessibil ...@@ -9,7 +9,6 @@ import static org.chromium.chrome.browser.autofill_assistant.AssistantAccessibil
import android.content.Context; import android.content.Context;
import android.text.Editable; import android.text.Editable;
import android.text.TextWatcher; import android.text.TextWatcher;
import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.LinearLayout; import android.widget.LinearLayout;
...@@ -23,6 +22,7 @@ import org.chromium.base.annotations.JNINamespace; ...@@ -23,6 +22,7 @@ import org.chromium.base.annotations.JNINamespace;
import org.chromium.chrome.browser.autofill.prefeditor.EditorFieldModel; import org.chromium.chrome.browser.autofill.prefeditor.EditorFieldModel;
import org.chromium.chrome.browser.autofill.prefeditor.EditorTextField; import org.chromium.chrome.browser.autofill.prefeditor.EditorTextField;
import org.chromium.chrome.browser.autofill_assistant.AssistantChevronStyle; import org.chromium.chrome.browser.autofill_assistant.AssistantChevronStyle;
import org.chromium.chrome.browser.autofill_assistant.LayoutUtils;
import org.chromium.chrome.browser.autofill_assistant.user_data.AssistantVerticalExpander; import org.chromium.chrome.browser.autofill_assistant.user_data.AssistantVerticalExpander;
import org.chromium.chrome.browser.autofill_assistant.user_data.AssistantVerticalExpanderAccordion; import org.chromium.chrome.browser.autofill_assistant.user_data.AssistantVerticalExpanderAccordion;
import org.chromium.ui.widget.ChromeImageView; import org.chromium.ui.widget.ChromeImageView;
...@@ -116,7 +116,7 @@ public class AssistantViewFactory { ...@@ -116,7 +116,7 @@ public class AssistantViewFactory {
/** Creates a divider widget as used in the {@code AssistantCollectUserData} action. */ /** Creates a divider widget as used in the {@code AssistantCollectUserData} action. */
@CalledByNative @CalledByNative
public static View createDividerView(Context context, String identifier) { public static View createDividerView(Context context, String identifier) {
View divider = LayoutInflater.from(context).inflate( View divider = LayoutUtils.createInflater(context).inflate(
org.chromium.chrome.autofill_assistant.R.layout org.chromium.chrome.autofill_assistant.R.layout
.autofill_assistant_payment_request_section_divider, .autofill_assistant_payment_request_section_divider,
null, false); null, false);
......
...@@ -6,7 +6,6 @@ package org.chromium.chrome.browser.autofill_assistant.header; ...@@ -6,7 +6,6 @@ package org.chromium.chrome.browser.autofill_assistant.header;
import android.content.Context; import android.content.Context;
import android.graphics.Rect; import android.graphics.Rect;
import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.ImageView; import android.widget.ImageView;
...@@ -17,6 +16,7 @@ import androidx.recyclerview.widget.RecyclerView; ...@@ -17,6 +16,7 @@ import androidx.recyclerview.widget.RecyclerView;
import org.chromium.chrome.autofill_assistant.R; import org.chromium.chrome.autofill_assistant.R;
import org.chromium.chrome.browser.autofill_assistant.AutofillAssistantUiController; import org.chromium.chrome.browser.autofill_assistant.AutofillAssistantUiController;
import org.chromium.chrome.browser.autofill_assistant.LayoutUtils;
import org.chromium.chrome.browser.autofill_assistant.carousel.AssistantChipAdapter; import org.chromium.chrome.browser.autofill_assistant.carousel.AssistantChipAdapter;
import org.chromium.chrome.browser.autofill_assistant.header.AssistantHeaderViewBinder.ViewHolder; import org.chromium.chrome.browser.autofill_assistant.header.AssistantHeaderViewBinder.ViewHolder;
import org.chromium.chrome.browser.signin.services.DisplayableProfileData; import org.chromium.chrome.browser.signin.services.DisplayableProfileData;
...@@ -44,7 +44,7 @@ public class AssistantHeaderCoordinator implements ProfileDataCache.Observer { ...@@ -44,7 +44,7 @@ public class AssistantHeaderCoordinator implements ProfileDataCache.Observer {
// Create the poodle and insert it before the status message. We have to create a view // Create the poodle and insert it before the status message. We have to create a view
// bigger than the desired poodle size (24dp) because the actual downstream implementation // bigger than the desired poodle size (24dp) because the actual downstream implementation
// needs extra space for the animation. // needs extra space for the animation.
mView = (ViewGroup) LayoutInflater.from(context).inflate( mView = (ViewGroup) LayoutUtils.createInflater(context).inflate(
R.layout.autofill_assistant_header, /* root= */ null); R.layout.autofill_assistant_header, /* root= */ null);
AnimatedPoodle poodle = new AnimatedPoodle(context, AnimatedPoodle poodle = new AnimatedPoodle(context,
context.getResources().getDimensionPixelSize( context.getResources().getDimensionPixelSize(
......
...@@ -5,11 +5,11 @@ ...@@ -5,11 +5,11 @@
package org.chromium.chrome.browser.autofill_assistant.infobox; package org.chromium.chrome.browser.autofill_assistant.infobox;
import android.content.Context; import android.content.Context;
import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import org.chromium.chrome.autofill_assistant.R; import org.chromium.chrome.autofill_assistant.R;
import org.chromium.chrome.browser.autofill_assistant.AutofillAssistantUiController; import org.chromium.chrome.browser.autofill_assistant.AutofillAssistantUiController;
import org.chromium.chrome.browser.autofill_assistant.LayoutUtils;
import org.chromium.chrome.browser.autofill_assistant.infobox.AssistantInfoBoxViewBinder.ViewHolder; import org.chromium.chrome.browser.autofill_assistant.infobox.AssistantInfoBoxViewBinder.ViewHolder;
import org.chromium.chrome.browser.image_fetcher.ImageFetcher; import org.chromium.chrome.browser.image_fetcher.ImageFetcher;
import org.chromium.chrome.browser.image_fetcher.ImageFetcherConfig; import org.chromium.chrome.browser.image_fetcher.ImageFetcherConfig;
...@@ -32,7 +32,7 @@ public class AssistantInfoBoxCoordinator { ...@@ -32,7 +32,7 @@ public class AssistantInfoBoxCoordinator {
/** Used for testing to inject an image fetcher. */ /** Used for testing to inject an image fetcher. */
public AssistantInfoBoxCoordinator( public AssistantInfoBoxCoordinator(
Context context, AssistantInfoBoxModel model, ImageFetcher imageFetcher) { Context context, AssistantInfoBoxModel model, ImageFetcher imageFetcher) {
mView = LayoutInflater.from(context).inflate( mView = LayoutUtils.createInflater(context).inflate(
R.layout.autofill_assistant_info_box, /* root= */ null); R.layout.autofill_assistant_info_box, /* root= */ null);
ViewHolder viewHolder = new ViewHolder(context, mView); ViewHolder viewHolder = new ViewHolder(context, mView);
mViewBinder = new AssistantInfoBoxViewBinder(context, imageFetcher); mViewBinder = new AssistantInfoBoxViewBinder(context, imageFetcher);
......
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
package org.chromium.chrome.browser.autofill_assistant.trigger_scripts; package org.chromium.chrome.browser.autofill_assistant.trigger_scripts;
import android.content.Context; import android.content.Context;
import android.view.LayoutInflater;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import android.widget.ScrollView; import android.widget.ScrollView;
...@@ -20,6 +19,7 @@ import org.chromium.chrome.browser.autofill_assistant.AssistantBottomBarDelegate ...@@ -20,6 +19,7 @@ import org.chromium.chrome.browser.autofill_assistant.AssistantBottomBarDelegate
import org.chromium.chrome.browser.autofill_assistant.AssistantBottomSheetContent; import org.chromium.chrome.browser.autofill_assistant.AssistantBottomSheetContent;
import org.chromium.chrome.browser.autofill_assistant.AssistantRootViewContainer; import org.chromium.chrome.browser.autofill_assistant.AssistantRootViewContainer;
import org.chromium.chrome.browser.autofill_assistant.BottomSheetUtils; import org.chromium.chrome.browser.autofill_assistant.BottomSheetUtils;
import org.chromium.chrome.browser.autofill_assistant.LayoutUtils;
import org.chromium.chrome.browser.autofill_assistant.carousel.AssistantChip; import org.chromium.chrome.browser.autofill_assistant.carousel.AssistantChip;
import org.chromium.chrome.browser.autofill_assistant.carousel.AssistantChipViewHolder; import org.chromium.chrome.browser.autofill_assistant.carousel.AssistantChipViewHolder;
import org.chromium.chrome.browser.autofill_assistant.generic_ui.AssistantDimension; import org.chromium.chrome.browser.autofill_assistant.generic_ui.AssistantDimension;
...@@ -140,7 +140,7 @@ public class AssistantTriggerScript { ...@@ -140,7 +140,7 @@ public class AssistantTriggerScript {
horizontalMargin, verticalMargin, horizontalMargin, verticalMargin); horizontalMargin, verticalMargin, horizontalMargin, verticalMargin);
AssistantRootViewContainer rootViewContainer = AssistantRootViewContainer rootViewContainer =
(AssistantRootViewContainer) LayoutInflater.from(mContext).inflate( (AssistantRootViewContainer) LayoutUtils.createInflater(mContext).inflate(
R.layout.autofill_assistant_bottom_sheet_content, /* root= */ null); R.layout.autofill_assistant_bottom_sheet_content, /* root= */ null);
ScrollView scrollableContent = rootViewContainer.findViewById(R.id.scrollable_content); ScrollView scrollableContent = rootViewContainer.findViewById(R.id.scrollable_content);
rootViewContainer.addView(mHeaderCoordinator.getView(), 0); rootViewContainer.addView(mHeaderCoordinator.getView(), 0);
......
...@@ -6,7 +6,6 @@ package org.chromium.chrome.browser.autofill_assistant.user_data; ...@@ -6,7 +6,6 @@ package org.chromium.chrome.browser.autofill_assistant.user_data;
import android.app.Activity; import android.app.Activity;
import android.os.Build; import android.os.Build;
import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.LinearLayout; import android.widget.LinearLayout;
...@@ -15,6 +14,7 @@ import androidx.annotation.VisibleForTesting; ...@@ -15,6 +14,7 @@ import androidx.annotation.VisibleForTesting;
import org.chromium.chrome.autofill_assistant.R; import org.chromium.chrome.autofill_assistant.R;
import org.chromium.chrome.browser.autofill_assistant.AssistantTagsForTesting; import org.chromium.chrome.browser.autofill_assistant.AssistantTagsForTesting;
import org.chromium.chrome.browser.autofill_assistant.LayoutUtils;
import org.chromium.chrome.browser.autofill_assistant.user_data.additional_sections.AssistantAdditionalSectionContainer; import org.chromium.chrome.browser.autofill_assistant.user_data.additional_sections.AssistantAdditionalSectionContainer;
import org.chromium.ui.modelutil.PropertyModelChangeProcessor; import org.chromium.ui.modelutil.PropertyModelChangeProcessor;
...@@ -167,7 +167,7 @@ public class AssistantCollectUserDataCoordinator { ...@@ -167,7 +167,7 @@ public class AssistantCollectUserDataCoordinator {
} }
private void createSeparator(ViewGroup parent) { private void createSeparator(ViewGroup parent) {
View divider = LayoutInflater.from(mActivity).inflate( View divider = LayoutUtils.createInflater(mActivity).inflate(
R.layout.autofill_assistant_payment_request_section_divider, parent, false); R.layout.autofill_assistant_payment_request_section_divider, parent, false);
divider.setTag(DIVIDER_TAG); divider.setTag(DIVIDER_TAG);
parent.addView(divider); parent.addView(divider);
......
...@@ -19,6 +19,7 @@ import org.chromium.base.Callback; ...@@ -19,6 +19,7 @@ import org.chromium.base.Callback;
import org.chromium.chrome.autofill_assistant.R; import org.chromium.chrome.autofill_assistant.R;
import org.chromium.chrome.browser.autofill_assistant.AssistantTagsForTesting; import org.chromium.chrome.browser.autofill_assistant.AssistantTagsForTesting;
import org.chromium.chrome.browser.autofill_assistant.AssistantTextUtils; import org.chromium.chrome.browser.autofill_assistant.AssistantTextUtils;
import org.chromium.chrome.browser.autofill_assistant.LayoutUtils;
import org.chromium.components.autofill.EditableOption; import org.chromium.components.autofill.EditableOption;
import java.util.ArrayList; import java.util.ArrayList;
...@@ -82,7 +83,7 @@ public abstract class AssistantCollectUserDataSection<T extends EditableOption> ...@@ -82,7 +83,7 @@ public abstract class AssistantCollectUserDataSection<T extends EditableOption>
mItems = new ArrayList<>(); mItems = new ArrayList<>();
mTitleToContentPadding = titleToContentPadding; mTitleToContentPadding = titleToContentPadding;
LayoutInflater inflater = LayoutInflater.from(context); LayoutInflater inflater = LayoutUtils.createInflater(context);
mSectionExpander = new AssistantVerticalExpander(context, null); mSectionExpander = new AssistantVerticalExpander(context, null);
View sectionTitle = View sectionTitle =
inflater.inflate(R.layout.autofill_assistant_payment_request_section_title, null); inflater.inflate(R.layout.autofill_assistant_payment_request_section_title, null);
...@@ -290,7 +291,7 @@ public abstract class AssistantCollectUserDataSection<T extends EditableOption> ...@@ -290,7 +291,7 @@ public abstract class AssistantCollectUserDataSection<T extends EditableOption>
* Creates a new item from {@code option}. * Creates a new item from {@code option}.
*/ */
private Item createItem(T option) { private Item createItem(T option) {
View fullView = LayoutInflater.from(mContext).inflate(mFullViewResId, null); View fullView = LayoutUtils.createInflater(mContext).inflate(mFullViewResId, null);
updateFullView(fullView, option); updateFullView(fullView, option);
Item item = new Item(fullView, option); Item item = new Item(fullView, option);
return item; return item;
......
...@@ -16,6 +16,7 @@ import androidx.annotation.Nullable; ...@@ -16,6 +16,7 @@ import androidx.annotation.Nullable;
import org.chromium.base.ApiCompatibilityUtils; import org.chromium.base.ApiCompatibilityUtils;
import org.chromium.chrome.autofill_assistant.R; import org.chromium.chrome.autofill_assistant.R;
import org.chromium.chrome.browser.autofill_assistant.AssistantChevronStyle; import org.chromium.chrome.browser.autofill_assistant.AssistantChevronStyle;
import org.chromium.chrome.browser.autofill_assistant.LayoutUtils;
import org.chromium.content.browser.input.PopupItemType; import org.chromium.content.browser.input.PopupItemType;
import org.chromium.content.browser.input.SelectPopupDialog; import org.chromium.content.browser.input.SelectPopupDialog;
import org.chromium.content.browser.input.SelectPopupItem; import org.chromium.content.browser.input.SelectPopupItem;
...@@ -62,7 +63,7 @@ public class AssistantDateSection { ...@@ -62,7 +63,7 @@ public class AssistantDateSection {
mTitleToContentPadding = context.getResources().getDimensionPixelSize( mTitleToContentPadding = context.getResources().getDimensionPixelSize(
R.dimen.autofill_assistant_payment_request_title_padding); R.dimen.autofill_assistant_payment_request_title_padding);
LayoutInflater inflater = LayoutInflater.from(context); LayoutInflater inflater = LayoutUtils.createInflater(context);
mRootLayout = (LinearLayout) inflater.inflate(R.layout.autofill_assistant_datetime, null); mRootLayout = (LinearLayout) inflater.inflate(R.layout.autofill_assistant_datetime, null);
mRootLayout.setVisibility(View.GONE); mRootLayout.setVisibility(View.GONE);
...@@ -139,7 +140,7 @@ public class AssistantDateSection { ...@@ -139,7 +140,7 @@ public class AssistantDateSection {
/** Common view configuration for the vertical expanders. */ /** Common view configuration for the vertical expanders. */
private void setupExpander(Context context, AssistantVerticalExpander expander) { private void setupExpander(Context context, AssistantVerticalExpander expander) {
View titleView = LayoutInflater.from(context).inflate( View titleView = LayoutUtils.createInflater(context).inflate(
R.layout.autofill_assistant_payment_request_section_title, null); R.layout.autofill_assistant_payment_request_section_title, null);
TextView summaryView = new TextView(context); TextView summaryView = new TextView(context);
summaryView.setSingleLine(); summaryView.setSingleLine();
......
...@@ -7,7 +7,6 @@ package org.chromium.chrome.browser.autofill_assistant.user_data; ...@@ -7,7 +7,6 @@ package org.chromium.chrome.browser.autofill_assistant.user_data;
import android.content.Context; import android.content.Context;
import android.text.TextUtils; import android.text.TextUtils;
import android.view.Gravity; import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.LinearLayout; import android.widget.LinearLayout;
...@@ -19,6 +18,7 @@ import org.chromium.base.ApiCompatibilityUtils; ...@@ -19,6 +18,7 @@ import org.chromium.base.ApiCompatibilityUtils;
import org.chromium.chrome.autofill_assistant.R; import org.chromium.chrome.autofill_assistant.R;
import org.chromium.chrome.browser.autofill_assistant.AssistantTagsForTesting; import org.chromium.chrome.browser.autofill_assistant.AssistantTagsForTesting;
import org.chromium.chrome.browser.autofill_assistant.AssistantTextUtils; import org.chromium.chrome.browser.autofill_assistant.AssistantTextUtils;
import org.chromium.chrome.browser.autofill_assistant.LayoutUtils;
/** /**
* The third party terms and conditions section of the Autofill Assistant payment request. * The third party terms and conditions section of the Autofill Assistant payment request.
...@@ -40,7 +40,7 @@ public class AssistantTermsSection { ...@@ -40,7 +40,7 @@ public class AssistantTermsSection {
private Delegate mDelegate; private Delegate mDelegate;
AssistantTermsSection(Context context, ViewGroup parent, boolean showAsSingleCheckbox) { AssistantTermsSection(Context context, ViewGroup parent, boolean showAsSingleCheckbox) {
mView = LayoutInflater.from(context).inflate( mView = LayoutUtils.createInflater(context).inflate(
R.layout.autofill_assistant_payment_request_terms_and_conditions, parent, false); R.layout.autofill_assistant_payment_request_terms_and_conditions, parent, false);
LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams( LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
......
...@@ -11,6 +11,7 @@ import android.view.ViewGroup; ...@@ -11,6 +11,7 @@ import android.view.ViewGroup;
import android.widget.Space; import android.widget.Space;
import org.chromium.chrome.autofill_assistant.R; import org.chromium.chrome.autofill_assistant.R;
import org.chromium.chrome.browser.autofill_assistant.LayoutUtils;
import org.chromium.chrome.browser.autofill_assistant.user_data.AssistantCollectUserDataCoordinator; import org.chromium.chrome.browser.autofill_assistant.user_data.AssistantCollectUserDataCoordinator;
import org.chromium.chrome.browser.autofill_assistant.user_data.additional_sections.AssistantAdditionalSection.Delegate; import org.chromium.chrome.browser.autofill_assistant.user_data.additional_sections.AssistantAdditionalSection.Delegate;
...@@ -44,7 +45,7 @@ public class AssistantAdditionalSectionContainer { ...@@ -44,7 +45,7 @@ public class AssistantAdditionalSectionContainer {
mSections.clear(); mSections.clear();
int index = mParent.indexOfChild(mPlaceholderView); int index = mParent.indexOfChild(mPlaceholderView);
LayoutInflater inflater = LayoutInflater.from(mContext); LayoutInflater inflater = LayoutUtils.createInflater(mContext);
for (int i = sections.size() - 1; i >= 0; i--) { for (int i = sections.size() - 1; i >= 0; i--) {
View divider = inflater.inflate( View divider = inflater.inflate(
R.layout.autofill_assistant_payment_request_section_divider, mParent, false); R.layout.autofill_assistant_payment_request_section_divider, mParent, false);
......
...@@ -16,6 +16,7 @@ import androidx.annotation.Nullable; ...@@ -16,6 +16,7 @@ import androidx.annotation.Nullable;
import org.chromium.chrome.autofill_assistant.R; import org.chromium.chrome.autofill_assistant.R;
import org.chromium.chrome.browser.autofill_assistant.AssistantChevronStyle; import org.chromium.chrome.browser.autofill_assistant.AssistantChevronStyle;
import org.chromium.chrome.browser.autofill_assistant.AssistantTextUtils; import org.chromium.chrome.browser.autofill_assistant.AssistantTextUtils;
import org.chromium.chrome.browser.autofill_assistant.LayoutUtils;
import org.chromium.chrome.browser.autofill_assistant.generic_ui.AssistantValue; import org.chromium.chrome.browser.autofill_assistant.generic_ui.AssistantValue;
import org.chromium.chrome.browser.autofill_assistant.user_data.AssistantVerticalExpander; import org.chromium.chrome.browser.autofill_assistant.user_data.AssistantVerticalExpander;
import org.chromium.content.browser.input.PopupItemType; import org.chromium.content.browser.input.PopupItemType;
...@@ -77,7 +78,7 @@ public class AssistantPopupListSection implements AssistantAdditionalSection { ...@@ -77,7 +78,7 @@ public class AssistantPopupListSection implements AssistantAdditionalSection {
mTitleToContentPadding = context.getResources().getDimensionPixelSize( mTitleToContentPadding = context.getResources().getDimensionPixelSize(
R.dimen.autofill_assistant_payment_request_title_padding); R.dimen.autofill_assistant_payment_request_title_padding);
LayoutInflater inflater = LayoutInflater.from(context); LayoutInflater inflater = LayoutUtils.createInflater(context);
mSectionExpander = new AssistantVerticalExpander(context, null); mSectionExpander = new AssistantVerticalExpander(context, null);
View sectionTitle = View sectionTitle =
inflater.inflate(R.layout.autofill_assistant_payment_request_section_title, null); inflater.inflate(R.layout.autofill_assistant_payment_request_section_title, null);
......
...@@ -13,6 +13,7 @@ import android.widget.TextView; ...@@ -13,6 +13,7 @@ import android.widget.TextView;
import org.chromium.chrome.autofill_assistant.R; import org.chromium.chrome.autofill_assistant.R;
import org.chromium.chrome.browser.autofill_assistant.AssistantTextUtils; import org.chromium.chrome.browser.autofill_assistant.AssistantTextUtils;
import org.chromium.chrome.browser.autofill_assistant.LayoutUtils;
/** A section which displays a simple static text message. */ /** A section which displays a simple static text message. */
public class AssistantStaticTextSection implements AssistantAdditionalSection { public class AssistantStaticTextSection implements AssistantAdditionalSection {
...@@ -40,7 +41,7 @@ public class AssistantStaticTextSection implements AssistantAdditionalSection { ...@@ -40,7 +41,7 @@ public class AssistantStaticTextSection implements AssistantAdditionalSection {
mTitleToContentPadding = context.getResources().getDimensionPixelSize( mTitleToContentPadding = context.getResources().getDimensionPixelSize(
R.dimen.autofill_assistant_payment_request_title_padding); R.dimen.autofill_assistant_payment_request_title_padding);
LayoutInflater inflater = LayoutInflater.from(context); LayoutInflater inflater = LayoutUtils.createInflater(context);
mRootLayout = (LinearLayout) inflater.inflate( mRootLayout = (LinearLayout) inflater.inflate(
R.layout.autofill_assistant_static_text_section, null); R.layout.autofill_assistant_static_text_section, null);
......
...@@ -25,6 +25,7 @@ import org.chromium.chrome.autofill_assistant.R; ...@@ -25,6 +25,7 @@ import org.chromium.chrome.autofill_assistant.R;
import org.chromium.chrome.browser.autofill.prefeditor.EditorFieldModel; import org.chromium.chrome.browser.autofill.prefeditor.EditorFieldModel;
import org.chromium.chrome.browser.autofill.prefeditor.EditorTextField; import org.chromium.chrome.browser.autofill.prefeditor.EditorTextField;
import org.chromium.chrome.browser.autofill_assistant.AssistantTextUtils; import org.chromium.chrome.browser.autofill_assistant.AssistantTextUtils;
import org.chromium.chrome.browser.autofill_assistant.LayoutUtils;
import org.chromium.chrome.browser.autofill_assistant.generic_ui.AssistantValue; import org.chromium.chrome.browser.autofill_assistant.generic_ui.AssistantValue;
import org.chromium.chrome.browser.autofill_assistant.user_data.AssistantVerticalExpander; import org.chromium.chrome.browser.autofill_assistant.user_data.AssistantVerticalExpander;
...@@ -113,7 +114,7 @@ public class AssistantTextInputSection implements AssistantAdditionalSection { ...@@ -113,7 +114,7 @@ public class AssistantTextInputSection implements AssistantAdditionalSection {
mTitleToContentPadding = context.getResources().getDimensionPixelSize( mTitleToContentPadding = context.getResources().getDimensionPixelSize(
R.dimen.autofill_assistant_payment_request_title_padding); R.dimen.autofill_assistant_payment_request_title_padding);
LayoutInflater inflater = LayoutInflater.from(context); LayoutInflater inflater = LayoutUtils.createInflater(context);
mSectionExpander = new AssistantVerticalExpander(context, null); mSectionExpander = new AssistantVerticalExpander(context, null);
View sectionTitle = View sectionTitle =
inflater.inflate(R.layout.autofill_assistant_payment_request_section_title, null); inflater.inflate(R.layout.autofill_assistant_payment_request_section_title, null);
......
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