-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheadb.functions
1266 lines (1198 loc) · 52.9 KB
/
eadb.functions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
[ -n "$BASH_VERSION" ] || [ -n "$ZSH_VERSION" ] || return
# Note: functins leading with eadb_* or eadb-* will be used instead of being passed
# to adb. eadb-* functions indicate a function that will have eadb-select run for them
# before being executed. eadb_* functions will have to handle calling eadb-select on their own.
function eadb {
function adb-push-with-devid {
local device=$1
shift
local last="${@: -1}"
for file in "${@:1:($#-1)}"; do
echo -n 'Pushing '
echo -n $file
echo -n '->'
echo "$device:$last"
echo -n " "
adb -s $device push "$file" "$last"
done
}
function eadb_select {
if [ -n "$ADB_DEFAULT_DEVICE" ]; then
echo "$ADB_DEFAULT_DEVICE"
else
local dids=`adb devices 2>&1 | egrep 'sideload$|device$|recovery$' | awk '{print $1}'`
if [ `echo "$dids" | wc -l` == "1" ]; then
name=`cat "$HOME/.eadb/$dids" 2>/dev/null`
if [ -n "$name" ]; then
echo "Only one device found using $name ($dids)" >&2
else
echo "Only one device found using $dids" >&2
fi
devid[0]="$dids"
DEVICE=0
DEV="$dids"
echo -n $DEV
return
fi
if [ "all" != "$1" ]; then
echo "Please select a device:" >&2
if [ "$1" == "true" ]; then
echo " a) Run on all devices" >&2
fi
fi
local devs=`adb devices 2>&1 | egrep 'sideload$|device$|recovery$' | sed 's/.\(sideload\|device\|recovery\)/~\1/g'`
local d=1
for line in $devs; do
if [ "device" != "$line" ] && [ "recovery" != "$line" ] && [ "sideload" != "$line" ] && [ -n "$line" ] ; then
mode[$d]=`echo "$line" | grep -o '~.*' | sed 's/^~//'`
line=`echo "$line" | sed 's/~.*//'`
devid[$d]="$line"
if [ "${mode[$d]}" == "device" ]; then
mod=`eadb_model-for $line`
else
mod=""
fi
modid[$d]="$mod"
if [ "all" != "$1" ]; then
if [ -f "$HOME/.eadb/$line" ]; then
name=`cat "$HOME/.eadb/$line"`
echo " $d) $name - $line $mod" >&2
else
echo " $d) $line $mod" >&2
fi
fi
d=`expr $d + 1`
fi
done
if [ "$d" == "2" ]; then
echo -n "${devid[1]}"
else
if [ "all" != "$1" ]; then
read -p " Device Number: " device
fi
if [ "a" == "$device" ] || [ "all" == "$1" ]; then
adb devices 2>&1 | egrep 'sideload$|device$|recovery$' | awk '{print $1}'
else
echo "${devid[$device]}"
fi
fi
fi
}
function eadb_clogcat-disable-timing {
if [ -f "$HOME/.eadb.logcat" ]; then
if [ "$1" != "-q" ]; then
echo "Disabling timing"
fi
sed -i '/THREADTIME/d' $HOME/.eadb.logcat
fi
}
function eadb_clogcat-enable-timing {
clogcat-disable-timing -q
if [ "$1" != "-q" ]; then
echo "Enabling timing"
fi
echo 'THREADTIME="-v threadtime"' >> $HOME/.eadb.logcat
}
function eadb_clogcat-always-log-clear {
if [ -f "$HOME/.eadb.logcat" ]; then
sed -i '/LOGCAT_ALWAYSLOG/d' $HOME/.eadb.logcat
fi
}
function eadb_clogcat-always-log {
#TODO: Fixme
#clogcat-always-log-clear
echo "LOGCAT_ALWAYSLOG=\"$1\"" >> $HOME/.eadb.logcat
}
function implode {
if [ -n "$2" ]; then
local IFS="$1"; shift; echo "$*";
fi
}
function eadb-clogcat {
if [ -f "$HOME/.eadb.logcat" ]; then
source "$HOME/.eadb.logcat"
fi
if [ "$(type -t eadb-clogcat$1)" = function ] && [ -n "$1" ]; then
eadb-clogcat$1
return
fi
local cmd="_eadb logcat $THREADTIME"
if [ "$1" == "plogcat" ] || [ "$1" == "plog" ]; then
shift
if [ -n "$1" ]; then
cmd="eadb-plogcat $1 $THREADTIME"
shift
fi
fi
if [ "$1" == "-" ]; then
cmd="read log"
shift
elif [ "http" == "${1:0:4}" ]; then
local filename="`echo $1 | sed 's/\//_/g'`"
if [ ! -f "/tmp/$filename" ]; then
curl $1 > "/tmp/$filename"
if [ -n "`grep "<title>401 - Unauthorized: Access is denied due to invalid credentials.</title>" /tmp/$filename`" ]; then
echo "Access denied. Could not retrieve log."
rm "/tmp/$filename"
return
fi
fi
cmd="cat /tmp/$filename"
shift
fi
if [ -n "$THREADTIME" ]; then
lcalways=""
if [ -n "$LOGCAT_ALWAYSLOG" ]; then
lcalways="|${LOGCAT_ALWAYSLOG}"
lcalwaysel="${LOGCAT_ALWAYSLOG}|"
fi
if [ -n "$1" ]; then
$cmd | egrep --color=never --line-buffered "E.JavaBinder|E.AndroidRuntime|E.ActivityThread|W.System.err${lcalways}|`implode "|" "$@"`" | \
GREP_COLOR="1;31" egrep --color=always --line-buffered "^[^ ]* *[^ ]* *[^ ]* *[^ ]* *E[^:]*: |$" | \
GREP_COLOR="1;33" egrep --color=always --line-buffered "^[^ ]* *[^ ]* *[^ ]* *[^ ]* *W[^:]*: |$" | \
GREP_COLOR="1;32" egrep --color=always --line-buffered "^[^ ]* *[^ ]* *[^ ]* *[^ ]* *D[^:]*: |$" | \
GREP_COLOR="1;90" egrep --color=always --line-buffered "^[^ ]* *[^ ]* *[^ ]* *[^ ]* *V[^:]*: |$" | \
GREP_COLOR="1;34" egrep --color=always --line-buffered "^[^ ]* *[^ ]* *[^ ]* *[^ ]* *I[^:]*: |$" | \
GREP_COLOR="1;36" egrep --color=always --line-buffered "`implode "|" "$@"`|$" | \
GREP_COLOR="1;35" egrep --color=always --line-buffered "${lcalwaysel}6$"
else
$cmd | egrep --color=never --line-buffered "E.JavaBinder|E.AndroidRuntime|E.ActivityThread|W.System.err|$LOGCAT_ALWAYSLOG" | \
GREP_COLOR="1;31" egrep --color=always --line-buffered "^[^ ]* *[^ ]* *[^ ]* *[^ ]* *E[^:]*: |$" | \
GREP_COLOR="1;33" egrep --line-buffered --color=always "^[^ ]* *[^ ]* *[^ ]* *[^ ]* *W[^:]*: |$" | \
GREP_COLOR="1;32" egrep --color=always --line-buffered "^[^ ]* *[^ ]* *[^ ]* *[^ ]* *D[^:]*: |$" | \
GREP_COLOR="1;90" egrep --color=always --line-buffered "^[^ ]* *[^ ]* *[^ ]* *[^ ]* *V[^:]*: |$" | \
GREP_COLOR="1;34" egrep --color=always --line-buffered "^[^ ]* *[^ ]* *[^ ]* *[^ ]* *I[^:]*: |$" | \
GREP_COLOR="1;35" egrep --color=always --line-buffered "${lcalwaysel}$"
fi
else
if [ -n "$1" ]; then
$cmd | egrep --color=never --line-buffered "E.JavaBinder|E.AndroidRuntime|E.ActivityThread|W.System.err${lcalways}|`implode "|" "$@"`" | \
GREP_COLOR="1;31" egrep --color=always --line-buffered "E[ /][^:]*: |$" | \
GREP_COLOR="1;33" egrep --color=always --line-buffered "W[ /][^:]*: |$" | \
GREP_COLOR="1;32" egrep --color=always --line-buffered "D[ /][^:]*: |$" | \
GREP_COLOR="1;90" egrep --color=always --line-buffered "V[ /][^:]*: |$" | \
GREP_COLOR="1;34" egrep --color=always --line-buffered "I[ /][^:]*: |$" | \
GREP_COLOR="1;36" egrep --color=always --line-buffered "`implode "|" "$@"`|$" | \
GREP_COLOR="1;35" egrep --color=always --line-buffered "${lcalwaysel}$"
else
$cmd | egrep --color=never --line-buffered "E.JavaBinder|E.AndroidRuntime|E.ActivityThread|W.System.err${lcalways}|.*" | \
GREP_COLOR="1;31" egrep --color=always --line-buffered "E/[^:]*: |$" | \
GREP_COLOR="1;33" egrep --color=always --line-buffered "W/[^:]*: |$" | \
GREP_COLOR="1;32" egrep --color=always --line-buffered "D/[^:]*: |$" | \
GREP_COLOR="1;90" egrep --color=always --line-buffered "V/[^:]*: |$" | \
GREP_COLOR="1;34" egrep --color=always --line-buffered "I/[^:]*: |$" | \
\
GREP_COLOR="1;31" egrep --color=always --line-buffered "E [^:]*: |$" | \
GREP_COLOR="1;33" egrep --color=always --line-buffered "W [^:]*: |$" | \
GREP_COLOR="1;32" egrep --color=always --line-buffered "D [^:]*: |$" | \
GREP_COLOR="1;90" egrep --color=always --line-buffered "V [^:]*: |$" | \
GREP_COLOR="1;34" egrep --color=always --line-buffered "I [^:]*: |$" | \
\
GREP_COLOR="1;35" egrep --color=always --line-buffered "${lcalwaysel}$"
fi
fi
}
function eadb-get-process-list {
_eadb shell ps | grep $1 | awk '{print $2}' | sed 's/\n/|/g' | tr "\\n" " " | sed "s/ $/\n/g" | sed "s/ /\\\\\\|/g"
}
function eadb-watch-process {
interval=1
if [ -n "$2" ]; then
interval=$2
fi
process="$1"
processes=`eadb-get-process-list "$process"`
lastprocesses="$processes"
while [ -n "$processes" ] && [ "$processes" == "$lastprocesses" ]; do
sleep $interval
lastprocesses="$processes"
processes=`eadb-get-process-list "$process"`
done
}
function eadb_screenstream {
eadb exec-out "while true; do screenrecord --bit-rate=8m --output-format=h264 --time-limit 180 -; done"
}
function eadb_screenshot {
if [ -z "$1" ]; then
echo "Usage: eadb screenshot /path/to/screenshot.png"
else
tmp=`mktemp`
echo -n " "
devices=`eadb_select true`
for device in $devices; do
local file="$1"
if [ "1" != `echo "$devices" | wc -l` ]; then
file="`echo "$1" | cut -f 1 -d '.'`.$device.png"
fi
echo "Grabbing screenshot from $device --> $file"
ADB_CURRENT_DEVICE=device
_eadb -s $device shell screencap -p /sdcard/`basename $tmp`
_eadb -s $device pull /sdcard/`basename $tmp` $file
_eadb -s $device shell rm /sdcard/`basename $tmp`
done
echo " Screenshot stored in $1"
fi
}
function eadb_unsetdefault {
unset ADB_DEFAULT_DEVICE
unset ADB_DEFAULT_MODEL
}
function eadb-model {
_eadb shell getprop ro.product.model
}
function eadb_model-for {
if [ ! -d "$HOME/.eadb" ]; then
mkdir "$HOME/.eadb"
fi
if [ ! -f "$HOME/.eadb/models" ]; then
touch $HOME/.eadb/models
fi
local model="`grep $1 $HOME/.eadb/models | awk '{ print substr($0, index($0,$2)) }' | uniq`"
if [ -z "$model" ]; then
model="`adb -s $1 shell getprop ro.product.model | awk '{ print substr($0, index($0,$0)) }'`"
if [ -n "$model" ]; then
printf "%-32s %s\n" "$1" "$model" >> ~/.eadb/models
fi
fi
echo "$model"
}
function eadb-start {
if [ -z "$1" ]; then
echo "Usage: eadb start application.package.name (applaction.package.name.activity)"
else
device=$(eadb_select)
adb wait-for-device 2>/dev/null
if [ -z "$2" ]; then
echo $device | xargs -I '{}' adb -s {} shell am start -a android.intent.action.MAIN -n $1
else
echo $device | xargs -I '{}' adb -s {} shell am start -n $1/$2
fi
fi
}
function eadb-slogcat {
if [ "$1" == "-p" ]; then
shift
command="plogcat $1"
shift
else
command=logcat
fi
lcparams=`echo "$@" | grep -o "[a-zA-Z0-9]*:[A-Z]"`
search=`echo ""$@"" | sed 's/[A-Za-z0-9]*:[A-Z]//g' | sed 's/ /\\\\|[IDWEV]\//g' | sed 's/\\\\|\[IDWEV\]\/$//g'`
if [ -z "$search" ]; then
_eadb $command $lcparams
else
_eadb $command $lcparams | grep "E/AndroidRuntime\|[IDWEV]/$search"
fi
}
function eadb-plogcat {
if [ -z "$1" ]; then
echo "Usage: eadb plogcat com.some.package"
return
fi
package="$1"
pid=`eadb-get-process-list $package`
if [ -n "$pid" ]; then
_eadb logcat "$@" | grep "$pid" &
pid=$!
eadb-watch-process $package
kill $pid
wait $! 2>/dev/null
else
echo "Process for $1 is not currently running."
fi
}
function eadb-wait {
devid=""
type="device"
if [ "$1" == "-s" ]; then
devid="$2"
if [ -n "$3" ]; then
type="$3"
fi
else
if [ -n "$1" ]; then
type="$1"
fi
fi
devinfo=`adb devices | grep -v "List of devices attached\|Only one device" | grep . | grep "$devid" | grep "$type" `
if [ -z "$devinfo" ]; then
sleep .5
_eadb wait "$@"
fi
}
function eadb_setdefault {
eadb_unsetdefault
export ADB_DEFAULT_DEVICE=`eadb_select true`
}
function eadb_name {
device=$(eadb_select)
read -p "Please provide a name for $device: " NAME
if [ ! -d $HOME/.eadb ]; then
mkdir $HOME/.eadb 2>/dev/null
fi
echo "$NAME" > $HOME/.eadb/$device
}
function eadb-install-mirroring {
_eadb -s $device shell sqlite3 /data/data/com.google.android.gsf/databases/gservices.db "INSERT INTO overrides (name, value) VALUES ('gms:cast:mirroring_enabled', 'true');"
_eadb -s $device shell sqlite3 /data/data/com.google.android.gsf/databases/gservices.db "UPDATE overrides SET value='true' WHERE name='gms:cast:mirroring_enabled';"
_eadb -s $device shell am force-stop com.google.android.gsf
_eadb -s $device shell am force-stop com.google.android.gms
_eadb -s $device shell am force-stop com.google.android.apps.chromecast.app
}
function eadb_showdefault {
if [ -z "$ADB_DEFAULT_DEVICE" ]; then
if [ "-q" != "$1" ]; then
echo "No default device is currently set." >&2
fi
else
if [ "-q" != "$1" ]; then
echo -n "Default deivce: " >&2
fi
echo "$ADB_DEFAULT_DEVICE $ADB_DEFAULT_MODEL"
fi
}
function eadb-input-text {
_eadb shell input text "$@"
}
# Key code constant: Soft Left key.
# Usually situated below the display on phones and used as a multi-function
# feature key for selecting a software defined function shown on the bottom left
# of the display.
KEYCODE_SOFT_LEFT=1
# Key code constant: Soft Right key.
# Usually situated below the display on phones and used as a multi-function
# feature key for selecting a software defined function shown on the bottom right
# of the display.
KEYCODE_SOFT_RIGHT=2
# Key code constant: Home key.
# This key is handled by the framework and is never delivered to applications.
KEYCODE_HOME=3
# Key code constant: Back key.
KEYCODE_BACK=4
# Key code constant: Call key.
KEYCODE_CALL=5
# Key code constant: End Call key.
KEYCODE_ENDCALL=6
# Key code constant: '0' key.
KEYCODE_0=7
# Key code constant: '1' key.
KEYCODE_1=8
# Key code constant: '2' key.
KEYCODE_2=9
# Key code constant: '3' key.
KEYCODE_3=10
# Key code constant: '4' key.
KEYCODE_4=11
# Key code constant: '5' key.
KEYCODE_5=12
# Key code constant: '6' key.
KEYCODE_6=13
# Key code constant: '7' key.
KEYCODE_7=14
# Key code constant: '8' key.
KEYCODE_8=15
# Key code constant: '9' key.
KEYCODE_9=16
# Key code constant: '*' key.
KEYCODE_STAR=17
# Key code constant: '#' key.
KEYCODE_POUND=18
# Key code constant: Directional Pad Up key.
# May also be synthesized from trackball motions.
KEYCODE_DPAD_UP=19
# Key code constant: Directional Pad Down key.
# May also be synthesized from trackball motions.
KEYCODE_DPAD_DOWN=20
# Key code constant: Directional Pad Left key.
# May also be synthesized from trackball motions.
KEYCODE_DPAD_LEFT=21
# Key code constant: Directional Pad Right key.
# May also be synthesized from trackball motions.
KEYCODE_DPAD_RIGHT=22
# Key code constant: Directional Pad Center key.
# May also be synthesized from trackball motions.
KEYCODE_DPAD_CENTER=23
# Key code constant: Volume Up key.
# Adjusts the speaker volume up.
KEYCODE_VOLUME_UP=24
# Key code constant: Volume Down key.
# Adjusts the speaker volume down.
KEYCODE_VOLUME_DOWN=25
# Key code constant: Power key.
KEYCODE_POWER=26
# Key code constant: Camera key.
# Used to launch a camera application or take pictures.
KEYCODE_CAMERA=27
# Key code constant: Clear key.
KEYCODE_CLEAR=28
# Key code constant: 'A' key.
KEYCODE_A=29
# Key code constant: 'B' key.
KEYCODE_B=30
# Key code constant: 'C' key.
KEYCODE_C=31
# Key code constant: 'D' key.
KEYCODE_D=32
# Key code constant: 'E' key.
KEYCODE_E=33
# Key code constant: 'F' key.
KEYCODE_F=34
# Key code constant: 'G' key.
KEYCODE_G=35
# Key code constant: 'H' key.
KEYCODE_H=36
# Key code constant: 'I' key.
KEYCODE_I=37
# Key code constant: 'J' key.
KEYCODE_J=38
# Key code constant: 'K' key.
KEYCODE_K=39
# Key code constant: 'L' key.
KEYCODE_L=40
# Key code constant: 'M' key.
KEYCODE_M=41
# Key code constant: 'N' key.
KEYCODE_N=42
# Key code constant: 'O' key.
KEYCODE_O=43
# Key code constant: 'P' key.
KEYCODE_P=44
# Key code constant: 'Q' key.
KEYCODE_Q=45
# Key code constant: 'R' key.
KEYCODE_R=46
# Key code constant: 'S' key.
KEYCODE_S=47
# Key code constant: 'T' key.
KEYCODE_T=48
# Key code constant: 'U' key.
KEYCODE_U=49
# Key code constant: 'V' key.
KEYCODE_V=50
# Key code constant: 'W' key.
KEYCODE_W=51
# Key code constant: 'X' key.
KEYCODE_X=52
# Key code constant: 'Y' key.
KEYCODE_Y=53
# Key code constant: 'Z' key.
KEYCODE_Z=54
# Key code constant: ',' key.
KEYCODE_COMMA=55
# Key code constant: '.' key.
KEYCODE_PERIOD=56
# Key code constant: Left Alt modifier key.
KEYCODE_ALT_LEFT=57
# Key code constant: Right Alt modifier key.
KEYCODE_ALT_RIGHT=58
# Key code constant: Left Shift modifier key.
KEYCODE_SHIFT_LEFT=59
# Key code constant: Right Shift modifier key.
KEYCODE_SHIFT_RIGHT=60
# Key code constant: Tab key.
KEYCODE_TAB=61
# Key code constant: Space key.
KEYCODE_SPACE=62
# Key code constant: Symbol modifier key.
# Used to enter alternate symbols.
KEYCODE_SYM=63
# Key code constant: Explorer special function key.
# Used to launch a browser application.
KEYCODE_EXPLORER=64
# Key code constant: Envelope special function key.
# Used to launch a mail application.
KEYCODE_ENVELOPE=65
# Key code constant: Enter key.
KEYCODE_ENTER=66
# Key code constant: Backspace key.
# Deletes characters before the insertion point, unlike {@link #KEYCODE_FORWARD_DEL}.
KEYCODE_DEL=67
# Key code constant: '`' (backtick) key.
KEYCODE_GRAVE=68
# Key code constant: '-'.
KEYCODE_MINUS=69
# Key code constant: '=' key.
KEYCODE_EQUALS=70
# Key code constant: '[' key.
KEYCODE_LEFT_BRACKET=71
# Key code constant: ']' key.
KEYCODE_RIGHT_BRACKET=72
# Key code constant: '\' key.
KEYCODE_BACKSLASH=73
# Key code constant: '' key.
KEYCODE_SEMICOLON=74
# Key code constant: ''' (apostrophe) key.
KEYCODE_APOSTROPHE=75
# Key code constant: '/' key.
KEYCODE_SLASH=76
# Key code constant: '@' key.
KEYCODE_AT=77
# Key code constant: Number modifier key.
# Used to enter numeric symbols.
# This key is not Num Lock it is more like {@link #KEYCODE_ALT_LEFT} and is
# interpreted as an ALT key by {@link android.text.method.MetaKeyKeyListener}.
KEYCODE_NUM=78
# Key code constant: Headset Hook key.
# Used to hang up calls and stop media.
KEYCODE_HEADSETHOOK=79
# Key code constant: Camera Focus key.
# Used to focus the camera.
KEYCODE_FOCUS=80 # *Camera* focus
# Key code constant: '+' key.
KEYCODE_PLUS=81
# Key code constant: Menu key.
KEYCODE_MENU=82
# Key code constant: Notification key.
KEYCODE_NOTIFICATION=83
# Key code constant: Search key.
KEYCODE_SEARCH=84
# Key code constant: Play/Pause media key.
KEYCODE_MEDIA_PLAY_PAUSE=85
# Key code constant: Stop media key.
KEYCODE_MEDIA_STOP=86
# Key code constant: Play Next media key.
KEYCODE_MEDIA_NEXT=87
# Key code constant: Play Previous media key.
KEYCODE_MEDIA_PREVIOUS=88
# Key code constant: Rewind media key.
KEYCODE_MEDIA_REWIND=89
# Key code constant: Fast Forward media key.
KEYCODE_MEDIA_FAST_FORWARD=90
# Key code constant: Mute key.
# Mutes the microphone, unlike {@link #KEYCODE_VOLUME_MUTE}.
KEYCODE_MUTE=91
# Key code constant: Page Up key.
KEYCODE_PAGE_UP=92
# Key code constant: Page Down key.
KEYCODE_PAGE_DOWN=93
# Key code constant: Picture Symbols modifier key.
# Used to switch symbol sets (Emoji, Kao-moji).
KEYCODE_PICTSYMBOLS=94 # switch symbol-sets (Emoji,Kao-moji)
# Key code constant: Switch Charset modifier key.
# Used to switch character sets (Kanji, Katakana).
KEYCODE_SWITCH_CHARSET=95 # switch char-sets (Kanji,Katakana)
# Key code constant: A Button key.
# On a game controller, the A button should be either the button labeled A
# or the first button on the bottom row of controller buttons.
KEYCODE_BUTTON_A=96
# Key code constant: B Button key.
# On a game controller, the B button should be either the button labeled B
# or the second button on the bottom row of controller buttons.
KEYCODE_BUTTON_B=97
# Key code constant: C Button key.
# On a game controller, the C button should be either the button labeled C
# or the third button on the bottom row of controller buttons.
KEYCODE_BUTTON_C=98
# Key code constant: X Button key.
# On a game controller, the X button should be either the button labeled X
# or the first button on the upper row of controller buttons.
KEYCODE_BUTTON_X=99
# Key code constant: Y Button key.
# On a game controller, the Y button should be either the button labeled Y
# or the second button on the upper row of controller buttons.
KEYCODE_BUTTON_Y=100
# Key code constant: Z Button key.
# On a game controller, the Z button should be either the button labeled Z
# or the third button on the upper row of controller buttons.
KEYCODE_BUTTON_Z=101
# Key code constant: L1 Button key.
# On a game controller, the L1 button should be either the button labeled L1 (or L)
# or the top left trigger button.
KEYCODE_BUTTON_L1=102
# Key code constant: R1 Button key.
# On a game controller, the R1 button should be either the button labeled R1 (or R)
# or the top right trigger button.
KEYCODE_BUTTON_R1=103
# Key code constant: L2 Button key.
# On a game controller, the L2 button should be either the button labeled L2
# or the bottom left trigger button.
KEYCODE_BUTTON_L2=104
# Key code constant: R2 Button key.
# On a game controller, the R2 button should be either the button labeled R2
# or the bottom right trigger button.
KEYCODE_BUTTON_R2=105
# Key code constant: Left Thumb Button key.
# On a game controller, the left thumb button indicates that the left (or only)
# joystick is pressed.
KEYCODE_BUTTON_THUMBL=106
# Key code constant: Right Thumb Button key.
# On a game controller, the right thumb button indicates that the right
# joystick is pressed.
KEYCODE_BUTTON_THUMBR=107
# Key code constant: Start Button key.
# On a game controller, the button labeled Start.
KEYCODE_BUTTON_START=108
# Key code constant: Select Button key.
# On a game controller, the button labeled Select.
KEYCODE_BUTTON_SELECT=109
# Key code constant: Mode Button key.
# On a game controller, the button labeled Mode.
KEYCODE_BUTTON_MODE=110
# Key code constant: Escape key.
KEYCODE_ESCAPE=111
# Key code constant: Forward Delete key.
# Deletes characters ahead of the insertion point, unlike {@link #KEYCODE_DEL}.
KEYCODE_FORWARD_DEL=112
# Key code constant: Left Control modifier key.
KEYCODE_CTRL_LEFT=113
# Key code constant: Right Control modifier key.
KEYCODE_CTRL_RIGHT=114
# Key code constant: Caps Lock key.
KEYCODE_CAPS_LOCK=115
# Key code constant: Scroll Lock key.
KEYCODE_SCROLL_LOCK=116
# Key code constant: Left Meta modifier key.
KEYCODE_META_LEFT=117
# Key code constant: Right Meta modifier key.
KEYCODE_META_RIGHT=118
# Key code constant: Function modifier key.
KEYCODE_FUNCTION=119
# Key code constant: System Request / Print Screen key.
KEYCODE_SYSRQ=120
# Key code constant: Break / Pause key.
KEYCODE_BREAK=121
# Key code constant: Home Movement key.
# Used for scrolling or moving the cursor around to the start of a line
# or to the top of a list.
KEYCODE_MOVE_HOME=122
# Key code constant: End Movement key.
# Used for scrolling or moving the cursor around to the end of a line
# or to the bottom of a list.
KEYCODE_MOVE_END=123
# Key code constant: Insert key.
# Toggles insert / overwrite edit mode.
KEYCODE_INSERT=124
# Key code constant: Forward key.
# Navigates forward in the history stack. Complement of {@link #KEYCODE_BACK}.
KEYCODE_FORWARD=125
# Key code constant: Play media key.
KEYCODE_MEDIA_PLAY=126
# Key code constant: Pause media key.
KEYCODE_MEDIA_PAUSE=127
# Key code constant: Close media key.
# May be used to close a CD tray, for example.
KEYCODE_MEDIA_CLOSE=128
# Key code constant: Eject media key.
# May be used to eject a CD tray, for example.
KEYCODE_MEDIA_EJECT=129
# Key code constant: Record media key.
KEYCODE_MEDIA_RECORD=130
# Key code constant: F1 key.
KEYCODE_F1=131
# Key code constant: F2 key.
KEYCODE_F2=132
# Key code constant: F3 key.
KEYCODE_F3=133
# Key code constant: F4 key.
KEYCODE_F4=134
# Key code constant: F5 key.
KEYCODE_F5=135
# Key code constant: F6 key.
KEYCODE_F6=136
# Key code constant: F7 key.
KEYCODE_F7=137
# Key code constant: F8 key.
KEYCODE_F8=138
# Key code constant: F9 key.
KEYCODE_F9=139
# Key code constant: F10 key.
KEYCODE_F10=140
# Key code constant: F11 key.
KEYCODE_F11=141
# Key code constant: F12 key.
KEYCODE_F12=142
# Key code constant: Num Lock key.
# This is the Num Lock key it is different from {@link #KEYCODE_NUM}.
# This key alters the behavior of other keys on the numeric keypad.
KEYCODE_NUM_LOCK=143
# Key code constant: Numeric keypad '0' key.
KEYCODE_NUMPAD_0=144
# Key code constant: Numeric keypad '1' key.
KEYCODE_NUMPAD_1=145
# Key code constant: Numeric keypad '2' key.
KEYCODE_NUMPAD_2=146
# Key code constant: Numeric keypad '3' key.
KEYCODE_NUMPAD_3=147
# Key code constant: Numeric keypad '4' key.
KEYCODE_NUMPAD_4=148
# Key code constant: Numeric keypad '5' key.
KEYCODE_NUMPAD_5=149
# Key code constant: Numeric keypad '6' key.
KEYCODE_NUMPAD_6=150
# Key code constant: Numeric keypad '7' key.
KEYCODE_NUMPAD_7=151
# Key code constant: Numeric keypad '8' key.
KEYCODE_NUMPAD_8=152
# Key code constant: Numeric keypad '9' key.
KEYCODE_NUMPAD_9=153
# Key code constant: Numeric keypad '/' key (for division).
KEYCODE_NUMPAD_DIVIDE=154
# Key code constant: Numeric keypad '*' key (for multiplication).
KEYCODE_NUMPAD_MULTIPLY=155
# Key code constant: Numeric keypad '-' key (for subtraction).
KEYCODE_NUMPAD_SUBTRACT=156
# Key code constant: Numeric keypad '+' key (for addition).
KEYCODE_NUMPAD_ADD=157
# Key code constant: Numeric keypad '.' key (for decimals or digit grouping).
KEYCODE_NUMPAD_DOT=158
# Key code constant: Numeric keypad ',' key (for decimals or digit grouping).
KEYCODE_NUMPAD_COMMA=159
# Key code constant: Numeric keypad Enter key.
KEYCODE_NUMPAD_ENTER=160
# Key code constant: Numeric keypad '=' key.
KEYCODE_NUMPAD_EQUALS=161
# Key code constant: Numeric keypad '(' key.
KEYCODE_NUMPAD_LEFT_PAREN=162
# Key code constant: Numeric keypad ')' key.
KEYCODE_NUMPAD_RIGHT_PAREN=163
# Key code constant: Volume Mute key.
# Mutes the speaker, unlike {@link #KEYCODE_MUTE}.
# This key should normally be implemented as a toggle such that the first press
# mutes the speaker and the second press restores the original volume.
KEYCODE_VOLUME_MUTE=164
# Key code constant: Info key.
# Common on TV remotes to show additional information related to what is
# currently being viewed.
KEYCODE_INFO=165
# Key code constant: Channel up key.
# On TV remotes, increments the television channel.
KEYCODE_CHANNEL_UP=166
# Key code constant: Channel down key.
# On TV remotes, decrements the television channel.
KEYCODE_CHANNEL_DOWN=167
# Key code constant: Zoom in key.
KEYCODE_ZOOM_IN=168
# Key code constant: Zoom out key.
KEYCODE_ZOOM_OUT=169
# Key code constant: TV key.
# On TV remotes, switches to viewing live TV.
KEYCODE_TV=170
# Key code constant: Window key.
# On TV remotes, toggles picture-in-picture mode or other windowing functions.
KEYCODE_WINDOW=171
# Key code constant: Guide key.
# On TV remotes, shows a programming guide.
KEYCODE_GUIDE=172
# Key code constant: DVR key.
# On some TV remotes, switches to a DVR mode for recorded shows.
KEYCODE_DVR=173
# Key code constant: Bookmark key.
# On some TV remotes, bookmarks content or web pages.
KEYCODE_BOOKMARK=174
# Key code constant: Toggle captions key.
# Switches the mode for closed-captioning text, for example during television shows.
KEYCODE_CAPTIONS=175
# Key code constant: Settings key.
# Starts the system settings activity.
KEYCODE_SETTINGS=176
# Key code constant: TV power key.
# On TV remotes, toggles the power on a television screen.
KEYCODE_TV_POWER=177
# Key code constant: TV input key.
# On TV remotes, switches the input on a television screen.
KEYCODE_TV_INPUT=178
# Key code constant: Set-top-box power key.
# On TV remotes, toggles the power on an external Set-top-box.
KEYCODE_STB_POWER=179
# Key code constant: Set-top-box input key.
# On TV remotes, switches the input mode on an external Set-top-box.
KEYCODE_STB_INPUT=180
# Key code constant: A/V Receiver power key.
# On TV remotes, toggles the power on an external A/V Receiver.
KEYCODE_AVR_POWER=181
# Key code constant: A/V Receiver input key.
# On TV remotes, switches the input mode on an external A/V Receiver.
KEYCODE_AVR_INPUT=182
# Key code constant: Red "programmable" key.
# On TV remotes, acts as a contextual/programmable key.
KEYCODE_PROG_RED=183
# Key code constant: Green "programmable" key.
# On TV remotes, actsas a contextual/programmable key.
KEYCODE_PROG_GREEN=184
# Key code constant: Yellow "programmable" key.
# On TV remotes, acts as a contextual/programmable key.
KEYCODE_PROG_YELLOW=185
# Key code constant: Blue "programmable" key.
# On TV remotes, acts as a contextual/programmable key.
KEYCODE_PROG_BLUE=186
# Key code constant: App switch key.
# Should bring up the application switcher dialog.
KEYCODE_APP_SWITCH=187
# Key code constant: Generic Game Pad Button #1.*/
KEYCODE_BUTTON_1=188
# Key code constant: Generic Game Pad Button #2.*/
KEYCODE_BUTTON_2=189
# Key code constant: Generic Game Pad Button #3.*/
KEYCODE_BUTTON_3=190
# Key code constant: Generic Game Pad Button #4.*/
KEYCODE_BUTTON_4=191
# Key code constant: Generic Game Pad Button #5.*/
KEYCODE_BUTTON_5=192
# Key code constant: Generic Game Pad Button #6.*/
KEYCODE_BUTTON_6=193
# Key code constant: Generic Game Pad Button #7.*/
KEYCODE_BUTTON_7=194
# Key code constant: Generic Game Pad Button #8.*/
KEYCODE_BUTTON_8=195
# Key code constant: Generic Game Pad Button #9.*/
KEYCODE_BUTTON_9=196
# Key code constant: Generic Game Pad Button #10.*/
KEYCODE_BUTTON_10=197
# Key code constant: Generic Game Pad Button #11.*/
KEYCODE_BUTTON_11=198
# Key code constant: Generic Game Pad Button #12.*/
KEYCODE_BUTTON_12=199
# Key code constant: Generic Game Pad Button #13.*/
KEYCODE_BUTTON_13=200
# Key code constant: Generic Game Pad Button #14.*/
KEYCODE_BUTTON_14=201
# Key code constant: Generic Game Pad Button #15.*/
KEYCODE_BUTTON_15=202
# Key code constant: Generic Game Pad Button #16.*/
KEYCODE_BUTTON_16=203
# Key code constant: Language Switch key.
# Toggles the current input language such as switching between English and Japanese on
# a QWERTY keyboard. On some devices, the same function may be performed by
# pressing Shift+Spacebar.
KEYCODE_LANGUAGE_SWITCH=204
# Key code constant: Manner Mode key.
# Toggles silent or vibrate mode on and off to make the device behave more politely
# in certain settings such as on a crowded train. On some devices, the key may only
# operate when long-pressed.
KEYCODE_MANNER_MODE=205
# Key code constant: 3D Mode key.
# Toggles the display between 2D and 3D mode.
KEYCODE_3D_MODE=206
# Key code constant: Contacts special function key.
# Used to launch an address book application.
KEYCODE_CONTACTS=207
# Key code constant: Calendar special function key.
# Used to launch a calendar application.
KEYCODE_CALENDAR=208
# Key code constant: Music special function key.
# Used to launch a music player application.
KEYCODE_MUSIC=209
# Key code constant: Calculator special function key.
# Used to launch a calculator application.
KEYCODE_CALCULATOR=210
# Key code constant: Japanese full-width / half-width key.
KEYCODE_ZENKAKU_HANKAKU=211
# Key code constant: Japanese alphanumeric key.
KEYCODE_EISU=212
# Key code constant: Japanese non-conversion key.
KEYCODE_MUHENKAN=213
# Key code constant: Japanese conversion key.
KEYCODE_HENKAN=214
# Key code constant: Japanese katakana / hiragana key.
KEYCODE_KATAKANA_HIRAGANA=215
# Key code constant: Japanese Yen key.
KEYCODE_YEN=216
# Key code constant: Japanese Ro key.
KEYCODE_RO=217
# Key code constant: Japanese kana key.
KEYCODE_KANA=218
# Key code constant: Assist key.
# Launches the global assist activity. Not delivered to applications.
KEYCODE_ASSIST=219
# Key code constant: Brightness Down key.
# Adjusts the screen brightness down.
KEYCODE_BRIGHTNESS_DOWN=220
# Key code constant: Brightness Up key.
# Adjusts the screen brightness up.
KEYCODE_BRIGHTNESS_UP=221
# Key code constant: Audio Track key.
# Switches the audio tracks.
KEYCODE_MEDIA_AUDIO_TRACK=222
# Key code constant: Sleep key.
# Puts the device to sleep. Behaves somewhat like {@link #KEYCODE_POWER} but it
# has no effect if the device is already asleep.
KEYCODE_SLEEP=223
# Key code constant: Wakeup key.
# Wakes up the device. Behaves somewhat like {@link #KEYCODE_POWER} but it
# has no effect if the device is already awake.
KEYCODE_WAKEUP=224
# Key code constant: Pairing key.
# Initiates peripheral pairing mode. Useful for pairing remote control
# devices or game controllers, especially if no other input mode is
# available.
KEYCODE_PAIRING=225
# Key code constant: Media Top Menu key.
# Goes to the top of media menu.
KEYCODE_MEDIA_TOP_MENU=226
# Key code constant: '11' key.
KEYCODE_11=227
# Key code constant: '12' key.
KEYCODE_12=228
# Key code constant: Last Channel key.
# Goes to the last viewed channel.
KEYCODE_LAST_CHANNEL=229
# Key code constant: TV data service key.
# Displays data services like weather, sports.
KEYCODE_TV_DATA_SERVICE=230
# Key code constant: Voice Assist key.
# Launches the global voice assist activity. Not delivered to applications.
KEYCODE_VOICE_ASSIST=231
# Key code constant: Radio key.
# Toggles TV service / Radio service.
KEYCODE_TV_RADIO_SERVICE=232
# Key code constant: Teletext key.
# Displays Teletext service.
KEYCODE_TV_TELETEXT=233
# Key code constant: Number entry key.
# Initiates to enter multi-digit channel nubmber when each digit key is assigned
# for selecting separate channel. Corresponds to Number Entry Mode (0x1D) of CEC
# User Control Code.
KEYCODE_TV_NUMBER_ENTRY=234
# Key code constant: Analog Terrestrial key.
# Switches to analog terrestrial broadcast service.
KEYCODE_TV_TERRESTRIAL_ANALOG=235
# Key code constant: Digital Terrestrial key.
# Switches to digital terrestrial broadcast service.
KEYCODE_TV_TERRESTRIAL_DIGITAL=236
# Key code constant: Satellite key.
# Switches to digital satellite broadcast service.
KEYCODE_TV_SATELLITE=237
# Key code constant: BS key.
# Switches to BS digital satellite broadcasting service available in Japan.
KEYCODE_TV_SATELLITE_BS=238
# Key code constant: CS key.