Small fixes
This commit is contained in:
parent
e4cba70008
commit
0f5465c5da
@ -6,6 +6,7 @@ import android.preference.PreferenceManager;
|
|||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
import com.topjohnwu.magisk.R;
|
import com.topjohnwu.magisk.R;
|
||||||
|
import com.topjohnwu.magisk.utils.Logger;
|
||||||
import com.topjohnwu.magisk.utils.ModuleHelper;
|
import com.topjohnwu.magisk.utils.ModuleHelper;
|
||||||
import com.topjohnwu.magisk.utils.Utils;
|
import com.topjohnwu.magisk.utils.Utils;
|
||||||
import com.topjohnwu.magisk.utils.WebRequest;
|
import com.topjohnwu.magisk.utils.WebRequest;
|
||||||
@ -30,12 +31,15 @@ public class Repo extends BaseModule {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void update() {
|
public void update() {
|
||||||
|
Logger.dev("Repo: Re-fetch prop " + mId);
|
||||||
String props = WebRequest.makeWebServiceCall(mManifestUrl, WebRequest.GET, true);
|
String props = WebRequest.makeWebServiceCall(mManifestUrl, WebRequest.GET, true);
|
||||||
String lines[] = props.split("\\n");
|
String lines[] = props.split("\\n");
|
||||||
parseProps(lines);
|
parseProps(lines);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void update(Date lastUpdate) {
|
public void update(Date lastUpdate) {
|
||||||
|
Logger.dev("Repo: Old: " + mLastUpdate);
|
||||||
|
Logger.dev("Repo: New: " + lastUpdate);
|
||||||
if (lastUpdate.after(mLastUpdate)) {
|
if (lastUpdate.after(mLastUpdate)) {
|
||||||
mLastUpdate = lastUpdate;
|
mLastUpdate = lastUpdate;
|
||||||
update();
|
update();
|
||||||
|
@ -203,6 +203,7 @@ public class Async {
|
|||||||
try {
|
try {
|
||||||
InputStream in = mContext.getContentResolver().openInputStream(mUri);
|
InputStream in = mContext.getContentResolver().openInputStream(mUri);
|
||||||
mFile = new File(mContext.getCacheDir().getAbsolutePath() + "/install.zip");
|
mFile = new File(mContext.getCacheDir().getAbsolutePath() + "/install.zip");
|
||||||
|
Utils.removeFile(mFile.getPath());
|
||||||
createFileFromInputStream(in, mFile);
|
createFileFromInputStream(in, mFile);
|
||||||
in.close();
|
in.close();
|
||||||
} catch (FileNotFoundException e) {
|
} catch (FileNotFoundException e) {
|
||||||
@ -251,7 +252,12 @@ public class Async {
|
|||||||
}
|
}
|
||||||
// Copy the file to sdcard
|
// Copy the file to sdcard
|
||||||
if (copyToSD && mFile != null) {
|
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())) {
|
if ((!sdFile.getParentFile().exists() && !sdFile.getParentFile().mkdirs()) || (sdFile.exists() && !sdFile.delete())) {
|
||||||
sdFile = null;
|
sdFile = null;
|
||||||
} else {
|
} else {
|
||||||
@ -269,7 +275,7 @@ public class Async {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (mFile.exists() && !mFile.delete()) {
|
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))) {
|
if (ret != null && Boolean.parseBoolean(ret.get(ret.size() - 1))) {
|
||||||
|
@ -191,9 +191,11 @@ public class Shell {
|
|||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
if (!e.getMessage().contains("EPIPE")) {
|
if (!e.getMessage().contains("EPIPE")) {
|
||||||
|
Logger.dev("Shell: Root shell error...");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
} catch(InterruptedException e) {
|
} catch(InterruptedException e) {
|
||||||
|
Logger.dev("Shell: Root shell error...");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user