summaryrefslogtreecommitdiffstats
path: root/docs/html/tools/help/MonkeyDevice.jd
blob: e7612e66409308fedad4c3c6ed597e3477c02824 (plain)
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
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
page.title=MonkeyDevice
parent.title=monkeyrunner
parent.link=index.html
@jd:body
<style>
    h4.jd-details-title {background-color: #DEE8F1;}
</style>
<p>
    A monkeyrunner class that represents a device or emulator accessible by the workstation running
<code><a href="{@docRoot}tools/help/monkeyrunner_concepts.html">monkeyrunner</a></code>.
</p>
<p>
    This class is used to control an Android device or emulator. The methods send UI events,
    retrieve information, install and remove applications, and run applications.
</p>
<p>
    You normally do not have to create an instance of <code>MonkeyDevice</code>. Instead, you
    use
<code><a href="{@docRoot}tools/help/MonkeyRunner.html#waitForConnection">
MonkeyRunner.waitForConnection()</a></code> to create a new object from a connection to a device or
emulator. For example, instead of
using:</p>
<pre>
newdevice = MonkeyDevice()
</pre>
<p>
    you would use:
</p>
<pre>
newdevice = MonkeyRunner.waitForConnection()
</pre>
<h2>Summary</h2>
    <table id="constants" class="jd-sumtable" style="background-color: white;">
       <tr>
            <th colspan="12" style="background-color: #E2E2E2">Constants</th>
       </tr>
        <tr class="api" style="background-color: white;">
            <td class="jd-typecol"><em>string</em></td>
            <td class="jd-linkcol"><a href="#ACTION_DOWN">DOWN</a></td>
            <td class="jd-descrcol" width="100%">
                Use this with the <code>type</code> argument of
                <code><a href="#press">press()</a></code> or <code><a href="#touch">touch()</a>
                </code>
                to send a DOWN event.
            </td>
        </tr>
        <tr class="api" style="background-color: white;">
            <td class="jd-typecol"><em>string</em></td>
            <td class="jd-linkcol"><a href="#ACTION_UP">UP</a></td>
            <td class="jd-descrcol" width="100%">
                Use this with the <code>type</code> argument of
                <code><a href="#press">press()</a></code> or <code><a href="#touch">touch()</a>
                </code>
                to send an UP event.
            </td>
        </tr>
        <tr class="api" style="background-color: white;">
            <td class="jd-typecol"><em>string</em></td>
            <td class="jd-linkcol"><a href="#ACTION_DOWN_AND_UP">DOWN_AND_UP</a></td>
            <td class="jd-descrcol" width="100%">
                Use this with the <code>type</code> argument of
                <code><a href="#press">press()</a></code> or <code><a href="#touch">touch()</a>
                </code>
                to send a DOWN event immediately followed by an UP event.
            </td>
        </tr>
    </table>
<table id="pubmethods" class="jd-sumtable">
    <tr>
        <th colspan="12" style="background-color: #E2E2E2">Methods</th>
    </tr>
    <tr class="api" >
        <td class="jd-typecol">
            <nobr>
                void
            </nobr>
        </td>
        <td class="jd-linkcol" width="100%">
            <nobr>
                <span class="sympad">
                    <a href="#broadcastIntent">broadcastIntent</a>
                </span>
                (<em>string</em> uri,
                <em>string</em> action,
                <em>string</em> data,
                <em>string</em> mimetype,
                <em>iterable</em> categories
                <em>dictionary</em> extras,
                <em>component</em> component,
                <em>iterable</em> flags)
            </nobr>
            <div class="jd-descrdiv">
                Broadcasts an Intent to this device, as if the Intent were coming from an
                application.
            </div>
        </td>
    </tr>
    <tr class="api" >
        <td class="jd-typecol">
            <nobr>
                void
            </nobr>
        </td>
        <td class="jd-linkcol" width="100%">
            <nobr>
                <span class="sympad">
                    <a href="#drag">drag</a>
                </span>
                (<em>tuple</em> start,
                <em>tuple</em> end,
                <em>float</em> duration,
                <em>integer</em> steps)
            </nobr>
            <div class="jd-descrdiv">
                Simulates a drag gesture (touch, hold, and move) on this device's screen.
            </div>
        </td>
    </tr>
    <tr class="api" >
        <td class="jd-typecol">
            <nobr>
                <em>object</em>
            </nobr>
        </td>
        <td class="jd-linkcol" width="100%">
            <nobr>
                <span class="sympad">
                    <a href="#getProperty">getProperty</a>
                </span>
                (<em>string</em> key)
            </nobr>
            <div class="jd-descrdiv">
                Given the name of a system environment variable, returns its value for this device.
                The available variable names are listed in the <a href="#getProperty">
                detailed description</a> of this method.
            </div>
        </td>
    </tr>
    <tr class="api" >
        <td class="jd-typecol">
            <nobr>
                <em>object</em>
            </nobr>
        </td>
        <td class="jd-linkcol" width="100%">
            <nobr>
                <span class="sympad">
                    <a href="#getSystemProperty">getSystemProperty</a>
                </span>
                (<em>string</em> key)
            </nobr>
            <div class="jd-descrdiv">
.               The API equivalent of <code>adb shell getprop &lt;key&gt;. This is provided for use
                by platform developers.
            </div>
        </td>
    </tr>
    <tr class="api" >
        <td class="jd-typecol">
            <nobr>
                void
            </nobr>
        </td>
        <td class="jd-linkcol" width="100%">
            <nobr>
                <span class="sympad">
                    <a href="#installPackage">installPackage</a>
                </span>
                (<em>string</em> path)
            </nobr>
            <div class="jd-descrdiv">
                Installs the Android application or test package contained in packageFile onto this
                device. If the application or test package is already installed, it is replaced.
            </div>
        </td>
    </tr>
    <tr class="api" >
        <td class="jd-typecol">
            <nobr>
                <em>dictionary</em>
            </nobr>
        </td>
        <td class="jd-linkcol" width="100%">
            <nobr>
                <span class="sympad">
                    <a href="#instrument">instrument</a>
                </span>
                (<em>string</em> className,
                <em>dictionary</em> args)
            </nobr>
            <div class="jd-descrdiv">
                Runs the specified component under Android instrumentation, and returns the results
                in a dictionary whose exact format is dictated by the component being run. The
                component must already be present on this device.
            </div>
        </td>
    </tr>
    <tr class="api">
        <td class="jd-typecol">
            <nobr>
                void
            </nobr>
        </td>
        <td class="jd-linkcol" width="100%">
            <nobr>
                <span class="sympad">
                    <a href="#press">press</a>
                </span>
                (<em>string</em> name,
                <em>dictionary</em> type)
            </nobr>
            <div class="jd-descrdiv">
                Sends the key event specified by type to the key specified by
                keycode.
            </div>
        </td>
    </tr>
    <tr class="api" >
        <td class="jd-typecol">
            <nobr>
                void
            </nobr>
        </td>
        <td class="jd-linkcol" width="100%">
            <nobr>
                <span class="sympad">
                    <a href="#reboot">reboot</a>
                </span>
                (<em>string</em> into)
            </nobr>
            <div class="jd-descrdiv">
                Reboots this device into the bootloader specified by bootloadType.
            </div>
        </td>
    </tr>
    <tr class="api" >
        <td class="jd-typecol">
            <nobr>
                void
            </nobr>
        </td>
        <td class="jd-linkcol" width="100%">
            <nobr>
                <span class="sympad">
                    <a href="#removePackage">removePackage</a>
                </span>
                (<em>string</em> package)
            </nobr>
            <div class="jd-descrdiv">
                Deletes the specified package from this device, including its data and cache.
            </div>
        </td>
    </tr>
    <tr class="api" >
        <td class="jd-typecol">
            <nobr>
                <em>object</em>
            </nobr>
        </td>
        <td class="jd-linkcol" width="100%">
            <nobr>
                <span class="sympad">
                    <a href="#shell">shell</a>
                </span>
                (<em>string</em> cmd)
            </nobr>
            <div class="jd-descrdiv">
                Executes an <code>adb</code> shell command and returns the result, if any.
            </div>
        </td>
    </tr>
    <tr class="api" >
        <td class="jd-typecol">
            <nobr>
                void
            </nobr>
        </td>
        <td class="jd-linkcol" width="100%">
            <nobr>
                <span class="sympad">
                    <a href="#startActivity">startActivity</a>
                </span>
                (<em>string</em> uri,
                <em>string</em> action,
                <em>string</em> data,
                <em>string</em> mimetype,
                <em>iterable</em> categories
                <em>dictionary</em> extras,
                <em>component</em> component,
                <em>flags</em>)
            </nobr>
            <div class="jd-descrdiv">
                Starts an Activity on this device by sending an Intent constructed from the
                supplied arguments.
            </div>
        </td>
    </tr>
    <tr class="api" >
        <td class="jd-typecol">
            <nobr>
                <code>
                <a href="{@docRoot}tools/help/MonkeyImage.html">
                        MonkeyImage
                    </a>
                </code>
            </nobr>
        </td>
        <td class="jd-linkcol" width="100%">
            <nobr>
                <span class="sympad">
                    <a href="#takeSnapshot">takeSnapshot</a>()
                </span>
            </nobr>
            <div class="jd-descrdiv">
                Captures the entire screen buffer of this device, yielding a
                <code>
                <a href="{@docRoot}tools/help/MonkeyImage.html">
                        MonkeyImage
                </a>
                </code> object containing a screen capture of the current display.
            </div>
        </td>
    </tr>
    <tr class="api" >
        <td class="jd-typecol">
            <nobr>
                void
            </nobr>
        </td>
        <td class="jd-linkcol" width="100%">
            <nobr>
                <span class="sympad">
                    <a href="#touch">touch</a>
                </span>
               (<em>integer</em> x,
                 <em>integer</em> y,
                 <em>integer</em> type)
            </nobr>
            <div class="jd-descrdiv">
                Sends a touch event specified by type to the screen location specified
                by x and y.
            </div>
        </td>
    </tr>
    <tr class="api" >
        <td class="jd-typecol">
            <nobr>
                void
            </nobr>
        </td>
        <td class="jd-linkcol" width="100%">
            <nobr>
                <span class="sympad">
                    <a href="#touch">type</a>
                </span>
                   (<em>string</em> message)
            </nobr>
            <div class="jd-descrdiv">
                Sends the characters contained in message to this device, as if they
                had been typed on the device's keyboard. This is equivalent to calling
                <code><a href="#press">press()</a></code> for each keycode in <code>message</code>
                using the key event type <code><a href="#ACTION_DOWN_AND_UP"></a>DOWN_AND_UP</code>.
            </div>
        </td>
    </tr>
    <tr class="api" >
        <td class="jd-typecol">
            <nobr>
                void
            </nobr>
        </td>
        <td class="jd-linkcol" width="100%">
            <nobr>
                <span class="sympad">
                    <a href="#touch">wake</a>
                </span>
                   ()
            </nobr>
            <div class="jd-descrdiv">
                Wakes the screen of this device.
            </div>
        </td>
    </tr>
</table>
<!-- ========= ENUM CONSTANTS DETAIL ======== -->
<h2>Constants</h2>
<A NAME="ACTION_DOWN"></a>
<div class="jd-details api">
    <h4 class="jd-details-title">
        <span class="normal">
            <em>string</em>
        </span>
            DOWN
    </h4>
    <div class="jd-details-descr">
        <div class="jd-tagdata jd-tagdescr">
            <p>
                <code><a href="#press">press()</a></code> or
                <code><a href="#press">touch()</a></code> value.
                Specifies that a DOWN event type should be sent to the device, corresponding to
                pressing down on a key or touching the screen.
            </p>
        </div>
    </div>
</div>
<A NAME="ACTION_UP"></A>
<div class="jd-details api">
    <h4 class="jd-details-title">
        <span class="normal">
            <em>string</em>
        </span>
            UP
    </h4>
    <div class="jd-details-descr">
        <div class="jd-tagdata jd-tagdescr">
            <p>
                <code><a href="#press">press()</a></code> or
                <code><a href="#press">touch()</a></code> value.
                Specifies that an UP event type should be sent to the device, corresponding to
                releasing a key or lifting up from the screen.
            </p>
        </div>
    </div>
</div>
<A NAME="ACTION_DOWN_AND_UP"></A>

<div class="jd-details api">
    <h4 class="jd-details-title">
        <span class="normal">
            <em>string</em>
        </span>
            DOWN_AND_UP
    </h4>
    <div class="jd-details-descr">
        <div class="jd-tagdata jd-tagdescr">
            <p>
                <code><a href="#press">press()</a></code>,
                <code><a href="#press">touch()</a></code> or
                <code><a href="#type">type()</a></code> value.
                Specifies that a DOWN event type followed by an UP event type should be sent to the
                device, corresponding to typing a key or clicking the screen.
            </p>
        </div>
    </div>
</div>
<!-- ========= METHOD DETAIL ======== -->
<!-- Public methods -->
<h2>Public Methods</h2>
<A NAME="broadcastIntent"></A>
<div class="jd-details api ">
    <h4 class="jd-details-title">
      <span class="normal">
        void
      </span>
      <span class="sympad">broadcastIntent</span>
      <span class="normal">
      (
            <em>string</em> uri,
            <em>string</em> action,
            <em>string</em> data,
            <em>string</em> mimetype,
            <em>iterable</em> categories
            <em>dictionary</em> extras,
            <em>component</em> component,
            <em>iterable</em> flags)
      </span>
    </h4>
  <div class="jd-details-descr">

    <div class="jd-tagdata jd-tagdescr">
        <p>
            Broadcasts an Intent to this device, as if the Intent were coming from an
            application. See {@link android.content.Intent Intent} for more information about the
            arguments.
        </p>
    </div>
    <div class="jd-tagdata">
      <h5 class="jd-tagtitle">Arguments</h5>
      <table class="jd-tagtable">
        <tr>
          <th>uri</th>
            <td>
                The URI for the Intent.
                (see {@link android.content.Intent#setData(android.net.Uri) Intent.setData()}).
            </td>
        </tr>
        <tr>
            <th>action</th>
            <td>
                The action for this Intent
                (see {@link android.content.Intent#setAction(java.lang.String) Intent.setAction()}).
            </td>
        </tr>
        <tr>
            <th>data</th>
            <td>
                The data URI for this Intent
                (see {@link android.content.Intent#setData(android.net.Uri) Intent.setData()}).
            </td>
        </tr>
        <tr>
            <th>mimetype</th>
            <td>
                The MIME type for the Intent
                (see {@link android.content.Intent#setType(java.lang.String) Intent.setType()}).
            </td>
        </tr>
        <tr>
            <th>categories</th>
            <td>
                An iterable data structure containing strings that define categories for this
                Intent
                (see
                {@link android.content.Intent#addCategory(java.lang.String) Intent.addCategory()}).
            </td>
        </tr>
        <tr>
            <th>extras</th>
            <td>
                A dictionary of extra data for this Intent
                (see {@link android.content.Intent#putExtra(java.lang.String,java.lang.String)
                Intent.putExtra()}
                for an example).
                <p>
                    The key for each dictionary item should be a <em>string</em>. The item's value
                    can be any simple or structured data type.
                </p>
            </td>
        </tr>
        <tr>
            <th>component</th>
            <td>
                The component for this Intent (see {@link android.content.ComponentName}).
                Using this argument will direct the Intent to a specific class within a specific
                Android package.
            </td>
        </tr>
        <tr>
            <th>flags</th>
            <td>
                An iterable data structure containing flags that control how the Intent is handled
                (see {@link android.content.Intent#setFlags(int) Intent.setFlags()}).
            </td>
        </tr>
      </table>
    </div>
  </div>
</div>
<A NAME="drag"></A>
<div class="jd-details api ">
    <h4 class="jd-details-title">
      <span class="normal">
        void
      </span>
      <span class="sympad">drag</span>
      <span class="normal">
      (
            <em>tuple</em> start,
            <em>tuple</em> end,
            <em>float</em> duration,
            <em>integer</em> steps)
      </span>
    </h4>
  <div class="jd-details-descr">

    <div class="jd-tagdata jd-tagdescr">
        <p>
            Simulates a drag gesture (touch, hold, and move) on this device's screen.
        </p>
    </div>
    <div class="jd-tagdata">
      <h5 class="jd-tagtitle">Arguments</h5>
      <table class="jd-tagtable">
        <tr>
          <th>start</th>
          <td>
            The starting point of the drag gesture, in the form of a <em>tuple</em>
            (x,y) where x and y are <em>integers</em>.
          </td>
        </tr>
        <tr>
          <th>end</th>
          <td>
            The end point of the drag gesture, in the form of a <em>tuple</em> (x,y)
            where x and y are <em>integers</em>.
          </td>
        </tr>
        <tr>
            <th>duration</th>
            <td>The duration of the drag gesture in seconds. The default is 1.0 seconds.</td>
        </tr>
        <tr>
            <th>steps</th>
            <td>The number of steps to take when interpolating points. The default is 10.</td>
        </tr>
      </table>
    </div>
  </div>
</div>
<A NAME="getProperty"></A>
<div class="jd-details api ">
    <h4 class="jd-details-title">
      <span class="normal">
        <em>object</em>
      </span>
      <span class="sympad">getProperty</span>
      <span class="normal">
        (<em>string</em> key)
      </span>
    </h4>
  <div class="jd-details-descr">

    <div class="jd-tagdata jd-tagdescr">
        <p>
            Given the name of a system environment variable, returns its value for this device.
        </p>
    </div>
    <div class="jd-tagdata">
      <h5 class="jd-tagtitle">Arguments</h5>
      <table class="jd-tagtable">
        <tr>
          <th>key</th>
          <td>
            The name of the system environment variable. The available variable names are listed in
            <a href="#table1">Table 1. Property variable names</a> at the end of this topic.
          </td>
        </tr>
      </table>
    </div>
    <div class="jd-tagdata">
      <h5 class="jd-tagtitle">Returns</h5>
      <ul class="nolist">
        <li>
            The value of the variable. The data format varies according to the variable requested.
        </li>
      </ul>
    </div>
  </div>
</div>
<A NAME="getSystemProperty"></A>
<div class="jd-details api ">
    <h4 class="jd-details-title">
      <span class="normal">
        <em>object</em>
      </span>
      <span class="sympad">getSystemProperty</span>
      <span class="normal">
      (<em>string</em> key)
      </span>
    </h4>
  <div class="jd-details-descr">

    <div class="jd-tagdata jd-tagdescr">
        <p>
            Synonym for <code><a href="#getProperty">getProperty()</a></code>.
        </p>
    </div>
    <div class="jd-tagdata">
      <h5 class="jd-tagtitle">Arguments</h5>
      <table class="jd-tagtable">
        <tr>
          <th>key</th>
          <td>
            The name of the system environment variable. The available variable names are listed in
            <a href="#table1">Table 1. Property Variable Names</a>.
          </td>
        </tr>
      </table>
    </div>
    <div class="jd-tagdata">
      <h5 class="jd-tagtitle">Returns</h5>
      <ul class="nolist">
        <li>
            The value of the variable. The data format varies according to the variable requested.
        </li>
      </ul>
    </div>
  </div>
</div>
<A NAME="installPackage"></A>
<div class="jd-details api ">
    <h4 class="jd-details-title">
      <span class="normal">
        void
      </span>
      <span class="sympad">installPackage</span>
      <span class="normal">
      (<em>string</em> path)
      </span>
    </h4>
  <div class="jd-details-descr">

    <div class="jd-tagdata jd-tagdescr">
        <p>
            Installs the Android application or test package contained in packageFile
            onto this device. If the application or test package is already installed, it is
            replaced.
        </p>
    </div>
    <div class="jd-tagdata">
      <h5 class="jd-tagtitle">Arguments</h5>
      <table class="jd-tagtable">
        <tr>
          <th>path</th>
          <td>
            The fully-qualified path and filename of the <code>.apk</code> file to install.
          </td>
        </tr>
      </table>
    </div>
  </div>
</div>
<A NAME="instrument"></A>
<div class="jd-details api ">
    <h4 class="jd-details-title">
      <span class="normal">
        <em>dictionary</em>
      </span>
      <span class="sympad">instrument</span>
      <span class="normal">
      (
            <em>string</em> className,
            <em>dictionary</em> args)
      </span>
    </h4>
  <div class="jd-details-descr">

    <div class="jd-tagdata jd-tagdescr">
        <p>
            Runs the specified component with Android instrumentation, and returns the results
            in a dictionary whose exact format is dictated by the component being run. The
            component must already be present on this device.
        </p>
        <p>
            Use this method to start a test case that uses one of Android's test case classes.
            See <a href="{@docRoot}tools/testing/testing_android.html">Testing
            Fundamentals</a> to learn more about unit testing with the Android testing
            framework.
        </p>
    </div>
    <div class="jd-tagdata">
      <h5 class="jd-tagtitle">Arguments</h5>
      <table class="jd-tagtable">
        <tr>
          <th>className</th>
          <td>
            The name of an Android component that is already installed on this device, in the
            standard form packagename/classname, where packagename is the
            Android package name of a <code>.apk</code> file on this device, and
            classname is the class name of an Android component (Activity,
            ContentProvider, Service, or BroadcastReceiver) in that file. Both
            packagename and classname must be fully qualified. See
            {@link android.content.ComponentName} for more details.
          </td>
        </tr>
        <tr>
          <th>args</th>
          <td>
            A dictionary containing flags and their values. These are passed to the component as it
            is started. If the flag does not take a value, set its dictionary value to an empty
            string.
          </td>
        </tr>
      </table>
    <div class="jd-tagdata">
      <h5 class="jd-tagtitle">Returns</h5>
        <ul class="nolist">
            <li>
                <p>
                    A dictionary containing the component's output. The contents of the dictionary
                    are defined by the component itself.
                </p>
                <p>
                    If you use {@link android.test.InstrumentationTestRunner} as the class name in
                    the componentName argument, then the result dictionary contains
                    the single key "stream". The value of "stream" is a <em>string</em> containing
                    the test output, as if <code>InstrumentationTestRunner</code> was run from the
                    command line. The format of this output is described in
                    <a href="{@docRoot}tools/testing/testing_otheride.html">
                    Testing in Other IDEs</a>.
                </p>
            </li>
        </ul>
    </div>
    </div>
  </div>
</div>
<A NAME="press"></A>
<div class="jd-details api ">
    <h4 class="jd-details-title">
      <span class="normal">
        void
      </span>
      <span class="sympad">press</span>
      <span class="normal">
      (<em>string</em> name,
      <em>integer</em> type)
      </span>
    </h4>
  <div class="jd-details-descr">
    <div class="jd-tagdata jd-tagdescr">
        <p>
            Sends the key event specified by <code>type</code> to the key specified by
            <code>keycode</code>.
        </p>
    </div>
    <div class="jd-tagdata">
      <h5 class="jd-tagtitle">Arguments</h5>
      <table class="jd-tagtable">
        <tr>
          <th>name</th>
          <td>
            The name of the keycode to send. See {@link android.view.KeyEvent} for a list of
            keycode names. Use the keycode name, not its integer value.
          </td>
        </tr>
        <tr>
          <th>type</th>
          <td>
            The type of key event to send. The allowed values are <code><a href="#ACTION_DOWN">
            DOWN</a></code>, <code><a href="#ACTION_UP">UP</a></code>, and
            <code><a href="#ACTION_DOWN_AND_UP">DOWN_AND_UP</a></code>.
          </td>
        </tr>
      </table>
    </div>
  </div>
</div>
<A NAME="reboot"></A>
<div class="jd-details api ">
    <h4 class="jd-details-title">
      <span class="normal">
        void
      </span>
      <span class="sympad">reboot</span>
      <span class="normal">
      (<em>string</em> bootloadType)
      </span>
    </h4>
  <div class="jd-details-descr">

    <div class="jd-tagdata jd-tagdescr">
        <p>
                Reboots this device into the bootloader specified by <code>bootloadType</code>.
        </p>
    </div>
    <div class="jd-tagdata">
      <h5 class="jd-tagtitle">Arguments</h5>
      <table class="jd-tagtable">
        <tr>
          <th>into</th>
          <td>
            The type of bootloader to reboot into. The allowed values are
            "bootloader", "recovery", or "None".
          </td>
        </tr>
      </table>
    </div>
  </div>
</div>
<A NAME="removePackage"></A>
<div class="jd-details api ">
    <h4 class="jd-details-title">
      <span class="normal">
        void
      </span>
      <span class="sympad">removePackage</span>
      <span class="normal">
      (<em>string</em> package)
      </span>
    </h4>
  <div class="jd-details-descr">

    <div class="jd-tagdata jd-tagdescr">
        <p>
            Deletes the specified package from this device, including its data and cache.
        </p>
    </div>
    <div class="jd-tagdata">
      <h5 class="jd-tagtitle">Arguments</h5>
      <table class="jd-tagtable">
        <tr>
          <th>package</th>
          <td>
            The Android package name of an <code>.apk</code> file on this device.
          </td>
      </table>
    </div>
  </div>
</div>
<A NAME="shell"></A>
<div class="jd-details api ">
    <h4 class="jd-details-title">
      <span class="normal">
        <em>object</em>
      </span>
      <span class="sympad">shell</span>
      <span class="normal">
      (<em>string</em> cmd)
      </span>
    </h4>
  <div class="jd-details-descr">
    <div class="jd-tagdata jd-tagdescr">
        <p>
            Executes an <code>adb</code> shell command and returns the result, if any.
        </p>
    </div>
    <div class="jd-tagdata">
      <h5 class="jd-tagtitle">Arguments</h5>
      <table class="jd-tagtable">
        <tr>
          <th>cmd</th>
          <td>
            The command to execute in the <code>adb</code> shell. The form of these commands is
            described in the topic <a href="{@docRoot}tools/help/adb.html">Android
            Debug Bridge</a>.
          </td>
        </tr>
      </table>
    </div>
    <div class="jd-tagdata">
      <h5 class="jd-tagtitle">Returns</h5>
      <ul class="nolist">
        <li>
            The results of the command, if any. The format of the results is determined by the
            command.
        </li>
      </ul>
    </div>
  </div>
</div>
<A NAME="startActivity"></A>
<div class="jd-details api ">
    <h4 class="jd-details-title">
      <span class="normal">
        void
      </span>
      <span class="sympad">startActivity</span>
      <span class="normal">
      (
            <em>string</em> uri,
            <em>string</em> action,
            <em>string</em> data,
            <em>string</em> mimetype,
            <em>iterable</em> categories
            <em>dictionary</em> extras,
            <em>component</em> component,
            <em>iterable</em> flags)
      </span>
    </h4>
  <div class="jd-details-descr">
    <div class="jd-tagdata jd-tagdescr">
        <p>
           Starts an Activity on this device by sending an Intent constructed from the
           supplied arguments.
        </p>
    </div>
    <div class="jd-tagdata">
      <h5 class="jd-tagtitle">Arguments</h5>
      <table class="jd-tagtable">
        <tr>
          <th>uri</th>
          <td>
            The URI for the Intent.
            (see {@link android.content.Intent#setData(android.net.Uri) Intent.setData()}).
          </td>
        </tr>
        <tr>
            <th>action</th>
            <td>
                The action for the Intent
                (see {@link android.content.Intent#setAction(java.lang.String) Intent.setAction()}).
            </td>
        </tr>
        <tr>
            <th>data</th>
            <td>
                The data URI for the Intent
                (see {@link android.content.Intent#setData(android.net.Uri) Intent.setData()}).
            </td>
        </tr>
        <tr>
            <th>mimetype</th>
            <td>
                The MIME type for the Intent
                (see {@link android.content.Intent#setType(java.lang.String) Intent.setType()}).
            </td>
        </tr>
        <tr>
            <th>categories</th>
            <td>
                An iterable data structure containing strings that define categories for the
                Intent
                (see
                {@link android.content.Intent#addCategory(java.lang.String) Intent.addCategory()}).
            </td>
        </tr>
        <tr>
            <th>extras</th>
            <td>
                A dictionary of extra data for the Intent
                (see
                {@link android.content.Intent#putExtra(java.lang.String,java.lang.String)
                Intent.putExtra()}
                for an example).
                <p>
                    The key for each dictionary item should be a <em>string</em>. The item's value
                    can be any simple or structured data type.
                </p>
            </td>
        </tr>
        <tr>
            <th>component</th>
            <td>
                The component for the Intent
                (see {@link android.content.ComponentName}). Using this argument will direct the
                Intent to a specific class within a specific Android package.
            </td>
        </tr>
        <tr>
            <th>flags</th>
            <td>
                An iterable data structure containing flags that control how the Intent is handled
                (see {@link android.content.Intent#setFlags(int) Intent.setFlags()}).
            </td>
        </tr>
      </table>
    </div>
  </div>
</div>
<A NAME="takeSnapshot"></A>
<div class="jd-details api ">
    <h4 class="jd-details-title">
      <span class="normal">
        <code>
            <a href="{@docRoot}tools/help/MonkeyImage.html">
                MonkeyImage
            </a>
        </code>
      </span>
      <span class="sympad">takeSnapshot</span>
      <span class="normal">
      ()
      </span>
    </h4>
  <div class="jd-details-descr">
    <div class="jd-tagdata jd-tagdescr">
        <p>
            Captures the entire screen buffer of this device, yielding a
            screen capture of the current display.
        </p>
    </div>
    <div class="jd-tagdata">
      <h5 class="jd-tagtitle">Returns</h5>
      <ul class="nolist">
        <li>
            A <a href="{@docRoot}tools/help/MonkeyImage.html">
            MonkeyImage</a> object containing the image of the current display.
        </li>
      </ul>
    </div>
  </div>
</div>
<A NAME="touch"></A>
<div class="jd-details api ">
    <h4 class="jd-details-title">
      <span class="normal">
        void
      </span>
      <span class="sympad">touch</span>
      <span class="normal">
      (
            <em>integer</em> x,
            <em>integer</em> y,
            <em>string</em> type)
      </span>
    </h4>
  <div class="jd-details-descr">
    <div class="jd-tagdata jd-tagdescr">
        <p>
            Sends a touch event specified by type to the screen location specified
            by x and y.
        </p>
    </div>
    <div class="jd-tagdata">
      <h5 class="jd-tagtitle">Arguments</h5>
      <table class="jd-tagtable">
        <tr>
          <th>x</th>
          <td>
            The horizontal position of the touch in actual device pixels, starting from the left of
            the screen in its current orientation.
          </td>
        </tr>
        <tr>
          <th>y</th>
          <td>
            The vertical position of the touch in actual device pixels, starting from the top of
            the screen in its current orientation.
          </td>
        </tr>
        <tr>
            <th>type</th>
            <td>
                The type of key event to send. The allowed values are <code><a href="#ACTION_DOWN">
                DOWN</a></code>, <code><a href="#ACTION_UP">UP</a></code>, and
                <code><a href="#ACTION_DOWN_AND_UP">DOWN_AND_UP</a></code>.
            </td>
        </tr>
      </table>
    </div>
  </div>
</div>
<A NAME="type"></A>
<div class="jd-details api ">
    <h4 class="jd-details-title">
      <span class="normal">
        void
      </span>
      <span class="sympad">type</span>
      <span class="normal">
      (<em>string</em> message)
      </span>
    </h4>
  <div class="jd-details-descr">
    <div class="jd-tagdata jd-tagdescr">
        <p>
            Sends the characters contained in message to this device, as if they
            had been typed on the device's keyboard. This is equivalent to calling
            <code><a href="#press">press()</a></code> for each keycode in <code>message</code>
            using the key event type <code><a href="#ACTION_DOWN_AND_UP">DOWN_AND_UP</a></code>.
        </p>
    </div>
    <div class="jd-tagdata">
      <h5 class="jd-tagtitle">Arguments</h5>
      <table class="jd-tagtable">
        <tr>
          <th>message</th>
          <td>
              A string containing the characters to send.
          </td>
        </tr>
      </table>
    </div>
  </div>
</div>
<A NAME="wake"></A>
<div class="jd-details api">
    <h4 class="jd-details-title">
      <span class="normal">
        void
      </span>
      <span class="sympad">wake</span>
      <span class="normal">
      ()
      </span>
    </h4>
  <div class="jd-details-descr">
    <div class="jd-tagdata jd-tagdescr">
        <p>
            Wakes the screen of this device.
        </p>
    </div>
  </div>
</div>
<hr></hr>
<h2>Appendix</h2>
    <p class="table-caption" id="table1">
        <strong>Table 1.</strong>Property variable names used with
        <span class="sympad"><a href="#getProperty">getProperty()</a></span> and
        <span class="sympad"><a href="#getSystemProperty">getSystemProperty()</a></span>.
    </p>
    <table>
        <tr>
            <th>
                Property Group
            </th>
            <th>
                Property
            </th>
            <th>
                Description
            </th>
            <th>
                Notes
            </th>
        </tr>
        <tr>
            <td rowspan="17"><code>build</code></td>
            <td><code>board</code></td>
            <td>Code name for the device's system board</td>
            <td rowspan="17">
                See {@link android.os.Build}
            </td>
        </tr>
        <tr>
            <td><code>brand</code></td>
            <td>The carrier or provider for which the OS is customized.</td>
        </tr>
            <tr>
            <td><code>device</code></td>
            <td>The device design name.</td>
        </tr>
            <tr>
            <td><code>fingerprint</code></td>
            <td>A unique identifier for the currently-running build.</td>
        </tr>
            <tr>
            <td><code>host</code></td>
            <td></td>
        </tr>
            <tr>
            <td><code>ID</code></td>
            <td>A changelist number or label.</td>
        </tr>
            <tr>
            <td><code>model</code></td>
            <td>The end-user-visible name for the device.</td>
        </tr>
            <tr>
            <td><code>product</code></td>
            <td>The overall product name.</td>
        </tr>
            <tr>
            <td><code>tags</code></td>
            <td>Comma-separated tags that describe the build, such as "unsigned" and "debug".</td>
        </tr>
            <tr>
            <td><code>type</code></td>
            <td>The build type, such as "user" or "eng".</td>
        </tr>
        <tr>
            <td><code>user</code></td>
            <td></td>
        </tr>
        <tr>
            <td><code>CPU_ABI</code></td>
            <td>
                The name of the native code instruction set, in the form CPU type plus
                ABI convention.
            </td>
        </tr>
        <tr>
            <td><code>manufacturer</code></td>
            <td>The product/hardware manufacturer.</td>
        </tr>
        <tr>
            <td><code>version.incremental</code></td>
            <td>
                The internal code used by the source control system to represent this version
                of the software.
            </td>
        </tr>
        <tr>
            <td><code>version.release</code></td>
            <td>The user-visible name of this version of the software.</td>
        </tr>
        <tr>
            <td><code>version.sdk</code></td>
            <td>The user-visible SDK version associated with this version of the OS.</td>
        </tr>
        <tr>
            <td><code>version.codename</code></td>
            <td>
                The current development codename, or "REL" if this version of the software has been
                released.
            </td>
        </tr>
        <tr>
            <td rowspan="3"><code>display</code></td>
            <td><code>width</code></td>
            <td>The device's display width in pixels.</td>
            <td rowspan="3">
                See
                {@link android.util.DisplayMetrics} for details.
            </td>
        </tr>
        <tr>
            <td><code>height</code></td>
            <td>The device's display height in pixels.</td>
        </tr>
        <tr>
            <td><code>density</code></td>
            <td>
                The logical density of the display. This is a factor that scales
                DIP (Density-Independent Pixel) units to the device's resolution. DIP is adjusted so
                that 1 DIP is equivalent to one pixel on a 160 pixel-per-inch display. For example,
                on a 160-dpi screen, density = 1.0, while on a 120-dpi screen, density = .75.
                <p>
                    The value does not exactly follow the real screen size, but is adjusted to
                    conform to large changes in the display DPI. See
                    {@link android.util.DisplayMetrics#density} for more details.
                </p>
            </td>
        </tr>
        <tr>
            <td rowspan="6"><code>am.current</code></td>
            <td><code>package</code></td>
            <td>The Android package name of the currently running package.</td>
            <td rowspan="6">
                The <code>am.current</code> keys return information about the currently-running
                Activity.
            </td>
        </tr>
        <tr>
            <td><code>action</code></td>
            <td>
                The current activity's action. This has the same format as the <code>name</code>
                attribute of the <code>action</code> element in a package manifest.
            </td>
        </tr>
        <tr>
            <td><code>comp.class</code></td>
            <td>
                The class name of the component that started the current Activity. See
                <code><a href="#comppackage">comp.package</a></code> for more details.</td>
        </tr>
        <tr>
            <td><a name="comppackage"><code>comp.package</code></a></td>
            <td>
                The package name of the component that started the current Activity. A component
                is specified by a package name and the name of class that the package contains.
            </td>
        </tr>
        <tr>
            <td><code>data</code></td>
            <td>The data (if any) contained in the Intent that started the current Activity.</td>
        </tr>
        <tr>
            <td><code>categories</code></td>
            <td>The categories specified by the Intent that started the current Activity.</td>
        </tr>
        <tr>
            <td rowspan="3"><code>clock</code></td>
            <td><code>realtime</code></td>
            <td>
                The number of milliseconds since the device rebooted, including deep-sleep
                time.
            </td>
            <td rowspan="3">
                See {@link android.os.SystemClock} for more information.
            </td>
        </tr>
        <tr>
            <td><code>uptime</code></td>
            <td>
                The number of milliseconds since the device rebooted, <em>not</em> including
                deep-sleep time
            </td>
        </tr>
        <tr>
            <td><code>millis</code></td>
            <td>current time since the UNIX epoch, in milliseconds.</td>
        </tr>
    </table>