From cd0234b4e80218bae07f7528ad089bf5e26f0d73 Mon Sep 17 00:00:00 2001 From: Ciaran Gultnieks Date: Mon, 19 Aug 2013 10:00:21 +0100 Subject: [PATCH] Create .nomedia in icons directory for old Androids --- src/org/fdroid/fdroid/UpdateService.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/org/fdroid/fdroid/UpdateService.java b/src/org/fdroid/fdroid/UpdateService.java index 77e73505c..3fe96c843 100644 --- a/src/org/fdroid/fdroid/UpdateService.java +++ b/src/org/fdroid/fdroid/UpdateService.java @@ -265,6 +265,20 @@ public class UpdateService extends IntentService implements ProgressListener { toDownloadIcons = acceptedapps; } if (toDownloadIcons != null) { + + // Create a .nomedia file in the icons directory. For + // recent Android versions this isn't necessary, because + // they recognise the cache location. Older versions don't + // though. + File f = new File(d, ".nomedia"); + if (!f.exists()) { + try { + f.createNewFile(); + } catch (Exception e) { + Log.d("FDroid", "Failed to create .nomedia"); + } + } + sendStatus(STATUS_INFO, getString(R.string.status_downloading_icons)); for (DB.App app : toDownloadIcons)