Commit cb1df521 authored by topjohnwu's avatar topjohnwu

Update error messages

parent 24ef8035
......@@ -81,6 +81,7 @@ public class MagiskFragment extends Fragment {
@Override
protected boolean unzipAndCheck() {
publishProgress(mContext.getString(R.string.zip_install_unzip_zip_msg));
if (Shell.rootAccess()) {
// We might not have busybox yet, unzip with Java
// We will have complete busybox after Magisk installation
ZipUtils.unzip(mCachedFile, new File(mCachedFile.getParent(), "magisk"));
......@@ -88,7 +89,9 @@ public class MagiskFragment extends Fragment {
"mkdir -p " + Async.TMP_FOLDER_PATH + "/magisk",
"cp -af " + mCachedFile.getParent() + "/magisk/. " + Async.TMP_FOLDER_PATH + "/magisk"
);
return super.unzipAndCheck();
}
super.unzipAndCheck();
return true;
}
@Override
......
......@@ -37,7 +37,6 @@ public class SplashActivity extends AppCompatActivity {
.apply();
new Async.CheckUpdates(prefs).exec();
// new Async.ConstructEnv(getApplicationInfo()).exec();
new Async.LoadModules(prefs) {
@Override
......
......@@ -207,7 +207,7 @@ public class Async {
@Override
protected Integer doInBackground(Void... voids) {
Logger.dev("FlashZip Running... " + mFilename);
List<String> ret = null;
List<String> ret;
try {
preProcessing();
copyToCache();
......@@ -216,8 +216,8 @@ public class Async {
return -1;
}
if (!unzipAndCheck()) return 0;
publishProgress(mContext.getString(R.string.zip_install_progress_msg, mFilename));
if (Shell.rootAccess()) {
publishProgress(mContext.getString(R.string.zip_install_progress_msg, mFilename));
ret = Shell.su(
"BOOTMODE=true sh " + mCachedFile.getParent() +
"/META-INF/com/google/android/update-binary dummy 1 " + mCachedFile.getPath(),
......@@ -231,6 +231,11 @@ public class Async {
"rm -rf " + mCachedFile.getParent() + "/*",
"rm -rf " + TMP_FOLDER_PATH
);
} else {
if (mCachedFile != null && mCachedFile.exists() && !mCachedFile.delete()) {
Utils.removeItem(mCachedFile.getPath());
}
return -1;
}
if (ret != null && Boolean.parseBoolean(ret.get(ret.size() - 1))) {
return 1;
......@@ -238,7 +243,7 @@ public class Async {
return -1;
}
// -1 = error; 0 = invalid zip; 1 = success
// -1 = error, manual install; 0 = invalid zip; 1 = success
@Override
protected void onPostExecute(Integer result) {
super.onPostExecute(result);
......
......@@ -139,7 +139,7 @@ public class ZipUtils {
if (!entry.getName().contains(path)) {
continue;
}
Logger.dev("Extracting: " + entry);
Logger.dev("ZipUtils: Extracting: " + entry);
is = zipfile.getInputStream(entry);
dest = new File(folder, entry.getName());
if (dest.getParentFile().mkdirs()) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment