Skip to content

Commit

Permalink
0.2.0-rc6
Browse files Browse the repository at this point in the history
* Fixed random partition errors (if it still occurs: that is a bug!)
* Added debug page
* Fixed Sailfish being Unknown
* Updated translations
  • Loading branch information
nift4 committed Feb 21, 2021
1 parent 03c9220 commit e58bad3
Show file tree
Hide file tree
Showing 13 changed files with 141 additions and 65 deletions.
4 changes: 3 additions & 1 deletion .idea/assetWizardSettings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ android {
// we're not going to google play
//noinspection OldTargetApi
targetSdkVersion 27
versionCode 2050
versionName "0.2.0-rc5"
versionCode 2060
versionName "0.2.0-rc6"
}
signingConfigs {
release {
Expand Down
7 changes: 5 additions & 2 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,11 @@
android:supportsRtl="false"
android:theme="@style/AppTheme"
tools:replace="android:allowBackup">
<activity android:name=".ui.wizard.WizardActivity"
android:theme="@style/AppTheme" />
<activity
android:name=".ui.debug.DebugActivity" />
<activity
android:name=".ui.wizard.WizardActivity"
android:theme="@style/AppTheme" />
<activity android:name=".ui.activities.SplashActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/assets/Scripts
37 changes: 7 additions & 30 deletions app/src/main/java/org/androidbootmanager/app/roms/ROMsList.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,66 +29,43 @@ public List<ROM> getROMs() {
ROM r = new ROM();
r.scriptname = sn;
r.fullPath = "/data/data/org.androidbootmanager.app/assets/Scripts/add_os/" + codename + "/" + r.scriptname;
ArrayList<String> a;
int b;
r.requiredFiles = new HashMap<>();
r.parts = new ArrayList<>();
r.strings = new HashMap<>();
ArrayList<String> a = new ArrayList<>(Arrays.asList(Objects.requireNonNull(SuFile.open("/data/abm/bootset/db/entries/").list())));
a.removeIf((c) -> !c.contains("rom"));
a.sort((c, d) -> Integer.compare(Integer.parseInt(c.replace("rom","").replace(".conf","")), Integer.parseInt(d.replace("rom","").replace(".conf",""))));
int b = a.size() > 0 ? Integer.parseInt(a.get(a.size()-1).replace("rom","").replace(".conf",""))+1 : 0;
switch (r.scriptname) {
case "add_ubuntutouch_systemimage_haliumboot.sh":
r.viewname = c.getString(R.string.rom_type_add_ut_sysimg_halium);
r.requiredFiles = new HashMap<>();
r.requiredFiles.put("halium-boot.img", c.getString(R.string.select_halium_boot));
r.requiredFiles.put("system.img", c.getString(R.string.select_system_image));
r.parts = new ArrayList<>();
r.parts.add(c.getString(R.string.select_part, c.getString(R.string.system_part)));
r.parts.add(c.getString(R.string.select_part, c.getString(R.string.data_part)));
r.strings = new HashMap<>();
r.strings.put(c.getString(R.string.enter_rom_name), "Ubuntu Touch");
a = new ArrayList<>(Arrays.asList(Objects.requireNonNull(SuFile.open("/data/abm/bootset/db/entries/").list())));
a.removeIf((c) -> !c.contains("rom"));
a.sort((c, d) -> Integer.compare(Integer.parseInt(c.replace("rom","").replace(".conf","")), Integer.parseInt(d.replace("rom","").replace(".conf",""))));
b = a.size() > 0 ? Integer.parseInt(a.get(a.size()-1).replace("rom","").replace(".conf",""))+1 : 0;
r.strings.put(c.getString(R.string.enter_rom_folder), "rom" + b);
r.gen = (imodel, menuName, folderName) -> imodel.setCmdline(Objects.requireNonNull(imodel.getROM().getValue()).fullPath + " '" + folderName + "' '" + menuName + "' " + Objects.requireNonNull(imodel.getParts().getValue()).get(0) + " " + imodel.getParts().getValue().get(1) + " /data/data/org.androidbootmanager.app/cache/system.img /data/data/org.androidbootmanager.app/cache/halium-boot.img");
break;
case "add_sailfish.sh":
r.viewname = c.getString(R.string.rom_type_add_sailfish);
r.requiredFiles = new HashMap<>();
r.requiredFiles.put("hybris-boot.img", c.getString(R.string.select_hybris_boot));
r.requiredFiles.put("sailfish.img001", c.getString(R.string.select_system_image));
r.parts = new ArrayList<>();
r.parts.add(c.getString(R.string.select_part, c.getString(R.string.data_part)));
r.strings = new HashMap<>();
r.strings.put(c.getString(R.string.enter_rom_name), "SailfishOS");
a = new ArrayList<>(Arrays.asList(Objects.requireNonNull(SuFile.open("/data/abm/bootset/db/entries/").list())));
a.removeIf((c) -> !c.contains("rom"));
a.sort((c, d) -> Integer.compare(Integer.parseInt(c.replace("rom","").replace(".conf","")), Integer.parseInt(d.replace("rom","").replace(".conf",""))));
b = a.size() > 0 ? Integer.parseInt(a.get(a.size()-1).replace("rom","").replace(".conf",""))+1 : 0;
r.strings.put(c.getString(R.string.enter_rom_folder), "rom" + b);
r.gen = (imodel, menuName, folderName) -> imodel.setCmdline(Objects.requireNonNull(imodel.getROM().getValue()).fullPath + " '" + folderName + "' '" + menuName + "' " + Objects.requireNonNull(imodel.getParts().getValue()).get(0) + " /data/data/org.androidbootmanager.app/cache/sailfish.img001 /data/data/org.androidbootmanager.app/cache/hybris-boot.img");
break;
case "other_os.sh":
r.viewname = c.getString(R.string.other_os);
r.requiredFiles = new HashMap<>();
r.requiredFiles.put("boot.img", c.getString(R.string.select_boot));
r.parts = new ArrayList<>();
r.strings = new HashMap<>();
r.strings.put(c.getString(R.string.enter_rom_name), "");
a = new ArrayList<>(Arrays.asList(Objects.requireNonNull(SuFile.open("/data/abm/bootset/db/entries/").list())));
a.removeIf((c) -> !c.contains("rom"));
a.sort((c, d) -> Integer.compare(Integer.parseInt(c.replace("rom","").replace(".conf","")), Integer.parseInt(d.replace("rom","").replace(".conf",""))));
b = a.size() > 0 ? Integer.parseInt(a.get(a.size()-1).replace("rom","").replace(".conf",""))+1 : 0;
r.strings.put(c.getString(R.string.enter_rom_folder), "rom" + b);
r.gen = (imodel, menuName, folderName) -> imodel.setCmdline(Objects.requireNonNull(imodel.getROM().getValue()).fullPath + " '" + folderName + "' '" + menuName + "' /data/data/org.androidbootmanager.app/cache/boot.img");
break;
case "entry_only.sh":
r.viewname = c.getString(R.string.empty_entry);
r.requiredFiles = new HashMap<>();
r.parts = new ArrayList<>();
r.strings = new HashMap<>();
r.strings.put(c.getString(R.string.enter_rom_name), "");
a = new ArrayList<>(Arrays.asList(Objects.requireNonNull(SuFile.open("/data/abm/bootset/db/entries/").list())));
a.removeIf((c) -> !c.contains("rom"));
a.sort((c, d) -> Integer.compare(Integer.parseInt(c.replace("rom","").replace(".conf","")), Integer.parseInt(d.replace("rom","").replace(".conf",""))));
b = a.size() > 0 ? Integer.parseInt(a.get(a.size()-1).replace("rom","").replace(".conf",""))+1 : 0;
r.strings.put(c.getString(R.string.enter_rom_folder), "rom" + b);
r.gen = (imodel, menuName, folderName) -> imodel.setCmdline(Objects.requireNonNull(imodel.getROM().getValue()).fullPath + " '" + folderName + "' '" + menuName + "'");
break;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package org.androidbootmanager.app.ui.debug;

import android.app.AlertDialog;
import android.os.Bundle;
import android.view.View;

import androidx.appcompat.app.AppCompatActivity;

import com.topjohnwu.superuser.Shell;

import org.androidbootmanager.app.R;

import java.util.ArrayList;

public class DebugActivity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_debug);
}

public void errorTest(View v) {
shelldialog("echo out && echo err 1>&2");
}

public void shelldialog(String j) {
ArrayList<String> o = new ArrayList<>();
ArrayList<String> e = new ArrayList<>();
Shell.Result r = Shell.su(j).to(o, e).exec();
new AlertDialog.Builder(this)
.setTitle(j)
.setMessage("OUT channel:\n" + String.join("\n", o) + "\nOUT channel using get:\n" + String.join("\n", r.getOut()) + "\nERR channel:\n" + String.join("\n", e) + "\nERR channel using get:\n" + String.join("\n", r.getErr()))
.show();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;

Expand All @@ -17,6 +18,7 @@
import org.androidbootmanager.app.R;
import org.androidbootmanager.app.devices.DeviceList;
import org.androidbootmanager.app.ui.activities.MainActivity;
import org.androidbootmanager.app.ui.debug.DebugActivity;
import org.androidbootmanager.app.ui.home.InstalledViewModel;
import org.androidbootmanager.app.ui.updatelk.BlUpdateWizardPageFragment;
import org.androidbootmanager.app.ui.wizard.WizardActivity;
Expand All @@ -41,6 +43,9 @@ public View onCreateView(@NonNull LayoutInflater inflater,
a.finish();
});
root.findViewById(R.id.generalcfg_update_bl).setOnClickListener((view) -> startActivity(new Intent(requireActivity(), WizardActivity.class).putExtra("codename",model.getCodename().getValue()).putExtra("StartFragment", BlUpdateWizardPageFragment.class)));
Button debug = root.findViewById(R.id.debug);
if (debug != null)
debug.setOnClickListener((view) -> startActivity(new Intent(requireActivity(), DebugActivity.class)));

final String fileName = SuFile.open("/data/abm/bootset/lk2nd/lk2nd.conf").exists() ? "/data/abm/bootset/lk2nd/lk2nd.conf" : "/data/abm/bootset/lk2nd/db.conf";
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,10 @@ public void onBindViewHolder(@NonNull ROMRecyclerViewAdapter.ViewHolder holder,
holder.label.setText(getString(R.string.ut));
holder.pic.setImageDrawable(ContextCompat.getDrawable(requireContext(), R.drawable.ut_logo));
break;
case "SFOS":
holder.label.setText(getString(R.string.rom_type_add_sailfish));
holder.pic.setImageDrawable(ContextCompat.getDrawable(requireContext(), R.drawable.ic_sailfish_os_logo));
break;
case "droid":
holder.label.setText(getString(R.string.android));
holder.pic.setImageDrawable(ContextCompat.getDrawable(requireContext(),R.drawable.ic_roms));
Expand Down
Loading

0 comments on commit e58bad3

Please sign in to comment.