Skip to content

Commit

Permalink
Reboot choose
Browse files Browse the repository at this point in the history
  • Loading branch information
nikita-yfh committed Jul 24, 2022
1 parent c85cb8a commit e0bb663
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 6 deletions.
23 changes: 19 additions & 4 deletions app/src/main/java/ru/nikita/adb/FastbootActivity.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package ru.nikita.adb;

import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.ArrayList;
import android.os.Bundle;
Expand All @@ -11,7 +9,9 @@
import android.widget.ArrayAdapter;
import android.widget.Toast;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.Intent;
import android.content.DialogInterface;
import android.hardware.usb.UsbManager;
import android.hardware.usb.UsbDevice;
import ru.nikita.adb.FastbootVariablesListActivity;
Expand Down Expand Up @@ -78,8 +78,23 @@ public void deviceInfoAll(View view){
}
public void reboot(View view){
try {
if(getSelectedDevice().openConnection(this))
getSelectedDevice().reboot();
if(getSelectedDevice().openConnection(this)) {
AlertDialog.Builder b = new AlertDialog.Builder(this);
b.setTitle(R.string.reboot);
final String[] items = {
"",
"bootloader",
"recovery",
};
b.setItems(R.array.fastboot_reboot, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which){
dialog.dismiss();
getSelectedDevice().reboot(items[which]);
}
});
b.show();
}
} catch(FastbootException e) {
e.showToast(this);
}
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/java/ru/nikita/adb/FastbootDevice.java
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ private String readOnce() {
return response;
}

public void reboot() {
write("reboot");
public void reboot(String target) {
write("reboot-" + target);
readOnce();
}

Expand Down

0 comments on commit e0bb663

Please sign in to comment.