Fix InstallerActivity error messages on failure.

This commit is contained in:
Fox2Code 2022-02-03 17:14:40 +01:00
parent 8995f2757c
commit 44472aaadb

View File

@ -117,6 +117,7 @@ public class InstallerActivity extends CompatActivity {
if (moduleCache.exists() && !moduleCache.delete() && if (moduleCache.exists() && !moduleCache.delete() &&
!new SuFile(moduleCache.getAbsolutePath()).delete()) !new SuFile(moduleCache.getAbsolutePath()).delete())
Log.e(TAG, "Failed to delete module cache"); Log.e(TAG, "Failed to delete module cache");
String errMessage = "Failed to download module zip";
try { try {
Log.i(TAG, "Downloading: " + target); Log.i(TAG, "Downloading: " + target);
byte[] rawModule = Http.doHttpGet(target,(progress, max, done) -> { byte[] rawModule = Http.doHttpGet(target,(progress, max, done) -> {
@ -145,6 +146,7 @@ public class InstallerActivity extends CompatActivity {
outputStream.flush(); outputStream.flush();
} }
} else { } else {
errMessage = "Failed to patch module zip";
this.runOnUiThread(() -> { this.runOnUiThread(() -> {
this.installerTerminal.addLine("- Patching " + name); this.installerTerminal.addLine("- Patching " + name);
this.progressIndicator.setVisibility(View.GONE); this.progressIndicator.setVisibility(View.GONE);
@ -162,11 +164,12 @@ public class InstallerActivity extends CompatActivity {
this.runOnUiThread(() -> { this.runOnUiThread(() -> {
this.installerTerminal.addLine("- Installing " + name); this.installerTerminal.addLine("- Installing " + name);
}); });
errMessage = "Failed to install module zip";
this.doInstall(moduleCache, noExtensions, rootless); this.doInstall(moduleCache, noExtensions, rootless);
} catch (IOException e) { } catch (IOException e) {
Log.e(TAG, "Failed to download module zip", e); Log.e(TAG, errMessage, e);
this.setInstallStateFinished(false, this.setInstallStateFinished(false,
"! Failed to download module zip", ""); "! " + errMessage, "");
} }
}, "Module download Thread").start(); }, "Module download Thread").start();
} else { } else {