diff --git a/build.sh b/build.sh index cf2c491a02d506b275c904b0e6c639e1172db4a1..0357ab0f654b251e4af8ab7e2514a329301c684f 100755 --- a/build.sh +++ b/build.sh @@ -115,6 +115,13 @@ patch() { git am -C0 -3 --ignore-whitespace "${root_dir}/build/e_patches/$file" done + while read dir patch; do + [ -z "$dir" ] && continue # skip empty lines + cd $chromium_dir/src/third_party/$dir + git am -C0 -3 --ignore-whitespace "${root_dir}/build/third_party/$patch" + cd $chromium_dir/src + done < "${root_dir}/build/third_party_patches_list.txt" + # Rename Chrome to Browser rename diff --git a/build/e_patches/Add-Mojeek-Search-engine.patch b/build/e_patches/Add-Mojeek-Search-engine.patch index 0e004e6d099d0d6202e5d0fe0197ad3aad22fb41..3c34c33bd7a412b43d3468980f5bfe16fcd11c43 100644 --- a/build/e_patches/Add-Mojeek-Search-engine.patch +++ b/build/e_patches/Add-Mojeek-Search-engine.patch @@ -1,4 +1,4 @@ -From e6d957ecae604d43ffcc3d47a13baff64d9fde44 Mon Sep 17 00:00:00 2001 +From 95389da2dc6c832af501fc1a2e1f64fbc603777d Mon Sep 17 00:00:00 2001 From: TheScarastic Date: Wed, 16 Nov 2022 11:14:01 +0000 Subject: Add Mojeek Search engine @@ -8,10 +8,10 @@ Subject: Add Mojeek Search engine 1 file changed, 1 insertion(+) diff --git a/components/search_engines/search_engine_countries-inc.cc b/components/search_engines/search_engine_countries-inc.cc -index 38964682da20f..ae5b4298d910e 100644 +index 2184d45677dcd..29cca1a481e63 100644 --- a/components/search_engines/search_engine_countries-inc.cc +++ b/components/search_engines/search_engine_countries-inc.cc -@@ -42,6 +42,7 @@ constexpr EngineAndTier engines_default[] = { +@@ -43,6 +43,7 @@ constexpr EngineAndTier engines_default[] = { {SearchEngineTier::kTopEngines, &qwant}, {SearchEngineTier::kTopEngines, &duckduckgo}, {SearchEngineTier::kTopEngines, &duckduckgo_light}, @@ -20,5 +20,5 @@ index 38964682da20f..ae5b4298d910e 100644 // Note, the below entries are sorted by country code, not the name in comment. -- -2.48.1 +2.34.1 diff --git a/build/e_patches/Browser-Modify-default-search-engines.patch b/build/e_patches/Browser-Modify-default-search-engines.patch index ae323ba55cb6ddd8e90018a92acf8e3b2b120fd1..305e1a382c2f78dd9014577ea023d75df5fb58db 100644 --- a/build/e_patches/Browser-Modify-default-search-engines.patch +++ b/build/e_patches/Browser-Modify-default-search-engines.patch @@ -1,23 +1,25 @@ -From a583aa33914da82d3a76a5cb71da25f105b0dc32 Mon Sep 17 00:00:00 2001 +From 7461780b80b4b4bd73f8a1c5fbbc16c431be74e4 Mon Sep 17 00:00:00 2001 From: Aayush Gupta Date: Thu, 18 Mar 2021 13:42:44 +0100 Subject: Browser: Modify default search engines Signed-off-by: althafvly + +Co-authored-by: althafvly --- .../locale/locale_template_url_loader.cc | 42 ++----------------- .../locale/locale_template_url_loader.h | 1 - .../browser/locale/LocaleManagerDelegate.java | 1 - .../locale/LocaleTemplateUrlLoader.java | 8 ---- - .../cromite/cromite_prepopulated_engines.json | 10 +++++ - .../search_engine_countries-inc.cc | 7 ++-- - .../search_engines/search_engine_type.h | 3 +- + .../cromite/cromite_prepopulated_engines.json | 32 ++++++++++++++ + .../search_engine_countries-inc.cc | 8 ++-- + .../search_engines/search_engine_type.h | 4 +- .../search_engines/search_engine_utils.cc | 12 +----- .../template_url_prepopulate_data.cc | 7 +++- - 9 files changed, 26 insertions(+), 65 deletions(-) + 9 files changed, 50 insertions(+), 65 deletions(-) diff --git a/chrome/browser/android/locale/locale_template_url_loader.cc b/chrome/browser/android/locale/locale_template_url_loader.cc -index 1cb4b8bd94469..412d2a7b29faf 100644 +index 1cb4b8bd94469..d65f18f980387 100644 --- a/chrome/browser/android/locale/locale_template_url_loader.cc +++ b/chrome/browser/android/locale/locale_template_url_loader.cc @@ -11,6 +11,7 @@ @@ -93,7 +95,7 @@ index 1cb4b8bd94469..412d2a7b29faf 100644 int LocaleTemplateUrlLoader::GetDesignatedSearchEngineForChina() { - return TemplateURLPrepopulateData::sogou.id; -+ return TemplateURLPrepopulateData::espot.id; ++ return TemplateURLPrepopulateData::murenasearch.id; } LocaleTemplateUrlLoader::~LocaleTemplateUrlLoader() = default; @@ -147,20 +149,42 @@ index a5ba6b961e6b0..52295c0b59e19 100644 } } diff --git a/components/search_engines/cromite/cromite_prepopulated_engines.json b/components/search_engines/cromite/cromite_prepopulated_engines.json -index 0d2ebbf08bfc7..d40c9982737d2 100644 +index 0d2ebbf08bfc7..9a7616e880b02 100644 --- a/components/search_engines/cromite/cromite_prepopulated_engines.json +++ b/components/search_engines/cromite/cromite_prepopulated_engines.json -@@ -13,6 +13,16 @@ +@@ -13,6 +13,38 @@ "id": 12 }, -+ "espot": { ++ "murenasearch": { ++ "name": "Murena Search", ++ "keyword": "murena.qwant.com", ++ "favicon_url": "https://www.qwant.com/favicon.ico", ++ "search_url": "https://murena.qwant.com/?q={searchTerms}", ++ "suggest_url": "https://api.qwant.com/api/suggest/?q={searchTerms}", ++ "type": "SEARCH_ENGINE_MURENASEARCH", ++ "id": 10, ++ "regulatory_extensions": [ ++ { ++ "variant": "RegulatoryExtensionType::kDefault", ++ "search_params": "client=cs-chrome", ++ "suggest_params": "client=opensearch" ++ }, ++ { ++ "variant": "RegulatoryExtensionType::kAndroidEEA", ++ "search_params": "client=acs", ++ "suggest_params": "client=opensearch" ++ } ++ ] ++ }, ++ ++ "spot": { + "name": "/e/ spot", + "keyword": "spot.murena.io", + "favicon_url": "https://spot.murena.io/favicon.ico", + "search_url": "https://spot.murena.io/?q={searchTerms}", + "suggest_url": "https://ac.duckduckgo.com/ac/?q={searchTerms}&type=list", -+ "type": "SEARCH_ENGINE_ESPOT", ++ "type": "SEARCH_ENGINE_SPOT", + "id": 11 + }, + @@ -168,17 +192,18 @@ index 0d2ebbf08bfc7..d40c9982737d2 100644 "name": "Google in English", "keyword": "googleen", diff --git a/components/search_engines/search_engine_countries-inc.cc b/components/search_engines/search_engine_countries-inc.cc -index 235377432cf9c..38964682da20f 100644 +index 235377432cf9c..2184d45677dcd 100644 --- a/components/search_engines/search_engine_countries-inc.cc +++ b/components/search_engines/search_engine_countries-inc.cc -@@ -38,9 +38,10 @@ struct EngineAndTier { +@@ -38,9 +38,11 @@ struct EngineAndTier { // Default (for countries with no better engine set) constexpr EngineAndTier engines_default[] = { - {SearchEngineTier::kTopEngines, &google}, - {SearchEngineTier::kTopEngines, &bing}, - {SearchEngineTier::kTopEngines, &yahoo}, -+ {SearchEngineTier::kTopEngines, &espot}, ++ {SearchEngineTier::kTopEngines, &murenasearch}, ++ {SearchEngineTier::kTopEngines, &spot}, + {SearchEngineTier::kTopEngines, &qwant}, + {SearchEngineTier::kTopEngines, &duckduckgo}, + {SearchEngineTier::kTopEngines, &duckduckgo_light}, @@ -186,20 +211,21 @@ index 235377432cf9c..38964682da20f 100644 // Note, the below entries are sorted by country code, not the name in comment. diff --git a/components/search_engines/search_engine_type.h b/components/search_engines/search_engine_type.h -index 18413c59ccdfd..2a53f07d642d8 100644 +index 18413c59ccdfd..0b33877ee8bac 100644 --- a/components/search_engines/search_engine_type.h +++ b/components/search_engines/search_engine_type.h -@@ -93,11 +93,12 @@ enum SearchEngineType { +@@ -93,11 +93,13 @@ enum SearchEngineType { SEARCH_ENGINE_LILO = 74, SEARCH_ENGINE_GOOGLE_EN = 75, SEARCH_ENGINE_DUCKDUCKGOLIGHT = 76, -+ SEARCH_ENGINE_ESPOT = 77, ++ SEARCH_ENGINE_MURENASEARCH = 77, ++ SEARCH_ENGINE_SPOT = 78, SEARCH_ENGINE_MAX // Bounding value needed for UMA histogram macro. }; -static_assert(SEARCH_ENGINE_DUCKDUCKGOLIGHT == (SEARCH_ENGINE_MAX - 1), -+static_assert(SEARCH_ENGINE_ESPOT == (SEARCH_ENGINE_MAX - 1), ++static_assert(SEARCH_ENGINE_SPOT == (SEARCH_ENGINE_MAX - 1), "Please check this patch"); // Enum to record the type of search engine a user used in keyword mode. This @@ -227,7 +253,7 @@ index 4b32c2424922b..9808a5e92ff3a 100644 if (SameDomain(url, GURL(engine->search_url))) { return engine->type; diff --git a/components/search_engines/template_url_prepopulate_data.cc b/components/search_engines/template_url_prepopulate_data.cc -index 5738c4f9853c7..e3dc518996051 100644 +index 5738c4f9853c7..8c9beddc44a59 100644 --- a/components/search_engines/template_url_prepopulate_data.cc +++ b/components/search_engines/template_url_prepopulate_data.cc @@ -86,6 +86,11 @@ GetPrepopulatedEnginesForEeaRegionCountries(int country_id, @@ -247,10 +273,10 @@ index 5738c4f9853c7..e3dc518996051 100644 search_engines::SearchEngineChoiceService* search_engine_choice_service) { return FindPrepopulatedEngineInternal(prefs, search_engine_choice_service, - google.id, -+ espot.id, ++ murenasearch.id, /*use_first_as_fallback=*/true); } -- -2.48.1 +2.34.1 diff --git a/build/e_patches/Migrate-to-murena-search-from-spot.patch b/build/e_patches/Migrate-to-murena-search-from-spot.patch new file mode 100644 index 0000000000000000000000000000000000000000..94ebd7816c0609561239347dfaf46187bcfb435d --- /dev/null +++ b/build/e_patches/Migrate-to-murena-search-from-spot.patch @@ -0,0 +1,34 @@ +From a62d957aebbdf6f9ba96c2ccb520f67993713cde Mon Sep 17 00:00:00 2001 +From: althafvly +Date: Wed, 16 Apr 2025 16:46:11 +0000 +Subject: Migrate to murena search from spot + +Needed for apps where browser search engine is used for search in apps. +For example BlissLauncher3 +--- + .../chrome/browser/provider/SearchEngineProvider.java | 9 ++++++++- + 1 file changed, 8 insertions(+), 1 deletion(-) + +diff --git a/chrome/android/java/src/org/chromium/chrome/browser/provider/SearchEngineProvider.java b/chrome/android/java/src/org/chromium/chrome/browser/provider/SearchEngineProvider.java +index 299562413fe05..2d1741e8f6b3d 100644 +--- a/chrome/android/java/src/org/chromium/chrome/browser/provider/SearchEngineProvider.java ++++ b/chrome/android/java/src/org/chromium/chrome/browser/provider/SearchEngineProvider.java +@@ -62,7 +62,14 @@ public class SearchEngineProvider extends ContentProvider { + SharedPreferences sharedPreferences = getContext().getSharedPreferences( + CONFIGURATION_PREFERENCE_FILE_NAME, Context.MODE_PRIVATE); + if (sharedPreferences != null) { +- rowBuilder.add(sharedPreferences.getString(PREFERENCE_KEY, "")); ++ String searchEngine = sharedPreferences.getString(PREFERENCE_KEY, ""); ++ if ("espot".equals(searchEngine)) { ++ // Update to murena search in preferences if it was espot ++ sharedPreferences.edit().putString(PREFERENCE_KEY, "murenasearch").apply(); ++ rowBuilder.add("murenasearch"); ++ } else { ++ rowBuilder.add(searchEngine); ++ } + } else { + rowBuilder.add(""); + } +-- +2.34.1 + diff --git a/build/e_patches/Update-default-sites.patch b/build/e_patches/Update-default-sites.patch index 5dcfa30d4f14a7283e4b355c30676172f4ffd90c..3040dc2d57ad133b7199499353233f7f7adcb12c 100644 --- a/build/e_patches/Update-default-sites.patch +++ b/build/e_patches/Update-default-sites.patch @@ -1,4 +1,4 @@ -From 9f0ca5bbd4ae4fddf87b12c748d908132991cceb Mon Sep 17 00:00:00 2001 +From 05fa947dd59ca105eecad07a769e49743d8068a8 Mon Sep 17 00:00:00 2001 From: Nishith Khanna Date: Thu, 11 Apr 2024 20:54:43 +0530 Subject: Update default sites @@ -8,7 +8,7 @@ Subject: Update default sites 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/components/ntp_tiles/resources/foundation_e.json b/components/ntp_tiles/resources/foundation_e.json -index 3c58051b91f8c..91b66bbdeb455 100644 +index 3c58051b91f8c..a69f31774ae0c 100644 --- a/components/ntp_tiles/resources/foundation_e.json +++ b/components/ntp_tiles/resources/foundation_e.json @@ -1,8 +1,13 @@ @@ -35,10 +35,10 @@ index 3c58051b91f8c..91b66bbdeb455 100644 + }, + { + "large_icon_url": "https://murena.com/wp-content/uploads/2022/11/murena-favicon.png", -+ "title": "/e/ Spot", -+ "url": "https://spot.murena.io/" ++ "title": "Murena Search", ++ "url": "https://murena.qwant.com/" } ] -- -2.48.1 +2.34.1 diff --git a/build/e_patches/Whitelist-murena-search.patch b/build/e_patches/Whitelist-murena-search.patch new file mode 100644 index 0000000000000000000000000000000000000000..d522b68ca6d7da89f624d15c34a193d4364ac788 --- /dev/null +++ b/build/e_patches/Whitelist-murena-search.patch @@ -0,0 +1,53 @@ +From c9d89a1e494a311b37bbf3aa43c58acda316aa1e Mon Sep 17 00:00:00 2001 +From: althafvly +Date: Wed, 16 Apr 2025 16:39:02 +0000 +Subject: Whitelist murena search + +--- + .../settings/AdblockAllowedDomainsFragment.java | 16 ++++++++++++++++ + 1 file changed, 16 insertions(+) + +diff --git a/components/adblock/android/java/src/org/chromium/components/adblock/settings/AdblockAllowedDomainsFragment.java b/components/adblock/android/java/src/org/chromium/components/adblock/settings/AdblockAllowedDomainsFragment.java +index d3fa1142c4a90..fc03240220242 100644 +--- a/components/adblock/android/java/src/org/chromium/components/adblock/settings/AdblockAllowedDomainsFragment.java ++++ b/components/adblock/android/java/src/org/chromium/components/adblock/settings/AdblockAllowedDomainsFragment.java +@@ -20,6 +20,8 @@ package org.chromium.components.adblock.settings; + import android.app.Activity; + import android.os.Bundle; + import android.view.View; ++import android.content.SharedPreferences; ++import android.content.Context; + + import org.chromium.components.adblock.AdblockController; + import org.chromium.components.adblock.R; +@@ -27,6 +29,8 @@ import org.chromium.components.adblock.R; + import java.util.List; + + public class AdblockAllowedDomainsFragment extends AdblockCustomItemFragment { ++ private static final String PREF_NAME = "adblock_domain_history"; ++ + public AdblockAllowedDomainsFragment() {} + + @Override +@@ -38,6 +42,18 @@ public class AdblockAllowedDomainsFragment extends AdblockCustomItemFragment allowedDomains = AdblockController.getInstance().getAllowedDomains(); ++ ++ if (!wasAdded && allowedDomains != null && !allowedDomains.contains(domain)) { ++ AdblockController.getInstance().addAllowedDomain(domain); ++ prefs.edit().putBoolean(domain, true).apply(); ++ } ++ } + } + + @Override +-- +2.34.1 + diff --git a/build/e_patches_list.txt b/build/e_patches_list.txt index 8f1395871ca191237306f067ab322c54e47123ef..f2eb64f1fe483f54117756d8449b626442b2b5f3 100644 --- a/build/e_patches_list.txt +++ b/build/e_patches_list.txt @@ -60,3 +60,5 @@ ungoogledchromium-Disable-Gaia.patch Disable-support-for-RAR-files-inspection.patch Browser-Fix-open-in-browser-text.patch Browser-Enable-external-intent-requests.patch +Whitelist-murena-search.patch +Migrate-to-murena-search-from-spot.patch diff --git a/build/third_party/bump-prepopulated-engine-data-version-to-update-exis.patch b/build/third_party/bump-prepopulated-engine-data-version-to-update-exis.patch new file mode 100644 index 0000000000000000000000000000000000000000..8f0f873b2cc8e39afa3465c90f3600b327eccff1 --- /dev/null +++ b/build/third_party/bump-prepopulated-engine-data-version-to-update-exis.patch @@ -0,0 +1,25 @@ +From 66d25a23d93202a55e985572432046f4efe7c21d Mon Sep 17 00:00:00 2001 +From: althafvly +Date: Wed, 16 Apr 2025 16:43:10 +0530 +Subject: [PATCH] bump prepopulated engine data version to update exisiting + +--- + definitions/prepopulated_engines.json | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/definitions/prepopulated_engines.json b/definitions/prepopulated_engines.json +index 1a331e7..43ba2aa 100644 +--- a/definitions/prepopulated_engines.json ++++ b/definitions/prepopulated_engines.json +@@ -26,7 +26,7 @@ + // existing data should get a new version. Otherwise, existing data may + // continue to be used and updates made here will not always appear. + // Also then run tools/search_engine_choice/generate_search_engine_icons.py. +- "kCurrentDataVersion": 170 ++ "kCurrentDataVersion": 171 + }, + + // The following engines are included in country lists and are added to the +-- +2.34.1 + diff --git a/build/third_party_patches_list.txt b/build/third_party_patches_list.txt new file mode 100644 index 0000000000000000000000000000000000000000..77963e87f9b962bb2da250147993a692806503e0 --- /dev/null +++ b/build/third_party_patches_list.txt @@ -0,0 +1 @@ +search_engines_data/resources bump-prepopulated-engine-data-version-to-update-exis.patch diff --git a/push.sh b/push.sh index cea07d9f394158be86c18e574365162eea013bc2..6a7915f9a2cc7097d9a437ba8e509a20eee0556d 100755 --- a/push.sh +++ b/push.sh @@ -1,13 +1,37 @@ -#!/usr/bin/env bash +#!/bin/bash -adb shell pm uninstall foundation.e.browser -adb shell pm uninstall com.android.webview -adb shell pm uninstall org.chromium.trichromelibrary +DO_UNINSTALL=false +DO_CLEAR=false -adb shell pm clear foundation.e.browser -adb shell pm clear com.android.webview -adb shell pm clear org.chromium.trichromelibrary +while getopts "uc" opt; do + case $opt in + u) DO_UNINSTALL=true ;; + c) DO_CLEAR=true ;; + *) echo "Usage: $0 [-u] [-c]" >&2 + exit 1 ;; + esac +done + +PACKAGES=( + "foundation.e.browser" + "com.android.webview" + "org.chromium.trichromelibrary" +) + +if [ "$DO_UNINSTALL" = true ]; then + for pkg in "${PACKAGES[@]}"; do + adb shell pm uninstall "$pkg" + done +fi + +if [ "$DO_CLEAR" = true ]; then + for pkg in "${PACKAGES[@]}"; do + adb shell pm clear "$pkg" + done +fi adb install -r apks/arm64/TrichromeLibrary.apk adb install -r apks/arm64/TrichromeWebView.apk adb install -r apks/arm64/TrichromeChrome.apk + +echo "Done."