diff --git a/app/src/main/java/com/topjohnwu/magisk/asyncs/LoadModules.java b/app/src/main/java/com/topjohnwu/magisk/asyncs/LoadModules.java index 8ccc19362..ef8a2f470 100644 --- a/app/src/main/java/com/topjohnwu/magisk/asyncs/LoadModules.java +++ b/app/src/main/java/com/topjohnwu/magisk/asyncs/LoadModules.java @@ -25,10 +25,8 @@ public class LoadModules extends ParallelTask { for (String path : Utils.getModList(getShell(), MagiskManager.MAGISK_PATH)) { Logger.dev("LoadModules: Adding modules from " + path); - try { - Module module = new Module(getShell(), path); - mm.moduleMap.put(module.getId(), module); - } catch (BaseModule.CacheModException ignored) {} + Module module = new Module(getShell(), path); + mm.moduleMap.put(module.getId(), module); } Logger.dev("LoadModules: Data load done"); diff --git a/app/src/main/java/com/topjohnwu/magisk/asyncs/UpdateRepos.java b/app/src/main/java/com/topjohnwu/magisk/asyncs/UpdateRepos.java index 86c240732..7746d18d0 100644 --- a/app/src/main/java/com/topjohnwu/magisk/asyncs/UpdateRepos.java +++ b/app/src/main/java/com/topjohnwu/magisk/asyncs/UpdateRepos.java @@ -68,21 +68,19 @@ public class UpdateRepos extends ParallelTask { SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'", Locale.US); Date updatedDate = format.parse(lastUpdate); Repo repo = repoDB.getRepo(id); - try { - Boolean updated; - if (repo == null) { - repo = new Repo(name, updatedDate); - updated = true; - } else { - // Popout from cached - cached.remove(id); - updated = repo.update(updatedDate); - } - if (updated) { - repoDB.addRepo(repo); - publishProgress(); - } - } catch (BaseModule.CacheModException ignored) {} + Boolean updated; + if (repo == null) { + repo = new Repo(name, updatedDate); + updated = true; + } else { + // Popout from cached + cached.remove(id); + updated = repo.update(updatedDate); + } + if (updated) { + repoDB.addRepo(repo); + publishProgress(); + } } } diff --git a/app/src/main/java/com/topjohnwu/magisk/container/BaseModule.java b/app/src/main/java/com/topjohnwu/magisk/container/BaseModule.java index 53aa5a10b..c843999d7 100644 --- a/app/src/main/java/com/topjohnwu/magisk/container/BaseModule.java +++ b/app/src/main/java/com/topjohnwu/magisk/container/BaseModule.java @@ -38,9 +38,9 @@ public abstract class BaseModule implements Comparable { return values; } - protected void parseProps(List props) throws CacheModException { parseProps(props.toArray(new String[0])); } + protected void parseProps(List props) { parseProps(props.toArray(new String[0])); } - protected void parseProps(String[] props) throws CacheModException { + protected void parseProps(String[] props) { for (String line : props) { String[] prop = line.split("=", 2); if (prop.length != 2) @@ -75,9 +75,6 @@ public abstract class BaseModule implements Comparable { try { templateVersion = Integer.parseInt(prop[1]); } catch (NumberFormatException ignored) {} - case "cacheModule": - if (Boolean.parseBoolean(prop[1])) - throw new CacheModException(mId); break; default: break; @@ -121,12 +118,6 @@ public abstract class BaseModule implements Comparable { return templateVersion; } - public static class CacheModException extends Exception { - public CacheModException(String id) { - Logger.error("Cache mods are no longer supported! id: " + id); - } - } - @Override public int compareTo(@NonNull BaseModule module) { return this.getName().toLowerCase().compareTo(module.getName().toLowerCase()); diff --git a/app/src/main/java/com/topjohnwu/magisk/container/Module.java b/app/src/main/java/com/topjohnwu/magisk/container/Module.java index 889a12e58..229e3267a 100644 --- a/app/src/main/java/com/topjohnwu/magisk/container/Module.java +++ b/app/src/main/java/com/topjohnwu/magisk/container/Module.java @@ -9,7 +9,7 @@ public class Module extends BaseModule { private String mRemoveFile, mDisableFile, mUpdateFile; private boolean mEnable, mRemove, mUpdated; - public Module(Shell shell, String path) throws CacheModException { + public Module(Shell shell, String path) { parseProps(Utils.readFile(shell, path + "/module.prop")); @@ -26,8 +26,6 @@ public class Module extends BaseModule { setName(getId()); } - Logger.dev("Creating Module, id: " + getId()); - mEnable = !Utils.itemExist(shell, mDisableFile); mRemove = Utils.itemExist(shell, mRemoveFile); mUpdated = Utils.itemExist(shell, mUpdateFile); diff --git a/app/src/main/java/com/topjohnwu/magisk/container/Repo.java b/app/src/main/java/com/topjohnwu/magisk/container/Repo.java index 2db9f6b3c..4583e401f 100644 --- a/app/src/main/java/com/topjohnwu/magisk/container/Repo.java +++ b/app/src/main/java/com/topjohnwu/magisk/container/Repo.java @@ -16,7 +16,7 @@ public class Repo extends BaseModule { private String repoName; private Date mLastUpdate; - public Repo(String name, Date lastUpdate) throws CacheModException { + public Repo(String name, Date lastUpdate) { mLastUpdate = lastUpdate; repoName = name; update(); @@ -28,14 +28,13 @@ public class Repo extends BaseModule { mLastUpdate = new Date(c.getLong(c.getColumnIndex("last_update"))); } - public void update() throws CacheModException { + public void update() { String props = WebService.getString(getManifestUrl()); String lines[] = props.split("\\n"); parseProps(lines); - Logger.dev("Repo: Fetching prop: " + getId()); } - public boolean update(Date lastUpdate) throws CacheModException { + public boolean update(Date lastUpdate) { if (lastUpdate.after(mLastUpdate)) { mLastUpdate = lastUpdate; update();