Commit 0c592848 authored by Nate Fischer's avatar Nate Fischer Committed by Chromium LUCI CQ

Android: inline deprecated BuildInfo methods (/components/download)

No change to logic. This inlines BuildInfo.isAtLeast{Q,R} and
BuildInfo.targetsAtLeast{Q,R} (and their C++ equivalents) in
/components/download.

The methods themselves will be removed in a follow-up CL once all call
sites have been removed.

This CL was uploaded by git cl split.

R=shaktisahu@chromium.org

Bug: 1106920
Test: autoninja -C out/Default monochrome_public_apk
Change-Id: Ib95d998cea01e034527987da76662d47710783f8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2575375
Auto-Submit: Nate Fischer <ntfschr@chromium.org>
Reviewed-by: default avatarShakti Sahu <shaktisahu@chromium.org>
Commit-Queue: Shakti Sahu <shaktisahu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#833938}
parent 4f335e07
...@@ -22,7 +22,6 @@ import android.text.format.DateUtils; ...@@ -22,7 +22,6 @@ import android.text.format.DateUtils;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import org.chromium.base.BuildInfo;
import org.chromium.base.ContextUtils; import org.chromium.base.ContextUtils;
import org.chromium.base.Log; import org.chromium.base.Log;
import org.chromium.base.StrictModeContext; import org.chromium.base.StrictModeContext;
...@@ -132,7 +131,7 @@ public class DownloadCollectionBridge { ...@@ -132,7 +131,7 @@ public class DownloadCollectionBridge {
*/ */
@CalledByNative @CalledByNative
public static boolean shouldPublishDownload(final String filePath) { public static boolean shouldPublishDownload(final String filePath) {
if (isAtLeastQ()) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
if (filePath == null) return false; if (filePath == null) return false;
// Only need to publish downloads that are on primary storage. // Only need to publish downloads that are on primary storage.
return !sDownloadDelegate.isDownloadOnSDCard(filePath); return !sDownloadDelegate.isDownloadOnSDCard(filePath);
...@@ -297,7 +296,7 @@ public class DownloadCollectionBridge { ...@@ -297,7 +296,7 @@ public class DownloadCollectionBridge {
* @return whether download collection is supported. * @return whether download collection is supported.
*/ */
public static boolean supportsDownloadCollection() { public static boolean supportsDownloadCollection() {
return isAtLeastQ(); return Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q;
} }
/** /**
...@@ -333,10 +332,6 @@ public class DownloadCollectionBridge { ...@@ -333,10 +332,6 @@ public class DownloadCollectionBridge {
return DownloadCollectionBridgeJni.get().getExpirationDurationInDays(); return DownloadCollectionBridgeJni.get().getExpirationDurationInDays();
} }
private static boolean isAtLeastQ() {
return BuildInfo.isAtLeastQ() || Build.VERSION.SDK_INT >= 29;
}
/** /**
* Helper method to create a pending session for download to be written into. * Helper method to create a pending session for download to be written into.
* @param fileName Name of the file. * @param fileName Name of the file.
......
...@@ -576,7 +576,8 @@ void InProgressDownloadManager::OnDBInitialized( ...@@ -576,7 +576,8 @@ void InProgressDownloadManager::OnDBInitialized(
std::unique_ptr<std::vector<DownloadDBEntry>> entries) { std::unique_ptr<std::vector<DownloadDBEntry>> entries) {
#if defined(OS_ANDROID) #if defined(OS_ANDROID)
// Retrieve display names for all downloads from media store if needed. // Retrieve display names for all downloads from media store if needed.
if (base::android::BuildInfo::GetInstance()->is_at_least_q()) { if (base::android::BuildInfo::GetInstance()->sdk_int() >=
base::android::SDK_VERSION_Q) {
DownloadCollectionBridge::GetDisplayNamesCallback callback = DownloadCollectionBridge::GetDisplayNamesCallback callback =
base::BindOnce(&InProgressDownloadManager::OnDownloadNamesRetrieved, base::BindOnce(&InProgressDownloadManager::OnDownloadNamesRetrieved,
weak_factory_.GetWeakPtr(), std::move(entries)); weak_factory_.GetWeakPtr(), std::move(entries));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment