Commit 7263b6fe authored by topjohnwu's avatar topjohnwu

Handle bootblock detect failure cases

parent 46a4070f
...@@ -47,12 +47,13 @@ public class InstallFragment extends Fragment implements CallbackHandler.EventLi ...@@ -47,12 +47,13 @@ public class InstallFragment extends Fragment implements CallbackHandler.EventLi
installTitle.setText(getString(R.string.install_magisk_title, Global.Info.remoteMagiskVersion)); installTitle.setText(getString(R.string.install_magisk_title, Global.Info.remoteMagiskVersion));
flashButton.setOnClickListener(v1 -> { flashButton.setOnClickListener(v1 -> {
String bootImage; String bootImage;
if (Global.Info.bootBlock != null) {
if (spinner.getSelectedItemPosition() > 0) if (spinner.getSelectedItemPosition() > 0)
bootImage = Global.Data.blockList.get(spinner.getSelectedItemPosition() - 1); bootImage = Global.Data.blockList.get(spinner.getSelectedItemPosition() - 1);
else else
bootImage = Global.Info.bootBlock; bootImage = Global.Info.bootBlock;
if (bootImage == null) { } else {
bootImage = Global.Data.blockList.get(spinner.getSelectedItemPosition() - 1); bootImage = Global.Data.blockList.get(spinner.getSelectedItemPosition());
} }
String filename = "Magisk-v" + Global.Info.remoteMagiskVersion + ".zip"; String filename = "Magisk-v" + Global.Info.remoteMagiskVersion + ".zip";
String finalBootImage = bootImage; String finalBootImage = bootImage;
...@@ -84,6 +85,7 @@ public class InstallFragment extends Fragment implements CallbackHandler.EventLi ...@@ -84,6 +85,7 @@ public class InstallFragment extends Fragment implements CallbackHandler.EventLi
private void updateUI() { private void updateUI() {
List<String> items = new ArrayList<>(Global.Data.blockList); List<String> items = new ArrayList<>(Global.Data.blockList);
if (Global.Info.bootBlock != null)
items.add(0, getString(R.string.auto_detect, Global.Info.bootBlock)); items.add(0, getString(R.string.auto_detect, Global.Info.bootBlock));
ArrayAdapter<String> adapter = new ArrayAdapter<>(getActivity(), ArrayAdapter<String> adapter = new ArrayAdapter<>(getActivity(),
android.R.layout.simple_spinner_item, items); android.R.layout.simple_spinner_item, items);
......
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