Skip to content

Instantly share code, notes, and snippets.

@llinfeng
Last active February 9, 2023 03:42
Show Gist options
  • Save llinfeng/affd7911645d7e8502b20d6f0a612842 to your computer and use it in GitHub Desktop.
Save llinfeng/affd7911645d7e8502b20d6f0a612842 to your computer and use it in GitHub Desktop.
Use adb to launch a page in OneNote APK on an Android tablet
alias one=onenote_adb_opener
onenote_adb_opener(){
# Send the link to Android tablet
python $LL_Home/Dropbox/Wiki/MyScripts/adb_commander/onenote_link_open.py $1
# Then, this is specific to Boox Lumi 2 tablet: to make sure the thing is unlocked.
adb_screen_on
}
adb_screen_on(){
# Note, "mActive=true" is specific to Boox Lumi 2 (may work for other Boox stuff?)
result="$(adb shell dumpsys input_method | grep -c "mActive=true")"
if test $result = 2 ; then
echo "Screen is already on."
else
echo "Turning screen on."
adb shell input keyevent 26
# Note, keyevent 26 is blindly simulating the pressing of the power key. It may turn the screen off.
fi
}
@llinfeng
Copy link
Author

llinfeng commented Jul 4, 2022

Renate commented on using adb shell input keyevent 26.

Don't send 26 (Power). Send 224 (Wakeup). FWIW 223 (Sleep).

Then, the Zsh function adb_screen_on() can be simplified into one line.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment