From f3c2f7d46309391119120ceb74c198e6062afb1c Mon Sep 17 00:00:00 2001 From: Scott Jackson Date: Fri, 17 Aug 2018 16:50:13 -0700 Subject: Fixes #869 Android Auto using the cached indexes from the main app --- .../github/daneren2005/dsub/service/CachedMusicService.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/github/daneren2005/dsub/service/CachedMusicService.java b/app/src/main/java/github/daneren2005/dsub/service/CachedMusicService.java index 9fd26fe5..1e91a61e 100644 --- a/app/src/main/java/github/daneren2005/dsub/service/CachedMusicService.java +++ b/app/src/main/java/github/daneren2005/dsub/service/CachedMusicService.java @@ -148,7 +148,11 @@ public class CachedMusicService implements MusicService { cachedIndexes.clear(); cachedMusicFolders.clear(); } - Indexes result = cachedIndexes.get(); + Indexes result = null; + if(Util.equals(musicFolderId, this.musicFolderId)) { + result = cachedIndexes.get(); + } + if (result == null) { String name = Util.isTagBrowsing(context, musicService.getInstance(context)) ? "artists" : "indexes"; name = getCacheName(context, name, musicFolderId); @@ -160,7 +164,10 @@ public class CachedMusicService implements MusicService { result = musicService.getIndexes(musicFolderId, refresh, context, progressListener); FileUtil.serialize(context, result, name); } - cachedIndexes.set(result); + + if(Util.equals(musicFolderId, this.musicFolderId)) { + cachedIndexes.set(result); + } } return result; } -- cgit v1.2.3