From 7b8f577fd43c4391eb12822ce5cdc53100134b98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Mart=C3=AD?= Date: Mon, 12 Oct 2015 12:45:27 +0200 Subject: [PATCH] Keep apk downloads from crashing on 2.2 Use a temporary quick fix for the crash until a better solution is in place. This is explained in the TODO. Fixes #448. --- .../org/fdroid/fdroid/net/AsyncDownloaderFromAndroid.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/F-Droid/src/org/fdroid/fdroid/net/AsyncDownloaderFromAndroid.java b/F-Droid/src/org/fdroid/fdroid/net/AsyncDownloaderFromAndroid.java index 00f21e461..2b91ad704 100644 --- a/F-Droid/src/org/fdroid/fdroid/net/AsyncDownloaderFromAndroid.java +++ b/F-Droid/src/org/fdroid/fdroid/net/AsyncDownloaderFromAndroid.java @@ -283,6 +283,14 @@ public class AsyncDownloaderFromAndroid implements AsyncDownloader { * @return -1 if not downloading, else the id from the Android download manager */ public static long isDownloading(Context context, String uniqueDownloadId) { + if (Build.VERSION.SDK_INT < Build.VERSION_CODES.GINGERBREAD) { + // TODO: remove. This is necessary because AppDetails calls this + // static method directly, without using the whole pipe through + // DownloaderFactory. This shouldn't be called at all on android-8 + // devices, since AppDetails is really using the old downloader, + // not this one. + return -1; + } DownloadManager dm = (DownloadManager) context.getSystemService(Context.DOWNLOAD_SERVICE); DownloadManager.Query query = new DownloadManager.Query(); Cursor c = dm.query(query);