scripts: build-chromium: Initial commit

* Script based on https://github.com/LineageOS/scripts/blob/45d62060bfaca101f52b14d0e61b295b6921fa40/build-webview/build-webview.sh
* Patches taken from https://github.com/GrapheneOS/Vanadium/tree/422333246c7cd40cec02aac751ed8d3637c652e9/patches

Change-Id: Id0df182c99d2cf2c372af12f0f93be74b8908756
diff --git a/build-chromium/build-chromium.sh b/build-chromium/build-chromium.sh
new file mode 100755
index 0000000..a281aa6
--- /dev/null
+++ b/build-chromium/build-chromium.sh
@@ -0,0 +1,143 @@
+#!/bin/bash
+
+set -e
+
+chromium_version="108.0.5359.79"
+chromium_code="5359079"
+clean=0
+gsync=0
+supported_archs=(arm64 x64)
+
+usage() {
+    echo "Usage:"
+    echo "  build_webview [ options ]"
+    echo
+    echo "  Options:"
+    echo "    -a <arch> Build specified arch"
+    echo "    -c Clean"
+    echo "    -h Show this message"
+    echo "    -r <release> Specify chromium release"
+    echo "    -s Sync"
+    echo
+    echo "  Example:"
+    echo "    build_webview -c -r $chromium_version:$chromium_code"
+    echo
+    exit 1
+}
+
+build() {
+    build_args=$args' target_cpu="'$1'"'
+
+    code=$chromium_code
+    if [ $1 '==' "arm" ]; then
+        code+=00
+    elif [ $1 '==' "arm64" ]; then
+        code+=50
+    elif [ $1 '==' "x86" ]; then
+        code+=10
+    elif [ $1 '==' "x64" ]; then
+        code+=60
+    fi
+    build_args+=' android_default_version_code="'$code'"'
+
+    gn gen "out/$1" --args="$build_args"
+    ninja -C out/$1 trichrome_webview_64_32_apk trichrome_chrome_64_32_apk trichrome_library_64_32_apk
+}
+
+while getopts ":a:chr:s" opt; do
+    case $opt in
+        a) for arch in ${supported_archs[@]}; do
+               [ "$OPTARG" '==' "$arch" ] && build_arch="$OPTARG"
+           done
+           if [ -z "$build_arch" ]; then
+               echo "Unsupported ARCH: $OPTARG"
+               echo "Supported ARCHs: ${supported_archs[@]}"
+               exit 1
+           fi
+           ;;
+        c) clean=1 ;;
+        h) usage ;;
+        r) version=(${OPTARG//:/ })
+           chromium_version=${version[0]}
+           chromium_code=${version[1]}
+           ;;
+        s) gsync=1 ;;
+        :)
+          echo "Option -$OPTARG requires an argument"
+          echo
+          usage
+          ;;
+        \?)
+          echo "Invalid option:-$OPTARG"
+          echo
+          usage
+          ;;
+    esac
+done
+shift $((OPTIND-1))
+
+# Add depot_tools to PATH
+if [ ! -d depot_tools ]; then
+    git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
+fi
+export PATH="$(pwd -P)/depot_tools:$PATH"
+
+if [ ! -d src ]; then
+    fetch --no-history android
+    yes | gclient sync -D -R -r $chromium_version --no-history
+fi
+
+if [ $gsync -eq 1 ]; then
+    find src -name index.lock -delete
+    yes | gclient sync -R -r $chromium_version --no-history
+fi
+cd src
+
+# Apply our patches
+if [ $gsync -eq 1 ]; then
+    git am $(realpath $(dirname $0))/patches/*.patch
+fi
+
+# Replace webview icon
+cp chrome/android/java/res_chromium_base/mipmap-mdpi/app_icon.png android_webview/nonembedded/java/res_icon/drawable-mdpi/icon_webview.png
+cp chrome/android/java/res_chromium_base/mipmap-hdpi/app_icon.png android_webview/nonembedded/java/res_icon/drawable-hdpi/icon_webview.png
+cp chrome/android/java/res_chromium_base/mipmap-xhdpi/app_icon.png android_webview/nonembedded/java/res_icon/drawable-xhdpi/icon_webview.png
+cp chrome/android/java/res_chromium_base/mipmap-xxhdpi/app_icon.png android_webview/nonembedded/java/res_icon/drawable-xxhdpi/icon_webview.png
+
+# Build args
+args='target_os="android"'
+args+=' is_debug=false'
+args+=' is_official_build=true'
+args+=' is_chrome_branded=false'
+args+=' use_official_google_api_keys=false'
+args+=' ffmpeg_branding="Chrome"'
+args+=' proprietary_codecs=true'
+args+=' enable_resource_allowlist_generation=false'
+args+=' enable_remoting=false'
+args+=' is_component_build=false'
+args+=' symbol_level=0'
+args+=' enable_nacl=false'
+args+=' blink_symbol_level=0'
+args+=' webview_devui_show_icon=false'
+args+=' dfmify_dev_ui=false'
+args+=' disable_autofill_assistant_dfm=true'
+args+=' disable_tab_ui_dfm=true'
+args+=' enable_gvr_services=false'
+args+=' disable_fieldtrial_testing_config=true'
+args+=' android_default_version_name="'$chromium_version'"'
+args+=' chrome_public_manifest_package="org.leafos.chromium"'
+args+=' system_webview_package_name="org.leafos.webview"'
+args+=' trichrome_library_package="org.leafos.trichromelibrary"'
+args+=' trichrome_certdigest="f57883d4c1f9007222ea92c5f25b42156bfa3aa13f5634237057e58835a996e2"'
+
+# Setup environment
+[ $clean -eq 1 ] && rm -rf out
+. build/android/envsetup.sh
+
+# Check target and build
+if [ -n "$build_arch" ]; then
+    build $build_arch
+else
+    build arm64
+    build x64
+fi
diff --git a/build-chromium/patches/0002-use-64-bit-WebView-processes.patch b/build-chromium/patches/0002-use-64-bit-WebView-processes.patch
new file mode 100644
index 0000000..a819a86
--- /dev/null
+++ b/build-chromium/patches/0002-use-64-bit-WebView-processes.patch
@@ -0,0 +1,21 @@
+From 731ee704e05cbc54d4b2937ea1a0c1b72dfb555a Mon Sep 17 00:00:00 2001
+From: Daniel Micay <danielmicay@gmail.com>
+Date: Thu, 26 Jan 2017 01:30:12 -0500
+Subject: [PATCH] use 64-bit WebView processes
+
+---
+ android_webview/nonembedded/java/AndroidManifest.xml | 1 -
+ 1 file changed, 1 deletion(-)
+
+diff --git a/android_webview/nonembedded/java/AndroidManifest.xml b/android_webview/nonembedded/java/AndroidManifest.xml
+index 82b280bc6b298..1c38c6a4e5b32 100644
+--- a/android_webview/nonembedded/java/AndroidManifest.xml
++++ b/android_webview/nonembedded/java/AndroidManifest.xml
+@@ -37,7 +37,6 @@ by a child template that "extends" this file.
+                  android:icon="@{{manifest_package|default('com.android.webview')}}:drawable/icon_webview"
+                  android:name="{{ application_name|default('org.chromium.android_webview.nonembedded.WebViewApkApplication') }}"
+                  android:multiArch="true"
+-                 {{ use32bitAbi|default('android:use32bitAbi="true"') }}
+                  android:extractNativeLibs="{{ trichrome_library is not defined }}">
+         {# This part is shared between stand-alone WebView and Monochrome #}
+         {% macro common(manifest_package, webview_lib) %}
diff --git a/build-chromium/patches/0013-remove-Help-feedback-menu-entry.patch b/build-chromium/patches/0013-remove-Help-feedback-menu-entry.patch
new file mode 100644
index 0000000..f833d12
--- /dev/null
+++ b/build-chromium/patches/0013-remove-Help-feedback-menu-entry.patch
@@ -0,0 +1,22 @@
+From 94b2ff82ff9b37fd0578f813d21cb145dde0948e Mon Sep 17 00:00:00 2001
+From: Daniel Micay <danielmicay@gmail.com>
+Date: Thu, 15 Apr 2021 02:14:37 -0400
+Subject: [PATCH] remove Help & feedback menu entry
+
+---
+ .../browser/app/appmenu/AppMenuPropertiesDelegateImpl.java      | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/chrome/android/java/src/org/chromium/chrome/browser/app/appmenu/AppMenuPropertiesDelegateImpl.java b/chrome/android/java/src/org/chromium/chrome/browser/app/appmenu/AppMenuPropertiesDelegateImpl.java
+index 52173bd406be9..4273435e98bd1 100644
+--- a/chrome/android/java/src/org/chromium/chrome/browser/app/appmenu/AppMenuPropertiesDelegateImpl.java
++++ b/chrome/android/java/src/org/chromium/chrome/browser/app/appmenu/AppMenuPropertiesDelegateImpl.java
+@@ -547,6 +547,8 @@ public class AppMenuPropertiesDelegateImpl implements AppMenuPropertiesDelegate
+         menu.findItem(R.id.reader_mode_prefs_id)
+                 .setVisible(isCurrentTabNotNull && shouldShowReaderModePrefs(currentTab));
+ 
++        menu.findItem(R.id.help_id).setVisible(false);
++
+         // Only display the Enter VR button if VR Shell Dev environment is enabled.
+         menu.findItem(R.id.enter_vr_id).setVisible(isCurrentTabNotNull && shouldShowEnterVr());
+ 
diff --git a/build-chromium/patches/0014-hide-passwords.google.com-link-when-not-supported.patch b/build-chromium/patches/0014-hide-passwords.google.com-link-when-not-supported.patch
new file mode 100644
index 0000000..aa93f96
--- /dev/null
+++ b/build-chromium/patches/0014-hide-passwords.google.com-link-when-not-supported.patch
@@ -0,0 +1,31 @@
+From 946bac247554e8d53bbc99e76814f248591690d2 Mon Sep 17 00:00:00 2001
+From: Daniel Micay <danielmicay@gmail.com>
+Date: Sun, 13 Aug 2017 19:33:04 -0400
+Subject: [PATCH] hide passwords.google.com link when not supported
+
+---
+ .../browser/password_manager/settings/PasswordSettings.java   | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/chrome/android/java/src/org/chromium/chrome/browser/password_manager/settings/PasswordSettings.java b/chrome/android/java/src/org/chromium/chrome/browser/password_manager/settings/PasswordSettings.java
+index 2c7b85cf3f3f6..9d61328d925d8 100644
+--- a/chrome/android/java/src/org/chromium/chrome/browser/password_manager/settings/PasswordSettings.java
++++ b/chrome/android/java/src/org/chromium/chrome/browser/password_manager/settings/PasswordSettings.java
+@@ -39,6 +39,7 @@ import org.chromium.chrome.browser.password_manager.PasswordManagerHelper;
+ import org.chromium.chrome.browser.preferences.Pref;
+ import org.chromium.chrome.browser.profiles.Profile;
+ import org.chromium.chrome.browser.settings.ChromeManagedPreferenceDelegate;
++import org.chromium.chrome.browser.signin.services.IdentityServicesProvider;
+ import org.chromium.chrome.browser.settings.SettingsLauncherImpl;
+ import org.chromium.chrome.browser.sync.SyncService;
+ import org.chromium.chrome.browser.sync.settings.SyncSettingsUtils;
+@@ -595,6 +596,9 @@ public class PasswordSettings extends PreferenceFragmentCompat
+         if (mSearchQuery != null && !mNoPasswords) {
+             return; // Don't add the Manage Account link if there is a search going on.
+         }
++        if (!IdentityServicesProvider.get().getSigninManager(Profile.getLastUsedRegularProfile()).isSigninSupported()) {
++            return;
++        }
+         if (getPreferenceScreen().findPreference(PREF_KEY_MANAGE_ACCOUNT_LINK) != null) {
+             return; // Don't add the Manage Account link if it's present.
+         }
diff --git a/build-chromium/patches/0015-disable-first-run-welcome-page.patch b/build-chromium/patches/0015-disable-first-run-welcome-page.patch
new file mode 100644
index 0000000..7dbb55d
--- /dev/null
+++ b/build-chromium/patches/0015-disable-first-run-welcome-page.patch
@@ -0,0 +1,48 @@
+From 565528abd8ddd9c4c8eb08d54468a862729a1352 Mon Sep 17 00:00:00 2001
+From: csagan5 <32685696+csagan5@users.noreply.github.com>
+Date: Sun, 26 Nov 2017 22:51:43 +0100
+Subject: [PATCH] disable first run welcome page
+
+---
+ .../org/chromium/chrome/browser/firstrun/FirstRunUtils.java | 3 ---
+ .../chromium/chrome/browser/firstrun/FirstRunStatus.java    | 6 +++++-
+ 2 files changed, 5 insertions(+), 4 deletions(-)
+
+diff --git a/chrome/android/java/src/org/chromium/chrome/browser/firstrun/FirstRunUtils.java b/chrome/android/java/src/org/chromium/chrome/browser/firstrun/FirstRunUtils.java
+index 8e32e791835ad..8c4063623324b 100644
+--- a/chrome/android/java/src/org/chromium/chrome/browser/firstrun/FirstRunUtils.java
++++ b/chrome/android/java/src/org/chromium/chrome/browser/firstrun/FirstRunUtils.java
+@@ -43,15 +43,12 @@ public class FirstRunUtils {
+         boolean javaPrefValue =
+                 javaPrefs.readBoolean(ChromePreferenceKeys.FIRST_RUN_CACHED_TOS_ACCEPTED, false);
+         boolean nativePrefValue = isFirstRunEulaAccepted();
+-        boolean isFirstRunComplete = FirstRunStatus.getFirstRunFlowComplete();
+-        if (javaPrefValue || nativePrefValue || isFirstRunComplete) {
+             if (!javaPrefValue) {
+                 javaPrefs.writeBoolean(ChromePreferenceKeys.FIRST_RUN_CACHED_TOS_ACCEPTED, true);
+             }
+             if (!nativePrefValue) {
+                 setEulaAccepted();
+             }
+-        }
+     }
+ 
+     /**
+diff --git a/chrome/browser/first_run/android/java/src/org/chromium/chrome/browser/firstrun/FirstRunStatus.java b/chrome/browser/first_run/android/java/src/org/chromium/chrome/browser/firstrun/FirstRunStatus.java
+index 46536c7cdd988..59d5c8d322e1f 100644
+--- a/chrome/browser/first_run/android/java/src/org/chromium/chrome/browser/firstrun/FirstRunStatus.java
++++ b/chrome/browser/first_run/android/java/src/org/chromium/chrome/browser/firstrun/FirstRunStatus.java
+@@ -43,8 +43,12 @@ public class FirstRunStatus {
+      * includes ToS and Sign In pages if necessary.
+      */
+     public static boolean getFirstRunFlowComplete() {
+-        return SharedPreferencesManager.getInstance().readBoolean(
++        boolean complete = SharedPreferencesManager.getInstance().readBoolean(
+                 ChromePreferenceKeys.FIRST_RUN_FLOW_COMPLETE, false);
++        if (!complete) {
++           setFirstRunFlowComplete(true);
++        }
++        return true;
+     }
+ 
+     /**
diff --git a/build-chromium/patches/0022-disable-metrics-by-default.patch b/build-chromium/patches/0022-disable-metrics-by-default.patch
new file mode 100644
index 0000000..2c26f5b
--- /dev/null
+++ b/build-chromium/patches/0022-disable-metrics-by-default.patch
@@ -0,0 +1,22 @@
+From 98950706bb4dd5ad747bc67d3f2237c604c5deef Mon Sep 17 00:00:00 2001
+From: Daniel Micay <danielmicay@gmail.com>
+Date: Thu, 24 Nov 2016 11:41:00 -0500
+Subject: [PATCH] disable metrics by default
+
+---
+ .../chromium/chrome/browser/firstrun/FirstRunActivityBase.java  | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/chrome/android/java/src/org/chromium/chrome/browser/firstrun/FirstRunActivityBase.java b/chrome/android/java/src/org/chromium/chrome/browser/firstrun/FirstRunActivityBase.java
+index 5a6ab47c4e220..bb0fce1d5226c 100644
+--- a/chrome/android/java/src/org/chromium/chrome/browser/firstrun/FirstRunActivityBase.java
++++ b/chrome/android/java/src/org/chromium/chrome/browser/firstrun/FirstRunActivityBase.java
+@@ -49,7 +49,7 @@ public abstract class FirstRunActivityBase extends AsyncInitializationActivity {
+     static final String SHOW_SEARCH_ENGINE_PAGE = "ShowSearchEnginePage";
+     static final String SHOW_SYNC_CONSENT_PAGE = "ShowSyncConsent";
+ 
+-    public static final boolean DEFAULT_METRICS_AND_CRASH_REPORTING = true;
++    public static final boolean DEFAULT_METRICS_AND_CRASH_REPORTING = false;
+ 
+     private static PolicyLoadListenerFactory sPolicyLoadListenerFactory;
+ 
diff --git a/build-chromium/patches/0024-disable-showing-popular-sites-by-default.patch b/build-chromium/patches/0024-disable-showing-popular-sites-by-default.patch
new file mode 100644
index 0000000..5e09a5e
--- /dev/null
+++ b/build-chromium/patches/0024-disable-showing-popular-sites-by-default.patch
@@ -0,0 +1,30 @@
+From 08c086fb3c355f7fd55a8216ceea3b7c37802f31 Mon Sep 17 00:00:00 2001
+From: Daniel Micay <danielmicay@gmail.com>
+Date: Tue, 6 Mar 2018 00:27:41 -0500
+Subject: [PATCH] disable showing popular sites by default
+
+---
+ components/ntp_tiles/features.cc | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/components/ntp_tiles/features.cc b/components/ntp_tiles/features.cc
+index d35052b2fec1c..89290a176f526 100644
+--- a/components/ntp_tiles/features.cc
++++ b/components/ntp_tiles/features.cc
+@@ -14,7 +14,7 @@ const char kPopularSitesFieldTrialName[] = "NTPPopularSites";
+ 
+ BASE_FEATURE(kPopularSitesBakedInContentFeature,
+              "NTPPopularSitesBakedInContent",
+-             base::FEATURE_ENABLED_BY_DEFAULT);
++             base::FEATURE_DISABLED_BY_DEFAULT);
+ 
+ BASE_FEATURE(kNtpMostLikelyFaviconsFromServerFeature,
+              "NTPMostLikelyFaviconsFromServer",
+@@ -22,6 +22,6 @@ BASE_FEATURE(kNtpMostLikelyFaviconsFromServerFeature,
+ 
+ BASE_FEATURE(kUsePopularSitesSuggestions,
+              "UsePopularSitesSuggestions",
+-             base::FEATURE_ENABLED_BY_DEFAULT);
++             base::FEATURE_DISABLED_BY_DEFAULT);
+ 
+ }  // namespace ntp_tiles
diff --git a/build-chromium/patches/0025-disable-article-suggestions-feature-by-default.patch b/build-chromium/patches/0025-disable-article-suggestions-feature-by-default.patch
new file mode 100644
index 0000000..6bf96ba
--- /dev/null
+++ b/build-chromium/patches/0025-disable-article-suggestions-feature-by-default.patch
@@ -0,0 +1,38 @@
+From 0c85c458895eee4690198bb58d735d46ead0f5bc Mon Sep 17 00:00:00 2001
+From: Daniel Micay <danielmicay@gmail.com>
+Date: Thu, 8 Mar 2018 22:43:12 -0500
+Subject: [PATCH] disable article suggestions feature by default
+
+---
+ components/feed/core/shared_prefs/pref_names.cc | 4 ++--
+ components/ntp_snippets/features.cc             | 2 +-
+ 2 files changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/components/feed/core/shared_prefs/pref_names.cc b/components/feed/core/shared_prefs/pref_names.cc
+index e239b42b31ef3..5a5e881272c22 100644
+--- a/components/feed/core/shared_prefs/pref_names.cc
++++ b/components/feed/core/shared_prefs/pref_names.cc
+@@ -20,8 +20,8 @@ const char kArticlesListVisible[] = "ntp_snippets.list_visible";
+ const char kVideoPreviewsType[] = "ntp_snippets.video_previews_type";
+ 
+ void RegisterFeedSharedProfilePrefs(PrefRegistrySimple* registry) {
+-  registry->RegisterBooleanPref(kEnableSnippets, true);
+-  registry->RegisterBooleanPref(kArticlesListVisible, true);
++  registry->RegisterBooleanPref(kEnableSnippets, false);
++  registry->RegisterBooleanPref(kArticlesListVisible, false);
+   registry->RegisterIntegerPref(kVideoPreviewsType, 1);
+ }
+ 
+diff --git a/components/ntp_snippets/features.cc b/components/ntp_snippets/features.cc
+index 7d146cd35fd4c..7bc431d6bcacb 100644
+--- a/components/ntp_snippets/features.cc
++++ b/components/ntp_snippets/features.cc
+@@ -40,7 +40,7 @@ const base::Feature* const kAllFeatures[] = {
+ 
+ BASE_FEATURE(kArticleSuggestionsFeature,
+              "NTPArticleSuggestions",
+-             base::FEATURE_ENABLED_BY_DEFAULT);
++             base::FEATURE_DISABLED_BY_DEFAULT);
+ 
+ BASE_FEATURE(kRemoteSuggestionsEmulateM58FetchingSchedule,
+              "RemoteSuggestionsEmulateM58FetchingSchedule",
diff --git a/build-chromium/patches/0026-disable-content-feed-suggestions-by-default.patch b/build-chromium/patches/0026-disable-content-feed-suggestions-by-default.patch
new file mode 100644
index 0000000..4c56b53
--- /dev/null
+++ b/build-chromium/patches/0026-disable-content-feed-suggestions-by-default.patch
@@ -0,0 +1,36 @@
+From beb94a379db43e249b4e9c7aa260ef557911f6ac Mon Sep 17 00:00:00 2001
+From: Daniel Micay <danielmicay@gmail.com>
+Date: Sun, 22 Mar 2020 01:23:48 -0400
+Subject: [PATCH] disable content feed suggestions by default
+
+---
+ .../org/chromium/chrome/browser/flags/CachedFeatureFlags.java   | 2 +-
+ components/feed/feed_feature_list.cc                            | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/chrome/browser/flags/android/java/src/org/chromium/chrome/browser/flags/CachedFeatureFlags.java b/chrome/browser/flags/android/java/src/org/chromium/chrome/browser/flags/CachedFeatureFlags.java
+index a4efd60024847..35b3ca107081d 100644
+--- a/chrome/browser/flags/android/java/src/org/chromium/chrome/browser/flags/CachedFeatureFlags.java
++++ b/chrome/browser/flags/android/java/src/org/chromium/chrome/browser/flags/CachedFeatureFlags.java
+@@ -78,7 +78,7 @@ public class CachedFeatureFlags {
+                     .put(ChromeFeatureList.INCOGNITO_REAUTHENTICATION_FOR_ANDROID, false)
+                     .put(ChromeFeatureList.INSTANCE_SWITCHER, true)
+                     .put(ChromeFeatureList.INSTANT_START, false)
+-                    .put(ChromeFeatureList.INTEREST_FEED_V2, true)
++                    .put(ChromeFeatureList.INTEREST_FEED_V2, false)
+                     .put(ChromeFeatureList.LENS_CAMERA_ASSISTED_SEARCH, false)
+                     .put(ChromeFeatureList.NEW_WINDOW_APP_MENU, true)
+                     .put(ChromeFeatureList.OMAHA_MIN_SDK_VERSION_ANDROID, false)
+diff --git a/components/feed/feed_feature_list.cc b/components/feed/feed_feature_list.cc
+index 198b24c5c9b5d..72c52bcb64c28 100644
+--- a/components/feed/feed_feature_list.cc
++++ b/components/feed/feed_feature_list.cc
+@@ -24,7 +24,7 @@ BASE_FEATURE(kInterestFeedContentSuggestions,
+ // changed, please update the cached one's default value in CachedFeatureFlags.
+ BASE_FEATURE(kInterestFeedV2,
+              "InterestFeedV2",
+-             base::FEATURE_ENABLED_BY_DEFAULT);
++             base::FEATURE_DISABLED_BY_DEFAULT);
+ 
+ BASE_FEATURE(kInterestFeedV2Autoplay,
+              "InterestFeedV2Autoplay",
diff --git a/build-chromium/patches/0031-disable-payment-support-by-default.patch b/build-chromium/patches/0031-disable-payment-support-by-default.patch
new file mode 100644
index 0000000..04270f2
--- /dev/null
+++ b/build-chromium/patches/0031-disable-payment-support-by-default.patch
@@ -0,0 +1,22 @@
+From 8ddb0abee5dadcadad3a07e50eb19645e14875fa Mon Sep 17 00:00:00 2001
+From: Daniel Micay <danielmicay@gmail.com>
+Date: Tue, 18 Jun 2019 22:28:53 -0400
+Subject: [PATCH] disable payment support by default
+
+---
+ components/payments/core/payment_prefs.cc | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/components/payments/core/payment_prefs.cc b/components/payments/core/payment_prefs.cc
+index 3196befc8c400..2caca44e2d4e7 100644
+--- a/components/payments/core/payment_prefs.cc
++++ b/components/payments/core/payment_prefs.cc
+@@ -16,7 +16,7 @@ const char kCanMakePaymentEnabled[] = "payments.can_make_payment_enabled";
+ void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry) {
+   registry->RegisterBooleanPref(kPaymentsFirstTransactionCompleted, false);
+   registry->RegisterBooleanPref(
+-      kCanMakePaymentEnabled, true,
++      kCanMakePaymentEnabled, false,
+       user_prefs::PrefRegistrySyncable::SYNCABLE_PREF);
+ }
+ 
diff --git a/build-chromium/patches/0032-disable-media-router-media-remoting-by-default.patch b/build-chromium/patches/0032-disable-media-router-media-remoting-by-default.patch
new file mode 100644
index 0000000..5aa06a5
--- /dev/null
+++ b/build-chromium/patches/0032-disable-media-router-media-remoting-by-default.patch
@@ -0,0 +1,22 @@
+From f1018667e7c52db1874e4093496a1a5c8d2996cb Mon Sep 17 00:00:00 2001
+From: Daniel Micay <danielmicay@gmail.com>
+Date: Thu, 4 Jul 2019 18:11:27 -0400
+Subject: [PATCH] disable media router media remoting by default
+
+---
+ chrome/browser/media/router/media_router_feature.cc | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/chrome/browser/media/router/media_router_feature.cc b/chrome/browser/media/router/media_router_feature.cc
+index 862329ef31459..1cfbc3b4f55dc 100644
+--- a/chrome/browser/media/router/media_router_feature.cc
++++ b/chrome/browser/media/router/media_router_feature.cc
+@@ -119,7 +119,7 @@ void RegisterProfilePrefs(PrefRegistrySimple* registry) {
+                                PrefRegistry::PUBLIC);
+ 
+   registry->RegisterBooleanPref(
+-      media_router::prefs::kMediaRouterMediaRemotingEnabled, true);
++      media_router::prefs::kMediaRouterMediaRemotingEnabled, false);
+   registry->RegisterListPref(
+       media_router::prefs::kMediaRouterTabMirroringSources);
+ 
diff --git a/build-chromium/patches/0033-disable-media-router-by-default.patch b/build-chromium/patches/0033-disable-media-router-by-default.patch
new file mode 100644
index 0000000..a0bff6e
--- /dev/null
+++ b/build-chromium/patches/0033-disable-media-router-by-default.patch
@@ -0,0 +1,36 @@
+From 4b4e64a988f251d4492e9761ba13e3293cd4a961 Mon Sep 17 00:00:00 2001
+From: Daniel Micay <danielmicay@gmail.com>
+Date: Thu, 4 Jul 2019 19:08:52 -0400
+Subject: [PATCH] disable media router by default
+
+---
+ chrome/browser/media/router/media_router_feature.cc | 2 +-
+ chrome/browser/profiles/profile_impl.cc             | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/chrome/browser/media/router/media_router_feature.cc b/chrome/browser/media/router/media_router_feature.cc
+index 1cfbc3b4f55dc..3bdbae40e0d37 100644
+--- a/chrome/browser/media/router/media_router_feature.cc
++++ b/chrome/browser/media/router/media_router_feature.cc
+@@ -105,7 +105,7 @@ bool MediaRouterEnabled(content::BrowserContext* context) {
+     pref_values.insert(std::make_pair(context, allowed));
+     return allowed;
+   }
+-  return true;
++  return false;
+ }
+ 
+ #if !BUILDFLAG(IS_ANDROID)
+diff --git a/chrome/browser/profiles/profile_impl.cc b/chrome/browser/profiles/profile_impl.cc
+index 2b1fd89740659..2cbba877a48ba 100644
+--- a/chrome/browser/profiles/profile_impl.cc
++++ b/chrome/browser/profiles/profile_impl.cc
+@@ -411,7 +411,7 @@ void ProfileImpl::RegisterProfilePrefs(
+ #endif
+ 
+   registry->RegisterBooleanPref(prefs::kForceEphemeralProfiles, false);
+-  registry->RegisterBooleanPref(prefs::kEnableMediaRouter, true);
++  registry->RegisterBooleanPref(prefs::kEnableMediaRouter, false);
+ #if !BUILDFLAG(IS_ANDROID)
+   registry->RegisterBooleanPref(prefs::kShowCastIconInToolbar, false);
+ #endif  // !BUILDFLAG(IS_ANDROID)
diff --git a/build-chromium/patches/0034-disable-offering-translations-by-default.patch b/build-chromium/patches/0034-disable-offering-translations-by-default.patch
new file mode 100644
index 0000000..56d237d
--- /dev/null
+++ b/build-chromium/patches/0034-disable-offering-translations-by-default.patch
@@ -0,0 +1,22 @@
+From 6e3aaf061853ebadbb99513e11271c081d2316df Mon Sep 17 00:00:00 2001
+From: Daniel Micay <danielmicay@gmail.com>
+Date: Fri, 12 Jul 2019 03:58:01 -0400
+Subject: [PATCH] disable offering translations by default
+
+---
+ chrome/browser/ui/browser_ui_prefs.cc | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/chrome/browser/ui/browser_ui_prefs.cc b/chrome/browser/ui/browser_ui_prefs.cc
+index df3225597d7e0..ef3cec3ceab16 100644
+--- a/chrome/browser/ui/browser_ui_prefs.cc
++++ b/chrome/browser/ui/browser_ui_prefs.cc
+@@ -77,7 +77,7 @@ void RegisterBrowserUserPrefs(user_prefs::PrefRegistrySyncable* registry) {
+   registry->RegisterBooleanPref(prefs::kWebAppCreateInAppsMenu, true);
+   registry->RegisterBooleanPref(prefs::kWebAppCreateInQuickLaunchBar, true);
+   registry->RegisterBooleanPref(
+-      translate::prefs::kOfferTranslateEnabled, true,
++      translate::prefs::kOfferTranslateEnabled, false,
+       user_prefs::PrefRegistrySyncable::SYNCABLE_PREF);
+   registry->RegisterStringPref(prefs::kCloudPrintEmail, std::string());
+   registry->RegisterBooleanPref(prefs::kCloudPrintProxyEnabled, true);
diff --git a/build-chromium/patches/0035-disable-browser-sign-in-feature-by-default.patch b/build-chromium/patches/0035-disable-browser-sign-in-feature-by-default.patch
new file mode 100644
index 0000000..56acf85
--- /dev/null
+++ b/build-chromium/patches/0035-disable-browser-sign-in-feature-by-default.patch
@@ -0,0 +1,36 @@
+From 796fa275d7cd8ffeb9ccb943c0acad08245be08f Mon Sep 17 00:00:00 2001
+From: Daniel Micay <danielmicay@gmail.com>
+Date: Fri, 12 Jul 2019 04:23:18 -0400
+Subject: [PATCH] disable browser sign in feature by default
+
+---
+ chrome/browser/signin/account_consistency_mode_manager.cc       | 2 +-
+ .../signin/internal/identity_manager/primary_account_manager.cc | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/chrome/browser/signin/account_consistency_mode_manager.cc b/chrome/browser/signin/account_consistency_mode_manager.cc
+index b1c0447353c0d..edd57dcffe4c5 100644
+--- a/chrome/browser/signin/account_consistency_mode_manager.cc
++++ b/chrome/browser/signin/account_consistency_mode_manager.cc
+@@ -112,7 +112,7 @@ AccountConsistencyModeManager::~AccountConsistencyModeManager() {}
+ // static
+ void AccountConsistencyModeManager::RegisterProfilePrefs(
+     user_prefs::PrefRegistrySyncable* registry) {
+-  registry->RegisterBooleanPref(prefs::kSigninAllowedOnNextStartup, true);
++  registry->RegisterBooleanPref(prefs::kSigninAllowedOnNextStartup, false);
+ }
+ 
+ // static
+diff --git a/components/signin/internal/identity_manager/primary_account_manager.cc b/components/signin/internal/identity_manager/primary_account_manager.cc
+index d8b6883073669..2ddc389f975e6 100644
+--- a/components/signin/internal/identity_manager/primary_account_manager.cc
++++ b/components/signin/internal/identity_manager/primary_account_manager.cc
+@@ -52,7 +52,7 @@ void PrimaryAccountManager::RegisterProfilePrefs(PrefRegistrySimple* registry) {
+   registry->RegisterBooleanPref(prefs::kGoogleServicesConsentedToSync, false);
+   registry->RegisterBooleanPref(prefs::kAutologinEnabled, true);
+   registry->RegisterListPref(prefs::kReverseAutologinRejectedEmailList);
+-  registry->RegisterBooleanPref(prefs::kSigninAllowed, true);
++  registry->RegisterBooleanPref(prefs::kSigninAllowed, false);
+   registry->RegisterBooleanPref(prefs::kSignedInWithCredentialProvider, false);
+ }
+ 
diff --git a/build-chromium/patches/0045-disable-autofill-assistant-by-default.patch b/build-chromium/patches/0045-disable-autofill-assistant-by-default.patch
new file mode 100644
index 0000000..c7c73e7
--- /dev/null
+++ b/build-chromium/patches/0045-disable-autofill-assistant-by-default.patch
@@ -0,0 +1,31 @@
+From f5cf957c00fe5bcde44c487eda25bddb307a90de Mon Sep 17 00:00:00 2001
+From: Daniel Micay <danielmicay@gmail.com>
+Date: Fri, 27 Nov 2020 02:43:37 -0500
+Subject: [PATCH] disable autofill assistant by default
+
+---
+ components/autofill_assistant/browser/features.cc | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/components/autofill_assistant/browser/features.cc b/components/autofill_assistant/browser/features.cc
+index 67b43661f31f5..55ce1551f735c 100644
+--- a/components/autofill_assistant/browser/features.cc
++++ b/components/autofill_assistant/browser/features.cc
+@@ -12,7 +12,7 @@ namespace features {
+ // Controls whether to enable Autofill Assistant.
+ BASE_FEATURE(kAutofillAssistant,
+              "AutofillAssistant",
+-             base::FEATURE_ENABLED_BY_DEFAULT);
++             base::FEATURE_DISABLED_BY_DEFAULT);
+ 
+ // Controls whether to enable Autofill Assistant's way of annotating DOM. If
+ // enabled will create an |AnnotateDomModelService|.
+@@ -119,7 +119,7 @@ BASE_FEATURE(kAutofillAssistantLoadDFMForTriggerScripts,
+ 
+ BASE_FEATURE(kAutofillAssistantProactiveHelp,
+              "AutofillAssistantProactiveHelp",
+-             base::FEATURE_ENABLED_BY_DEFAULT);
++             base::FEATURE_DISABLED_BY_DEFAULT);
+ 
+ // Enables assistant UI (once the feature is enabled, scripts need to use the
+ // USE_ASSISTANT_UI=true flag to use the assistant UI).
diff --git a/build-chromium/patches/0046-disable-autofill-server-communication-by-default.patch b/build-chromium/patches/0046-disable-autofill-server-communication-by-default.patch
new file mode 100644
index 0000000..f181ed8
--- /dev/null
+++ b/build-chromium/patches/0046-disable-autofill-server-communication-by-default.patch
@@ -0,0 +1,22 @@
+From cf2cc2d16b0235158597c086238e4de3711f3b04 Mon Sep 17 00:00:00 2001
+From: Daniel Micay <danielmicay@gmail.com>
+Date: Tue, 1 Dec 2020 00:56:57 -0500
+Subject: [PATCH] disable autofill server communication by default
+
+---
+ components/autofill/core/common/autofill_features.cc | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/components/autofill/core/common/autofill_features.cc b/components/autofill/core/common/autofill_features.cc
+index 90b9ab996a343..5e79001039e07 100644
+--- a/components/autofill/core/common/autofill_features.cc
++++ b/components/autofill/core/common/autofill_features.cc
+@@ -512,7 +512,7 @@ const base::FeatureParam<int> kAutofillServerBehaviorsParam{
+ // i.e., https://other.autofill.server:port/tbproxy/af/
+ BASE_FEATURE(kAutofillServerCommunication,
+              "AutofillServerCommunication",
+-             base::FEATURE_ENABLED_BY_DEFAULT);
++             base::FEATURE_DISABLED_BY_DEFAULT);
+ 
+ // Controls whether Autofill may fill across origins as part of the
+ // AutofillAcrossIframes experiment.
diff --git a/build-chromium/patches/0047-disable-component-updater-pings-by-default.patch b/build-chromium/patches/0047-disable-component-updater-pings-by-default.patch
new file mode 100644
index 0000000..8033b3b
--- /dev/null
+++ b/build-chromium/patches/0047-disable-component-updater-pings-by-default.patch
@@ -0,0 +1,22 @@
+From b49424ca5a0e03cc236fcc388b2284b60cdcf14d Mon Sep 17 00:00:00 2001
+From: Daniel Micay <danielmicay@gmail.com>
+Date: Fri, 27 Nov 2020 03:56:29 -0500
+Subject: [PATCH] disable component updater pings by default
+
+---
+ .../component_updater_command_line_config_policy.h              | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/components/component_updater/component_updater_command_line_config_policy.h b/components/component_updater/component_updater_command_line_config_policy.h
+index 5a080ea473c61..e90a252d4f3f7 100644
+--- a/components/component_updater/component_updater_command_line_config_policy.h
++++ b/components/component_updater/component_updater_command_line_config_policy.h
+@@ -41,7 +41,7 @@ class ComponentUpdaterCommandLineConfigPolicy final
+   bool background_downloads_enabled_ = false;
+   bool deltas_enabled_ = true;
+   bool fast_update_ = false;
+-  bool pings_enabled_ = true;
++  bool pings_enabled_ = false;
+   bool test_request_ = false;
+ 
+   // If non-zero, time interval in seconds until the first component
diff --git a/build-chromium/patches/0056-remove-translate-offer-preference.patch b/build-chromium/patches/0056-remove-translate-offer-preference.patch
new file mode 100644
index 0000000..6b76d97
--- /dev/null
+++ b/build-chromium/patches/0056-remove-translate-offer-preference.patch
@@ -0,0 +1,41 @@
+From 46ca75ac42e01b954f3051bb0f7eec8dde815636 Mon Sep 17 00:00:00 2001
+From: Daniel Micay <danielmicay@gmail.com>
+Date: Fri, 2 Aug 2019 21:11:17 -0400
+Subject: [PATCH] remove translate offer preference
+
+---
+ .../language/settings/LanguageSettings.java   | 21 +------------------
+ 1 file changed, 1 insertion(+), 20 deletions(-)
+
+diff --git a/chrome/browser/language/android/java/src/org/chromium/chrome/browser/language/settings/LanguageSettings.java b/chrome/browser/language/android/java/src/org/chromium/chrome/browser/language/settings/LanguageSettings.java
+index 2c8af6ded3ed0..4b45cb935d198 100644
+--- a/chrome/browser/language/android/java/src/org/chromium/chrome/browser/language/settings/LanguageSettings.java
++++ b/chrome/browser/language/android/java/src/org/chromium/chrome/browser/language/settings/LanguageSettings.java
+@@ -101,26 +101,7 @@ public class LanguageSettings extends PreferenceFragmentCompat
+                 (ContentLanguagesPreference) findPreference(PREFERRED_LANGUAGES_KEY);
+         mLanguageListPref.registerActivityLauncher(this);
+ 
+-        ChromeSwitchPreference translateSwitch =
+-                (ChromeSwitchPreference) findPreference(TRANSLATE_SWITCH_KEY);
+-        boolean isTranslateEnabled = getPrefService().getBoolean(Pref.OFFER_TRANSLATE_ENABLED);
+-        translateSwitch.setChecked(isTranslateEnabled);
+-
+-        translateSwitch.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
+-            @Override
+-            public boolean onPreferenceChange(Preference preference, Object newValue) {
+-                boolean enabled = (boolean) newValue;
+-                getPrefService().setBoolean(Pref.OFFER_TRANSLATE_ENABLED, enabled);
+-                mLanguageListPref.notifyPrefChanged();
+-                LanguagesManager.recordAction(enabled ? LanguagesManager.LanguageSettingsActionType
+-                                                                .ENABLE_TRANSLATE_GLOBALLY
+-                                                      : LanguagesManager.LanguageSettingsActionType
+-                                                                .DISABLE_TRANSLATE_GLOBALLY);
+-                return true;
+-            }
+-        });
+-        translateSwitch.setManagedPreferenceDelegate((ChromeManagedPreferenceDelegate) preference
+-                -> getPrefService().isManagedPreference(Pref.OFFER_TRANSLATE_ENABLED));
++        getPreferenceScreen().removePreference(findPreference(TRANSLATE_SWITCH_KEY));
+     }
+ 
+     /**
diff --git a/build-chromium/patches/0060-disable-Omaha-update-check-support.patch b/build-chromium/patches/0060-disable-Omaha-update-check-support.patch
new file mode 100644
index 0000000..4e3f63c
--- /dev/null
+++ b/build-chromium/patches/0060-disable-Omaha-update-check-support.patch
@@ -0,0 +1,36 @@
+From c8eb1f72856ca3e8e53a857e8d5564900bc7a6d6 Mon Sep 17 00:00:00 2001
+From: Daniel Micay <danielmicay@gmail.com>
+Date: Wed, 18 Nov 2020 19:13:27 -0500
+Subject: [PATCH] disable Omaha update check support
+
+---
+ .../java/src/org/chromium/chrome/browser/omaha/OmahaBase.java   | 2 +-
+ .../org/chromium/chrome/browser/omaha/VersionNumberGetter.java  | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/chrome/android/java/src/org/chromium/chrome/browser/omaha/OmahaBase.java b/chrome/android/java/src/org/chromium/chrome/browser/omaha/OmahaBase.java
+index 4f80654a7db5a..e58b2de4da341 100644
+--- a/chrome/android/java/src/org/chromium/chrome/browser/omaha/OmahaBase.java
++++ b/chrome/android/java/src/org/chromium/chrome/browser/omaha/OmahaBase.java
+@@ -160,7 +160,7 @@ public class OmahaBase {
+ 
+     /** See {@link #sIsDisabled}. */
+     static boolean isDisabled() {
+-        return sIsDisabled;
++        return true;
+     }
+ 
+     /**
+diff --git a/chrome/android/java/src/org/chromium/chrome/browser/omaha/VersionNumberGetter.java b/chrome/android/java/src/org/chromium/chrome/browser/omaha/VersionNumberGetter.java
+index 01eb29216e367..21b9a096997aa 100644
+--- a/chrome/android/java/src/org/chromium/chrome/browser/omaha/VersionNumberGetter.java
++++ b/chrome/android/java/src/org/chromium/chrome/browser/omaha/VersionNumberGetter.java
+@@ -48,7 +48,7 @@ public class VersionNumberGetter {
+     private static VersionNumberGetter sInstanceForTests;
+ 
+     /** If false, OmahaClient will never report that a newer version is available. */
+-    private static boolean sEnableUpdateDetection = true;
++    private static boolean sEnableUpdateDetection = false;
+ 
+     protected VersionNumberGetter() { }
+ 
diff --git a/build-chromium/patches/0062-remove-safety-check-menu.patch b/build-chromium/patches/0062-remove-safety-check-menu.patch
new file mode 100644
index 0000000..603dcd0
--- /dev/null
+++ b/build-chromium/patches/0062-remove-safety-check-menu.patch
@@ -0,0 +1,22 @@
+From 5a9a0498b8e3b7cfc3a7008181dea0373a599346 Mon Sep 17 00:00:00 2001
+From: Daniel Micay <danielmicay@gmail.com>
+Date: Tue, 25 May 2021 16:43:39 -0400
+Subject: [PATCH] remove safety check menu
+
+---
+ .../src/org/chromium/chrome/browser/settings/MainSettings.java  | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/chrome/android/java/src/org/chromium/chrome/browser/settings/MainSettings.java b/chrome/android/java/src/org/chromium/chrome/browser/settings/MainSettings.java
+index c72bed9714299..bd097737d5a34 100644
+--- a/chrome/android/java/src/org/chromium/chrome/browser/settings/MainSettings.java
++++ b/chrome/android/java/src/org/chromium/chrome/browser/settings/MainSettings.java
+@@ -216,6 +216,8 @@ public class MainSettings extends PreferenceFragmentCompat
+             TemplateUrlServiceFactory.get().load();
+         }
+ 
++        getPreferenceScreen().removePreference(findPreference(PREF_SAFETY_CHECK));
++
+         new AdaptiveToolbarStatePredictor(null).recomputeUiState(uiState -> {
+             // We don't show the toolbar shortcut settings page if disabled from finch.
+             if (uiState.canShowUi) return;
diff --git a/build-chromium/patches/0064-add-trichrome-browser-apk-targets.patch b/build-chromium/patches/0064-add-trichrome-browser-apk-targets.patch
new file mode 100644
index 0000000..3ac8a25
--- /dev/null
+++ b/build-chromium/patches/0064-add-trichrome-browser-apk-targets.patch
@@ -0,0 +1,95 @@
+From 2f2f6a0b0663bec5ae7acd722338d2544b1c7457 Mon Sep 17 00:00:00 2001
+From: Daniel Micay <danielmicay@gmail.com>
+Date: Thu, 27 May 2021 07:30:02 -0400
+Subject: [PATCH] add trichrome browser apk targets
+
+---
+ chrome/android/BUILD.gn | 61 ++++++++++++++++++++++++++++++++++++++++-
+ 1 file changed, 60 insertions(+), 1 deletion(-)
+
+diff --git a/chrome/android/BUILD.gn b/chrome/android/BUILD.gn
+index 7934ab9348808..17af636d2d7ab 100644
+--- a/chrome/android/BUILD.gn
++++ b/chrome/android/BUILD.gn
+@@ -2359,6 +2359,10 @@ if (current_toolchain == default_toolchain) {
+     is_monochrome = true
+     is_bundle_module = true
+   }
++  resource_packaging("trichrome_chrome_apk_pak_assets") {
++    is_monochrome = false
++    is_trichrome = true
++  }
+   resource_packaging("trichrome_chrome_bundle_module_pak_assets") {
+     is_monochrome = false
+     is_trichrome = true
+@@ -2899,7 +2903,7 @@ if (current_toolchain == default_toolchain) {
+ 
+       if (trichrome_synchronized_proguard) {
+         webview_target = "//android_webview:trichrome_webview_apk"
+-        chrome_target = ":trichrome_chrome_bundle"
++        chrome_target = ":trichrome_chrome_apk"
+       }
+ 
+       if (_enable_manifest_verification) {
+@@ -2954,6 +2958,61 @@ if (current_toolchain == default_toolchain) {
+       }
+     }
+   }
++ 
++monochrome_public_apk_or_module_tmpl("trichrome_chrome_apk") {
++  version_code = trichrome_version_code
++  version_name = chrome_version_name
++  apk_name = "TrichromeChrome"
++  target_type = "android_apk"
++  use_trichrome_library = true
++  static_library_provider = ":trichrome_library_apk"
++  if (!is_java_debug) {
++    static_library_synchronized_proguard = trichrome_synchronized_proguard
++    if (trichrome_synchronized_proguard) {
++      resource_ids_provider_dep = "//android_webview:trichrome_webview_apk"
++    }
++  }
++  if (android_64bit_target_cpu) {
++    is_64_bit_browser = false
++    include_64_bit_webview = true
++  }
++}
++
++if (android_64bit_target_cpu) {
++  monochrome_public_apk_or_module_tmpl("trichrome_chrome_64_32_apk") {
++    version_code = trichrome_version_code
++    version_name = chrome_version_name
++    apk_name = "TrichromeChrome6432"
++    target_type = "android_apk"
++    use_trichrome_library = true
++    static_library_provider = ":trichrome_library_64_32_apk"
++    if (!is_java_debug) {
++      static_library_synchronized_proguard = trichrome_synchronized_proguard
++      if (trichrome_synchronized_proguard) {
++        resource_ids_provider_dep = "//android_webview:trichrome_webview_apk"
++      }
++    }
++    is_64_bit_browser = true
++    include_32_bit_webview = true
++  }
++
++  monochrome_public_apk_or_module_tmpl("trichrome_chrome_64_apk") {
++    version_code = trichrome_version_code
++    version_name = chrome_version_name
++    apk_name = "TrichromeChrome64"
++    target_type = "android_apk"
++    use_trichrome_library = true
++    static_library_provider = ":trichrome_library_64_apk"
++    if (!is_java_debug) {
++      static_library_synchronized_proguard = trichrome_synchronized_proguard
++      if (trichrome_synchronized_proguard) {
++        resource_ids_provider_dep = "//android_webview:trichrome_webview_apk"
++      }
++    }
++    is_64_bit_browser = true
++    include_32_bit_webview = false
++  }
++}
+ 
+   chrome_public_unit_test_apk_manifest =
+       "$root_gen_dir/chrome_public_unit_test_apk_manifest/AndroidManifest.xml"
diff --git a/build-chromium/patches/0065-Move-search-suggestions-back-to-privacy-section.patch b/build-chromium/patches/0065-Move-search-suggestions-back-to-privacy-section.patch
new file mode 100644
index 0000000..1db59da
--- /dev/null
+++ b/build-chromium/patches/0065-Move-search-suggestions-back-to-privacy-section.patch
@@ -0,0 +1,76 @@
+From 1f3c5bec780301939b04539973eb9389d751a532 Mon Sep 17 00:00:00 2001
+From: fgei <fgei@gmail.com>
+Date: Fri, 20 Aug 2021 16:13:42 +0000
+Subject: [PATCH] Move search suggestions back to privacy section.
+
+---
+ .../java/res/xml/privacy_preferences.xml       |  5 +++++
+ .../privacy/settings/PrivacySettings.java      | 18 +++++++++++++++++-
+ 2 files changed, 22 insertions(+), 1 deletion(-)
+
+diff --git a/chrome/android/java/res/xml/privacy_preferences.xml b/chrome/android/java/res/xml/privacy_preferences.xml
+index eadd16fa6c6bf..860dde01cc01e 100644
+--- a/chrome/android/java/res/xml/privacy_preferences.xml
++++ b/chrome/android/java/res/xml/privacy_preferences.xml
+@@ -27,6 +27,11 @@ found in the LICENSE file.
+         android:key="https_first_mode"
+         android:title="@string/settings_https_first_mode_title"
+         android:summary="@string/settings_https_first_mode_summary"/>
++    <org.chromium.components.browser_ui.settings.ChromeSwitchPreference
++        android:key="search_suggestions"
++        android:title="@string/autocomplete_searches_and_urls_title"
++        android:summary="@string/autocomplete_searches_and_urls_summary"
++        android:persistent="false"/>
+      <org.chromium.chrome.browser.incognito.reauth.IncognitoReauthSettingSwitchPreference
+         android:key="incognito_lock"
+         android:title="@string/settings_incognito_tab_lock_title"
+diff --git a/chrome/android/java/src/org/chromium/chrome/browser/privacy/settings/PrivacySettings.java b/chrome/android/java/src/org/chromium/chrome/browser/privacy/settings/PrivacySettings.java
+index ba173aab43533..241ef12e6753a 100644
+--- a/chrome/android/java/src/org/chromium/chrome/browser/privacy/settings/PrivacySettings.java
++++ b/chrome/android/java/src/org/chromium/chrome/browser/privacy/settings/PrivacySettings.java
+@@ -54,6 +54,7 @@ public class PrivacySettings
+     private static final String PREF_PRELOAD_PAGES = "preload_pages";
+     private static final String PREF_HTTPS_FIRST_MODE = "https_first_mode";
+     private static final String PREF_SECURE_DNS = "secure_dns";
++    private static final String PREF_SEARCH_SUGGESTIONS = "search_suggestions";
+     private static final String PREF_USAGE_STATS = "usage_stats_reporting";
+     private static final String PREF_DO_NOT_TRACK = "do_not_track";
+     private static final String PREF_SAFE_BROWSING = "safe_browsing";
+@@ -111,6 +112,11 @@ public class PrivacySettings
+ 
+         mManagedPreferenceDelegate = createManagedPreferenceDelegate();
+ 
++        ChromeSwitchPreference searchSuggestionsPref =
++                (ChromeSwitchPreference) findPreference(PREF_SEARCH_SUGGESTIONS);
++        searchSuggestionsPref.setOnPreferenceChangeListener(this);
++        searchSuggestionsPref.setManagedPreferenceDelegate(mManagedPreferenceDelegate);
++
+         ChromeSwitchPreference canMakePaymentPref =
+                 (ChromeSwitchPreference) findPreference(PREF_CAN_MAKE_PAYMENT);
+         canMakePaymentPref.setOnPreferenceChangeListener(this);
+@@ -160,7 +166,10 @@ public class PrivacySettings
+     @Override
+     public boolean onPreferenceChange(Preference preference, Object newValue) {
+         String key = preference.getKey();
+-        if (PREF_CAN_MAKE_PAYMENT.equals(key)) {
++        if (PREF_SEARCH_SUGGESTIONS.equals(key)) {
++            UserPrefs.get(Profile.getLastUsedRegularProfile())
++                    .setBoolean(Pref.SEARCH_SUGGEST_ENABLED, (boolean) newValue);
++        } else if (PREF_CAN_MAKE_PAYMENT.equals(key)) {
+             UserPrefs.get(Profile.getLastUsedRegularProfile())
+                     .setBoolean(Pref.CAN_MAKE_PAYMENT_ENABLED, (boolean) newValue);
+         } else if (PREF_HTTPS_FIRST_MODE.equals(key)) {
+@@ -188,6 +197,13 @@ public class PrivacySettings
+             canMakePaymentPref.setChecked(prefService.getBoolean(Pref.CAN_MAKE_PAYMENT_ENABLED));
+         }
+ 
++        ChromeSwitchPreference searchSuggestionsPref =
++                (ChromeSwitchPreference) findPreference(PREF_SEARCH_SUGGESTIONS);
++        if (searchSuggestionsPref != null) {
++            searchSuggestionsPref.setChecked(prefService.getBoolean(Pref.SEARCH_SUGGEST_ENABLED));
++        }
++
++
+         Preference doNotTrackPref = findPreference(PREF_DO_NOT_TRACK);
+         if (doNotTrackPref != null) {
+             doNotTrackPref.setSummary(prefService.getBoolean(Pref.ENABLE_DO_NOT_TRACK)
diff --git a/build-chromium/patches/0068-remove-unwanted-sync-and-services-link.patch b/build-chromium/patches/0068-remove-unwanted-sync-and-services-link.patch
new file mode 100644
index 0000000..ea0e970
--- /dev/null
+++ b/build-chromium/patches/0068-remove-unwanted-sync-and-services-link.patch
@@ -0,0 +1,23 @@
+From 04debf9af4c33c31812905b396a88f6130ea9e9e Mon Sep 17 00:00:00 2001
+From: Daniel Micay <danielmicay@gmail.com>
+Date: Sat, 7 Aug 2021 15:01:54 -0400
+Subject: [PATCH] remove unwanted sync and services link
+
+---
+ .../chrome/browser/privacy/settings/PrivacySettings.java       | 3 +--
+ 1 file changed, 1 insertion(+), 2 deletions(-)
+
+diff --git a/chrome/android/java/src/org/chromium/chrome/browser/privacy/settings/PrivacySettings.java b/chrome/android/java/src/org/chromium/chrome/browser/privacy/settings/PrivacySettings.java
+index 241ef12e6753a..4ccb99d9dea69 100644
+--- a/chrome/android/java/src/org/chromium/chrome/browser/privacy/settings/PrivacySettings.java
++++ b/chrome/android/java/src/org/chromium/chrome/browser/privacy/settings/PrivacySettings.java
+@@ -133,8 +133,7 @@ public class PrivacySettings
+         Preference secureDnsPref = findPreference(PREF_SECURE_DNS);
+         secureDnsPref.setVisible(SecureDnsSettings.isUiEnabled());
+ 
+-        Preference syncAndServicesLink = findPreference(PREF_SYNC_AND_SERVICES_LINK);
+-        syncAndServicesLink.setSummary(buildSyncAndServicesLink());
++        getPreferenceScreen().removePreference(findPreference(PREF_SYNC_AND_SERVICES_LINK));
+ 
+         updatePreferences();
+     }
diff --git a/build-chromium/patches/0069-remove-unwanted-account-and-services-section.patch b/build-chromium/patches/0069-remove-unwanted-account-and-services-section.patch
new file mode 100644
index 0000000..30f4f2a
--- /dev/null
+++ b/build-chromium/patches/0069-remove-unwanted-account-and-services-section.patch
@@ -0,0 +1,22 @@
+From 4cfad906d7cd21bd99bb00e999f0f23e786ed0c9 Mon Sep 17 00:00:00 2001
+From: fgei <fgei@gmail.com>
+Date: Fri, 20 Aug 2021 16:13:42 +0000
+Subject: [PATCH] remove unwanted account and services section
+
+---
+ .../src/org/chromium/chrome/browser/settings/MainSettings.java  | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/chrome/android/java/src/org/chromium/chrome/browser/settings/MainSettings.java b/chrome/android/java/src/org/chromium/chrome/browser/settings/MainSettings.java
+index bd097737d5a34..cd202add8cba2 100644
+--- a/chrome/android/java/src/org/chromium/chrome/browser/settings/MainSettings.java
++++ b/chrome/android/java/src/org/chromium/chrome/browser/settings/MainSettings.java
+@@ -217,6 +217,8 @@ public class MainSettings extends PreferenceFragmentCompat
+         }
+ 
+         getPreferenceScreen().removePreference(findPreference(PREF_SAFETY_CHECK));
++        getPreferenceScreen().removePreference(findPreference(PREF_ACCOUNT_AND_GOOGLE_SERVICES_SECTION));
++        getPreferenceScreen().removePreference(findPreference(PREF_GOOGLE_SERVICES));
+ 
+         new AdaptiveToolbarStatePredictor(null).recomputeUiState(uiState -> {
+             // We don't show the toolbar shortcut settings page if disabled from finch.
diff --git a/build-chromium/patches/0070-Hide-Sign-In-preference-when-disallowed.patch b/build-chromium/patches/0070-Hide-Sign-In-preference-when-disallowed.patch
new file mode 100644
index 0000000..e512923
--- /dev/null
+++ b/build-chromium/patches/0070-Hide-Sign-In-preference-when-disallowed.patch
@@ -0,0 +1,21 @@
+From 1ed992902baff3c26141632d8072f258d903d60c Mon Sep 17 00:00:00 2001
+From: fgei <fgei@gmail.com>
+Date: Sun, 29 Aug 2021 19:31:00 +0000
+Subject: [PATCH] Hide Sign In preference when disallowed
+
+---
+ .../chromium/chrome/browser/sync/settings/SignInPreference.java  | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/chrome/android/java/src/org/chromium/chrome/browser/sync/settings/SignInPreference.java b/chrome/android/java/src/org/chromium/chrome/browser/sync/settings/SignInPreference.java
+index 5112a89b1070b..478b3463347ba 100644
+--- a/chrome/android/java/src/org/chromium/chrome/browser/sync/settings/SignInPreference.java
++++ b/chrome/android/java/src/org/chromium/chrome/browser/sync/settings/SignInPreference.java
+@@ -149,6 +149,7 @@ public class SignInPreference
+     }
+ 
+     private void setupSigninDisallowed() {
++        setViewEnabled(false);
+         mWasGenericSigninPromoDisplayed = false;
+     }
+ 
diff --git a/build-chromium/patches/0071-disable-using-Play-services-fonts.patch b/build-chromium/patches/0071-disable-using-Play-services-fonts.patch
new file mode 100644
index 0000000..efbe8c1
--- /dev/null
+++ b/build-chromium/patches/0071-disable-using-Play-services-fonts.patch
@@ -0,0 +1,22 @@
+From 8c259d93838824f6acf6be6a9d13c22f2b396cca Mon Sep 17 00:00:00 2001
+From: Daniel Micay <danielmicay@gmail.com>
+Date: Wed, 1 Sep 2021 02:09:14 -0400
+Subject: [PATCH] disable using Play services fonts
+
+---
+ .../chromium/content/browser/font/AndroidFontLookupImpl.java    | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/content/public/android/java/src/org/chromium/content/browser/font/AndroidFontLookupImpl.java b/content/public/android/java/src/org/chromium/content/browser/font/AndroidFontLookupImpl.java
+index cbf69c1b60ff7..9262079508774 100644
+--- a/content/public/android/java/src/org/chromium/content/browser/font/AndroidFontLookupImpl.java
++++ b/content/public/android/java/src/org/chromium/content/browser/font/AndroidFontLookupImpl.java
+@@ -179,7 +179,7 @@ public class AndroidFontLookupImpl implements AndroidFontLookup {
+      * @param fontUniqueName The ICU case folded unique full font name to fetch.
+      */
+     private ReadOnlyFile fetchFontInBackground(String fontUniqueName, Core core) {
+-        ParcelFileDescriptor fileDescriptor = tryFetchFont(fontUniqueName);
++        ParcelFileDescriptor fileDescriptor = null;
+         if (fileDescriptor == null) {
+             // Avoid re-requesting this font in future.
+             mExpectedFonts.remove(fontUniqueName);