From 8bec2da834f7b975b2ffea1038c0956c3283e5a5 Mon Sep 17 00:00:00 2001 From: Mattias Brodda Date: Wed, 16 Jun 2010 10:48:27 +0200 Subject: Prevent MediaScanner from removing Micro thumbnail database after scan. After scanning the sdcard for the first time, the MediaScanner deletes the micro thumbnail database files. The MiniThumbFile class attempts to recreate the files but ends up with 0-sized db-files that it cannot store any more micro thumbs in, resulting in that all micro thumbnails that are results from thumbnail request are never stored properly until the device is restarted. Change-Id: I2b49580ae3360447525dbee80f6ba15b4bc658dd --- media/java/android/media/MiniThumbFile.java | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/media/java/android/media/MiniThumbFile.java b/media/java/android/media/MiniThumbFile.java index 351ca56..26f6dcc 100644 --- a/media/java/android/media/MiniThumbFile.java +++ b/media/java/android/media/MiniThumbFile.java @@ -89,12 +89,10 @@ public class MiniThumbFile { private void removeOldFile() { String oldPath = randomAccessFilePath(MINI_THUMB_DATA_FILE_VERSION - 1); File oldFile = new File(oldPath); - if (oldFile.exists()) { - try { - oldFile.delete(); - } catch (SecurityException ex) { - // ignore - } + try { + oldFile.delete(); + } catch (SecurityException ex) { + // ignore } } @@ -147,7 +145,11 @@ public class MiniThumbFile { public synchronized void removeMiniThumbDataFile() { String path = randomAccessFilePath(MINI_THUMB_DATA_FILE_VERSION); File file = new File(path); - file.delete(); + try { + file.delete(); + } catch (SecurityException ex) { + // ignore + } } // Get the magic number for the specified id in the mini-thumb file. -- cgit v1.1