diff --git a/app/src/main/java/com/topjohnwu/magisk/module/Repo.java b/app/src/main/java/com/topjohnwu/magisk/module/Repo.java index 013bd9475..c01b0804b 100644 --- a/app/src/main/java/com/topjohnwu/magisk/module/Repo.java +++ b/app/src/main/java/com/topjohnwu/magisk/module/Repo.java @@ -6,6 +6,7 @@ import android.preference.PreferenceManager; import android.util.Log; import com.topjohnwu.magisk.R; +import com.topjohnwu.magisk.utils.Logger; import com.topjohnwu.magisk.utils.ModuleHelper; import com.topjohnwu.magisk.utils.Utils; import com.topjohnwu.magisk.utils.WebRequest; @@ -30,12 +31,15 @@ public class Repo extends BaseModule { } public void update() { + Logger.dev("Repo: Re-fetch prop " + mId); String props = WebRequest.makeWebServiceCall(mManifestUrl, WebRequest.GET, true); String lines[] = props.split("\\n"); parseProps(lines); } public void update(Date lastUpdate) { + Logger.dev("Repo: Old: " + mLastUpdate); + Logger.dev("Repo: New: " + lastUpdate); if (lastUpdate.after(mLastUpdate)) { mLastUpdate = lastUpdate; update(); diff --git a/app/src/main/java/com/topjohnwu/magisk/utils/Async.java b/app/src/main/java/com/topjohnwu/magisk/utils/Async.java index 9b472340b..eed337856 100644 --- a/app/src/main/java/com/topjohnwu/magisk/utils/Async.java +++ b/app/src/main/java/com/topjohnwu/magisk/utils/Async.java @@ -203,6 +203,7 @@ public class Async { try { InputStream in = mContext.getContentResolver().openInputStream(mUri); mFile = new File(mContext.getCacheDir().getAbsolutePath() + "/install.zip"); + Utils.removeFile(mFile.getPath()); createFileFromInputStream(in, mFile); in.close(); } catch (FileNotFoundException e) { @@ -251,7 +252,12 @@ public class Async { } // Copy the file to sdcard if (copyToSD && mFile != null) { - sdFile = new File(Environment.getExternalStorageDirectory() + "/MagiskManager/" + (mName.contains(".zip") ? mName : mName + ".zip").replace(" ", "_")); + String filename = (mName.contains(".zip") ? mName : mName + ".zip"); + filename = filename.replace(" ", "_").replace("'", "").replace("\"", "") + .replace("$", "").replace("`", "").replace("(", "_").replace(")", "_") + .replace("#", "").replace("@", "").replace("*", ""); + sdFile = new File(Environment.getExternalStorageDirectory() + "/MagiskManager/" + filename); + Logger.dev("FlashZip: Copy zip back to " + sdFile.getPath()); if ((!sdFile.getParentFile().exists() && !sdFile.getParentFile().mkdirs()) || (sdFile.exists() && !sdFile.delete())) { sdFile = null; } else { @@ -269,7 +275,7 @@ public class Async { } } if (mFile.exists() && !mFile.delete()) { - Shell.su("rm -f " + mFile.getPath()); + Utils.removeFile(mFile.getPath()); } } if (ret != null && Boolean.parseBoolean(ret.get(ret.size() - 1))) { diff --git a/app/src/main/java/com/topjohnwu/magisk/utils/Shell.java b/app/src/main/java/com/topjohnwu/magisk/utils/Shell.java index 5996b44d1..c93cc02c7 100644 --- a/app/src/main/java/com/topjohnwu/magisk/utils/Shell.java +++ b/app/src/main/java/com/topjohnwu/magisk/utils/Shell.java @@ -191,9 +191,11 @@ public class Shell { } } catch (IOException e) { if (!e.getMessage().contains("EPIPE")) { + Logger.dev("Shell: Root shell error..."); return null; } } catch(InterruptedException e) { + Logger.dev("Shell: Root shell error..."); return null; }