bypass.patch 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. diff --git a/anykernel.sh b/anykernel.sh
  2. index 35b6e59..7936667 100755
  3. --- a/anykernel.sh
  4. +++ b/anykernel.sh
  5. @@ -45,6 +45,47 @@ esac
  6. ui_print " " " -> Wild Kernels Supported: $ksu_supported"
  7. $ksu_supported || abort " -> Non-GKI device, abort."
  8. +handle_input() {
  9. + /system/bin/getevent -lq 2>/dev/null | while IFS= read -r line; do
  10. + case "$line" in
  11. + *KEY_VOLUMEUP*DOWN*) echo "bypass"; break ;;
  12. + *KEY_VOLUMEDOWN*DOWN*) echo "normal"; break ;;
  13. + *KEY_POWER*DOWN*) echo "cancel"; break ;;
  14. + esac
  15. + done
  16. +}
  17. +
  18. +choose_flash_mode() {
  19. + ui_print " -> Most users do not need Bypass; try Normal first!"
  20. + ui_print " -> This only swaps the Image for compatibility workarounds, this doesn't help with hiding root."
  21. + ui_print " -> VOL+ = Bypass"
  22. + ui_print " -> VOL- = Normal"
  23. + ui_print " -> POWER = Cancel"
  24. +
  25. + while true; do
  26. + case $(handle_input) in
  27. + normal)
  28. + ui_print " -> Selected: Normal"
  29. + return 0
  30. + ;;
  31. + bypass)
  32. + ui_print " -> Selected: Bypass"
  33. + if [ -f "$AKHOME/Bypass-Image" ]; then
  34. + cp -f "$AKHOME/Bypass-Image" "$AKHOME/Image"
  35. + ui_print " -> Using Bypass-Image for this flash"
  36. + return 0
  37. + fi
  38. + abort " -> ERROR: Bypass-Image not found. Abort."
  39. + ;;
  40. + cancel)
  41. + abort " -> Cancelled by POWER button. Abort."
  42. + ;;
  43. + esac
  44. + done
  45. +}
  46. +
  47. +choose_flash_mode
  48. +
  49. # boot install
  50. split_boot