Read only the first line instead of loading the whole file
This commit is contained in:
parent
cbb32f82eb
commit
a5b573eaaa
@ -218,9 +218,8 @@ public class Async {
|
|||||||
|
|
||||||
protected boolean unzipAndCheck() {
|
protected boolean unzipAndCheck() {
|
||||||
ZipUtils.unzip(mCachedFile, mCachedFile.getParentFile(), "META-INF/com/google/android");
|
ZipUtils.unzip(mCachedFile, mCachedFile.getParentFile(), "META-INF/com/google/android");
|
||||||
List<String> ret;
|
String line = Utils.readFirstLine(mCachedFile.getParent() + "/META-INF/com/google/android/updater-script");
|
||||||
ret = Utils.readFile(mCachedFile.getParent() + "/META-INF/com/google/android/updater-script");
|
return line != null && line.contains("#MAGISK");
|
||||||
return Utils.isValidShellResponse(ret) && ret.get(0).contains("#MAGISK");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -75,6 +75,17 @@ public class Utils {
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String readFirstLine(String path) {
|
||||||
|
List<String> ret;
|
||||||
|
String command = "head -1 " + path;
|
||||||
|
if (Shell.rootAccess()) {
|
||||||
|
ret = Shell.su(command);
|
||||||
|
} else {
|
||||||
|
ret = Shell.sh(command);
|
||||||
|
}
|
||||||
|
return isValidShellResponse(ret) ? ret.get(0) : null;
|
||||||
|
}
|
||||||
|
|
||||||
public static void dlAndReceive(Context context, DownloadReceiver receiver, String link, String filename) {
|
public static void dlAndReceive(Context context, DownloadReceiver receiver, String link, String filename) {
|
||||||
if (isDownloading) {
|
if (isDownloading) {
|
||||||
return;
|
return;
|
||||||
|
Loading…
Reference in New Issue
Block a user