diff --git a/android/java/org/chromium/base/BraveFeatureList.java b/android/java/org/chromium/base/BraveFeatureList.java index f850435e94d8..bc876d07ae92 100644 --- a/android/java/org/chromium/base/BraveFeatureList.java +++ b/android/java/org/chromium/base/BraveFeatureList.java @@ -13,6 +13,7 @@ public abstract class BraveFeatureList { public static final String USE_DEV_UPDATER_URL = "UseDevUpdaterUrl"; public static final String FORCE_WEB_CONTENTS_DARK_MODE = "WebContentsForceDark"; public static final String ENABLE_FORCE_DARK = "enable-force-dark"; + public static final String ENABLE_PARALLEL_DOWNLOADING = "enable-parallel-downloading"; public static final String BRAVE_SEARCH_OMNIBOX_BANNER = "BraveSearchOmniboxBanner"; public static final String BRAVE_BACKGROUND_VIDEO_PLAYBACK = "BraveBackgroundVideoPlayback"; public static final String BRAVE_BACKGROUND_VIDEO_PLAYBACK_INTERNAL = diff --git a/android/java/org/chromium/chrome/browser/download/settings/BraveDownloadSettings.java b/android/java/org/chromium/chrome/browser/download/settings/BraveDownloadSettings.java index 2d847baaa4eb..50f1dfcc6dbc 100644 --- a/android/java/org/chromium/chrome/browser/download/settings/BraveDownloadSettings.java +++ b/android/java/org/chromium/chrome/browser/download/settings/BraveDownloadSettings.java @@ -9,22 +9,29 @@ import androidx.preference.Preference; +import org.chromium.base.BraveFeatureList; import org.chromium.base.BravePreferenceKeys; import org.chromium.base.ContextUtils; import org.chromium.chrome.R; +import org.chromium.chrome.browser.BraveFeatureUtil; +import org.chromium.chrome.browser.BraveRelaunchUtils; +import org.chromium.chrome.browser.flags.ChromeFeatureList; import org.chromium.components.browser_ui.settings.ChromeSwitchPreference; import org.chromium.components.browser_ui.settings.SettingsUtils; -public class BraveDownloadSettings - extends DownloadSettings implements Preference.OnPreferenceChangeListener { +public class BraveDownloadSettings extends DownloadSettings + implements Preference.OnPreferenceChangeListener { private static final String PREF_AUTOMATICALLY_OPEN_WHEN_POSSIBLE = "automatically_open_when_possible"; public static final String PREF_LOCATION_PROMPT_ENABLED = "location_prompt_enabled"; private static final String PREF_DOWNLOAD_PROGRESS_NOTIFICATION_BUBBLE = "download_progress_notification_bubble"; + private static final String PREF_ENABLE_PARALLEL_DOWNLOADING = "enable_parallel_downloading"; + private static final String PARALLEL_DOWNLOADING = "ParallelDownloading"; private ChromeSwitchPreference mAutomaticallyOpenWhenPossiblePref; private ChromeSwitchPreference mDownloadProgressNotificationBubblePref; + private ChromeSwitchPreference mParallelDownloadingPref; @Override public void onCreate(Bundle savedInstanceState) { @@ -40,6 +47,10 @@ public void onCreate(Bundle savedInstanceState) { (ChromeSwitchPreference) findPreference(PREF_DOWNLOAD_PROGRESS_NOTIFICATION_BUBBLE); mDownloadProgressNotificationBubblePref.setOnPreferenceChangeListener(this); + mParallelDownloadingPref = + (ChromeSwitchPreference) findPreference(PREF_ENABLE_PARALLEL_DOWNLOADING); + mParallelDownloadingPref.setOnPreferenceChangeListener(this); + ChromeSwitchPreference locationPromptEnabledPref = (ChromeSwitchPreference) findPreference(PREF_LOCATION_PROMPT_ENABLED); if (locationPromptEnabledPref != null) { @@ -60,10 +71,15 @@ private void updateDownloadSettings() { mAutomaticallyOpenWhenPossiblePref.setChecked(automaticallyOpenWhenPossible); boolean downloadProgressNotificationBubble = - ContextUtils.getAppSharedPreferences().getBoolean( - BravePreferenceKeys.BRAVE_DOWNLOADS_DOWNLOAD_PROGRESS_NOTIFICATION_BUBBLE, - false); + ContextUtils.getAppSharedPreferences() + .getBoolean( + BravePreferenceKeys + .BRAVE_DOWNLOADS_DOWNLOAD_PROGRESS_NOTIFICATION_BUBBLE, + false); mDownloadProgressNotificationBubblePref.setChecked(downloadProgressNotificationBubble); + + boolean isParallelDownloadingEnabled = ChromeFeatureList.isEnabled(PARALLEL_DOWNLOADING); + mParallelDownloadingPref.setChecked(isParallelDownloadingEnabled); } // Preference.OnPreferenceChangeListener implementation. @@ -79,10 +95,15 @@ public boolean onPreferenceChange(Preference preference, Object newValue) { } else if (PREF_DOWNLOAD_PROGRESS_NOTIFICATION_BUBBLE.equals(preference.getKey())) { ContextUtils.getAppSharedPreferences() .edit() - .putBoolean(BravePreferenceKeys - .BRAVE_DOWNLOADS_DOWNLOAD_PROGRESS_NOTIFICATION_BUBBLE, + .putBoolean( + BravePreferenceKeys + .BRAVE_DOWNLOADS_DOWNLOAD_PROGRESS_NOTIFICATION_BUBBLE, (boolean) newValue) .apply(); + } else if (PREF_ENABLE_PARALLEL_DOWNLOADING.equals(preference.getKey())) { + BraveFeatureUtil.enableFeature( + BraveFeatureList.ENABLE_PARALLEL_DOWNLOADING, (boolean) newValue, false); + BraveRelaunchUtils.askForRelaunch(getActivity()); } return super.onPreferenceChange(preference, newValue); } diff --git a/android/java/res/xml/brave_download_preferences.xml b/android/java/res/xml/brave_download_preferences.xml index b582536d500f..27089123b316 100644 --- a/android/java/res/xml/brave_download_preferences.xml +++ b/android/java/res/xml/brave_download_preferences.xml @@ -16,5 +16,10 @@ android:title="@string/download_progress_notification_title" android:summaryOn="@string/text_on" android:summaryOff="@string/text_off" /> + + diff --git a/browser/ui/android/strings/android_brave_strings.grd b/browser/ui/android/strings/android_brave_strings.grd index 4073b7671dab..167c74aba685 100644 --- a/browser/ui/android/strings/android_brave_strings.grd +++ b/browser/ui/android/strings/android_brave_strings.grd @@ -1864,6 +1864,12 @@ Are you sure you want to do this? Ask where to save files (if SD card is detected) + + Parallel Downloading + + + Enable parallel downloading to accelerate download speed + View full Privacy Report diff --git a/chromium_src/chrome/browser/flags/android/chrome_feature_list.cc b/chromium_src/chrome/browser/flags/android/chrome_feature_list.cc index edaab4e784ce..06ee250fa15e 100644 --- a/chromium_src/chrome/browser/flags/android/chrome_feature_list.cc +++ b/chromium_src/chrome/browser/flags/android/chrome_feature_list.cc @@ -37,6 +37,7 @@ &brave_vpn::features::kBraveVPNLinkSubscriptionAndroidUI, \ &brave_wallet::features::kNativeBraveWalletFeature, \ &playlist::features::kPlaylist, \ + &download::features::kParallelDownloading, \ &preferences::features::kBraveBackgroundVideoPlayback, \ &request_otr::features::kBraveRequestOTRTab, \ &safe_browsing::features::kBraveAndroidSafeBrowsing, \