zr`I;RW_w~PXgy=sM
+zFW<0Z#r*y2t5_Ir*?%!C-(vA%|MlC;rWqb>voD`9vnkc%L$|=KaCUR)<++=es^=6k
+zdS#hbu1|FIHV@q!yV7(=Ge?sG5UI3_o4szn*>QjOAz*q_Epd$~Nl7e8wMs5Z1yT$~
+z21bUuhK9OEh9L%)R)!{4Mkd+@237_JTL0gPsvQH#H}HEQP?k_1_n=8KbLh*
+G2~7a)DNWn}
+
+literal 0
+HcmV?d00001
+
+diff --git a/components/browser_ui/site_settings/android/java/res/xml/site_settings_preferences.xml b/components/browser_ui/site_settings/android/java/res/xml/site_settings_preferences.xml
+index b261f5c1b2e9a..848ae8441df01 100644
+--- a/components/browser_ui/site_settings/android/java/res/xml/site_settings_preferences.xml
++++ b/components/browser_ui/site_settings/android/java/res/xml/site_settings_preferences.xml
+@@ -47,6 +47,10 @@ Also add new settings to site_settings_preferences_with_categories.xml!
+
++
++
+
+
+ JavaScript
+
++
++ JavaScript JIT
++
+
+ Location
+
+@@ -646,6 +649,21 @@
+ Block JavaScript for a specific site.
+
+
++
++
++
++ Allow sites to use just-in-time compilation; improve performance at expense of security by compiling JavaScript to native code.
++
++
++ Block sites to use just-in-time compilation; improve security at expense of performance by not compiling JavaScript to native code, and using only interpreted code.
++
++
++ Allow JIT for a specific site.
++
++
++ Block JIT for a specific site.
++
++
+
+
+
+diff --git a/components/content_settings/core/browser/content_settings_registry.cc b/components/content_settings/core/browser/content_settings_registry.cc
+index 7a2c634ebb4a3..f37611519b351 100644
+--- a/components/content_settings/core/browser/content_settings_registry.cc
++++ b/components/content_settings/core/browser/content_settings_registry.cc
+@@ -508,7 +508,7 @@ void ContentSettingsRegistry::Init() {
+ ContentSettingsInfo::EXCEPTIONS_ON_SECURE_ORIGINS_ONLY);
+
+ Register(ContentSettingsType::JAVASCRIPT_JIT, "javascript-jit",
+- CONTENT_SETTING_ALLOW, WebsiteSettingsInfo::UNSYNCABLE,
++ CONTENT_SETTING_BLOCK, WebsiteSettingsInfo::UNSYNCABLE,
+ /*allowlisted_schemes=*/{},
+ /*valid_settings=*/{CONTENT_SETTING_ALLOW, CONTENT_SETTING_BLOCK},
+ WebsiteSettingsInfo::TOP_ORIGIN_ONLY_SCOPE,
+diff --git a/components/page_info/android/page_info_controller_android.cc b/components/page_info/android/page_info_controller_android.cc
+index 126d202ff7355..51fd74ac38735 100644
+--- a/components/page_info/android/page_info_controller_android.cc
++++ b/components/page_info/android/page_info_controller_android.cc
+@@ -134,6 +134,7 @@ void PageInfoControllerAndroid::SetPermissionInfo(
+ permissions_to_display.push_back(ContentSettingsType::IDLE_DETECTION);
+ permissions_to_display.push_back(ContentSettingsType::IMAGES);
+ permissions_to_display.push_back(ContentSettingsType::JAVASCRIPT);
++ permissions_to_display.push_back(ContentSettingsType::JAVASCRIPT_JIT);
+ permissions_to_display.push_back(ContentSettingsType::POPUPS);
+ permissions_to_display.push_back(ContentSettingsType::ADS);
+ permissions_to_display.push_back(
+@@ -216,6 +217,8 @@ absl::optional PageInfoControllerAndroid::GetSettingToDisplay(
+ // The javascript content setting should show up if it is blocked globally
+ // to give users an easy way to create exceptions.
+ return permission.default_setting;
++ } else if (permission.type == ContentSettingsType::JAVASCRIPT_JIT) {
++ return permission.default_setting;
+ } else if (permission.type == ContentSettingsType::SOUND) {
+ // The sound content setting should always show up when the tab has played
+ // audio since last navigation.
+diff --git a/components/page_info/page_info.cc b/components/page_info/page_info.cc
+index 57ec08b826a66..20170f569c7fa 100644
+--- a/components/page_info/page_info.cc
++++ b/components/page_info/page_info.cc
+@@ -99,6 +99,7 @@ ContentSettingsType kPermissionType[] = {
+ ContentSettingsType::SENSORS,
+ ContentSettingsType::NOTIFICATIONS,
+ ContentSettingsType::JAVASCRIPT,
++ ContentSettingsType::JAVASCRIPT_JIT,
+ #if !BUILDFLAG(IS_ANDROID)
+ ContentSettingsType::IMAGES,
+ #endif
+@@ -157,6 +158,11 @@ bool ShouldShowPermission(const PageInfo::PermissionInfo& info,
+ return true;
+ }
+
++ // Always show JIT settings UI when when it has a site-specific override.
++ if (info.type == ContentSettingsType::JAVASCRIPT_JIT) {
++ return true;
++ }
++
+ const bool is_incognito = web_contents->GetBrowserContext()->IsOffTheRecord();
+ #if BUILDFLAG(IS_ANDROID)
+ // Special geolocation DSE settings apply only on Android, so make sure it
+diff --git a/components/page_info/page_info_ui.cc b/components/page_info/page_info_ui.cc
+index 22aab629c43e5..efcccf42de6ac 100644
+--- a/components/page_info/page_info_ui.cc
++++ b/components/page_info/page_info_ui.cc
+@@ -137,6 +137,8 @@ base::span GetContentSettingsUIInfo() {
+ IDS_SITE_SETTINGS_TYPE_COOKIES_MID_SENTENCE},
+ {ContentSettingsType::JAVASCRIPT, IDS_SITE_SETTINGS_TYPE_JAVASCRIPT,
+ IDS_SITE_SETTINGS_TYPE_JAVASCRIPT_MID_SENTENCE},
++ {ContentSettingsType::JAVASCRIPT_JIT, IDS_SITE_SETTINGS_TYPE_JAVASCRIPT_JIT,
++ IDS_SITE_SETTINGS_TYPE_JAVASCRIPT_JIT_MID_SENTENCE},
+ {ContentSettingsType::POPUPS, IDS_SITE_SETTINGS_TYPE_POPUPS_REDIRECTS,
+ IDS_SITE_SETTINGS_TYPE_POPUPS_REDIRECTS_MID_SENTENCE},
+ {ContentSettingsType::GEOLOCATION, IDS_SITE_SETTINGS_TYPE_LOCATION,
+diff --git a/components/site_settings_strings.grdp b/components/site_settings_strings.grdp
+index d2b25c8483de5..3e27850ff9645 100644
+--- a/components/site_settings_strings.grdp
++++ b/components/site_settings_strings.grdp
+@@ -82,6 +82,12 @@
+
+ javascript
+
++
++ JavaScript JIT
++
++
++ javascript JIT
++
+
+ Location
+
diff --git a/patches/0001-Vanadium/0087-enable-process-isolated-sandboxed-iframes-by-default.patch b/patches/0001-Vanadium/0087-enable-process-isolated-sandboxed-iframes-by-default.patch
new file mode 100644
index 0000000..5cbee54
--- /dev/null
+++ b/patches/0001-Vanadium/0087-enable-process-isolated-sandboxed-iframes-by-default.patch
@@ -0,0 +1,23 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: June
+Date: Sun, 8 May 2022 01:34:58 +0000
+Subject: [PATCH] enable process isolated sandboxed iframes by default
+
+Signed-off-by: June
+---
+ third_party/blink/common/features.cc | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/third_party/blink/common/features.cc b/third_party/blink/common/features.cc
+index a69da8c71d979..953924fa504a6 100644
+--- a/third_party/blink/common/features.cc
++++ b/third_party/blink/common/features.cc
+@@ -1642,7 +1642,7 @@ BASE_FEATURE(kWebRtcCombinedNetworkAndWorkerThread,
+ // sandboxes are isolated.
+ BASE_FEATURE(kIsolateSandboxedIframes,
+ "IsolateSandboxedIframes",
+- base::FEATURE_DISABLED_BY_DEFAULT);
++ base::FEATURE_ENABLED_BY_DEFAULT);
+ const base::FeatureParam::Option
+ isolated_sandboxed_iframes_grouping_types[] = {
+ {IsolateSandboxedIframesGrouping::kPerSite, "per-site"},
diff --git a/patches/0001-Vanadium/0088-Toggle-for-closing-tabs-on-exit.patch b/patches/0001-Vanadium/0088-Toggle-for-closing-tabs-on-exit.patch
new file mode 100644
index 0000000..88d7037
--- /dev/null
+++ b/patches/0001-Vanadium/0088-Toggle-for-closing-tabs-on-exit.patch
@@ -0,0 +1,166 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: fgei
+Date: Fri, 17 Jun 2022 10:15:43 +0000
+Subject: [PATCH] Toggle for closing tabs on exit
+
+---
+ chrome/android/chrome_ext_java_sources.gni | 1 +
+ .../java/res/xml/privacy_preferences_ext.xml | 5 ++++
+ .../chrome/browser/ChromeTabbedActivity.java | 1 +
+ .../chrome/browser/TabPreferencesUtils.java | 24 +++++++++++++++++++
+ .../privacy/settings/PrivacySettingsExt.java | 16 +++++++++++++
+ .../browser/preferences/SharedPrefsUtils.java | 3 +++
+ .../strings/android_chrome_ext_strings.grdp | 6 +++++
+ 7 files changed, 56 insertions(+)
+ create mode 100644 chrome/android/java/src/org/chromium/chrome/browser/TabPreferencesUtils.java
+
+diff --git a/chrome/android/chrome_ext_java_sources.gni b/chrome/android/chrome_ext_java_sources.gni
+index d580fb6e83875..b4e048ed73ef3 100644
+--- a/chrome/android/chrome_ext_java_sources.gni
++++ b/chrome/android/chrome_ext_java_sources.gni
+@@ -5,4 +5,5 @@
+ chrome_ext_java_sources = [
+ "java/src/org/chromium/chrome/browser/settings/SettingsExtUtils.java",
+ "java/src/org/chromium/chrome/browser/privacy/settings/PrivacySettingsExt.java",
++ "java/src/org/chromium/chrome/browser/TabPreferencesUtils.java",
+ ]
+diff --git a/chrome/android/java/res/xml/privacy_preferences_ext.xml b/chrome/android/java/res/xml/privacy_preferences_ext.xml
+index 01e8c8217afed..ea1dd6c3f529c 100644
+--- a/chrome/android/java/res/xml/privacy_preferences_ext.xml
++++ b/chrome/android/java/res/xml/privacy_preferences_ext.xml
+@@ -10,5 +10,10 @@ that can be found in the LICENSE file.
+ android:title="@string/improve_search_suggestions_title"
+ android:summary="@string/improve_search_suggestions_summary"
+ android:persistent="false"/>
++
+
+
+diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ChromeTabbedActivity.java b/chrome/android/java/src/org/chromium/chrome/browser/ChromeTabbedActivity.java
+index eb8d976faa065..f595aa4e1b231 100644
+--- a/chrome/android/java/src/org/chromium/chrome/browser/ChromeTabbedActivity.java
++++ b/chrome/android/java/src/org/chromium/chrome/browser/ChromeTabbedActivity.java
+@@ -1285,6 +1285,7 @@ public class ChromeTabbedActivity extends ChromeActivity {
+@@ -36,6 +37,8 @@ final class PrivacySettingsExt {
+ String key = pref.getKey();
+ if (PREF_SEARCH_SUGGESTIONS.equals(key)) {
+ prefService.setBoolean(Pref.SEARCH_SUGGEST_ENABLED, (boolean) val);
++ } else if (PREF_CLOSE_TABS_ON_EXIT.equals(key)) {
++ SharedPrefsExt.CLOSE_TABS_ON_EXIT.put((boolean) val);
+ }
+ return true;
+ };
+@@ -73,6 +76,13 @@ final class PrivacySettingsExt {
+ searchSuggestionsPref.setOnPreferenceChangeListener(LISTENER);
+ searchSuggestionsPref.setManagedPreferenceDelegate(DELEGATE);
+ }
++
++ ChromeSwitchPreference closeTabsOnExitPref =
++ (ChromeSwitchPreference) prefFragment.findPreference(PREF_CLOSE_TABS_ON_EXIT);
++ if (closeTabsOnExitPref != null) {
++ closeTabsOnExitPref.setOrder(PRIVACY_PREFERENCES_ORDER);
++ closeTabsOnExitPref.setOnPreferenceChangeListener(LISTENER);
++ }
+ }
+
+ static void updatePreferences(@NonNull PreferenceFragmentCompat prefFragment) {
+@@ -83,5 +93,11 @@ final class PrivacySettingsExt {
+ SettingsExtUtils.safelyUpdateSwitchPreference(/* switchPref */ searchSuggestionsPref,
+ /* newSummary*/ null,
+ /* newCheckedValue*/ prefService.getBoolean(Pref.SEARCH_SUGGEST_ENABLED));
++
++ ChromeSwitchPreference closeTabsOnExitPref =
++ (ChromeSwitchPreference) prefFragment.findPreference(PREF_CLOSE_TABS_ON_EXIT);
++ SettingsExtUtils.safelyUpdateSwitchPreference(/* switchPref */ closeTabsOnExitPref,
++ /* newSummary*/ null,
++ /* newCheckedValue*/ SharedPrefsExt.CLOSE_TABS_ON_EXIT.get());
+ }
+ }
+diff --git a/chrome/browser/preferences/android/java/src/org/chromium/chrome/browser/preferences/SharedPrefsUtils.java b/chrome/browser/preferences/android/java/src/org/chromium/chrome/browser/preferences/SharedPrefsUtils.java
+index ceec302c0a9d6..8fc7dde1db697 100644
+--- a/chrome/browser/preferences/android/java/src/org/chromium/chrome/browser/preferences/SharedPrefsUtils.java
++++ b/chrome/browser/preferences/android/java/src/org/chromium/chrome/browser/preferences/SharedPrefsUtils.java
+@@ -136,6 +136,8 @@ public final class SharedPrefsUtils {
+
+ // Stores SharedPreferences keys and its default value
+ public static class SharedPrefsExt {
++ public static final BoolSharedPref CLOSE_TABS_ON_EXIT =
++ new BoolSharedPref("close_tabs_on_exit", false);
+ }
+
+ static SharedPreferencesManager getSharedPrefManager() {
+@@ -146,6 +148,7 @@ public final class SharedPrefsUtils {
+ static boolean isKeyInUse(String key) {
+ // clang-format off
+ return Arrays.asList(
++ SharedPrefsExt.CLOSE_TABS_ON_EXIT.getKey()
+ ).contains(key);
+ // clang-format on
+ }
+diff --git a/chrome/browser/ui/android/strings/android_chrome_ext_strings.grdp b/chrome/browser/ui/android/strings/android_chrome_ext_strings.grdp
+index ba31bf0fad150..a1018b43620cd 100644
+--- a/chrome/browser/ui/android/strings/android_chrome_ext_strings.grdp
++++ b/chrome/browser/ui/android/strings/android_chrome_ext_strings.grdp
+@@ -3,4 +3,10 @@
+ Use of this source code is governed by a GPLv2 only-style license that can be
+ found in the LICENSE file. -->
+
++
++ Close tabs on exit
++
++
++ Don't persist tabs between browsing sessions
++
+
diff --git a/patches/0001-Vanadium/0089-Toggle-for-navigating-external-URL-in-incognito.patch b/patches/0001-Vanadium/0089-Toggle-for-navigating-external-URL-in-incognito.patch
new file mode 100644
index 0000000..6dba2c0
--- /dev/null
+++ b/patches/0001-Vanadium/0089-Toggle-for-navigating-external-URL-in-incognito.patch
@@ -0,0 +1,195 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: fgei
+Date: Sun, 19 Jun 2022 06:39:48 +0000
+Subject: [PATCH] Toggle for navigating external URL in incognito
+
+---
+ .../java/res/xml/privacy_preferences_ext.xml | 5 +++
+ .../chrome/browser/ChromeTabbedActivity.java | 2 ++
+ .../browser/LaunchIntentDispatcher.java | 3 ++
+ .../chrome/browser/TabPreferencesUtils.java | 32 +++++++++++++++++++
+ .../privacy/settings/PrivacySettingsExt.java | 17 ++++++++++
+ .../browser/preferences/SharedPrefsUtils.java | 5 ++-
+ .../strings/android_chrome_ext_strings.grdp | 6 ++++
+ 7 files changed, 69 insertions(+), 1 deletion(-)
+
+diff --git a/chrome/android/java/res/xml/privacy_preferences_ext.xml b/chrome/android/java/res/xml/privacy_preferences_ext.xml
+index ea1dd6c3f529c..4f6b5a3ae75a5 100644
+--- a/chrome/android/java/res/xml/privacy_preferences_ext.xml
++++ b/chrome/android/java/res/xml/privacy_preferences_ext.xml
+@@ -15,5 +15,10 @@ that can be found in the LICENSE file.
+ android:title="@string/close_tabs_on_exit_title"
+ android:summary="@string/close_tabs_on_exit_summary"
+ android:persistent="false"/>
++
+
+
+diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ChromeTabbedActivity.java b/chrome/android/java/src/org/chromium/chrome/browser/ChromeTabbedActivity.java
+index f595aa4e1b231..2950cc2c8b81b 100644
+--- a/chrome/android/java/src/org/chromium/chrome/browser/ChromeTabbedActivity.java
++++ b/chrome/android/java/src/org/chromium/chrome/browser/ChromeTabbedActivity.java
+@@ -2373,6 +2373,8 @@ public class ChromeTabbedActivity extends ChromeActivity {
+@@ -39,6 +41,8 @@ final class PrivacySettingsExt {
+ prefService.setBoolean(Pref.SEARCH_SUGGEST_ENABLED, (boolean) val);
+ } else if (PREF_CLOSE_TABS_ON_EXIT.equals(key)) {
+ SharedPrefsExt.CLOSE_TABS_ON_EXIT.put((boolean) val);
++ } else if (PREF_OPEN_LINKS_IN_INCOGNITO.equals(key)) {
++ SharedPrefsExt.OPEN_LINKS_IN_INCOGNITO.put((boolean) val);
+ }
+ return true;
+ };
+@@ -83,6 +87,13 @@ final class PrivacySettingsExt {
+ closeTabsOnExitPref.setOrder(PRIVACY_PREFERENCES_ORDER);
+ closeTabsOnExitPref.setOnPreferenceChangeListener(LISTENER);
+ }
++
++ ChromeSwitchPreference openLinksInIncognitoPref =
++ (ChromeSwitchPreference) prefFragment.findPreference(PREF_OPEN_LINKS_IN_INCOGNITO);
++ if (openLinksInIncognitoPref != null) {
++ openLinksInIncognitoPref.setOrder(PRIVACY_PREFERENCES_ORDER);
++ openLinksInIncognitoPref.setOnPreferenceChangeListener(LISTENER);
++ }
+ }
+
+ static void updatePreferences(@NonNull PreferenceFragmentCompat prefFragment) {
+@@ -99,5 +110,11 @@ final class PrivacySettingsExt {
+ SettingsExtUtils.safelyUpdateSwitchPreference(/* switchPref */ closeTabsOnExitPref,
+ /* newSummary*/ null,
+ /* newCheckedValue*/ SharedPrefsExt.CLOSE_TABS_ON_EXIT.get());
++
++ ChromeSwitchPreference openLinksInIncognitoPref =
++ (ChromeSwitchPreference) prefFragment.findPreference(PREF_OPEN_LINKS_IN_INCOGNITO);
++ SettingsExtUtils.safelyUpdateSwitchPreference(/* switchPref */ openLinksInIncognitoPref,
++ /* newSummary*/ null,
++ /* newCheckedValue*/ SharedPrefsExt.OPEN_LINKS_IN_INCOGNITO.get());
+ }
+ }
+diff --git a/chrome/browser/preferences/android/java/src/org/chromium/chrome/browser/preferences/SharedPrefsUtils.java b/chrome/browser/preferences/android/java/src/org/chromium/chrome/browser/preferences/SharedPrefsUtils.java
+index 8fc7dde1db697..c2ab10e14c29a 100644
+--- a/chrome/browser/preferences/android/java/src/org/chromium/chrome/browser/preferences/SharedPrefsUtils.java
++++ b/chrome/browser/preferences/android/java/src/org/chromium/chrome/browser/preferences/SharedPrefsUtils.java
+@@ -138,6 +138,8 @@ public final class SharedPrefsUtils {
+ public static class SharedPrefsExt {
+ public static final BoolSharedPref CLOSE_TABS_ON_EXIT =
+ new BoolSharedPref("close_tabs_on_exit", false);
++ public static final BoolSharedPref OPEN_LINKS_IN_INCOGNITO =
++ new BoolSharedPref("open_links_in_incognito", false);
+ }
+
+ static SharedPreferencesManager getSharedPrefManager() {
+@@ -148,7 +150,8 @@ public final class SharedPrefsUtils {
+ static boolean isKeyInUse(String key) {
+ // clang-format off
+ return Arrays.asList(
+- SharedPrefsExt.CLOSE_TABS_ON_EXIT.getKey()
++ SharedPrefsExt.CLOSE_TABS_ON_EXIT.getKey(),
++ SharedPrefsExt.OPEN_LINKS_IN_INCOGNITO.getKey()
+ ).contains(key);
+ // clang-format on
+ }
+diff --git a/chrome/browser/ui/android/strings/android_chrome_ext_strings.grdp b/chrome/browser/ui/android/strings/android_chrome_ext_strings.grdp
+index a1018b43620cd..52b9ca2042bee 100644
+--- a/chrome/browser/ui/android/strings/android_chrome_ext_strings.grdp
++++ b/chrome/browser/ui/android/strings/android_chrome_ext_strings.grdp
+@@ -9,4 +9,10 @@
+
+ Don't persist tabs between browsing sessions
+
++
++ Open external links in incognito
++
++
++ Open links navigated by external apps in incognito tabs
++
+
diff --git a/patches/0001-Vanadium/0090-Implement-UI-for-WebRTC-toggle.patch b/patches/0001-Vanadium/0090-Implement-UI-for-WebRTC-toggle.patch
new file mode 100644
index 0000000..18ffa67
--- /dev/null
+++ b/patches/0001-Vanadium/0090-Implement-UI-for-WebRTC-toggle.patch
@@ -0,0 +1,470 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: fgei
+Date: Thu, 23 Jun 2022 16:38:51 +0000
+Subject: [PATCH] Implement UI for WebRTC toggle
+
+This is based on Brave's implementation for webRTC policy toggle, but reuses
+PrivacySettings logic on saving, loading preference values from
+PrefService for the said policy.
+---
+ chrome/android/chrome_ext_java_resources.gni | 2 +
+ chrome/android/chrome_ext_java_sources.gni | 3 +
+ .../res/layout/webrtc_policy_preference.xml | 54 +++++++++++
+ .../java/res/xml/privacy_preferences_ext.xml | 4 +
+ .../res/xml/webrtc_policy_preferences.xml | 9 ++
+ .../privacy/settings/PrivacySettingsExt.java | 11 +++
+ .../settings/WebRtcPolicyPreference.java | 97 +++++++++++++++++++
+ .../webrtc/settings/WebRtcPolicySettings.java | 58 +++++++++++
+ .../webrtc/settings/WebRtcPolicyUtils.java | 92 ++++++++++++++++++
+ .../strings/android_chrome_ext_strings.grdp | 16 +++
+ 10 files changed, 346 insertions(+)
+ create mode 100644 chrome/android/java/res/layout/webrtc_policy_preference.xml
+ create mode 100644 chrome/android/java/res/xml/webrtc_policy_preferences.xml
+ create mode 100644 chrome/android/java/src/org/chromium/chrome/browser/webrtc/settings/WebRtcPolicyPreference.java
+ create mode 100644 chrome/android/java/src/org/chromium/chrome/browser/webrtc/settings/WebRtcPolicySettings.java
+ create mode 100644 chrome/android/java/src/org/chromium/chrome/browser/webrtc/settings/WebRtcPolicyUtils.java
+
+diff --git a/chrome/android/chrome_ext_java_resources.gni b/chrome/android/chrome_ext_java_resources.gni
+index 164ef483d5a44..4b55afd038612 100644
+--- a/chrome/android/chrome_ext_java_resources.gni
++++ b/chrome/android/chrome_ext_java_resources.gni
+@@ -4,4 +4,6 @@
+
+ chrome_ext_java_resources = [
+ "java/res/xml/privacy_preferences_ext.xml",
++ "java/res/layout/webrtc_policy_preference.xml",
++ "java/res/xml/webrtc_policy_preferences.xml",
+ ]
+diff --git a/chrome/android/chrome_ext_java_sources.gni b/chrome/android/chrome_ext_java_sources.gni
+index b4e048ed73ef3..77963fdccafca 100644
+--- a/chrome/android/chrome_ext_java_sources.gni
++++ b/chrome/android/chrome_ext_java_sources.gni
+@@ -6,4 +6,7 @@ chrome_ext_java_sources = [
+ "java/src/org/chromium/chrome/browser/settings/SettingsExtUtils.java",
+ "java/src/org/chromium/chrome/browser/privacy/settings/PrivacySettingsExt.java",
+ "java/src/org/chromium/chrome/browser/TabPreferencesUtils.java",
++ "java/src/org/chromium/chrome/browser/webrtc/settings/WebRtcPolicyPreference.java",
++ "java/src/org/chromium/chrome/browser/webrtc/settings/WebRtcPolicySettings.java",
++ "java/src/org/chromium/chrome/browser/webrtc/settings/WebRtcPolicyUtils.java",
+ ]
+diff --git a/chrome/android/java/res/layout/webrtc_policy_preference.xml b/chrome/android/java/res/layout/webrtc_policy_preference.xml
+new file mode 100644
+index 0000000000000..8addab2ecf1e1
+--- /dev/null
++++ b/chrome/android/java/res/layout/webrtc_policy_preference.xml
+@@ -0,0 +1,54 @@
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
+diff --git a/chrome/android/java/res/xml/privacy_preferences_ext.xml b/chrome/android/java/res/xml/privacy_preferences_ext.xml
+index 4f6b5a3ae75a5..6e955e33c0109 100644
+--- a/chrome/android/java/res/xml/privacy_preferences_ext.xml
++++ b/chrome/android/java/res/xml/privacy_preferences_ext.xml
+@@ -20,5 +20,9 @@ that can be found in the LICENSE file.
+ android:title="@string/open_links_in_incognito_title"
+ android:summary="@string/open_links_in_incognito_summary"
+ android:persistent="false"/>
++
+
+
+diff --git a/chrome/android/java/res/xml/webrtc_policy_preferences.xml b/chrome/android/java/res/xml/webrtc_policy_preferences.xml
+new file mode 100644
+index 0000000000000..f90f9d7231ff9
+--- /dev/null
++++ b/chrome/android/java/res/xml/webrtc_policy_preferences.xml
+@@ -0,0 +1,9 @@
++
++
++
++
++
++
+diff --git a/chrome/android/java/src/org/chromium/chrome/browser/privacy/settings/PrivacySettingsExt.java b/chrome/android/java/src/org/chromium/chrome/browser/privacy/settings/PrivacySettingsExt.java
+index e75b5cd5a534a..fdd7daddf6dca 100644
+--- a/chrome/android/java/src/org/chromium/chrome/browser/privacy/settings/PrivacySettingsExt.java
++++ b/chrome/android/java/src/org/chromium/chrome/browser/privacy/settings/PrivacySettingsExt.java
+@@ -17,6 +17,7 @@ import org.chromium.chrome.browser.preferences.SharedPrefsUtils.SharedPrefsExt;
+ import org.chromium.chrome.browser.profiles.Profile;
+ import org.chromium.chrome.browser.settings.ChromeManagedPreferenceDelegate;
+ import org.chromium.chrome.browser.settings.SettingsExtUtils;
++import org.chromium.chrome.browser.webrtc.settings.WebRtcPolicySettings;
+ import org.chromium.components.browser_ui.settings.ChromeBasePreference;
+ import org.chromium.components.browser_ui.settings.ChromeSwitchPreference;
+ import org.chromium.components.browser_ui.settings.SettingsUtils;
+@@ -29,6 +30,7 @@ final class PrivacySettingsExt {
+ private static final String PREF_CLOSE_TABS_ON_EXIT = SharedPrefsExt.CLOSE_TABS_ON_EXIT.getKey();
+ private static final String PREF_OPEN_LINKS_IN_INCOGNITO =
+ SharedPrefsExt.OPEN_LINKS_IN_INCOGNITO.getKey();
++ private static final String PREF_WEBRTC_POLICY = "webrtc_policy";
+
+ private static final Preference.OnPreferenceChangeListener LISTENER =
+ (pref, val) -> {
+@@ -94,6 +96,11 @@ final class PrivacySettingsExt {
+ openLinksInIncognitoPref.setOrder(PRIVACY_PREFERENCES_ORDER);
+ openLinksInIncognitoPref.setOnPreferenceChangeListener(LISTENER);
+ }
++
++ Preference webRtcPolicyPref = prefFragment.findPreference(PREF_WEBRTC_POLICY);
++ if (webRtcPolicyPref != null) {
++ webRtcPolicyPref.setOrder(PRIVACY_PREFERENCES_ORDER);
++ }
+ }
+
+ static void updatePreferences(@NonNull PreferenceFragmentCompat prefFragment) {
+@@ -116,5 +123,9 @@ final class PrivacySettingsExt {
+ SettingsExtUtils.safelyUpdateSwitchPreference(/* switchPref */ openLinksInIncognitoPref,
+ /* newSummary*/ null,
+ /* newCheckedValue*/ SharedPrefsExt.OPEN_LINKS_IN_INCOGNITO.get());
++
++ Preference webRtcPolicyPref = prefFragment.findPreference(PREF_WEBRTC_POLICY);
++ SettingsExtUtils.safelyUpdatePreference(/* preference */ webRtcPolicyPref,
++ /* newSummary */ WebRtcPolicySettings.getWebRtcPolicySummaryString(prefFragment.getContext()));
+ }
+ }
+diff --git a/chrome/android/java/src/org/chromium/chrome/browser/webrtc/settings/WebRtcPolicyPreference.java b/chrome/android/java/src/org/chromium/chrome/browser/webrtc/settings/WebRtcPolicyPreference.java
+new file mode 100644
+index 0000000000000..2026f9461b632
+--- /dev/null
++++ b/chrome/android/java/src/org/chromium/chrome/browser/webrtc/settings/WebRtcPolicyPreference.java
+@@ -0,0 +1,97 @@
++/* Copyright (c) 2021 The Brave Authors. All rights reserved.
++ * This Source Code Form is subject to the terms of the Mozilla Public
++ * License, v. 2.0. If a copy of the MPL was not distributed with this file,
++ * You can obtain one at http://mozilla.org/MPL/2.0/. */
++
++package org.chromium.chrome.browser.webrtc.settings;
++
++import android.annotation.SuppressLint;
++import android.content.Context;
++import android.content.Intent;
++import android.net.Uri;
++import android.provider.Browser;
++import android.util.AttributeSet;
++import android.view.View;
++import android.widget.RadioGroup;
++import android.widget.TextView;
++
++import androidx.annotation.IntDef;
++import androidx.preference.Preference;
++import androidx.preference.PreferenceViewHolder;
++
++import org.chromium.chrome.R;
++import org.chromium.components.browser_ui.widget.RadioButtonWithDescription;
++import org.chromium.components.browser_ui.widget.RadioButtonWithDescriptionLayout;
++
++import java.util.ArrayList;
++import java.util.Collections;
++
++public class WebRtcPolicyPreference
++ extends Preference implements RadioGroup.OnCheckedChangeListener {
++ @IntDef({WebRtcPolicy.DEFAULT, WebRtcPolicy.DEFAULT_PUBLIC_AND_PRIVATE_INTERFACES,
++ WebRtcPolicy.DEFAULT_PUBLIC_INTERFACE_ONLY, WebRtcPolicy.DISABLE_NON_PROXIED_UDP})
++ public @interface WebRtcPolicy {
++ int DEFAULT = 0;
++ int DEFAULT_PUBLIC_AND_PRIVATE_INTERFACES = 1;
++ int DEFAULT_PUBLIC_INTERFACE_ONLY = 2;
++ int DISABLE_NON_PROXIED_UDP = 3;
++
++ int NUM_ENTRIES = 4;
++ }
++
++ private @WebRtcPolicy int mSetting;
++ private RadioButtonWithDescription mSettingRadioButton;
++ private RadioButtonWithDescriptionLayout mGroup;
++ private ArrayList mButtons;
++
++ @SuppressLint("WrongConstant")
++ public WebRtcPolicyPreference(Context context, AttributeSet attrs) {
++ super(context, attrs);
++
++ setLayoutResource(R.layout.webrtc_policy_preference);
++
++ mButtons = new ArrayList<>(Collections.nCopies(WebRtcPolicy.NUM_ENTRIES, null));
++ }
++
++ public void initialize(@WebRtcPolicy int policy) {
++ mSetting = policy;
++ }
++
++ @Override
++ public void onBindViewHolder(PreferenceViewHolder holder) {
++ super.onBindViewHolder(holder);
++
++ mGroup = (RadioButtonWithDescriptionLayout) holder.findViewById(R.id.radio_button_layout);
++ mGroup.setOnCheckedChangeListener(this);
++
++ mButtons.set(WebRtcPolicy.DEFAULT,
++ (RadioButtonWithDescription) holder.findViewById(R.id.webrtc_policy_default));
++ mButtons.set(WebRtcPolicy.DEFAULT_PUBLIC_AND_PRIVATE_INTERFACES,
++ (RadioButtonWithDescription) holder.findViewById(
++ R.id.webrtc_policy_default_public_and_private_interfaces));
++ mButtons.set(WebRtcPolicy.DEFAULT_PUBLIC_INTERFACE_ONLY,
++ (RadioButtonWithDescription) holder.findViewById(
++ R.id.webrtc_policy_default_public_interface_only));
++ mButtons.set(WebRtcPolicy.DISABLE_NON_PROXIED_UDP,
++ (RadioButtonWithDescription) holder.findViewById(
++ R.id.webrtc_policy_disable_non_proxied_udp));
++
++ mSettingRadioButton = mButtons.get(mSetting);
++ mSettingRadioButton.setChecked(true);
++ }
++
++ @Override
++ @SuppressLint("WrongConstant")
++ public void onCheckedChanged(RadioGroup group, int checkedId) {
++ for (int i = 0; i < WebRtcPolicy.NUM_ENTRIES; i++) {
++ if (mButtons.get(i).isChecked()) {
++ mSetting = i;
++ mSettingRadioButton = mButtons.get(i);
++ break;
++ }
++ }
++ assert mSetting >= 0 && mSetting < WebRtcPolicy.NUM_ENTRIES : "No matching setting found.";
++
++ callChangeListener(mSetting);
++ }
++}
+diff --git a/chrome/android/java/src/org/chromium/chrome/browser/webrtc/settings/WebRtcPolicySettings.java b/chrome/android/java/src/org/chromium/chrome/browser/webrtc/settings/WebRtcPolicySettings.java
+new file mode 100644
+index 0000000000000..5ee1893382254
+--- /dev/null
++++ b/chrome/android/java/src/org/chromium/chrome/browser/webrtc/settings/WebRtcPolicySettings.java
+@@ -0,0 +1,58 @@
++/* Copyright (c) 2021 The Brave Authors. All rights reserved.
++ * This Source Code Form is subject to the terms of the Mozilla Public
++ * License, v. 2.0. If a copy of the MPL was not distributed with this file,
++ * You can obtain one at http://mozilla.org/MPL/2.0/. */
++
++package org.chromium.chrome.browser.webrtc.settings;
++
++import android.content.Context;
++import android.content.Intent;
++import android.net.Uri;
++import android.os.Build;
++import android.os.Bundle;
++import android.provider.Browser;
++import android.view.Menu;
++import android.view.MenuInflater;
++import android.view.MenuItem;
++
++import androidx.annotation.Nullable;
++import androidx.preference.PreferenceFragmentCompat;
++
++import org.chromium.chrome.R;
++import org.chromium.components.browser_ui.settings.SettingsUtils;
++import org.chromium.ui.UiUtils;
++
++public class WebRtcPolicySettings extends PreferenceFragmentCompat {
++ static final String PREF_WEBRTC_POLICY = "webrtc_policy";
++
++ @Override
++ public void onCreatePreferences(@Nullable Bundle savedInstanceState, String rootKey) {
++ SettingsUtils.addPreferencesFromResource(this, R.xml.webrtc_policy_preferences);
++ getActivity().setTitle(R.string.webrtc_policy_title);
++
++ WebRtcPolicyPreference webRtcPolicyPreference =
++ (WebRtcPolicyPreference) findPreference(PREF_WEBRTC_POLICY);
++ webRtcPolicyPreference.initialize(WebRtcPolicyUtils.getPolicy());
++
++ webRtcPolicyPreference.setOnPreferenceChangeListener((preference, newValue) -> {
++ WebRtcPolicyUtils.setPolicy((int) newValue);
++ return true;
++ });
++ }
++
++ public static String getWebRtcPolicySummaryString(Context context) {
++ return WebRtcPolicyUtils.getSummary(context);
++ }
++
++ @Override
++ public void onActivityCreated(Bundle savedInstanceState) {
++ super.onActivityCreated(savedInstanceState);
++
++ if (Build.VERSION.SDK_INT == Build.VERSION_CODES.O_MR1) {
++ UiUtils.setNavigationBarIconColor(getActivity().getWindow().getDecorView(),
++ getResources().getBoolean(R.bool.window_light_navigation_bar));
++ }
++
++ setDivider(null);
++ }
++}
+diff --git a/chrome/android/java/src/org/chromium/chrome/browser/webrtc/settings/WebRtcPolicyUtils.java b/chrome/android/java/src/org/chromium/chrome/browser/webrtc/settings/WebRtcPolicyUtils.java
+new file mode 100644
+index 0000000000000..296e59fc57167
+--- /dev/null
++++ b/chrome/android/java/src/org/chromium/chrome/browser/webrtc/settings/WebRtcPolicyUtils.java
+@@ -0,0 +1,92 @@
++// Copyright 2023 GrapheneOS
++// Use of this source code is governed by a GPLv2 only-style license that can be
++// found in the LICENSE file.
++
++package org.chromium.chrome.browser.webrtc.settings;
++
++import android.content.Context;
++
++import org.chromium.chrome.R;
++import org.chromium.chrome.browser.preferences.Pref;
++import org.chromium.chrome.browser.profiles.Profile;
++import org.chromium.chrome.browser.webrtc.settings.WebRtcPolicyPreference.WebRtcPolicy;
++import org.chromium.components.user_prefs.UserPrefs;
++
++/**
++ * Utility class for fetching and converting native pref value for WebRTC
++ * policy to Java int equivalent and its corresponding description.
++ */
++class WebRtcPolicyUtils {
++ // Pref values mirrored in Java, copied from
++ // third_party/blink/common/peerconnection/webrtc_ip_handling_policy.cc
++ private static final String WEBRTC_DEFAULT = "default";
++ private static final String WEBRTC_DEFAULT_PUBLIC_AND_PRIVATE_INTERFACES =
++ "default_public_and_private_interfaces";
++ private static final String WEBRTC_DEFAULT_PUBLIC_INTERFACE_ONLY =
++ "default_public_interface_only";
++ private static final String WEBRTC_DISABLE_NON_PROXIED_UDP =
++ "disable_non_proxied_udp";
++
++ static String getSummary(Context context) {
++ switch (convertToWebRtcPolicyInt(getPolicyFromNative())) {
++ case WebRtcPolicy.DEFAULT:
++ return context.getString(R.string.webrtc_policy_default);
++ case WebRtcPolicy.DEFAULT_PUBLIC_AND_PRIVATE_INTERFACES:
++ return context.getString(
++ R.string.webrtc_policy_default_public_and_private_interfaces);
++ case WebRtcPolicy.DEFAULT_PUBLIC_INTERFACE_ONLY:
++ return context.getString(R.string.webrtc_policy_default_public_interface_only);
++ case WebRtcPolicy.DISABLE_NON_PROXIED_UDP:
++ return context.getString(R.string.webrtc_policy_disable_non_proxied_udp);
++ default:
++ assert false;
++ return "";
++ }
++ }
++
++ static String convertToWebRtcPolicyString(@WebRtcPolicy int policy) {
++ switch (policy) {
++ case WebRtcPolicy.DEFAULT:
++ return WEBRTC_DEFAULT;
++ case WebRtcPolicy.DEFAULT_PUBLIC_AND_PRIVATE_INTERFACES:
++ return WEBRTC_DEFAULT_PUBLIC_AND_PRIVATE_INTERFACES;
++ case WebRtcPolicy.DEFAULT_PUBLIC_INTERFACE_ONLY:
++ return WEBRTC_DEFAULT_PUBLIC_INTERFACE_ONLY;
++ case WebRtcPolicy.DISABLE_NON_PROXIED_UDP:
++ return WEBRTC_DISABLE_NON_PROXIED_UDP;
++ default:
++ return WEBRTC_DISABLE_NON_PROXIED_UDP;
++ }
++ }
++
++ static @WebRtcPolicy int convertToWebRtcPolicyInt(String value) {
++ switch (value) {
++ case WEBRTC_DEFAULT:
++ return WebRtcPolicy.DEFAULT;
++ case WEBRTC_DEFAULT_PUBLIC_AND_PRIVATE_INTERFACES:
++ return WebRtcPolicy.DEFAULT_PUBLIC_AND_PRIVATE_INTERFACES;
++ case WEBRTC_DEFAULT_PUBLIC_INTERFACE_ONLY:
++ return WebRtcPolicy.DEFAULT_PUBLIC_INTERFACE_ONLY;
++ case WEBRTC_DISABLE_NON_PROXIED_UDP:
++ return WebRtcPolicy.DISABLE_NON_PROXIED_UDP;
++ default:
++ return WebRtcPolicy.DISABLE_NON_PROXIED_UDP;
++ }
++ }
++
++ private static String getPolicyFromNative() {
++ return UserPrefs.get(Profile.getLastUsedRegularProfile())
++ .getString(Pref.WEB_RTCIP_HANDLING_POLICY);
++ }
++
++ static @WebRtcPolicy int getPolicy() {
++ return convertToWebRtcPolicyInt(getPolicyFromNative());
++ }
++
++ static void setPolicy(@WebRtcPolicy int policy) {
++ UserPrefs.get(Profile.getLastUsedRegularProfile())
++ .setString(Pref.WEB_RTCIP_HANDLING_POLICY, convertToWebRtcPolicyString(policy));
++ }
++
++ private WebRtcPolicyUtils() {}
++}
+diff --git a/chrome/browser/ui/android/strings/android_chrome_ext_strings.grdp b/chrome/browser/ui/android/strings/android_chrome_ext_strings.grdp
+index 52b9ca2042bee..11457f2fbc577 100644
+--- a/chrome/browser/ui/android/strings/android_chrome_ext_strings.grdp
++++ b/chrome/browser/ui/android/strings/android_chrome_ext_strings.grdp
+@@ -15,4 +15,20 @@
+
+ Open links navigated by external apps in incognito tabs
+
++
++
++ WebRTC IP handling policy
++
++
++ Default
++
++
++ Default public and private interfaces
++
++
++ Default public interface only
++
++
++ Disable non-proxied UDP
++
+
diff --git a/patches/0001-Vanadium/0091-Handle-web-search-action-in-browser.patch b/patches/0001-Vanadium/0091-Handle-web-search-action-in-browser.patch
new file mode 100644
index 0000000..d084bf8
--- /dev/null
+++ b/patches/0001-Vanadium/0091-Handle-web-search-action-in-browser.patch
@@ -0,0 +1,73 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: fgei
+Date: Wed, 28 Sep 2022 05:37:00 +0200
+Subject: [PATCH] Handle web search action in browser
+
+---
+ .../src/org/chromium/base/PackageManagerUtils.java | 10 ++++++++++
+ chrome/android/java/AndroidManifest.xml | 4 ++++
+ .../src/org/chromium/chrome/browser/IntentHandler.java | 1 +
+ .../chrome/browser/LaunchIntentDispatcher.java | 2 +-
+ 4 files changed, 16 insertions(+), 1 deletion(-)
+
+diff --git a/base/android/java/src/org/chromium/base/PackageManagerUtils.java b/base/android/java/src/org/chromium/base/PackageManagerUtils.java
+index 2d1661ee534f6..2c983646ab42b 100644
+--- a/base/android/java/src/org/chromium/base/PackageManagerUtils.java
++++ b/base/android/java/src/org/chromium/base/PackageManagerUtils.java
+@@ -85,6 +85,16 @@ public class PackageManagerUtils {
+ return canResolveActivity(intent, 0);
+ }
+
++ public static boolean canOnlyOthersResolveActivity(Intent intent, int flags) {
++ for (ResolveInfo ri: queryIntentActivities(intent, flags)) {
++ if (ContextUtils.getApplicationContext()
++ .getPackageName().equals(ri.activityInfo.packageName)) {
++ return false;
++ }
++ }
++ return true;
++ }
++
+ /**
+ * @return Intent to query a list of installed home launchers.
+ */
+diff --git a/chrome/android/java/AndroidManifest.xml b/chrome/android/java/AndroidManifest.xml
+index db72fb7356e29..575050c5c0d06 100644
+--- a/chrome/android/java/AndroidManifest.xml
++++ b/chrome/android/java/AndroidManifest.xml
+@@ -345,6 +345,10 @@ by a child template that "extends" this file.
+
+
+
++ # DOWNSTREAM
++
++
++ # DOWNSTREAM
+
+
+
+diff --git a/chrome/android/java/src/org/chromium/chrome/browser/IntentHandler.java b/chrome/android/java/src/org/chromium/chrome/browser/IntentHandler.java
+index 3647020cb02d8..da7ad2c4a09ac 100644
+--- a/chrome/android/java/src/org/chromium/chrome/browser/IntentHandler.java
++++ b/chrome/android/java/src/org/chromium/chrome/browser/IntentHandler.java
+@@ -768,6 +768,7 @@ public class IntentHandler {
+ String query = null;
+ final String action = intent.getAction();
+ if (Intent.ACTION_SEARCH.equals(action)
++ || Intent.ACTION_WEB_SEARCH.equals(action)
+ || MediaStore.INTENT_ACTION_MEDIA_SEARCH.equals(action)) {
+ query = IntentUtils.safeGetStringExtra(intent, SearchManager.QUERY);
+ }
+diff --git a/chrome/android/java/src/org/chromium/chrome/browser/LaunchIntentDispatcher.java b/chrome/android/java/src/org/chromium/chrome/browser/LaunchIntentDispatcher.java
+index aa44a679bee3c..e75c14b279c33 100644
+--- a/chrome/android/java/src/org/chromium/chrome/browser/LaunchIntentDispatcher.java
++++ b/chrome/android/java/src/org/chromium/chrome/browser/LaunchIntentDispatcher.java
+@@ -211,7 +211,7 @@ public class LaunchIntentDispatcher implements IntentHandler.IntentHandlerDelega
+ searchIntent.putExtra(SearchManager.QUERY, query);
+
+ try (StrictModeContext ignored = StrictModeContext.allowDiskReads()) {
+- if (PackageManagerUtils.canResolveActivity(
++ if (PackageManagerUtils.canOnlyOthersResolveActivity(
+ searchIntent, PackageManager.GET_RESOLVED_FILTER)) {
+ mActivity.startActivity(searchIntent);
+ } else {
diff --git a/patches/0001-Vanadium/0092-Support-opening-external-web-search-in-incognito.patch b/patches/0001-Vanadium/0092-Support-opening-external-web-search-in-incognito.patch
new file mode 100644
index 0000000..1ce6fa7
--- /dev/null
+++ b/patches/0001-Vanadium/0092-Support-opening-external-web-search-in-incognito.patch
@@ -0,0 +1,30 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: fgei
+Date: Sat, 3 Sep 2022 08:15:59 +0200
+Subject: [PATCH] Support opening external web search in incognito
+
+---
+ .../chromium/chrome/browser/searchwidget/SearchActivity.java | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/chrome/android/java/src/org/chromium/chrome/browser/searchwidget/SearchActivity.java b/chrome/android/java/src/org/chromium/chrome/browser/searchwidget/SearchActivity.java
+index 9a426bfdd7843..9a0615f63674e 100644
+--- a/chrome/android/java/src/org/chromium/chrome/browser/searchwidget/SearchActivity.java
++++ b/chrome/android/java/src/org/chromium/chrome/browser/searchwidget/SearchActivity.java
+@@ -32,6 +32,7 @@ import org.chromium.base.supplier.UnownedUserDataSupplier;
+ import org.chromium.blink.mojom.DisplayMode;
+ import org.chromium.chrome.R;
+ import org.chromium.chrome.browser.IntentHandler;
++import org.chromium.chrome.browser.TabPreferencesUtils;
+ import org.chromium.chrome.browser.WebContentsFactory;
+ import org.chromium.chrome.browser.app.omnibox.ActionChipsDelegateImpl;
+ import org.chromium.chrome.browser.app.tabmodel.TabWindowManagerSingleton;
+@@ -532,6 +533,8 @@ public class SearchActivity extends AsyncInitializationActivity
+ }
+ if (isFromSearchWidget()) {
+ intent.putExtra(SearchWidgetProvider.EXTRA_FROM_SEARCH_WIDGET, true);
++ } else if (TabPreferencesUtils.shouldOpenLinksInIncognito()) {
++ intent = TabPreferencesUtils.appendNeededIncognitoExtras(this, intent);
+ }
+ intent.putExtra(EXTRA_FROM_SEARCH_ACTIVITY, true);
+ IntentUtils.addTrustedIntentExtras(intent);
diff --git a/patches/0001-Vanadium/0094-Enable-reduce-accept-language-header-by-default.patch b/patches/0001-Vanadium/0094-Enable-reduce-accept-language-header-by-default.patch
new file mode 100644
index 0000000..193e35a
--- /dev/null
+++ b/patches/0001-Vanadium/0094-Enable-reduce-accept-language-header-by-default.patch
@@ -0,0 +1,22 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: fgei
+Date: Tue, 14 Feb 2023 21:35:28 +0000
+Subject: [PATCH] Enable reduce accept language header by default
+
+---
+ services/network/public/cpp/features.cc | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/services/network/public/cpp/features.cc b/services/network/public/cpp/features.cc
+index 61deb8a280354..8e7774854f015 100644
+--- a/services/network/public/cpp/features.cc
++++ b/services/network/public/cpp/features.cc
+@@ -301,7 +301,7 @@ constexpr base::FeatureParam kCacheTransparencyPervasivePayloads{
+ // accept-language. https://github.com/Tanych/accept-language
+ BASE_FEATURE(kReduceAcceptLanguage,
+ "ReduceAcceptLanguage",
+- base::FEATURE_DISABLED_BY_DEFAULT);
++ base::FEATURE_ENABLED_BY_DEFAULT);
+
+ const base::FeatureParam kReduceAcceptLanguageCacheDuration{
+ &kReduceAcceptLanguage, "reduce-accept-language-cache-duration",
diff --git a/patches/0001-Vanadium/0095-Add-missing-null-check-for-password-manager-autofill.patch b/patches/0001-Vanadium/0095-Add-missing-null-check-for-password-manager-autofill.patch
new file mode 100644
index 0000000..ecdb1a5
--- /dev/null
+++ b/patches/0001-Vanadium/0095-Add-missing-null-check-for-password-manager-autofill.patch
@@ -0,0 +1,25 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: fgei
+Date: Mon, 20 Feb 2023 07:06:53 +0000
+Subject: [PATCH] Add missing null check for password manager autofill
+
+---
+ .../autofill/content/renderer/password_autofill_agent.cc | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/components/autofill/content/renderer/password_autofill_agent.cc b/components/autofill/content/renderer/password_autofill_agent.cc
+index 82d26af673fa8..f1877135d198a 100644
+--- a/components/autofill/content/renderer/password_autofill_agent.cc
++++ b/components/autofill/content/renderer/password_autofill_agent.cc
+@@ -778,7 +778,10 @@ void PasswordAutofillAgent::UpdateStateForTextChange(
+
+ void PasswordAutofillAgent::TrackAutofilledElement(
+ const blink::WebFormControlElement& element) {
+- autofill_agent_->TrackAutofilledElement(element);
++ AutofillAgent* agent = autofill_agent_.get();
++ if (agent) {
++ agent->TrackAutofilledElement(element);
++ }
+ }
+
+ bool PasswordAutofillAgent::FillSuggestion(
diff --git a/patches/0001-Vanadium/0096-Drop-workaround-with-android-autofill-in-compatibili.patch b/patches/0001-Vanadium/0096-Drop-workaround-with-android-autofill-in-compatibili.patch
new file mode 100644
index 0000000..890f333
--- /dev/null
+++ b/patches/0001-Vanadium/0096-Drop-workaround-with-android-autofill-in-compatibili.patch
@@ -0,0 +1,25 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: fgei
+Date: Fri, 24 Feb 2023 10:20:37 +0100
+Subject: [PATCH] Drop workaround with android autofill in compatibility mode
+
+This causes the autofill popup to show when url is tapped. Drop in favor
+of native android autofill support compatibility with other autofill
+implementations.
+---
+ .../java/src/org/chromium/chrome/browser/omnibox/UrlBar.java | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/chrome/browser/ui/android/omnibox/java/src/org/chromium/chrome/browser/omnibox/UrlBar.java b/chrome/browser/ui/android/omnibox/java/src/org/chromium/chrome/browser/omnibox/UrlBar.java
+index c03bff1721bf9..a6ac07dc01f67 100644
+--- a/chrome/browser/ui/android/omnibox/java/src/org/chromium/chrome/browser/omnibox/UrlBar.java
++++ b/chrome/browser/ui/android/omnibox/java/src/org/chromium/chrome/browser/omnibox/UrlBar.java
+@@ -408,7 +408,7 @@ public abstract class UrlBar extends AutocompleteEditText {
+ // the domain changes. We restore this behavior by mimicking the relevant part of
+ // TextView.notifyListeningManagersAfterTextChanged().
+ // https://cs.android.com/android/platform/superproject/+/5d123b67756dffcfdebdb936ab2de2b29c799321:frameworks/base/core/java/android/widget/TextView.java;l=10618;drc=master;bpv=0
+- ApiHelperForO.notifyValueChangedForAutofill(this);
++ //ApiHelperForO.notifyValueChangedForAutofill(this);
+ }
+ }
+
diff --git a/patches/0001-Vanadium/0097-Enable-android-autofill-on-http-authentication-dialo.patch b/patches/0001-Vanadium/0097-Enable-android-autofill-on-http-authentication-dialo.patch
new file mode 100644
index 0000000..10c543c
--- /dev/null
+++ b/patches/0001-Vanadium/0097-Enable-android-autofill-on-http-authentication-dialo.patch
@@ -0,0 +1,22 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: fgei
+Date: Mon, 20 Feb 2023 07:10:30 +0000
+Subject: [PATCH] Enable android autofill on http authentication dialog
+
+---
+ .../chromium/chrome/browser/login/ChromeHttpAuthHandler.java | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/chrome/android/java/src/org/chromium/chrome/browser/login/ChromeHttpAuthHandler.java b/chrome/android/java/src/org/chromium/chrome/browser/login/ChromeHttpAuthHandler.java
+index 3b87576c9ed6b..a97f7cff21c49 100644
+--- a/chrome/android/java/src/org/chromium/chrome/browser/login/ChromeHttpAuthHandler.java
++++ b/chrome/android/java/src/org/chromium/chrome/browser/login/ChromeHttpAuthHandler.java
+@@ -102,7 +102,7 @@ public class ChromeHttpAuthHandler extends EmptyTabObserver implements LoginProm
+ mTab.addObserver(this);
+ String messageBody = ChromeHttpAuthHandlerJni.get().getMessageBody(
+ mNativeChromeHttpAuthHandler, ChromeHttpAuthHandler.this);
+- mLoginPrompt = new LoginPrompt(activity, messageBody, null, this);
++ mLoginPrompt = new LoginPrompt(activity, messageBody, tab.getOriginalUrl(), this);
+ // In case the autofill data arrives before the prompt is created.
+ if (mAutofillUsername != null && mAutofillPassword != null) {
+ mLoginPrompt.onAutofillDataAvailable(mAutofillUsername, mAutofillPassword);
diff --git a/patches/0001-Vanadium/0098-Enable-new-password-manager-autofill-UI-by-default.patch b/patches/0001-Vanadium/0098-Enable-new-password-manager-autofill-UI-by-default.patch
new file mode 100644
index 0000000..f1a4e6d
--- /dev/null
+++ b/patches/0001-Vanadium/0098-Enable-new-password-manager-autofill-UI-by-default.patch
@@ -0,0 +1,25 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: fgei
+Date: Mon, 20 Feb 2023 07:07:52 +0000
+Subject: [PATCH] Enable new password manager autofill UI by default
+
+This instead uses a keyboard accessory on top of virutal keyboard to
+avoid UX issues of drop-down suggestions obscuring other dialogs, such
+as switching keyboard
+---
+ 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 2246179592da9..db8549d0ea31a 100644
+--- a/components/autofill/core/common/autofill_features.cc
++++ b/components/autofill/core/common/autofill_features.cc
+@@ -611,7 +611,7 @@ BASE_FEATURE(kAutofillVirtualCardsOnTouchToFillAndroid,
+ // instead of the regular popup.
+ BASE_FEATURE(kAutofillKeyboardAccessory,
+ "AutofillKeyboardAccessory",
+- base::FEATURE_DISABLED_BY_DEFAULT);
++ base::FEATURE_ENABLED_BY_DEFAULT);
+
+ // Controls whether the Autofill manual fallback for Addresses and Payments is
+ // present on Android.
diff --git a/patches/0001-Vanadium/0099-Support-both-password-manager-and-android-autofill-f.patch b/patches/0001-Vanadium/0099-Support-both-password-manager-and-android-autofill-f.patch
new file mode 100644
index 0000000..f8d56e5
--- /dev/null
+++ b/patches/0001-Vanadium/0099-Support-both-password-manager-and-android-autofill-f.patch
@@ -0,0 +1,76 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: fgei
+Date: Mon, 20 Feb 2023 07:06:53 +0000
+Subject: [PATCH] Support both password manager and android autofill
+ functionality
+
+---
+ .../autofill/content/renderer/autofill_agent.cc | 2 --
+ .../content/renderer/password_autofill_agent.cc | 9 ---------
+ .../core/browser/browser_autofill_manager.cc | 13 +++++++++++++
+ 3 files changed, 13 insertions(+), 11 deletions(-)
+
+diff --git a/components/autofill/content/renderer/autofill_agent.cc b/components/autofill/content/renderer/autofill_agent.cc
+index a663c48414a08..dc752712b1cb5 100644
+--- a/components/autofill/content/renderer/autofill_agent.cc
++++ b/components/autofill/content/renderer/autofill_agent.cc
+@@ -509,7 +509,6 @@ void AutofillAgent::OnTextFieldDidChange(const WebInputElement& element) {
+ if (password_autofill_agent_->TextDidChangeInTextField(element)) {
+ is_popup_possibly_visible_ = true;
+ element_ = element;
+- return;
+ }
+
+ ShowSuggestions(element, {.requires_caret_at_end = true});
+@@ -878,7 +877,6 @@ void AutofillAgent::ShowSuggestions(const WebFormControlElement& element,
+ input_element, ShowAll(options.show_full_suggestion_list),
+ GenerationShowing(is_generation_popup_possibly_visible_))) {
+ is_popup_possibly_visible_ = true;
+- return;
+ }
+
+ if (is_generation_popup_possibly_visible_)
+diff --git a/components/autofill/content/renderer/password_autofill_agent.cc b/components/autofill/content/renderer/password_autofill_agent.cc
+index f1877135d198a..f0e623b9cf9d2 100644
+--- a/components/autofill/content/renderer/password_autofill_agent.cc
++++ b/components/autofill/content/renderer/password_autofill_agent.cc
+@@ -1102,15 +1102,6 @@ bool PasswordAutofillAgent::ShowSuggestions(
+ if (generation_popup_showing)
+ return false;
+
+-#if BUILDFLAG(IS_ANDROID)
+- // Don't call ShowSuggestionPopup if Touch To Fill is currently showing. Since
+- // Touch To Fill in spirit is very similar to a suggestion pop-up, return true
+- // so that the AutofillAgent does not try to show other autofill suggestions
+- // instead.
+- if (touch_to_fill_state_ == TouchToFillState::kIsShowing)
+- return true;
+-#endif
+-
+ if (!HasDocumentWithValidFrame(element))
+ return false;
+
+diff --git a/components/autofill/core/browser/browser_autofill_manager.cc b/components/autofill/core/browser/browser_autofill_manager.cc
+index b89394fa35f3d..73776acad6ae0 100644
+--- a/components/autofill/core/browser/browser_autofill_manager.cc
++++ b/components/autofill/core/browser/browser_autofill_manager.cc
+@@ -1107,6 +1107,19 @@ void BrowserAutofillManager::OnAskForValuesToFillImpl(
+ return;
+ }
+
++ if (AutofillField* _autofill_field = GetAutofillField(form, field)) {
++ switch (_autofill_field->Type().group()) {
++ // Do not override password manager prompt on these fields
++ case FieldTypeGroup::kNoGroup:
++ case FieldTypeGroup::kPasswordField:
++ case FieldTypeGroup::kUsernameField:
++ case FieldTypeGroup::kEmail:
++ return;
++ default:
++ break;
++ }
++ }
++
+ SetDataList(field.datalist_values, field.datalist_labels);
+ external_delegate_->OnQuery(form, field, transformed_box);
+
diff --git a/patches/0001-Vanadium/0100-Support-for-both-browser-and-android-autofill-functi.patch b/patches/0001-Vanadium/0100-Support-for-both-browser-and-android-autofill-functi.patch
new file mode 100644
index 0000000..9d6baf9
--- /dev/null
+++ b/patches/0001-Vanadium/0100-Support-for-both-browser-and-android-autofill-functi.patch
@@ -0,0 +1,230 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: fgei
+Date: Tue, 21 Feb 2023 01:48:15 +0000
+Subject: [PATCH] Support for both browser and android autofill functionality
+
+---
+ .../browser/android_autofill_manager.cc | 15 +++++++
+ .../browser/android_autofill_manager.h | 15 +++++++
+ .../browser/content_autofill_driver.cc | 42 +++++++++++++++++++
+ .../content/browser/content_autofill_driver.h | 12 ++++++
+ 4 files changed, 84 insertions(+)
+
+diff --git a/components/android_autofill/browser/android_autofill_manager.cc b/components/android_autofill/browser/android_autofill_manager.cc
+index 60b056e7e22d9..4101639a5649e 100644
+--- a/components/android_autofill/browser/android_autofill_manager.cc
++++ b/components/android_autofill/browser/android_autofill_manager.cc
+@@ -9,6 +9,7 @@
+ #include "components/android_autofill/browser/autofill_provider.h"
+ #include "components/autofill/content/browser/content_autofill_driver.h"
+ #include "components/autofill/core/browser/metrics/form_events/form_event_logger_weblayer_android.h"
++#include "components/autofill/core/browser/browser_autofill_manager.h"
+ #include "content/public/browser/render_frame_host.h"
+ #include "content/public/browser/web_contents.h"
+
+@@ -26,6 +27,20 @@ void AndroidDriverInitHook(AutofillClient* client,
+ driver->GetAutofillAgent()->SetQueryPasswordSuggestion(true);
+ }
+
++void AndroidAndBrowserDriverInitHook(
++ AutofillClient* client,
++ const std::string& app_locale,
++ ContentAutofillDriver* driver) {
++ driver->set_autofill_manager(std::make_unique(
++ driver, client, app_locale));
++ driver->set_secondary_autofill_manager(base::WrapUnique(
++ new AndroidAutofillManager(driver, client)));
++ driver->GetAutofillAgent()->SetUserGestureRequired(false);
++ driver->GetAutofillAgent()->SetSecureContextRequired(true);
++ driver->GetAutofillAgent()->SetFocusRequiresScroll(false);
++ driver->GetAutofillAgent()->SetQueryPasswordSuggestion(true);
++}
++
+ AndroidAutofillManager::AndroidAutofillManager(AutofillDriver* driver,
+ AutofillClient* client)
+ : AutofillManager(driver, client) {
+diff --git a/components/android_autofill/browser/android_autofill_manager.h b/components/android_autofill/browser/android_autofill_manager.h
+index 179b2b47464e0..dd8af3166841a 100644
+--- a/components/android_autofill/browser/android_autofill_manager.h
++++ b/components/android_autofill/browser/android_autofill_manager.h
+@@ -16,6 +16,16 @@ class AutofillProvider;
+ class ContentAutofillDriver;
+ class FormEventLoggerWeblayerAndroid;
+
++// Creates an AndroidAutofillManager and attaches it to the `driver`.
++//
++// This hook is to be passed to CreateForWebContentsAndDelegate().
++// It is the glue between ContentAutofillDriver[Factory] and
++// AndroidAutofillManager, BrowserAutofillManager.
++void AndroidAndBrowserDriverInitHook(
++ AutofillClient* client,
++ const std::string& app_locale,
++ ContentAutofillDriver* driver);
++
+ // Creates an AndroidAutofillManager and attaches it to the `driver`.
+ //
+ // This hook is to be passed to CreateForWebContentsAndDelegate().
+@@ -86,6 +96,11 @@ class AndroidAutofillManager : public AutofillManager {
+ const url::Origin& triggered_origin);
+
+ protected:
++ friend void AndroidAndBrowserDriverInitHook(
++ AutofillClient* client,
++ const std::string& app_locale,
++ ContentAutofillDriver* driver);
++
+ friend void AndroidDriverInitHook(AutofillClient* client,
+ ContentAutofillDriver* driver);
+
+diff --git a/components/autofill/content/browser/content_autofill_driver.cc b/components/autofill/content/browser/content_autofill_driver.cc
+index 00b0f300a0748..0f9287246a098 100644
+--- a/components/autofill/content/browser/content_autofill_driver.cc
++++ b/components/autofill/content/browser/content_autofill_driver.cc
+@@ -336,6 +336,10 @@ void ContentAutofillDriver::FormsSeen(
+ const std::vector& removed_forms) {
+ target->autofill_manager_->OnFormsSeen(WithNewVersion(updated_forms),
+ removed_forms);
++ if (target->secondary_autofill_manager_) {
++ target->secondary_autofill_manager_->OnFormsSeen(WithNewVersion(updated_forms),
++ removed_forms);
++ }
+ });
+ }
+
+@@ -362,6 +366,10 @@ void ContentAutofillDriver::FormSubmitted(
+ }
+ target->autofill_manager_->OnFormSubmitted(
+ WithNewVersion(form), known_success, submission_source);
++ if (target->secondary_autofill_manager_) {
++ target->secondary_autofill_manager_->OnFormSubmitted(
++ WithNewVersion(form), known_success, submission_source);
++ }
+ });
+ }
+
+@@ -382,6 +390,10 @@ void ContentAutofillDriver::TextFieldDidChange(const FormData& raw_form,
+ base::TimeTicks timestamp) {
+ target->autofill_manager_->OnTextFieldDidChange(
+ WithNewVersion(form), field, bounding_box, timestamp);
++ if (target->secondary_autofill_manager_) {
++ target->secondary_autofill_manager_->OnTextFieldDidChange(
++ WithNewVersion(form), field, bounding_box, timestamp);
++ }
+ });
+ }
+
+@@ -400,6 +412,10 @@ void ContentAutofillDriver::TextFieldDidScroll(const FormData& raw_form,
+ const FormFieldData& field, const gfx::RectF& bounding_box) {
+ target->autofill_manager_->OnTextFieldDidScroll(WithNewVersion(form),
+ field, bounding_box);
++ if (target->secondary_autofill_manager_) {
++ target->secondary_autofill_manager_->OnTextFieldDidScroll(WithNewVersion(form),
++ field, bounding_box);
++ }
+ });
+ }
+
+@@ -419,6 +435,10 @@ void ContentAutofillDriver::SelectControlDidChange(
+ const FormFieldData& field, const gfx::RectF& bounding_box) {
+ target->autofill_manager_->OnSelectControlDidChange(
+ WithNewVersion(form), field, bounding_box);
++ if (target->secondary_autofill_manager_) {
++ target->autofill_manager_->OnSelectControlDidChange(
++ WithNewVersion(form), field, bounding_box);
++ }
+ });
+ }
+
+@@ -444,6 +464,11 @@ void ContentAutofillDriver::AskForValuesToFill(
+ target->autofill_manager_->OnAskForValuesToFill(
+ WithNewVersion(form), field, bounding_box,
+ autoselect_first_suggestion, form_element_was_clicked);
++ if (target->secondary_autofill_manager_) {
++ target->secondary_autofill_manager_->OnAskForValuesToFill(
++ WithNewVersion(form), field, bounding_box,
++ autoselect_first_suggestion, form_element_was_clicked);
++ }
+ });
+ }
+
+@@ -454,12 +479,18 @@ void ContentAutofillDriver::HidePopup() {
+ DCHECK(!target->IsPrerendering())
+ << "We should never affect UI while prerendering";
+ target->autofill_manager_->OnHidePopup();
++ if (target->secondary_autofill_manager_) {
++ target->secondary_autofill_manager_->OnHidePopup();
++ }
+ });
+ }
+
+ void ContentAutofillDriver::FocusNoLongerOnFormCallback(
+ bool had_interacted_form) {
+ autofill_manager_->OnFocusNoLongerOnForm(had_interacted_form);
++ if (secondary_autofill_manager_) {
++ secondary_autofill_manager_->OnFocusNoLongerOnForm(had_interacted_form);
++ }
+ }
+
+ void ContentAutofillDriver::FocusNoLongerOnForm(bool had_interacted_form) {
+@@ -487,6 +518,10 @@ void ContentAutofillDriver::FocusOnFormField(const FormData& raw_form,
+ const FormFieldData& field, const gfx::RectF& bounding_box) {
+ target->autofill_manager_->OnFocusOnFormField(WithNewVersion(form),
+ field, bounding_box);
++ if (target->secondary_autofill_manager_) {
++ target->secondary_autofill_manager_->OnFocusOnFormField(WithNewVersion(form),
++ field, bounding_box);
++ }
+ });
+ }
+
+@@ -500,6 +535,10 @@ void ContentAutofillDriver::DidFillAutofillFormData(const FormData& raw_form,
+ base::TimeTicks timestamp) {
+ target->autofill_manager_->OnDidFillAutofillFormData(
+ WithNewVersion(form), timestamp);
++ if (target->secondary_autofill_manager_) {
++ target->secondary_autofill_manager_->OnDidFillAutofillFormData(
++ WithNewVersion(form), timestamp);
++ }
+ });
+ }
+
+@@ -575,6 +614,9 @@ void ContentAutofillDriver::Reset() {
+ submitted_forms_.clear();
+ autofill_router_->UnregisterDriver(this);
+ autofill_manager_->Reset();
++ if (secondary_autofill_manager_) {
++ secondary_autofill_manager_->Reset();
++ }
+ }
+
+ const mojo::AssociatedRemote&
+diff --git a/components/autofill/content/browser/content_autofill_driver.h b/components/autofill/content/browser/content_autofill_driver.h
+index 65d6e43b5e017..bfae54ada1006 100644
+--- a/components/autofill/content/browser/content_autofill_driver.h
++++ b/components/autofill/content/browser/content_autofill_driver.h
+@@ -130,6 +130,14 @@ class ContentAutofillDriver : public AutofillDriver,
+ }
+ AutofillManager* autofill_manager() { return autofill_manager_.get(); }
+
++ void set_secondary_autofill_manager(
++ std::unique_ptr secondary_autofill_manager) {
++ secondary_autofill_manager_ = std::move(secondary_autofill_manager);
++ }
++ AutofillManager* secondary_autofill_manager() {
++ return secondary_autofill_manager_.get();
++ }
++
+ content::RenderFrameHost* render_frame_host() { return render_frame_host_; }
+
+ // Expose the events that originate from the browser and renderer processes,
+@@ -343,6 +351,10 @@ class ContentAutofillDriver : public AutofillDriver,
+ // code.
+ std::unique_ptr autofill_manager_ = nullptr;
+
++ // adds a reference for AndroidAutofillManager, since native autofill works in
++ // conjunction with browser autofill
++ std::unique_ptr secondary_autofill_manager_ = nullptr;
++
+ content::RenderWidgetHost::KeyPressEventCallback key_press_handler_;
+
+ mojo::AssociatedReceiver receiver_{this};
diff --git a/patches/0001-Vanadium/0101-Support-native-Android-autofill-at-browser.patch b/patches/0001-Vanadium/0101-Support-native-Android-autofill-at-browser.patch
new file mode 100644
index 0000000..bdde4ff
--- /dev/null
+++ b/patches/0001-Vanadium/0101-Support-native-Android-autofill-at-browser.patch
@@ -0,0 +1,379 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: fgei
+Date: Mon, 20 Feb 2023 07:10:55 +0000
+Subject: [PATCH] Support native Android autofill at browser
+
+This enables support for Android Autofil on tabs showing fillable
+entries, reusing the codebase used for webview's android autofill
+support.
+---
+ android_webview/browser/aw_autofill_client.cc | 4 ++
+ chrome/android/BUILD.gn | 1 +
+ .../chromium/chrome/browser/tab/TabImpl.java | 45 +++++++++++++++++
+ .../browser/tab/TabViewAndroidDelegate.java | 13 +++++
+ chrome/browser/BUILD.gn | 7 +++
+ .../ui/autofill/chrome_autofill_client.cc | 14 +++++-
+ .../embedder_support/view/ContentView.java | 48 +++++++++++++++++++
+ .../chromium/ui/base/ViewAndroidDelegate.java | 8 ++++
+ 8 files changed, 139 insertions(+), 1 deletion(-)
+
+diff --git a/android_webview/browser/aw_autofill_client.cc b/android_webview/browser/aw_autofill_client.cc
+index 7dd21f8202f9f..889bf90b7821e 100644
+--- a/android_webview/browser/aw_autofill_client.cc
++++ b/android_webview/browser/aw_autofill_client.cc
+@@ -83,6 +83,7 @@ AwAutofillClient::GetURLLoaderFactory() {
+ }
+
+ autofill::AutofillDownloadManager* AwAutofillClient::GetDownloadManager() {
++#if defined(USE_BROWSER_AUTOFILL_ONLY)
+ if (autofill::AutofillProvider::is_download_manager_disabled_for_testing()) {
+ return nullptr;
+ }
+@@ -92,6 +93,9 @@ autofill::AutofillDownloadManager* AwAutofillClient::GetDownloadManager() {
+ this, GetChannel(), GetLogManager());
+ }
+ return download_manager_.get();
++#else
++ return nullptr;
++#endif // defined(USE_BROWSER_AUTOFILL_ONLY)
+ }
+
+ autofill::PersonalDataManager* AwAutofillClient::GetPersonalDataManager() {
+diff --git a/chrome/android/BUILD.gn b/chrome/android/BUILD.gn
+index 4a4695c3d0119..47956c1f09e07 100644
+--- a/chrome/android/BUILD.gn
++++ b/chrome/android/BUILD.gn
+@@ -351,6 +351,7 @@ if (current_toolchain == default_toolchain) {
+ "//chrome/browser/webapps/android:java",
+ "//chrome/browser/webauthn/android:java",
+ "//chrome/browser/xsurface:java",
++ "//components/android_autofill/browser:java",
+ "//components/autofill/android:autofill_java",
+ "//components/autofill/android:prefeditor_autofill_java",
+ "//components/background_task_scheduler:background_task_scheduler_java",
+diff --git a/chrome/android/java/src/org/chromium/chrome/browser/tab/TabImpl.java b/chrome/android/java/src/org/chromium/chrome/browser/tab/TabImpl.java
+index 84dee29291b42..baf0859ca7cf2 100644
+--- a/chrome/android/java/src/org/chromium/chrome/browser/tab/TabImpl.java
++++ b/chrome/android/java/src/org/chromium/chrome/browser/tab/TabImpl.java
+@@ -10,10 +10,14 @@ import android.annotation.SuppressLint;
+ import android.app.Activity;
+ import android.content.Context;
+ import android.graphics.Rect;
++import android.os.Build;
+ import android.text.TextUtils;
++import android.util.SparseArray;
+ import android.view.View;
+ import android.view.View.OnAttachStateChangeListener;
++import android.view.ViewStructure;
+ import android.view.accessibility.AccessibilityEvent;
++import android.view.autofill.AutofillValue;
+
+ import androidx.annotation.Nullable;
+ import androidx.annotation.VisibleForTesting;
+@@ -54,6 +58,8 @@ import org.chromium.chrome.browser.tab.state.CriticalPersistedTabData;
+ import org.chromium.chrome.browser.tab.state.SerializedCriticalPersistedTabData;
+ import org.chromium.chrome.browser.ui.native_page.FrozenNativePage;
+ import org.chromium.chrome.browser.ui.native_page.NativePage;
++import org.chromium.components.autofill.AutofillActionModeCallback;
++import org.chromium.components.autofill.AutofillProvider;
+ import org.chromium.components.dom_distiller.core.DomDistillerUrlUtils;
+ import org.chromium.components.embedder_support.util.UrlConstants;
+ import org.chromium.components.embedder_support.view.ContentView;
+@@ -66,9 +72,11 @@ import org.chromium.components.version_info.VersionInfo;
+ import org.chromium.content_public.browser.ChildProcessImportance;
+ import org.chromium.content_public.browser.ContentFeatureList;
+ import org.chromium.content_public.browser.LoadUrlParams;
++import org.chromium.content_public.browser.SelectionPopupController;
+ import org.chromium.content_public.browser.WebContents;
+ import org.chromium.content_public.browser.WebContentsAccessibility;
+ import org.chromium.content_public.browser.navigation_controller.UserAgentOverrideOption;
++import org.chromium.ui.base.EventOffsetHandler;
+ import org.chromium.ui.base.PageTransition;
+ import org.chromium.ui.base.ViewAndroidDelegate;
+ import org.chromium.ui.base.WindowAndroid;
+@@ -212,6 +220,7 @@ public class TabImpl implements Tab {
+ private int mThemeColor;
+ private boolean mUsedCriticalPersistedTabData;
+ private boolean mIsWebContentObscured;
++ AutofillProvider mAutofillProvider;
+
+ /**
+ * Creates an instance of a {@link TabImpl}.
+@@ -255,12 +264,18 @@ public class TabImpl implements Tab {
+ public void onViewAttachedToWindow(View view) {
+ mIsViewAttachedToWindow = true;
+ updateInteractableState();
++ if (mAutofillProvider != null) {
++ mAutofillProvider.onContainerViewChanged(mContentView);
++ }
+ }
+
+ @Override
+ public void onViewDetachedFromWindow(View view) {
+ mIsViewAttachedToWindow = false;
+ updateInteractableState();
++ if (mAutofillProvider != null) {
++ mAutofillProvider.onContainerViewChanged(mContentView);
++ }
+ }
+ };
+ mTabViewManager = new TabViewManagerImpl(this);
+@@ -796,6 +811,11 @@ public class TabImpl implements Tab {
+ for (TabObserver observer : mObservers) observer.onDestroyed(this);
+ mObservers.clear();
+
++ if (mAutofillProvider != null) {
++ mAutofillProvider.destroy();
++ mAutofillProvider = null;
++ }
++
+ mUserDataHost.destroy();
+ mTabViewManager.destroy();
+ hideNativePage(false, null);
+@@ -1393,6 +1413,18 @@ public class TabImpl implements Tab {
+ return tabsPtrArray;
+ }
+
++ public void onProvideAutofillVirtualStructure(ViewStructure structure, int flags) {
++ if (mAutofillProvider != null) {
++ mAutofillProvider.onProvideAutoFillVirtualStructure(structure, flags);
++ }
++ }
++
++ public void autofill(final SparseArray values) {
++ if (mAutofillProvider != null) {
++ mAutofillProvider.autofill(values);
++ }
++ }
++
+ /**
+ * Initializes the {@link WebContents}. Completes the browser content components initialization
+ * around a native WebContents pointer.
+@@ -1436,10 +1468,23 @@ public class TabImpl implements Tab {
+ mWebContentsDelegate = createWebContentsDelegate();
+
+ assert mNativeTabAndroid != 0;
++ SelectionPopupController selectionController = null;
++ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
++ selectionController = SelectionPopupController.fromWebContents(mWebContents);
++ mAutofillProvider = new AutofillProvider(
++ getContext(), cv, webContents, "NativeAutofillRenderer");
++ }
+ TabImplJni.get().initWebContents(mNativeTabAndroid, mIncognito, isDetached(this),
+ webContents, mWebContentsDelegate,
+ new TabContextMenuPopulatorFactory(
+ mDelegateFactory.createContextMenuPopulatorFactory(this), this));
++ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && selectionController != null) {
++ mAutofillProvider.setWebContents(webContents);
++ cv.setWebContents(webContents);
++ selectionController.setNonSelectionActionModeCallback(
++ new AutofillActionModeCallback(
++ mThemedApplicationContext, mAutofillProvider));
++ }
+
+ mWebContents.notifyRendererPreferenceUpdate();
+ TabHelpers.initWebContentsHelpers(this);
+diff --git a/chrome/android/java/src/org/chromium/chrome/browser/tab/TabViewAndroidDelegate.java b/chrome/android/java/src/org/chromium/chrome/browser/tab/TabViewAndroidDelegate.java
+index aeb890d6fd459..df95505407cda 100644
+--- a/chrome/android/java/src/org/chromium/chrome/browser/tab/TabViewAndroidDelegate.java
++++ b/chrome/android/java/src/org/chromium/chrome/browser/tab/TabViewAndroidDelegate.java
+@@ -4,7 +4,10 @@
+
+ package org.chromium.chrome.browser.tab;
+
++import android.util.SparseArray;
+ import android.view.ViewGroup;
++import android.view.ViewStructure;
++import android.view.autofill.AutofillValue;
+
+ import androidx.annotation.Nullable;
+ import androidx.annotation.VisibleForTesting;
+@@ -87,6 +90,16 @@ public class TabViewAndroidDelegate extends ViewAndroidDelegate {
+ mTab.onBackgroundColorChanged(color);
+ }
+
++ @Override
++ public void onProvideAutofillVirtualStructure(ViewStructure structure, int flags) {
++ mTab.onProvideAutofillVirtualStructure(structure, flags);
++ }
++
++ @Override
++ public void autofill(final SparseArray values) {
++ mTab.autofill(values);
++ }
++
+ @Override
+ public void onTopControlsChanged(
+ int topControlsOffsetY, int contentOffsetY, int topControlsMinHeightOffsetY) {
+diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn
+index acf48b7ffd061..ef9200037fe05 100644
+--- a/chrome/browser/BUILD.gn
++++ b/chrome/browser/BUILD.gn
+@@ -2484,6 +2484,13 @@ static_library("browser") {
+ deps += [ "//chrome/browser/error_reporting" ]
+ }
+
++ if (is_android) {
++ deps += [
++ "//components/android_autofill/browser",
++ "//components/android_autofill/browser:android"
++ ]
++ }
++
+ if (use_ozone) {
+ deps += [
+ "//ui/events/ozone",
+diff --git a/chrome/browser/ui/autofill/chrome_autofill_client.cc b/chrome/browser/ui/autofill/chrome_autofill_client.cc
+index 07663b4b2e793..dccf3ac3163dc 100644
+--- a/chrome/browser/ui/autofill/chrome_autofill_client.cc
++++ b/chrome/browser/ui/autofill/chrome_autofill_client.cc
+@@ -53,6 +53,9 @@
+ #include "chrome/browser/web_data_service_factory.h"
+ #include "chrome/common/channel_info.h"
+ #include "chrome/common/url_constants.h"
++#if BUILDFLAG(IS_ANDROID)
++#include "components/android_autofill/browser/android_autofill_manager.h"
++#endif // BUILDFLAG(IS_ANDROID)
+ #include "components/autofill/content/browser/autofill_log_router_factory.h"
+ #include "components/autofill/content/browser/content_autofill_driver.h"
+ #include "components/autofill/content/browser/content_autofill_driver_factory.h"
+@@ -180,12 +183,16 @@ ChromeAutofillClient::GetURLLoaderFactory() {
+ }
+
+ AutofillDownloadManager* ChromeAutofillClient::GetDownloadManager() {
++#if defined(USE_BROWSER_AUTOFILL_ONLY)
+ if (!download_manager_) {
+ // Lazy initialization to avoid virtual function calls in the constructor.
+ download_manager_ = std::make_unique(
+ this, GetChannel(), GetLogManager());
+ }
+ return download_manager_.get();
++#else
++ return nullptr;
++#endif // defined(USE_BROWSER_AUTOFILL_ONLY)
+ }
+
+ AutofillOptimizationGuide* ChromeAutofillClient::GetAutofillOptimizationGuide()
+@@ -1162,7 +1169,12 @@ void ChromeAutofillClient::OnZoomChanged(
+ ChromeAutofillClient::ChromeAutofillClient(content::WebContents* web_contents)
+ : ContentAutofillClient(
+ web_contents,
+- base::BindRepeating(&BrowserDriverInitHook,
++ base::BindRepeating(
++#if BUILDFLAG(IS_ANDROID)
++ &AndroidAndBrowserDriverInitHook,
++#else
++ &BrowserDriverInitHook,
++#endif // BUILDFLAG(IS_ANDROID)
+ this,
+ g_browser_process->GetApplicationLocale())),
+ content::WebContentsObserver(web_contents),
+diff --git a/components/embedder_support/android/java/src/org/chromium/components/embedder_support/view/ContentView.java b/components/embedder_support/android/java/src/org/chromium/components/embedder_support/view/ContentView.java
+index 0e909aab3760a..58de87e58e3f1 100644
+--- a/components/embedder_support/android/java/src/org/chromium/components/embedder_support/view/ContentView.java
++++ b/components/embedder_support/android/java/src/org/chromium/components/embedder_support/view/ContentView.java
+@@ -9,6 +9,7 @@ import android.content.res.Configuration;
+ import android.graphics.Rect;
+ import android.os.Build;
+ import android.os.Handler;
++import android.util.SparseArray;
+ import android.view.DragEvent;
+ import android.view.KeyEvent;
+ import android.view.MotionEvent;
+@@ -18,6 +19,7 @@ import android.view.View.OnSystemUiVisibilityChangeListener;
+ import android.view.ViewGroup.OnHierarchyChangeListener;
+ import android.view.ViewStructure;
+ import android.view.accessibility.AccessibilityNodeProvider;
++import android.view.autofill.AutofillValue;
+ import android.view.inputmethod.EditorInfo;
+ import android.view.inputmethod.InputConnection;
+ import android.widget.FrameLayout;
+@@ -37,6 +39,7 @@ import org.chromium.ui.accessibility.AccessibilityState;
+ import org.chromium.ui.base.EventForwarder;
+ import org.chromium.ui.base.EventOffsetHandler;
+ import org.chromium.ui.dragdrop.DragEventDispatchHelper.DragEventDispatchDestination;
++import org.chromium.ui.base.ViewAndroidDelegate;
+
+ /**
+ * The containing view for {@link WebContents} that exists in the Android UI hierarchy and exposes
+@@ -89,6 +92,9 @@ public class ContentView extends FrameLayout
+ */
+ public static ContentView createContentView(Context context,
+ @Nullable EventOffsetHandler eventOffsetHandler, @Nullable WebContents webContents) {
++ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
++ return new ContentViewWithAutofill(context, eventOffsetHandler, webContents);
++ }
+ return new ContentView(context, eventOffsetHandler, webContents);
+ }
+
+@@ -619,4 +625,46 @@ public class ContentView extends FrameLayout
+ mDragDropEventOffsetHandler.onPostDispatchDragEvent(event.getAction());
+ return ret;
+ }
++
++ /**
++ * API level 26 implementation that includes autofill.
++ */
++ private static class ContentViewWithAutofill extends ContentView {
++ private ViewAndroidDelegate viewAndroidDelegate;
++
++ private ContentViewWithAutofill(
++ Context context, EventOffsetHandler eventOffsetHandler, WebContents webContents) {
++ super(context, eventOffsetHandler, webContents);
++
++ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
++ // The Autofill system-level infrastructure has heuristics for which Views it
++ // considers important for autofill; only these Views will be queried for their
++ // autofill structure on notifications that a new (virtual) View was entered. By
++ // default, FrameLayout is not considered important for autofill. Thus, for
++ // ContentView to be queried for its autofill structure, we must explicitly inform
++ // the autofill system that this View is important for autofill.
++ setImportantForAutofill(View.IMPORTANT_FOR_AUTOFILL_YES);
++ }
++ }
++
++ @Override
++ public void setWebContents(WebContents webContents) {
++ viewAndroidDelegate = webContents.getViewAndroidDelegate();
++ super.setWebContents(webContents);
++ }
++
++ @Override
++ public void onProvideAutofillVirtualStructure(ViewStructure structure, int flags) {
++ if (viewAndroidDelegate != null) {
++ viewAndroidDelegate.onProvideAutofillVirtualStructure(structure, flags);
++ }
++ }
++
++ @Override
++ public void autofill(final SparseArray values) {
++ if (viewAndroidDelegate != null) {
++ viewAndroidDelegate.autofill(values);
++ }
++ }
++ }
+ }
+diff --git a/ui/android/java/src/org/chromium/ui/base/ViewAndroidDelegate.java b/ui/android/java/src/org/chromium/ui/base/ViewAndroidDelegate.java
+index 454eb50e76104..849fdd41bca62 100644
+--- a/ui/android/java/src/org/chromium/ui/base/ViewAndroidDelegate.java
++++ b/ui/android/java/src/org/chromium/ui/base/ViewAndroidDelegate.java
+@@ -29,6 +29,10 @@ import org.chromium.ui.dragdrop.DragStateTracker;
+ import org.chromium.ui.dragdrop.DropDataAndroid;
+ import org.chromium.ui.mojom.CursorType;
+
++import android.util.SparseArray;
++import android.view.autofill.AutofillValue;
++import android.view.ViewStructure;
++
+ /**
+ * Class to acquire, position, and remove anchor views from the implementing View.
+ */
+@@ -620,4 +624,8 @@ public class ViewAndroidDelegate {
+ public static void setDragAndDropDelegateForTest(DragAndDropDelegate testDelegate) {
+ sDragAndDropTestDelegate = testDelegate;
+ }
++
++ public void onProvideAutofillVirtualStructure(ViewStructure structure, int flags) {}
++
++ public void autofill(final SparseArray values) {}
+ }
diff --git a/patches/0001-Vanadium/0102-Disable-Play-services-dependent-password-manager-fea.patch b/patches/0001-Vanadium/0102-Disable-Play-services-dependent-password-manager-fea.patch
new file mode 100644
index 0000000..88f1f92
--- /dev/null
+++ b/patches/0001-Vanadium/0102-Disable-Play-services-dependent-password-manager-fea.patch
@@ -0,0 +1,23 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: fgei
+Date: Tue, 21 Feb 2023 02:02:40 +0000
+Subject: [PATCH] Disable Play services dependent password manager feature by
+ default
+
+---
+ .../password_manager/core/common/password_manager_features.cc | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/components/password_manager/core/common/password_manager_features.cc b/components/password_manager/core/common/password_manager_features.cc
+index dd18e63ae5fb0..77bcd13048d5d 100644
+--- a/components/password_manager/core/common/password_manager_features.cc
++++ b/components/password_manager/core/common/password_manager_features.cc
+@@ -255,7 +255,7 @@ BASE_FEATURE(kUnifiedCredentialManagerDryRun,
+ // database will be unused but kept in sync for local passwords.
+ BASE_FEATURE(kUnifiedPasswordManagerAndroid,
+ "UnifiedPasswordManagerAndroid",
+- base::FEATURE_ENABLED_BY_DEFAULT);
++ base::FEATURE_DISABLED_BY_DEFAULT);
+
+ // Enables showing contextual error messages when UPM encounters an auth error.
+ BASE_FEATURE(kUnifiedPasswordManagerErrorMessages,
diff --git a/patches/0001-Vanadium/0103-Disable-Play-services-dependent-password-manager-pre.patch b/patches/0001-Vanadium/0103-Disable-Play-services-dependent-password-manager-pre.patch
new file mode 100644
index 0000000..5904d2a
--- /dev/null
+++ b/patches/0001-Vanadium/0103-Disable-Play-services-dependent-password-manager-pre.patch
@@ -0,0 +1,26 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: fgei
+Date: Tue, 21 Feb 2023 02:06:16 +0000
+Subject: [PATCH] Disable Play services dependent password manager prefs by
+ default
+
+---
+ components/password_manager/core/browser/password_manager.cc | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/components/password_manager/core/browser/password_manager.cc b/components/password_manager/core/browser/password_manager.cc
+index b926aa122adf2..abae7863e1aea 100644
+--- a/components/password_manager/core/browser/password_manager.cc
++++ b/components/password_manager/core/browser/password_manager.cc
+@@ -307,9 +307,9 @@ void PasswordManager::RegisterProfilePrefs(
+ user_prefs::PrefRegistrySyncable::SYNCABLE_PREF);
+ registry->RegisterBooleanPref(prefs::kPasswordsPrefWithNewLabelUsed, false);
+ #if BUILDFLAG(IS_ANDROID)
+- registry->RegisterBooleanPref(prefs::kOfferToSavePasswordsEnabledGMS, true);
++ registry->RegisterBooleanPref(prefs::kOfferToSavePasswordsEnabledGMS, false);
+ registry->RegisterBooleanPref(prefs::kSavePasswordsSuspendedByError, false);
+- registry->RegisterBooleanPref(prefs::kAutoSignInEnabledGMS, true);
++ registry->RegisterBooleanPref(prefs::kAutoSignInEnabledGMS, false);
+ registry->RegisterBooleanPref(prefs::kSettingsMigratedToUPM, false);
+ registry->RegisterIntegerPref(
+ prefs::kCurrentMigrationVersionToGoogleMobileServices, 0);
diff --git a/patches/0001-Vanadium/0104-Use-local-list-of-supported-languages-for-Language-s.patch b/patches/0001-Vanadium/0104-Use-local-list-of-supported-languages-for-Language-s.patch
new file mode 100644
index 0000000..2de6c3d
--- /dev/null
+++ b/patches/0001-Vanadium/0104-Use-local-list-of-supported-languages-for-Language-s.patch
@@ -0,0 +1,34 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: fgei
+Date: Sat, 25 Feb 2023 05:11:12 +0100
+Subject: [PATCH] Use local list of supported languages for Language settings
+
+Disable requests or connections to fetch language list from server
+---
+ .../translate/core/browser/translate_language_list.cc | 6 +++++-
+ 1 file changed, 5 insertions(+), 1 deletion(-)
+
+diff --git a/components/translate/core/browser/translate_language_list.cc b/components/translate/core/browser/translate_language_list.cc
+index 577f2c9f4de00..e49dc937e60eb 100644
+--- a/components/translate/core/browser/translate_language_list.cc
++++ b/components/translate/core/browser/translate_language_list.cc
+@@ -163,7 +163,7 @@ const char* const kDefaultSupportedLanguages[] = {
+ const char kLanguageListFetchPath[] = "translate_a/l?client=chrome";
+
+ // Represent if the language list updater is disabled.
+-bool update_is_disabled = false;
++bool update_is_disabled = true;
+
+ // Retry parameter for fetching.
+ const int kMaxRetryOn5xx = 5;
+@@ -229,6 +229,10 @@ GURL TranslateLanguageList::TranslateLanguageUrl() {
+ }
+
+ void TranslateLanguageList::RequestLanguageList() {
++ if (update_is_disabled) {
++ return;
++ }
++
+ // If resource requests are not allowed, we'll get a callback when they are.
+ if (!resource_requests_allowed_) {
+ request_pending_ = true;
diff --git a/patches/0001-Vanadium/0106-Remove-not-applicable-additional-terms-of-services.patch b/patches/0001-Vanadium/0106-Remove-not-applicable-additional-terms-of-services.patch
new file mode 100644
index 0000000..77b8694
--- /dev/null
+++ b/patches/0001-Vanadium/0106-Remove-not-applicable-additional-terms-of-services.patch
@@ -0,0 +1,24 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: fgei
+Date: Wed, 19 Apr 2023 13:16:49 +0000
+Subject: [PATCH] Remove not applicable additional terms of services
+
+---
+ chrome/android/java/res/xml/legal_information_preferences.xml | 4 ----
+ 1 file changed, 4 deletions(-)
+
+diff --git a/chrome/android/java/res/xml/legal_information_preferences.xml b/chrome/android/java/res/xml/legal_information_preferences.xml
+index 32067c19d4f7a..e386dc0765491 100644
+--- a/chrome/android/java/res/xml/legal_information_preferences.xml
++++ b/chrome/android/java/res/xml/legal_information_preferences.xml
+@@ -16,10 +16,6 @@ found in the LICENSE file.
+ android:key="google_terms_of_service"
+ android:title="@string/google_terms_of_service_title"
+ app:url="@string/google_terms_of_service_url" />
+-
+
+Date: Tue, 25 Apr 2023 04:53:22 -0400
+Subject: [PATCH] require HTTPS for component updates
+
+---
+ .../component_updater/aw_component_updater_configurator.cc | 2 +-
+ .../component_updater/chrome_component_updater_configurator.cc | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/android_webview/nonembedded/component_updater/aw_component_updater_configurator.cc b/android_webview/nonembedded/component_updater/aw_component_updater_configurator.cc
+index f0a64d0cdb6ef..66d2a98f0fddf 100644
+--- a/android_webview/nonembedded/component_updater/aw_component_updater_configurator.cc
++++ b/android_webview/nonembedded/component_updater/aw_component_updater_configurator.cc
+@@ -36,7 +36,7 @@ AwComponentUpdaterConfigurator::AwComponentUpdaterConfigurator(
+ PrefService* pref_service)
+ : configurator_impl_(
+ component_updater::ComponentUpdaterCommandLineConfigPolicy(cmdline),
+- false),
++ true),
+ pref_service_(pref_service) {}
+
+ AwComponentUpdaterConfigurator::~AwComponentUpdaterConfigurator() = default;
+diff --git a/chrome/browser/component_updater/chrome_component_updater_configurator.cc b/chrome/browser/component_updater/chrome_component_updater_configurator.cc
+index c89a2d5c693dd..298e91d90bdb3 100644
+--- a/chrome/browser/component_updater/chrome_component_updater_configurator.cc
++++ b/chrome/browser/component_updater/chrome_component_updater_configurator.cc
+@@ -111,7 +111,7 @@ class ChromeConfigurator : public update_client::Configurator {
+ ChromeConfigurator::ChromeConfigurator(const base::CommandLine* cmdline,
+ PrefService* pref_service)
+ : configurator_impl_(ComponentUpdaterCommandLineConfigPolicy(cmdline),
+- false),
++ true),
+ pref_service_(pref_service) {
+ DCHECK(pref_service_);
+ }
diff --git a/patches/0001-Vanadium/0110-Block-partitioned-third-party-cookies-as-well-when-b.patch b/patches/0001-Vanadium/0110-Block-partitioned-third-party-cookies-as-well-when-b.patch
new file mode 100644
index 0000000..050fbc7
--- /dev/null
+++ b/patches/0001-Vanadium/0110-Block-partitioned-third-party-cookies-as-well-when-b.patch
@@ -0,0 +1,36 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: fgei
+Date: Sat, 15 Apr 2023 04:04:47 +0000
+Subject: [PATCH] Block partitioned third party cookies as well when blocking
+ third party cookies
+
+---
+ services/network/cookie_settings.cc | 8 +++++++-
+ 1 file changed, 7 insertions(+), 1 deletion(-)
+
+diff --git a/services/network/cookie_settings.cc b/services/network/cookie_settings.cc
+index d5299ee0a680d..3145460067cf1 100644
+--- a/services/network/cookie_settings.cc
++++ b/services/network/cookie_settings.cc
+@@ -35,6 +35,11 @@ bool IsExplicitSetting(const ContentSettingPatternSource& setting) {
+ !setting.secondary_pattern.MatchesAllHosts();
+ }
+
++bool IsThirdPartyAllowed(const ContentSettingPatternSource& setting) {
++ return setting.primary_pattern.MatchesAllHosts() &&
++ !setting.secondary_pattern.MatchesAllHosts();
++}
++
+ const ContentSettingPatternSource* FindMatchingSetting(
+ const GURL& primary_url,
+ const GURL& secondary_url,
+@@ -197,7 +202,8 @@ CookieSettings::GetThirdPartyBlockingScope(const GURL& first_party_url) const {
+ // partitioned cross-site cookies.
+ if (const ContentSettingPatternSource* match = FindMatchingSetting(
+ first_party_url, first_party_url, content_settings_);
+- !match || match->GetContentSetting() == CONTENT_SETTING_ALLOW) {
++ match && IsThirdPartyAllowed(*match) &&
++ match->GetContentSetting() == CONTENT_SETTING_ALLOW) {
+ return ThirdPartyBlockingScope::kUnpartitionedOnly;
+ }
+ return ThirdPartyBlockingScope::kUnpartitionedAndPartitioned;
diff --git a/patches/0001-Vanadium/0111-Use-StorageKey-for-NetworkIsolationKey-in-ServiceWor.patch b/patches/0001-Vanadium/0111-Use-StorageKey-for-NetworkIsolationKey-in-ServiceWor.patch
new file mode 100644
index 0000000..d957506
--- /dev/null
+++ b/patches/0001-Vanadium/0111-Use-StorageKey-for-NetworkIsolationKey-in-ServiceWor.patch
@@ -0,0 +1,28 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Dylan Cutler
+Date: Tue, 2 May 2023 13:12:27 -0400
+Subject: [PATCH] Use StorageKey for NetworkIsolationKey in ServiceWorkerHost
+
+Bug:1147281
+Change-Id: I1a47f2ca4927bfd39bc8d0c159c6b5b0a6114d3b
+---
+ content/browser/service_worker/service_worker_host.cc | 6 +-----
+ 1 file changed, 1 insertion(+), 5 deletions(-)
+
+diff --git a/content/browser/service_worker/service_worker_host.cc b/content/browser/service_worker/service_worker_host.cc
+index f1192469d5305..5b368d0d99499 100644
+--- a/content/browser/service_worker/service_worker_host.cc
++++ b/content/browser/service_worker/service_worker_host.cc
+@@ -145,11 +145,7 @@ void ServiceWorkerHost::BindUsbService(
+ }
+
+ net::NetworkIsolationKey ServiceWorkerHost::GetNetworkIsolationKey() const {
+- // TODO(https://crbug.com/1147281): This is the NetworkIsolationKey of a
+- // top-level browsing context, which shouldn't be use for ServiceWorkers used
+- // in iframes.
+- return net::NetworkIsolationKey::ToDoUseTopFrameOriginAsWell(
+- version_->key().origin());
++ return version_->key().ToPartialNetIsolationInfo().network_isolation_key();
+ }
+
+ net::NetworkAnonymizationKey ServiceWorkerHost::GetNetworkAnonymizationKey()
diff --git a/patches/0001-Vanadium/0112-Add-method-to-convert-StorageKey-to-net-IsolationInf.patch b/patches/0001-Vanadium/0112-Add-method-to-convert-StorageKey-to-net-IsolationInf.patch
new file mode 100644
index 0000000..3f78182
--- /dev/null
+++ b/patches/0001-Vanadium/0112-Add-method-to-convert-StorageKey-to-net-IsolationInf.patch
@@ -0,0 +1,120 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Dylan Cutler
+Date: Tue, 2 May 2023 20:31:30 +0000
+Subject: [PATCH] Add method to convert StorageKey to net::IsolationInfo
+
+This is useful for computing IsolationInfo, NetworkIsolationKey, etc.
+in partitioned storage which have network access (e.g. service workers). We want to switch to deriving these using the contexts' StorageKey so that they only have access to network state in their partition.
+
+Bug: 1147281
+Change-Id: I22ae2cd861ce156b2897cbf0fec713933957a421
+Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4496124
+Commit-Queue: Dylan Cutler
+Reviewed-by: Steven Bingler
+Cr-Commit-Position: refs/heads/main@{#1138611}
+---
+ .../blink/common/storage_key/storage_key.cc | 10 +++++
+ .../storage_key/storage_key_unittest.cc | 40 +++++++++++++++++++
+ .../public/common/storage_key/storage_key.h | 17 ++++++++
+ 3 files changed, 67 insertions(+)
+
+diff --git a/third_party/blink/common/storage_key/storage_key.cc b/third_party/blink/common/storage_key/storage_key.cc
+index da0925aa2414d..512880ba4afd1 100644
+--- a/third_party/blink/common/storage_key/storage_key.cc
++++ b/third_party/blink/common/storage_key/storage_key.cc
+@@ -779,6 +779,16 @@ const net::SiteForCookies StorageKey::ToNetSiteForCookies() const {
+ return net::SiteForCookies(top_level_site_);
+ }
+
++const net::IsolationInfo StorageKey::ToPartialNetIsolationInfo() const {
++ url::Origin top_frame_origin =
++ IsFirstPartyContext() ? origin_
++ : url::Origin::Create(top_level_site_.GetURL());
++ return net::IsolationInfo::Create(net::IsolationInfo::RequestType::kOther,
++ top_frame_origin, origin_,
++ ToNetSiteForCookies(),
++ /*party_context=*/absl::nullopt, nonce_);
++}
++
+ // static
+ bool StorageKey::ShouldSkipKeyDueToPartitioning(
+ const std::string& reg_key_string) {
+diff --git a/third_party/blink/common/storage_key/storage_key_unittest.cc b/third_party/blink/common/storage_key/storage_key_unittest.cc
+index 4066bf8c62691..3d0ecf69fde44 100644
+--- a/third_party/blink/common/storage_key/storage_key_unittest.cc
++++ b/third_party/blink/common/storage_key/storage_key_unittest.cc
+@@ -944,6 +944,46 @@ TEST_F(StorageKeyTest, ToNetSiteForCookies) {
+ }
+ }
+
++TEST_F(StorageKeyTest, ToPartialNetIsolationInfo) {
++ const auto kOrigin = url::Origin::Create(GURL("https://subdomain.foo.com"));
++ const auto kOtherOrigin =
++ url::Origin::Create(GURL("https://subdomain.bar.com"));
++ const auto nonce = base::UnguessableToken::Create();
++
++ { // Same-site storage key
++ const auto storage_key =
++ StorageKey::Create(kOrigin, net::SchemefulSite(kOrigin),
++ mojom::AncestorChainBit::kSameSite);
++
++ storage_key.ToPartialNetIsolationInfo().IsEqualForTesting(
++ net::IsolationInfo::Create(net::IsolationInfo::RequestType::kOther,
++ kOrigin, kOrigin,
++ net::SiteForCookies::FromOrigin(kOrigin)));
++ }
++
++ { // Cross-site storage key
++ const auto storage_key =
++ StorageKey::Create(kOrigin, net::SchemefulSite(kOtherOrigin),
++ mojom::AncestorChainBit::kCrossSite);
++
++ storage_key.ToPartialNetIsolationInfo().IsEqualForTesting(
++ net::IsolationInfo::Create(
++ net::IsolationInfo::RequestType::kOther,
++ net::SchemefulSite(kOrigin).GetInternalOriginForTesting(),
++ kOtherOrigin, net::SiteForCookies()));
++ }
++
++ { // Nonced key
++ const auto storage_key = StorageKey::CreateWithNonce(kOrigin, nonce);
++
++ storage_key.ToPartialNetIsolationInfo().IsEqualForTesting(
++ net::IsolationInfo::Create(
++ net::IsolationInfo::RequestType::kOther,
++ net::SchemefulSite(kOrigin).GetInternalOriginForTesting(), kOrigin,
++ net::SiteForCookies(), absl::nullopt, nonce));
++ }
++}
++
+ TEST_F(StorageKeyTest, CopyWithForceEnabledThirdPartyStoragePartitioning) {
+ const url::Origin kOrigin = url::Origin::Create(GURL("https://foo.com"));
+ const url::Origin kOtherOrigin = url::Origin::Create(GURL("https://bar.com"));
+diff --git a/third_party/blink/public/common/storage_key/storage_key.h b/third_party/blink/public/common/storage_key/storage_key.h
+index 7c452e6563660..7993f652d7542 100644
+--- a/third_party/blink/public/common/storage_key/storage_key.h
++++ b/third_party/blink/public/common/storage_key/storage_key.h
+@@ -239,6 +239,23 @@ class BLINK_COMMON_EXPORT StorageKey {
+ // info.)
+ const net::SiteForCookies ToNetSiteForCookies() const;
+
++ // Return an instance of net::IsolationInfo. This is used for forms of storage
++ // like workers which have network access to ensure they only have access to
++ // network state in their partition.
++ //
++ // The IsolationInfo that this creates will not be exactly the same as the
++ // IsolationInfo of the context that created the worker. This is because
++ // StorageKey only stores the top-frame *site* whereas IsolationInfo normally
++ // uses top-frame *origin*. So we may lose the subdomain of the original
++ // context. Although this is imperfect, it is better than using first-party
++ // IsolationInfo for partitioned workers.
++ //
++ // For first-party contexts, the storage origin is used for the top-frame
++ // origin in the resulting IsolationInfo. This matches legacy behavior before
++ // storage partitioning, where the storage origin is always used as the
++ // top-frame origin.
++ const net::IsolationInfo ToPartialNetIsolationInfo() const;
++
+ // Returns true if the registration key string is partitioned by top-level
+ // site but storage partitioning is currently disabled, otherwise returns
+ // false. Also returns false if the key string contains a serialized nonce.
diff --git a/patches/0001-Vanadium/0113-Use-StorageKey-method-to-convert-to-IsolationInfo-in.patch b/patches/0001-Vanadium/0113-Use-StorageKey-method-to-convert-to-IsolationInfo-in.patch
new file mode 100644
index 0000000..1be7e33
--- /dev/null
+++ b/patches/0001-Vanadium/0113-Use-StorageKey-method-to-convert-to-IsolationInfo-in.patch
@@ -0,0 +1,46 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Dylan Cutler
+Date: Fri, 5 May 2023 16:53:42 +0000
+Subject: [PATCH] Use StorageKey method to convert to IsolationInfo in
+ background fetch
+
+Now that this method was merged in https://crrev.com/c/4496124, I am cleaning up places where we derive IsolationInfo from a StorageKey so that we can have only one implementation of the casting logic.
+
+The logic used in StorageKey::ToPartialNetIsolationInfo is almost identical to the logic here. The only difference is in first-party contexts, it uses the full storage origin for the top-frame origin, instead of making an origin from the top-frame site.
+
+Bug: None
+Change-Id: Ia0c2d1b8e776be5b918af54770dcc9a9450ed66c
+Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4500186
+Commit-Queue: Dylan Cutler
+Reviewed-by: Peter Beverloo
+Cr-Commit-Position: refs/heads/main@{#1140174}
+---
+ .../background_fetch_service_impl.cc | 15 +++++----------
+ 1 file changed, 5 insertions(+), 10 deletions(-)
+
+diff --git a/content/browser/background_fetch/background_fetch_service_impl.cc b/content/browser/background_fetch/background_fetch_service_impl.cc
+index d3b8c441ed525..34efc195dc75c 100644
+--- a/content/browser/background_fetch/background_fetch_service_impl.cc
++++ b/content/browser/background_fetch/background_fetch_service_impl.cc
+@@ -67,16 +67,11 @@ void BackgroundFetchServiceImpl::CreateForWorker(
+ return;
+ }
+
+- mojo::MakeSelfOwnedReceiver(
+- std::make_unique(
+- std::move(context), info.storage_key,
+- net::IsolationInfo::Create(
+- net::IsolationInfo::RequestType::kOther,
+- url::Origin::Create(info.storage_key.top_level_site().GetURL()),
+- info.storage_key.origin(), info.storage_key.ToNetSiteForCookies(),
+- /*party_context=*/absl::nullopt, info.storage_key.nonce()),
+- render_process_host, /*rfh=*/nullptr),
+- std::move(receiver));
++ mojo::MakeSelfOwnedReceiver(std::make_unique(
++ std::move(context), info.storage_key,
++ info.storage_key.ToPartialNetIsolationInfo(),
++ render_process_host, /*rfh=*/nullptr),
++ std::move(receiver));
+ }
+
+ // static
diff --git a/patches/0001-Vanadium/LICENSE b/patches/0001-Vanadium/LICENSE
new file mode 100644
index 0000000..ef9a0e8
--- /dev/null
+++ b/patches/0001-Vanadium/LICENSE
@@ -0,0 +1,12 @@
+Copyright © 2016-2023 GrapheneOS
+
+Vanadium patches are available under the terms of the GNU General Public
+License version 2 only, according with LICENSE.GPL-2.0. Also see
+LICENSE.WebView-note and LICENSE.Apache-2.0-note for exceptions from the GPLv2
+terms.
+
+In order for us to continue to contribute upstream, contributors to Vanadium
+give permission to the GrapheneOS project to submit their changes to the
+Chromium project or a future replacement for the base Vanadium code based on
+it under the preferred choice of licensing for that project. Only the code
+accepted by them will be available under their choice of license.
diff --git a/patches/0001-Vanadium/LICENSE.Apache-2.0-note b/patches/0001-Vanadium/LICENSE.Apache-2.0-note
new file mode 100644
index 0000000..84c8fed
--- /dev/null
+++ b/patches/0001-Vanadium/LICENSE.Apache-2.0-note
@@ -0,0 +1,4 @@
+The Vanadium code may be used as part of a work containing code licensed as
+Apache 2. An exception is made for the specific patent clause of the Apache 2
+license. This exception does not permit using our code in a project containing
+GPLv3 code which has additional restrictions.
diff --git a/patches/0001-Vanadium/LICENSE.GPL-2.0 b/patches/0001-Vanadium/LICENSE.GPL-2.0
new file mode 100644
index 0000000..d159169
--- /dev/null
+++ b/patches/0001-Vanadium/LICENSE.GPL-2.0
@@ -0,0 +1,339 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users. This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it. (Some other Free Software Foundation software is covered by
+the GNU Lesser General Public License instead.) You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have. You must make sure that they, too, receive or can get the
+source code. And you must show them these terms so they know their
+rights.
+
+ We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+ Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary. To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ GNU GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License. The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language. (Hereinafter, translation is included without limitation in
+the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+ 1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+ 2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) You must cause the modified files to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ b) You must cause any work that you distribute or publish, that in
+ whole or in part contains or is derived from the Program or any
+ part thereof, to be licensed as a whole at no charge to all third
+ parties under the terms of this License.
+
+ c) If the modified program normally reads commands interactively
+ when run, you must cause it, when started running for such
+ interactive use in the most ordinary way, to print or display an
+ announcement including an appropriate copyright notice and a
+ notice that there is no warranty (or else, saying that you provide
+ a warranty) and that users may redistribute the program under
+ these conditions, and telling the user how to view a copy of this
+ License. (Exception: if the Program itself is interactive but
+ does not normally print such an announcement, your work based on
+ the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+ a) Accompany it with the complete corresponding machine-readable
+ source code, which must be distributed under the terms of Sections
+ 1 and 2 above on a medium customarily used for software interchange; or,
+
+ b) Accompany it with a written offer, valid for at least three
+ years, to give any third party, for a charge no more than your
+ cost of physically performing source distribution, a complete
+ machine-readable copy of the corresponding source code, to be
+ distributed under the terms of Sections 1 and 2 above on a medium
+ customarily used for software interchange; or,
+
+ c) Accompany it with the information you received as to the offer
+ to distribute corresponding source code. (This alternative is
+ allowed only for noncommercial distribution and only if you
+ received the program in object code or executable form with such
+ an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it. For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable. However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+ 5. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Program or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+ 6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+ 7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all. For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded. In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+ 9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation. If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+ 10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission. For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this. Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+ NO WARRANTY
+
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+
+ Copyright (C)
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this program; if not, write to the Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+ Gnomovision version 69, Copyright (C) year name of author
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+ , 1 April 1989
+ Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs. If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library. If this is what you want to do, use the GNU Lesser General
+Public License instead of this License.
diff --git a/patches/0001-Vanadium/LICENSE.WebView-note b/patches/0001-Vanadium/LICENSE.WebView-note
new file mode 100644
index 0000000..a791cf3
--- /dev/null
+++ b/patches/0001-Vanadium/LICENSE.WebView-note
@@ -0,0 +1,3 @@
+Applications using Vanadium through the WebView library including our changes
+and extensions to the API are not considered derivative works of Vanadium for
+the terms of the GPL-2.0 license.
diff --git a/patches/0002-LineageOS/0001-Add-support-for-getting-updates-for-theme-color-chan.patch b/patches/0002-LineageOS/0001-Add-support-for-getting-updates-for-theme-color-chan.patch
new file mode 100644
index 0000000..e22bf61
--- /dev/null
+++ b/patches/0002-LineageOS/0001-Add-support-for-getting-updates-for-theme-color-chan.patch
@@ -0,0 +1,210 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Danny Baumann
+Date: Thu, 18 May 2017 11:04:40 +0200
+Subject: [PATCH] Add support for getting updates for theme color changes.
+
+---
+ .../webview/chromium/WebViewChromium.java | 9 +++++
+ .../WebViewContentsClientAdapter.java | 34 +++++++++++++++++++
+ .../android_webview/AwContentsClient.java | 2 ++
+ .../AwContentsClientCallbackHelper.java | 11 ++++++
+ .../AwWebContentsObserver.java | 15 ++++++++
+ .../test/NullContentsClient.java | 4 +++
+ 6 files changed, 75 insertions(+)
+
+diff --git a/android_webview/glue/java/src/com/android/webview/chromium/WebViewChromium.java b/android_webview/glue/java/src/com/android/webview/chromium/WebViewChromium.java
+index 38b5fff802e1e..148f632261f48 100644
+--- a/android_webview/glue/java/src/com/android/webview/chromium/WebViewChromium.java
++++ b/android_webview/glue/java/src/com/android/webview/chromium/WebViewChromium.java
+@@ -10,6 +10,7 @@ import android.content.Intent;
+ import android.content.res.Configuration;
+ import android.graphics.Bitmap;
+ import android.graphics.Canvas;
++import android.graphics.Color;
+ import android.graphics.Paint;
+ import android.graphics.Picture;
+ import android.graphics.Rect;
+@@ -75,6 +76,7 @@ import org.chromium.components.embedder_support.application.ClassLoaderContextWr
+ import org.chromium.content_public.browser.MessagePayload;
+ import org.chromium.content_public.browser.NavigationHistory;
+ import org.chromium.content_public.browser.SmartClipProvider;
++import org.chromium.content_public.browser.WebContents;
+ import org.chromium.url.GURL;
+
+ import java.io.BufferedWriter;
+@@ -1371,6 +1373,13 @@ class WebViewChromium implements WebViewProvider, WebViewProvider.ScrollDelegate
+ return mAwContents.getMostRecentProgress();
+ }
+
++ public int getThemeColor() {
++ WebContents webContents = mAwContents != null ? mAwContents.getWebContents() : null;
++ if (webContents == null) return Color.TRANSPARENT;
++ // No checkThread() because the value is cached java side (workaround for b/10533304).
++ return webContents.getThemeColor();
++ }
++
+ @Override
+ public int getContentHeight() {
+ recordWebViewApiCall(ApiCall.GET_CONTENT_HEIGHT);
+diff --git a/android_webview/glue/java/src/com/android/webview/chromium/WebViewContentsClientAdapter.java b/android_webview/glue/java/src/com/android/webview/chromium/WebViewContentsClientAdapter.java
+index d1c3f5606ef80..9c8d2c1d7db76 100644
+--- a/android_webview/glue/java/src/com/android/webview/chromium/WebViewContentsClientAdapter.java
++++ b/android_webview/glue/java/src/com/android/webview/chromium/WebViewContentsClientAdapter.java
+@@ -57,6 +57,8 @@ import org.chromium.base.task.TaskTraits;
+ import org.chromium.components.embedder_support.util.WebResourceResponseInfo;
+
+ import java.lang.ref.WeakReference;
++import java.lang.reflect.InvocationTargetException;
++import java.lang.reflect.Method;
+ import java.security.Principal;
+ import java.security.PrivateKey;
+ import java.security.cert.X509Certificate;
+@@ -99,6 +101,9 @@ class WebViewContentsClientAdapter extends SharedWebViewContentsClientAdapter {
+ private WeakHashMap>
+ mOngoingPermissionRequests;
+
++ private static Method sWebChromeClientThemeColorMethod;
++ private static boolean sWebChromeClientThemeColorMethodInitialized;
++
+ /**
+ * Adapter constructor.
+ *
+@@ -110,6 +115,17 @@ class WebViewContentsClientAdapter extends SharedWebViewContentsClientAdapter {
+ super(webView, webViewDelegate, context);
+ try (ScopedSysTraceEvent event =
+ ScopedSysTraceEvent.scoped("WebViewContentsClientAdapter.constructor")) {
++
++ if (!sWebChromeClientThemeColorMethodInitialized) {
++ try {
++ sWebChromeClientThemeColorMethod = WebChromeClient.class.getMethod(
++ "onThemeColorChanged", WebView.class, Integer.TYPE);
++ } catch (Exception e) {
++ // ignored
++ }
++ sWebChromeClientThemeColorMethodInitialized = true;
++ }
++
+ // See //android_webview/docs/how-does-on-create-window-work.md for more details.
+ mUiThreadHandler = new Handler() {
+ @Override
+@@ -1037,6 +1053,24 @@ class WebViewContentsClientAdapter extends SharedWebViewContentsClientAdapter {
+ }
+ }
+
++ /**
++ * @see AwContentsClient#onThemeColorChanged(int)
++ */
++ @Override
++ public void onThemeColorChanged(int color) {
++ try {
++ TraceEvent.begin("WebViewContentsClientAdapter.onThemeColorChanged");
++ if (mWebChromeClient != null && sWebChromeClientThemeColorMethod != null) {
++ if (TRACE) Log.d(TAG, "onThemeColorChanged=" + color);
++ sWebChromeClientThemeColorMethod.invoke(mWebChromeClient, mWebView, color);
++ }
++ } catch (IllegalAccessException | InvocationTargetException e) {
++ // ignored
++ } finally {
++ TraceEvent.end("WebViewContentsClientAdapter.onThemeColorChanged");
++ }
++ }
++
+ private static class AwHttpAuthHandlerAdapter extends android.webkit.HttpAuthHandler {
+ private AwHttpAuthHandler mAwHandler;
+
+diff --git a/android_webview/java/src/org/chromium/android_webview/AwContentsClient.java b/android_webview/java/src/org/chromium/android_webview/AwContentsClient.java
+index b842bcc9b3f84..cab7751b7cdf1 100644
+--- a/android_webview/java/src/org/chromium/android_webview/AwContentsClient.java
++++ b/android_webview/java/src/org/chromium/android_webview/AwContentsClient.java
+@@ -170,6 +170,8 @@ public abstract class AwContentsClient {
+
+ public abstract void onProgressChanged(int progress);
+
++ public abstract void onThemeColorChanged(int color);
++
+ public abstract WebResourceResponseInfo shouldInterceptRequest(AwWebResourceRequest request);
+
+ public abstract boolean shouldOverrideKeyEvent(KeyEvent event);
+diff --git a/android_webview/java/src/org/chromium/android_webview/AwContentsClientCallbackHelper.java b/android_webview/java/src/org/chromium/android_webview/AwContentsClientCallbackHelper.java
+index 29ad12ad713be..6370748819511 100644
+--- a/android_webview/java/src/org/chromium/android_webview/AwContentsClientCallbackHelper.java
++++ b/android_webview/java/src/org/chromium/android_webview/AwContentsClientCallbackHelper.java
+@@ -134,6 +134,9 @@ public class AwContentsClientCallbackHelper {
+ private static final int MSG_ON_FORM_RESUBMISSION = 14;
+ private static final int MSG_ON_SAFE_BROWSING_HIT = 15;
+
++ // Custom
++ private static final int MSG_ON_THEME_COLOR_CHANGED = 99;
++
+ // Minimum period allowed between consecutive onNewPicture calls, to rate-limit the callbacks.
+ private static final long ON_NEW_PICTURE_MIN_PERIOD_MILLIS = 500;
+ // Timestamp of the most recent onNewPicture callback.
+@@ -229,6 +232,10 @@ public class AwContentsClientCallbackHelper {
+ mContentsClient.onProgressChanged(msg.arg1);
+ break;
+ }
++ case MSG_ON_THEME_COLOR_CHANGED: {
++ mContentsClient.onThemeColorChanged(msg.arg1);
++ break;
++ }
+ case MSG_SYNTHESIZE_PAGE_LOADING: {
+ final String url = (String) msg.obj;
+ mContentsClient.onPageStarted(url);
+@@ -341,6 +348,10 @@ public class AwContentsClientCallbackHelper {
+ mHandler.sendMessage(mHandler.obtainMessage(MSG_SYNTHESIZE_PAGE_LOADING, url));
+ }
+
++ public void postOnThemeColorChanged(int color) {
++ mHandler.sendMessage(mHandler.obtainMessage(MSG_ON_THEME_COLOR_CHANGED, color, 0));
++ }
++
+ public void postDoUpdateVisitedHistory(String url, boolean isReload) {
+ DoUpdateVisitedHistoryInfo info = new DoUpdateVisitedHistoryInfo(url, isReload);
+ mHandler.sendMessage(mHandler.obtainMessage(MSG_DO_UPDATE_VISITED_HISTORY, info));
+diff --git a/android_webview/java/src/org/chromium/android_webview/AwWebContentsObserver.java b/android_webview/java/src/org/chromium/android_webview/AwWebContentsObserver.java
+index 6b6b16075b8b2..2e814fa3fa0df 100644
+--- a/android_webview/java/src/org/chromium/android_webview/AwWebContentsObserver.java
++++ b/android_webview/java/src/org/chromium/android_webview/AwWebContentsObserver.java
+@@ -164,12 +164,27 @@ public class AwWebContentsObserver extends WebContentsObserver {
+ });
+ }
+
++ if (client != null) {
++ AwContents awContents = mAwContents.get();
++ WebContents contents = awContents != null ? awContents.getWebContents() : null;
++ if (contents != null) {
++ client.getCallbackHelper().postOnThemeColorChanged(contents.getThemeColor());
++ }
++ }
++
+ if (client != null && navigation.isPrimaryMainFrameFragmentNavigation()) {
+ // Note fragment navigations do not have a matching onPageStarted.
+ client.getCallbackHelper().postOnPageFinished(url);
+ }
+ }
+
++ public void didChangeThemeColor(int color) {
++ AwContentsClient client = mAwContentsClient.get();
++ if (client != null) {
++ client.getCallbackHelper().postOnThemeColorChanged(color);
++ }
++ }
++
+ public boolean didEverCommitNavigation() {
+ return mCommittedNavigation;
+ }
+diff --git a/android_webview/test/shell/src/org/chromium/android_webview/test/NullContentsClient.java b/android_webview/test/shell/src/org/chromium/android_webview/test/NullContentsClient.java
+index 198ae543a6a66..5465d1438a4e4 100644
+--- a/android_webview/test/shell/src/org/chromium/android_webview/test/NullContentsClient.java
++++ b/android_webview/test/shell/src/org/chromium/android_webview/test/NullContentsClient.java
+@@ -72,6 +72,10 @@ public class NullContentsClient extends AwContentsClient {
+ public void onProgressChanged(int progress) {
+ }
+
++ @Override
++ public void onThemeColorChanged(int color) {
++ }
++
+ @Override
+ public WebResourceResponseInfo shouldInterceptRequest(
+ AwContentsClient.AwWebResourceRequest request) {
diff --git a/patches/0002-LineageOS/0002-Add-xxxhdpi-icon_webview.png-to-BUILD.gn.patch b/patches/0002-LineageOS/0002-Add-xxxhdpi-icon_webview.png-to-BUILD.gn.patch
new file mode 100644
index 0000000..b6b0a88
--- /dev/null
+++ b/patches/0002-LineageOS/0002-Add-xxxhdpi-icon_webview.png-to-BUILD.gn.patch
@@ -0,0 +1,21 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: "Kevin F. Haggerty"
+Date: Tue, 19 May 2020 17:21:42 -0600
+Subject: [PATCH] Add xxxhdpi icon_webview.png to BUILD.gn
+
+---
+ android_webview/nonembedded/BUILD.gn | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/android_webview/nonembedded/BUILD.gn b/android_webview/nonembedded/BUILD.gn
+index 06c44fd47ba33..626e7a3fdce67 100644
+--- a/android_webview/nonembedded/BUILD.gn
++++ b/android_webview/nonembedded/BUILD.gn
+@@ -203,6 +203,7 @@ android_resources("icon_resources") {
+ "java/res_icon/drawable-mdpi/icon_webview.png",
+ "java/res_icon/drawable-xhdpi/icon_webview.png",
+ "java/res_icon/drawable-xxhdpi/icon_webview.png",
++ "java/res_icon/drawable-xxxhdpi/icon_webview.png",
+ ]
+ }
+
diff --git a/patches/0002-LineageOS/0003-webview-Hard-no-to-persistent-histograms.patch b/patches/0002-LineageOS/0003-webview-Hard-no-to-persistent-histograms.patch
new file mode 100644
index 0000000..7f368ba
--- /dev/null
+++ b/patches/0002-LineageOS/0003-webview-Hard-no-to-persistent-histograms.patch
@@ -0,0 +1,34 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: "Kevin F. Haggerty"
+Date: Sun, 27 Dec 2020 09:42:54 -0700
+Subject: [PATCH] webview: Hard no to persistent histograms
+
+* It's probably some kind of bug somewhere that these are never
+ deleted, but they don't really add value to us in the first
+ place.
+* Stop eating 4MB every single time any app that uses webview
+ ever opens.
+* These were guarded by a feature check before
+ https://chromium.googlesource.com/chromium/src/+/b86102f2a243
+---
+ android_webview/browser/aw_field_trials.cc | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/android_webview/browser/aw_field_trials.cc b/android_webview/browser/aw_field_trials.cc
+index f6f167cb88916..3252a46a6f1b1 100644
+--- a/android_webview/browser/aw_field_trials.cc
++++ b/android_webview/browser/aw_field_trials.cc
+@@ -11,6 +11,7 @@
+ #include "components/metrics/persistent_histograms.h"
+
+ void AwFieldTrials::OnVariationsSetupComplete() {
++#if 0
+ // Persistent histograms must be enabled ASAP, but depends on Features.
+ base::FilePath metrics_dir;
+ if (base::PathService::Get(base::DIR_ANDROID_APP_DATA, &metrics_dir)) {
+@@ -18,4 +19,5 @@ void AwFieldTrials::OnVariationsSetupComplete() {
+ } else {
+ NOTREACHED();
+ }
++#endif
+ }
diff --git a/patches/0002-LineageOS/0005-webview-Disable-autofill-metadata-uploads-by-default.patch b/patches/0002-LineageOS/0005-webview-Disable-autofill-metadata-uploads-by-default.patch
new file mode 100644
index 0000000..0c01b6d
--- /dev/null
+++ b/patches/0002-LineageOS/0005-webview-Disable-autofill-metadata-uploads-by-default.patch
@@ -0,0 +1,24 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: "Kevin F. Haggerty"
+Date: Tue, 28 Sep 2021 08:43:01 -0600
+Subject: [PATCH] webview: Disable autofill metadata uploads by default
+
+* [haggertk - 2021-11-16] - Update per d85f6c03db147
+ (Reland "[Autofill] Inline kAutofillMetadataUploads")
+---
+ components/autofill/core/browser/randomized_encoder.cc | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/components/autofill/core/browser/randomized_encoder.cc b/components/autofill/core/browser/randomized_encoder.cc
+index 376849e083fa8..0d3bc03b66b6e 100644
+--- a/components/autofill/core/browser/randomized_encoder.cc
++++ b/components/autofill/core/browser/randomized_encoder.cc
+@@ -187,7 +187,7 @@ const char RandomizedEncoder::kUrlKeyedAnonymizedDataCollectionEnabled[] =
+ std::unique_ptr RandomizedEncoder::Create(
+ PrefService* pref_service) {
+ // Early abort if metadata uploads are not enabled.
+- if (!pref_service) {
++ if (!pref_service || (true)) {
+ return nullptr;
+ }
+
diff --git a/patches/0003-LeOS/1-19/000-Bromite-subresource-adblocker.patch b/patches/0003-LeOS/1-19/000-Bromite-subresource-adblocker.patch
new file mode 100644
index 0000000..4aa87b6
--- /dev/null
+++ b/patches/0003-LeOS/1-19/000-Bromite-subresource-adblocker.patch
@@ -0,0 +1,1878 @@
+From: csagan5 <32685696+csagan5@users.noreply.github.com>
+Date: Sat, 14 Sep 2019 10:20:08 +0200
+Subject: Bromite subresource adblocker
+
+Add option to configure the ad blocker filters URL
+Disable look-alike, metrics, ablation and navigation throttles
+Do not use experiments to enable/disable presets
+Always enable ad filtering
+Download filters by checking Last-Modified header first
+Fix RestoreForeignSessionTab by recreating the tab (issue #681)
+Enable AutomaticLazyFrameLoadingToAds and AutomaticLazyFrameLoadingToEmbeds features
+
+License: GPL-3.0-only - https://spdx.org/licenses/GPL-3.0-only.html
+Change-Id: I09c0504269c659e0f125dfa982148b705cd6528b
+---
+ chrome/android/BUILD.gn | 1 +
+ chrome/android/chrome_java_resources.gni | 2 +
+ chrome/android/chrome_java_sources.gni | 2 +
+ .../java/res/layout/adblock_editor.xml | 67 +++++
+ chrome/android/java/res/values/styles.xml | 18 ++
+ chrome/android/java/res/values/values.xml | 2 +
+ .../java/res/xml/adblock_preferences.xml | 25 ++
+ .../android/java/res/xml/main_preferences.xml | 5 +
+ .../browser/settings/AdBlockEditor.java | 91 ++++++
+ .../browser/settings/AdBlockPreferences.java | 61 ++++
+ .../chrome/browser/tabmodel/TabModelImpl.java | 2 +-
+ chrome/app/generated_resources.grd | 10 +
+ chrome/browser/after_startup_task_utils.cc | 4 +
+ chrome/browser/browser_process.h | 6 +
+ chrome/browser/browser_process_impl.cc | 20 ++
+ chrome/browser/browser_process_impl.h | 2 +
+ chrome/browser/chrome_browser_main.cc | 3 +
+ .../flags/android/cached_feature_flags.cc | 11 +
+ .../browser/flags/CachedFeatureFlags.java | 10 +
+ .../net/system_network_context_manager.cc | 4 +
+ .../sessions/session_restore_android.cc | 4 +-
+ .../strings/android_chrome_strings.grd | 14 +
+ chrome/common/pref_names.cc | 3 +
+ chrome/common/pref_names.h | 1 +
+ .../strings/android/site_settings.grdp | 4 +-
+ components/component_updater/BUILD.gn | 7 +
+ .../adblock_updater_service.cc | 268 ++++++++++++++++++
+ .../adblock_updater_service.h | 98 +++++++
+ .../download_filters_task.cc | 222 +++++++++++++++
+ .../component_updater/download_filters_task.h | 129 +++++++++
+ ...ent_subresource_filter_throttle_manager.cc | 11 +
+ .../content/browser/ruleset_service.cc | 33 ++-
+ .../content/browser/ruleset_service.h | 7 +-
+ .../content/browser/ruleset_version.h | 4 +
+ .../browser/verified_ruleset_dealer.cc | 4 +
+ .../browser/subresource_filter_features.cc | 116 +-------
+ .../core/common/indexed_ruleset.cc | 5 +-
+ .../navigation_throttle_runner.cc | 5 -
+ third_party/blink/common/features.cc | 12 +-
+ 39 files changed, 1158 insertions(+), 135 deletions(-)
+ create mode 100644 chrome/android/java/res/layout/adblock_editor.xml
+ create mode 100644 chrome/android/java/res/xml/adblock_preferences.xml
+ create mode 100644 chrome/android/java/src/org/chromium/chrome/browser/settings/AdBlockEditor.java
+ create mode 100644 chrome/android/java/src/org/chromium/chrome/browser/settings/AdBlockPreferences.java
+ create mode 100644 components/component_updater/adblock_updater_service.cc
+ create mode 100644 components/component_updater/adblock_updater_service.h
+ create mode 100644 components/component_updater/download_filters_task.cc
+ create mode 100644 components/component_updater/download_filters_task.h
+
+diff --git a/chrome/android/BUILD.gn b/chrome/android/BUILD.gn
+--- a/chrome/android/BUILD.gn
++++ b/chrome/android/BUILD.gn
+@@ -253,6 +253,7 @@ if (current_toolchain == default_toolchain) {
+ "//chrome/android/modules/image_editor/provider:java",
+ "//chrome/android/modules/stack_unwinder/provider:java",
+ "//chrome/android/webapk/libs/client:client_java",
++ "//chrome/browser/endpoint_fetcher:java",
+ "//chrome/android/webapk/libs/common:common_java",
+ "//chrome/android/webapk/libs/common:splash_java",
+ "//chrome/android/webapk/libs/runtime_library:webapk_service_aidl_java",
+diff --git a/chrome/android/chrome_java_sources.gni b/chrome/android/chrome_java_sources.gni
+--- a/chrome/android/chrome_java_sources.gni
++++ b/chrome/android/chrome_java_sources.gni
+@@ -941,6 +941,8 @@ chrome_java_sources = [
+ "java/src/org/chromium/chrome/browser/permissions/PermissionSettingsBridge.java",
+ "java/src/org/chromium/chrome/browser/permissions/PermissionUpdateRequester.java",
+ "java/src/org/chromium/chrome/browser/photo_picker/DecoderServiceImpl.java",
++ "java/src/org/chromium/chrome/browser/settings/AdBlockEditor.java",
++ "java/src/org/chromium/chrome/browser/settings/AdBlockPreferences.java",
+ "java/src/org/chromium/chrome/browser/policy/PolicyAuditor.java",
+ "java/src/org/chromium/chrome/browser/policy/PolicyAuditorBridge.java",
+ "java/src/org/chromium/chrome/browser/prerender/ChromePrerenderServiceImpl.java",
+diff --git a/chrome/android/java/res/layout/adblock_editor.xml b/chrome/android/java/res/layout/adblock_editor.xml
+new file mode 100644
+index 0000000000000000000000000000000000000000..aced0dbca5a2be7e2dc03207a757a6c0c1e654e1
+--- /dev/null
++++ b/chrome/android/java/res/layout/adblock_editor.xml
+@@ -0,0 +1,67 @@
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
+diff --git a/chrome/android/java/res/values/styles.xml b/chrome/android/java/res/values/styles.xml
+--- a/chrome/android/java/res/values/styles.xml
++++ b/chrome/android/java/res/values/styles.xml
+@@ -224,6 +224,24 @@ found in the LICENSE file.
+
+
+
++
++
++
++
+
+