Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.
 
 

35 rindas
1.0 KiB

  1. #!/bin/bash
  2. #RESOLUTION="1280x720"
  3. RESOLUTION="1920x1080"
  4. VIDEODEV="/dev/video10"
  5. function unlock {
  6. ### Activates the screen and unlocks the phone
  7. # Reads the current screen state eturns any combination of ON/OFF and
  8. # LOCKED/UNLOCKED (i.e. OFF_LOCKED).
  9. # Works only on NFC enabled phones but alternative methods exist.
  10. IFS='_' read -ra screenstate <<< $(adb shell dumpsys nfc | awk -F'=' \
  11. '/mScreenState/ {print $2}')
  12. # Emulate Power-Button press if screen is OFF.
  13. [[ ${screenstate[0]} == "OFF" ]] && adb shell input keyevent 26 && \
  14. echo Screen activated
  15. # Emulate Menu-button press if phone is locked. Requires the phone to
  16. # unlock without PIN or password.
  17. [[ ${screenstate[1]} == "LOCKED" ]] && adb shell input keyevent 82 && \
  18. echo Device unlocked
  19. }
  20. function blank {
  21. ### Blanks the screen after X seconds
  22. sleep ${1}
  23. IFS='_' read -ra screenstate <<< $(adb shell dumpsys nfc | awk -F'=' \
  24. '/mScreenState/ {print $2}')
  25. [[ ${screenstate[0]} == "ON" ]] && adb shell input keyevent 26 && \
  26. echo Screen deactivated
  27. }
  28. # Unlock phone
  29. unlock