diff options
author | Dominik Riebeling <Dominik.Riebeling@gmail.com> | 2011-09-04 19:07:14 +0000 |
---|---|---|
committer | Dominik Riebeling <Dominik.Riebeling@gmail.com> | 2011-09-04 19:07:14 +0000 |
commit | 1b70a7079ec979a895e6bb69475d89cd79a7087c (patch) | |
tree | 30a686daf2f34977be615b59f845d5eb49508ed7 /android | |
parent | 642736f53b153f544dc60bb5d7ff4f147ec760b4 (diff) |
Android: store resources on SD card.
On the first start Rockbox extracts libmisc.so which in fact is a zip file
holding resource files like theme bitmaps. Those can requires quite a bit of
memory.
As extended version of FS#12063 resources will now be extracted to SD card if
the file /sdcard/rockbox/rockbox-info.txt is found. This file is part of the
extracted resources and can therefore safely be used for checking.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30430 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'android')
-rw-r--r-- | android/src/org/rockbox/RockboxService.java | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/android/src/org/rockbox/RockboxService.java b/android/src/org/rockbox/RockboxService.java index 20b8d0c806..fc496f4331 100644 --- a/android/src/org/rockbox/RockboxService.java +++ b/android/src/org/rockbox/RockboxService.java @@ -169,7 +169,11 @@ public class RockboxService extends Service { final int BUFFER = 8*1024; String rockboxDirPath = "/data/data/org.rockbox/app_rockbox/rockbox"; + String rockboxCreditsPath = "/data/data/org.rockbox/app_rockbox/rockbox/rocks/viewers"; + String rockboxSdDirPath = "/sdcard/rockbox"; File rockboxDir = new File(rockboxDirPath); + File rockboxSdDir = new File(rockboxSdDirPath); + File rockboxCreditsDir = new File(rockboxCreditsPath); /* load library before unzipping which may take a while */ synchronized (lock) { @@ -184,7 +188,16 @@ public class RockboxService extends Service */ File libMisc = new File("/data/data/org.rockbox/lib/libmisc.so"); /* use arbitrary file to determine whether extracting is needed */ - File arbitraryFile = new File(rockboxDir, "viewers.config"); + File arbitraryFile = new File(rockboxCreditsPath, "credits.rock"); + File rockboxInfoFile = new File(rockboxSdDirPath, "rockbox-info.txt"); + boolean extractToSd = false; + if(rockboxInfoFile.exists()) { + extractToSd = true; + LOG("extracting resources to SD card"); + } + else { + LOG("extracting resources to internal memory"); + } if (!arbitraryFile.exists() || (libMisc.lastModified() > arbitraryFile.lastModified())) { try @@ -202,7 +215,16 @@ public class RockboxService extends Service /* strip off /.rockbox when extracting */ String fileName = entry.getName(); int slashIndex = fileName.indexOf('/', 1); - file = new File(rockboxDirPath + fileName.substring(slashIndex)); + /* codecs are now stored as libs, only keep rocks on internal */ + if(extractToSd == false + || fileName.substring(slashIndex).startsWith("/rocks")) + { + file = new File(rockboxDirPath + fileName.substring(slashIndex)); + } + else + { + file = new File(rockboxSdDirPath + fileName.substring(slashIndex)); + } if (!entry.isDirectory()) { @@ -230,6 +252,7 @@ public class RockboxService extends Service resultReceiver.send(RESULT_LIB_LOAD_PROGRESS, progressData); } } + arbitraryFile.setLastModified(libMisc.lastModified()); } catch(Exception e) { LOG("Exception when unzipping", e); e.printStackTrace(); |