diff --git a/build/e_patches/Browser-Enable-external-intent-requests.patch b/build/e_patches/Browser-Enable-external-intent-requests.patch new file mode 100644 index 0000000000000000000000000000000000000000..372ee5f70901dfc8c8575f7f4818d9b2eb169204 --- /dev/null +++ b/build/e_patches/Browser-Enable-external-intent-requests.patch @@ -0,0 +1,175 @@ +From 65e44d310e964eb6f6eab29b978dc14b7aed4e3c Mon Sep 17 00:00:00 2001 +From: althafvly +Date: Tue, 5 Nov 2024 10:08:21 +0530 +Subject: Browser: Enable external intent requests + +--- + .../java/res/xml/privacy_preferences.xml | 3 +- + .../ExternalNavigationDelegateImpl.java | 6 ++-- + .../privacy/settings/PrivacySettings.java | 11 +++++++ + .../cromite/sAllowExternalIntentRequests.java | 33 ------------------- + ...ag-to-disable-external-intent-requests.inc | 13 -------- + ...ag-to-disable-external-intent-requests.inc | 3 -- + 6 files changed, 15 insertions(+), 54 deletions(-) + delete mode 100644 chrome/browser/flags/android/java/src/org/chromium/chrome/browser/flags/cromite/sAllowExternalIntentRequests.java + delete mode 100644 cromite_flags/chrome/browser/about_flags_cc/Add-flag-to-disable-external-intent-requests.inc + delete mode 100644 cromite_flags/chrome/browser/flags/android/chrome_feature_list_cc/Add-flag-to-disable-external-intent-requests.inc + +diff --git a/chrome/android/java/res/xml/privacy_preferences.xml b/chrome/android/java/res/xml/privacy_preferences.xml +index 91183f69c335e..abab143d39093 100644 +--- a/chrome/android/java/res/xml/privacy_preferences.xml ++++ b/chrome/android/java/res/xml/privacy_preferences.xml +@@ -93,8 +93,7 @@ found in the LICENSE file. + android:key="allow_external_intent_requests" + android:title="@string/allow_external_intent_requests_title" + android:summary="@string/allow_external_intent_requests_summary" +- app:featureName="AllowExternalIntentRequests" +- app:needRestart="false" /> ++ android:defaultValue="true" /> + +diff --git a/chrome/android/java/src/org/chromium/chrome/browser/externalnav/ExternalNavigationDelegateImpl.java b/chrome/android/java/src/org/chromium/chrome/browser/externalnav/ExternalNavigationDelegateImpl.java +index 57a70e9368a9b..2a37f7595d7ea 100644 +--- a/chrome/android/java/src/org/chromium/chrome/browser/externalnav/ExternalNavigationDelegateImpl.java ++++ b/chrome/android/java/src/org/chromium/chrome/browser/externalnav/ExternalNavigationDelegateImpl.java +@@ -19,7 +19,6 @@ import org.chromium.base.IntentUtils; + import org.chromium.base.PackageManagerUtils; + import org.chromium.base.supplier.Supplier; + import org.chromium.chrome.browser.ChromeTabbedActivity2; +-import org.chromium.chrome.browser.flags.cromite.sAllowExternalIntentRequests; + import org.chromium.chrome.browser.IntentHandler; + import org.chromium.chrome.browser.tab.EmptyTabObserver; + import org.chromium.chrome.browser.tab.Tab; +@@ -42,6 +41,8 @@ public class ExternalNavigationDelegateImpl implements ExternalNavigationDelegat + + private boolean mIsTabDestroyed; + ++ public static final String PREF_OPEN_EXTERNAL_INTENT = "allow_external_intent_requests"; ++ + public ExternalNavigationDelegateImpl(Tab tab) { + mTab = tab; + mTabModelSelectorSupplier = TabModelSelectorSupplier.from(tab.getWindowAndroid()); +@@ -104,8 +105,7 @@ public class ExternalNavigationDelegateImpl implements ExternalNavigationDelegat + + @Override + public boolean shouldDisableExternalIntentRequestsForUrl(GURL url) { +- if ("tel".equals(url.getScheme())) return false; +- return !sAllowExternalIntentRequests.getInstance().isEnabled(); ++ return !ContextUtils.getAppSharedPreferences().getBoolean(PREF_OPEN_EXTERNAL_INTENT, true); + } + + @Override +diff --git a/chrome/android/java/src/org/chromium/chrome/browser/privacy/settings/PrivacySettings.java b/chrome/android/java/src/org/chromium/chrome/browser/privacy/settings/PrivacySettings.java +index caf093d5f4b70..630895519a0e0 100644 +--- a/chrome/android/java/src/org/chromium/chrome/browser/privacy/settings/PrivacySettings.java ++++ b/chrome/android/java/src/org/chromium/chrome/browser/privacy/settings/PrivacySettings.java +@@ -119,6 +119,7 @@ public class PrivacySettings extends ChromeBaseSettingsFragment + + private ChromeSwitchPreference allowCustomTabIntentsPref; + private ChromeSwitchPreference openExternalLinksPref; ++ private ChromeSwitchPreference openExternalIntentPref; + + private static final String PREF_HISTORY_EXPIRE_DAYS_THRESHOLD = "history_expire_days_threshold"; + +@@ -381,6 +382,7 @@ public class PrivacySettings extends ChromeBaseSettingsFragment + + public static final String PREF_ALLOW_CUSTOM_TAB_INTENTS = "allow_custom_tab_intents"; + public static final String PREF_OPEN_EXTERNAL_LINKS_INCOGNITO = "open_external_links_incognito"; ++ public static final String PREF_OPEN_EXTERNAL_INTENT = "allow_external_intent_requests"; + + @Override + public boolean onPreferenceChange(Preference preference, Object newValue) { +@@ -423,6 +425,10 @@ public class PrivacySettings extends ChromeBaseSettingsFragment + SharedPreferences.Editor sharedPreferencesEditor = ContextUtils.getAppSharedPreferences().edit(); + sharedPreferencesEditor.putBoolean(PREF_OPEN_EXTERNAL_LINKS_INCOGNITO, (boolean)newValue); + sharedPreferencesEditor.apply(); ++ } else if (PREF_OPEN_EXTERNAL_INTENT.equals(key)) { ++ SharedPreferences.Editor sharedPreferencesEditor = ContextUtils.getAppSharedPreferences().edit(); ++ sharedPreferencesEditor.putBoolean(PREF_OPEN_EXTERNAL_INTENT, (boolean)newValue); ++ sharedPreferencesEditor.apply(); + } + return true; + } +@@ -455,6 +461,11 @@ public class PrivacySettings extends ChromeBaseSettingsFragment + openExternalLinksPref.setOnPreferenceChangeListener(this); + openExternalLinksPref.setManagedPreferenceDelegate(mManagedPreferenceDelegate); + ++ openExternalIntentPref = ++ (ChromeSwitchPreference) findPreference(PREF_OPEN_EXTERNAL_INTENT); ++ openExternalIntentPref.setOnPreferenceChangeListener(this); ++ openExternalIntentPref.setManagedPreferenceDelegate(mManagedPreferenceDelegate); ++ + Preference doNotTrackPref = findPreference(PREF_DO_NOT_TRACK); + if (doNotTrackPref != null) { + doNotTrackPref.setSummary( +diff --git a/chrome/browser/flags/android/java/src/org/chromium/chrome/browser/flags/cromite/sAllowExternalIntentRequests.java b/chrome/browser/flags/android/java/src/org/chromium/chrome/browser/flags/cromite/sAllowExternalIntentRequests.java +deleted file mode 100644 +index de469ca636b99..0000000000000 +--- a/chrome/browser/flags/android/java/src/org/chromium/chrome/browser/flags/cromite/sAllowExternalIntentRequests.java ++++ /dev/null +@@ -1,33 +0,0 @@ +-/* +- This file is part of Cromite. +- +- Cromite 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 3 of the License, or +- (at your option) any later version. +- +- Cromite 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 Cromite. If not, see . +-*/ +- +-package org.chromium.chrome.browser.flags.cromite; +- +-import org.chromium.base.cached_flags.CachedFlag; +-import org.chromium.chrome.browser.flags.ChromeFeatureMap; +- +-public class sAllowExternalIntentRequests { +- private static final CachedFlag sInstance = +- new CachedFlag(ChromeFeatureMap.getInstance(), +- "AllowExternalIntentRequests", false); +- +- private sAllowExternalIntentRequests() {} +- +- public static CachedFlag getInstance() { +- return sInstance; +- } +-} +diff --git a/cromite_flags/chrome/browser/about_flags_cc/Add-flag-to-disable-external-intent-requests.inc b/cromite_flags/chrome/browser/about_flags_cc/Add-flag-to-disable-external-intent-requests.inc +deleted file mode 100644 +index 292d587269804..0000000000000 +--- a/cromite_flags/chrome/browser/about_flags_cc/Add-flag-to-disable-external-intent-requests.inc ++++ /dev/null +@@ -1,13 +0,0 @@ +-#if BUILDFLAG(IS_ANDROID) +- +-#ifdef FLAG_SECTION +- +- {"allow-external-intent-requests", +- "Allow forward URL requests to external intents", +- "If disabled, URL requests will never" +- "allow for redirecting to an external intent.", kOsAndroid, +- SINGLE_DISABLE_VALUE_TYPE("disable-external-intent-requests")}, +- +-#endif +- +-#endif +diff --git a/cromite_flags/chrome/browser/flags/android/chrome_feature_list_cc/Add-flag-to-disable-external-intent-requests.inc b/cromite_flags/chrome/browser/flags/android/chrome_feature_list_cc/Add-flag-to-disable-external-intent-requests.inc +deleted file mode 100644 +index c4015ad7de119..0000000000000 +--- a/cromite_flags/chrome/browser/flags/android/chrome_feature_list_cc/Add-flag-to-disable-external-intent-requests.inc ++++ /dev/null +@@ -1,3 +0,0 @@ +-CROMITE_FEATURE(kAllowExternalIntentRequests, +- "AllowExternalIntentRequests", +- base::FEATURE_DISABLED_BY_DEFAULT); +-- +2.34.1 + diff --git a/build/e_patches_list.txt b/build/e_patches_list.txt index 11a99440d22c5462a40bde20a6c2a5e05cd4ab86..3f0b62e33042afa46c2dd9ac272a7415562bf0dd 100644 --- a/build/e_patches_list.txt +++ b/build/e_patches_list.txt @@ -59,3 +59,4 @@ ungoogledchromium-Disable-Gaia.patch Disable-support-for-RAR-files-inspection.patch Browser-Fix-open-in-browser-text.patch Inject-scripts-for-AMP-tracking-ads-and-video.patch +Browser-Enable-external-intent-requests.patch diff --git a/push.sh b/push.sh new file mode 100755 index 0000000000000000000000000000000000000000..858059b00019a7e7709a6b82afb620ef9206cf2d --- /dev/null +++ b/push.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +adb shell pm uninstall foundation.e.browser +adb shell pm uninstall com.android.webview +adb shell pm uninstall org.chromium.trichromelibrary + +adb shell pm clear foundation.e.browser +adb shell pm clear com.android.webview +adb shell pm clear org.chromium.trichromelibrary + +adb install -r apks/arm64/TrichromeLibrary.apk +adb install -r apks/arm64/TrichromeWebView.apk +adb install -r apks/arm64/TrichromeChrome.apk diff --git a/update_e_patches.sh b/update_e_patches.sh index 7526ea8939e16fb5ded2173a3fed9d66c070525c..62be4dab9179de1b4c76c47f4b89a31fc4815793 100755 --- a/update_e_patches.sh +++ b/update_e_patches.sh @@ -15,15 +15,11 @@ if [ -f "$output_patch_file" ]; then rm "$output_patch_file" fi -if [ -d "$output_patch_dir" ]; then - rm -rf "$output_patch_dir" -fi - last_patch=$(tail -n 1 "$patch_list_file") subject=${last_patch%.patch} formatted_subject=${subject//-/" "} -cd ${root_dir}/src || exit 1 +cd "${root_dir}/src" || exit 1 chromium_commit_hash=$(git log --pretty=format:"%H %s" | grep -F "$formatted_subject" | head -n 1 | awk '{print $1}') @@ -33,7 +29,7 @@ if [ -z "$chromium_commit_hash" ]; then fi > "$output_patch_file" -mkdir -p ${root_dir}/build/e_patches +mkdir -p "$output_patch_dir" # Patches to ignore ignore_patches=("Browser-Replace-Chrome-with-Browser.patch" "Browser-Automated-domain-substitution.patch") @@ -42,6 +38,7 @@ for commit in $(git rev-list --reverse "$chromium_commit_hash"..HEAD); do subject=$(git log -n 1 --pretty=format:%s "$commit" | tr -d '[:punct:]') formatted_subject=${subject// /-} patch_filename="${formatted_subject}.patch" + patch_path="${output_patch_dir}/${patch_filename}" # Check if the patch filename is in the ignore list if [[ " ${ignore_patches[@]} " =~ " ${patch_filename} " ]]; then @@ -49,8 +46,23 @@ for commit in $(git rev-list --reverse "$chromium_commit_hash"..HEAD); do continue fi - echo "Creating patch: $patch_filename" - git format-patch -1 --stdout "$commit" --subject-prefix="" > "$patch_filename" + # Generate the patch to a temporary file + temp_patch_file=$(mktemp) + git format-patch -1 --stdout "$commit" --subject-prefix="" > "$temp_patch_file" + + # Check if the patch differs from any existing one, ignoring the first line + if [ -f "$patch_path" ]; then + # Compare content ignoring the first line + if diff -q <(tail -n +2 "$temp_patch_file") <(tail -n +2 "$patch_path") > /dev/null; then + echo "Patch already up-to-date: $patch_filename" + rm "$temp_patch_file" + echo "$patch_filename" >> "$output_patch_file" + continue + fi + fi + + # Move the patch to the output directory if it’s new or updated + echo "Updating patch: $patch_filename" + mv "$temp_patch_file" "$patch_path" echo "$patch_filename" >> "$output_patch_file" - mv "$patch_filename" "${root_dir}/build/e_patches/" done