Update error messages

This commit is contained in:
topjohnwu 2016-11-29 13:38:32 +08:00
parent 24ef80351c
commit cb1df5217e
4 changed files with 20 additions and 13 deletions

View File

@ -81,14 +81,17 @@ public class MagiskFragment extends Fragment {
@Override
protected boolean unzipAndCheck() {
publishProgress(mContext.getString(R.string.zip_install_unzip_zip_msg));
// 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"));
Shell.su(
"mkdir -p " + Async.TMP_FOLDER_PATH + "/magisk",
"cp -af " + mCachedFile.getParent() + "/magisk/. " + Async.TMP_FOLDER_PATH + "/magisk"
);
return super.unzipAndCheck();
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"));
Shell.su(
"mkdir -p " + Async.TMP_FOLDER_PATH + "/magisk",
"cp -af " + mCachedFile.getParent() + "/magisk/. " + Async.TMP_FOLDER_PATH + "/magisk"
);
}
super.unzipAndCheck();
return true;
}
@Override

View File

@ -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

View File

@ -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);

View File

@ -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()) {