Skip to content

Commit

Permalink
Bugfixes
Browse files Browse the repository at this point in the history
  • Loading branch information
nift4 committed Feb 11, 2021
1 parent cde7ef7 commit b32129e
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@

import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Objects;
import java.util.concurrent.atomic.AtomicBoolean;

Expand Down Expand Up @@ -66,7 +67,7 @@ public View onCreateView(@NonNull LayoutInflater inflater,
byte[] buf = new byte[100];
int len;
ByteArrayOutputStream s = new ByteArrayOutputStream();
SuFileInputStream i = new SuFileInputStream("/data/abm/codename.cfg");
InputStream i = SuFileInputStream.open("/data/abm/codename.cfg");
while ((len = i.read(buf)) > 0)
s.write(buf, 0, len);
model.setCodename(s.toString("UTF-8").replace("\n",""));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
Expand Down Expand Up @@ -145,20 +146,22 @@ public ViewHolder(View view) {
.setCancelable(true)
.setNeutralButton(R.string.cancel, (p1, p2) -> p1.dismiss())
.setNegativeButton(R.string.delete, (p1, p2) -> MiscUtils.sure(requireContext(), p1, getString(R.string.delete_msg_2, e.config.get("title")), (p112, p212) -> {
if (e.config.get("xsystem") != null && e.config.get("xdata") != null) {
if (e.config.get("xsystem").equals("real") || e.config.get("xdata").equals("real"))
Log.i("ABM","tryna1");
if (e.config.get("xsystem") != null && e.config.get("xdata") != null)
if (e.config.get("xsystem").equals("real") || e.config.get("xdata").equals("real")) {
new AlertDialog.Builder(requireContext())
.setTitle(R.string.failed)
.setMessage(R.string.delete_real_rom)
.setCancelable(true)
.setNegativeButton(R.string.ok, (d, p) -> d.dismiss())
.show();
} else {
if (!SuFile.open(e.file).delete())
Toast.makeText(requireContext(),"Deleting configuration file: Error.",Toast.LENGTH_LONG).show();
Shell.su("rm -rf /data/abm/bootset/" + e.file.replace("/data/abm/bootset/lk2nd/entries/","").replace(".conf","")).submit();
updateEntries();
}
return;
}

if (!SuFile.open(e.file).delete())
Toast.makeText(requireContext(),"Deleting configuration file: Error.",Toast.LENGTH_LONG).show();
Shell.su("rm -rf /data/abm/bootset/" + e.file.replace("/data/abm/bootset/lk2nd/entries/","").replace(".conf","")).submit();
updateEntries();
}))
.setPositiveButton(R.string.save, (p1, p2) -> {
e.config = proposed;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.HashMap;
import java.util.Map;
Expand Down Expand Up @@ -62,11 +63,11 @@ public static ConfigFile importFromString(String s) {

public static ConfigFile importFromFile(File f) throws ActionAbortedCleanlyError {
ByteArrayOutputStream s = new ByteArrayOutputStream();
SuFileInputStream i;
InputStream i;
byte[] b = new byte[1024];
int o;
try {
i = new SuFileInputStream(f);
i = SuFileInputStream.open(f);
} catch (FileNotFoundException e) {
throw new ActionAbortedCleanlyError(e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ public static String umsd(SDPartitionMeta meta) {
for (Partition p : meta.p)
s.append(umsd(p.type, meta.major, p.minor)).append(" && ");
String e = s.toString();
if (e.isEmpty()) return e;
if (e.isEmpty()) return "true";
return e.substring(0, e.length()-4);
}

Expand Down

0 comments on commit b32129e

Please sign in to comment.