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
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
|
#include "android/help.h"
#include "android/cmdline-option.h"
#include "android/utils/path.h"
#include "android/utils/bufprint.h"
#include "android/utils/debug.h"
#include "android/utils/misc.h"
#include "android/skin/keyset.h"
#include "android/android.h"
#include <stdint.h>
#include "audio/audio.h"
#include <string.h>
#include <stdlib.h>
#include "android/ui-core-protocol.h"
/* XXX: TODO: put most of the help stuff in auto-generated files */
#define PRINTF(...) stralloc_add_format(out,__VA_ARGS__)
static void
help_virtual_device( stralloc_t* out )
{
PRINTF(
" An Android Virtual Device (AVD) models a single virtual\n"
" device running the Android platform that has, at least, its own\n"
" kernel, system image and data partition.\n\n"
" Only one emulator process can run a given AVD at a time, but\n"
" you can create several AVDs and run them concurrently.\n\n"
" You can invoke a given AVD at startup using either '-avd <name>'\n"
" or '@<name>', both forms being equivalent. For example, to launch\n"
" the AVD named 'foo', type:\n\n"
" emulator @foo\n\n"
" The 'android' helper tool can be used to manage virtual devices.\n"
" For example:\n\n"
" android create avd -n <name> -t 1 # creates a new virtual device.\n"
" android list avd # list all virtual devices available.\n\n"
" Try 'android --help' for more commands.\n\n"
" Each AVD really corresponds to a content directory which stores\n"
" persistent and writable disk images as well as configuration files.\n"
" Each AVD must be created against an existing SDK platform or add-on.\n"
" For more information on this topic, see -help-sdk-images.\n\n"
" SPECIAL NOTE: in the case where you are *not* using the emulator\n"
" with the Android SDK, but with the Android build system, you will\n"
" need to define the ANDROID_PRODUCT_OUT variable in your environment.\n"
" See -help-build-images for the details.\n"
);
}
static void
help_sdk_images( stralloc_t* out )
{
PRINTF(
" The Android SDK now supports multiple versions of the Android platform.\n"
" Each SDK 'platform' corresponds to:\n\n"
" - a given version of the Android API.\n"
" - a set of corresponding system image files.\n"
" - build and configuration properties.\n"
" - an android.jar file used when building your application.\n"
" - skins.\n\n"
" The Android SDK also supports the concept of 'add-ons'. Each add-on is\n"
" based on an existing platform, and provides replacement or additional\n"
" image files, android.jar, hardware configuration options and/or skins.\n\n"
" The purpose of add-ons is to allow vendors to provide their own customized\n"
" system images and APIs without needing to package a complete SDK.\n\n"
" Before using the SDK, you need to create an Android Virtual Device (AVD)\n"
" (see -help-virtual-device for details). Each AVD is created in reference\n"
" to a given SDK platform *or* add-on, and will search the corresponding\n"
" directories for system image files, in the following order:\n\n"
" - in the AVD's content directory.\n"
" - in the AVD's SDK add-on directory, if any.\n"
" - in the AVD's SDK platform directory, if any.\n\n"
" The image files are documented in -help-disk-images. By default, an AVD\n"
" content directory will contain the following persistent image files:\n\n"
" userdata-qemu.img - the /data partition image file\n"
" cache.img - the /cache partition image file\n\n"
" You can use -wipe-data to re-initialize the /data partition to its factory\n"
" defaults. This will erase all user settings for the virtual device.\n\n"
);
}
static void
help_build_images( stralloc_t* out )
{
PRINTF(
" The emulator detects that you are working from the Android build system\n"
" by looking at the ANDROID_PRODUCT_OUT variable in your environment.\n\n"
" If it is defined, it should point to the product-specific directory that\n"
" contains the generated system images.\n"
" In this case, the emulator will look by default for the following image\n"
" files there:\n\n"
" - system.img : the *initial* system image.\n"
" - ramdisk.img : the ramdisk image used to boot the system.\n"
" - userdata.img : the *initial* user data image (see below).\n"
" - kernel-qemu : the emulator-specific Linux kernel image.\n\n"
" If the kernel image is not found in the out directory, then it is searched\n"
" in <build-root>/prebuilt/android-arm/kernel/.\n\n"
" Skins will be looked in <build-root>/sdk/emulator/skins/\n\n"
" You can use the -sysdir, -system, -kernel, -ramdisk, -datadir, -data options\n"
" to specify different search directories or specific image files. You can\n"
" also use the -cache and -sdcard options to indicate specific cache partition\n"
" and SD Card image files.\n\n"
" For more details, see the corresponding -help-<option> section.\n\n"
" Note that the following behaviour is specific to 'build mode':\n\n"
" - the *initial* system image is copied to a temporary file which is\n"
" automatically removed when the emulator exits. There is thus no way to\n"
" make persistent changes to this image through the emulator, even if\n"
" you use the '-image <file>' option.\n\n"
" - unless you use the '-cache <file>' option, the cache partition image\n"
" is backed by a temporary file that is initially empty and destroyed on\n"
" program exit.\n\n"
" SPECIAL NOTE: If you are using the emulator with the Android SDK, the\n"
" information above doesn't apply. See -help-sdk-images for more details.\n"
);
}
static void
help_disk_images( stralloc_t* out )
{
char datadir[256];
bufprint_config_path( datadir, datadir + sizeof(datadir) );
PRINTF(
" The emulator needs several key image files to run appropriately.\n"
" Their exact location depends on whether you're using the emulator\n"
" from the Android SDK, or not (more details below).\n\n"
" The minimal required image files are the following:\n\n"
" kernel-qemu the emulator-specific Linux kernel image\n"
" ramdisk.img the ramdisk image used to boot the system\n"
" system.img the *initial* system image\n"
" userdata.img the *initial* data partition image\n\n"
" It will also use the following writable image files:\n\n"
" userdata-qemu.img the persistent data partition image\n"
" system-qemu.img an *optional* persistent system image\n"
" cache.img an *optional* cache partition image\n"
" sdcard.img an *optional* SD Card partition image\n\n"
#if CONFIG_ANDROID_SNAPSHOTS
" snapshots.img an *optional* state snapshots image\n\n"
#endif
" If you use a virtual device, its content directory should store\n"
" all writable images, and read-only ones will be found from the\n"
" corresponding platform/add-on directories. See -help-sdk-images\n"
" for more details.\n\n"
" If you are building from the Android build system, you should\n"
" have ANDROID_PRODUCT_OUT defined in your environment, and the\n"
" emulator shall be able to pick-up the right image files automatically.\n"
" See -help-build-images for more details.\n\n"
" If you're neither using the SDK or the Android build system, you\n"
" can still run the emulator by explicitely providing the paths to\n"
" *all* required disk images through a combination of the following\n"
" options: -sysdir, -datadir, -kernel, -ramdisk, -system, -data, -cache\n"
#if CONFIG_ANDROID_SNAPSHOTS
" -sdcard and -snapstorage.\n\n"
#else
" and -sdcard.\n\n"
#endif
" The actual logic being that the emulator should be able to find all\n"
" images from the options you give it.\n\n"
" For more detail, see the corresponding -help-<option> entry.\n\n"
" Other related options are:\n\n"
" -init-data Specify an alternative *initial* user data image\n\n"
" -wipe-data Copy the content of the *initial* user data image\n"
" (userdata.img) into the writable one (userdata-qemu.img)\n\n"
" -no-cache do not use a cache partition, even if one is\n"
" available.\n\n"
#if CONFIG_ANDROID_SNAPSHOTS
" -no-snapstorage do not use a state snapshot image, even if one is\n"
" available.\n\n"
#endif
,
datadir );
}
static void
help_keys(stralloc_t* out)
{
int pass, maxw = 0;
stralloc_add_str( out, " When running the emulator, use the following keypresses:\n\n");
if (!android_keyset)
android_keyset = skin_keyset_new_from_text( skin_keyset_get_default() );
for (pass = 0; pass < 2; pass++) {
SkinKeyCommand cmd;
for (cmd = SKIN_KEY_COMMAND_NONE+1; cmd < SKIN_KEY_COMMAND_MAX; cmd++)
{
SkinKeyBinding bindings[ SKIN_KEY_COMMAND_MAX_BINDINGS ];
int n, count, len;
char temp[32], *p = temp, *end = p + sizeof(temp);
count = skin_keyset_get_bindings( android_keyset, cmd, bindings );
if (count <= 0)
continue;
for (n = 0; n < count; n++) {
p = bufprint(p, end, "%s%s", (n == 0) ? "" : ", ",
skin_key_symmod_to_str( bindings[n].sym, bindings[n].mod ) );
}
if (pass == 0) {
len = strlen(temp);
if (len > maxw)
maxw = len;
} else {
PRINTF( " %-*s %s\n", maxw, temp, skin_key_command_description(cmd) );
}
}
}
PRINTF( "\n" );
PRINTF( " note that NumLock must be deactivated for keypad keys to work\n\n" );
}
static void
help_environment(stralloc_t* out)
{
PRINTF(
" The Android emulator looks at various environment variables when it starts:\n\n"
" If ANDROID_LOG_TAGS is defined, it will be used as in '-logcat <tags>'.\n\n"
" If 'http_proxy' is defined, it will be used as in '-http-proxy <proxy>'.\n\n"
" If ANDROID_VERBOSE is defined, it can contain a comma-separated list of\n"
" verbose items. for example:\n\n"
" ANDROID_VERBOSE=socket,radio\n\n"
" is equivalent to using the '-verbose -verbose-socket -verbose-radio'\n"
" options together. unsupported items will be ignored.\n\n"
" If ANDROID_LOG_TAGS is defined, it will be used as in '-logcat <tags>'.\n\n"
" If ANDROID_SDK_HOME is defined, it indicates the path of the '.android'\n"
" directory which contains the SDK user data (Android Virtual Devices,\n"
" DDMS preferences, key stores, etc.).\n\n"
" If ANDROID_SDK_ROOT is defined, it indicates the path of the SDK\n"
" installation directory.\n\n"
);
}
static void
help_keyset_file(stralloc_t* out)
{
int n, count;
const char** strings;
char temp[MAX_PATH];
PRINTF(
" on startup, the emulator looks for 'keyset' file that contains the\n"
" configuration of key-bindings to use. the default location on this\n"
" system is:\n\n"
);
bufprint_config_file( temp, temp+sizeof(temp), KEYSET_FILE );
PRINTF( " %s\n\n", temp );
PRINTF(
" if the file doesn't exist, the emulator writes one containing factory\n"
" defaults. you are then free to modify it to suit specific needs.\n\n"
" this file shall contain a list of text lines in the following format:\n\n"
" <command> [<modifiers>]<key>\n\n"
" where <command> is an emulator-specific command name, i.e. one of:\n\n"
);
count = SKIN_KEY_COMMAND_MAX-1;
strings = calloc( count, sizeof(char*) );
for (n = 0; n < count; n++)
strings[n] = skin_key_command_to_str(n+1);
stralloc_tabular( out, strings, count, " ", 80-8 );
free(strings);
PRINTF(
"\n"
" <modifers> is an optional list of <modifier> elements (without separators)\n"
" which can be one of:\n\n"
" Ctrl- Left Control Key\n"
" Shift- Left Shift Key\n"
" Alt- Left Alt key\n"
" RCtrl- Right Control Key\n"
" RShift- Right Shift Key\n"
" RAlt- Right Alt key (a.k.a AltGr)\n"
"\n"
" finally <key> is a QWERTY-specific keyboard symbol which can be one of:\n\n"
);
count = skin_keysym_str_count();
strings = calloc( count, sizeof(char*) );
for (n = 0; n < count; n++)
strings[n] = skin_keysym_str(n);
stralloc_tabular( out, strings, count, " ", 80-8 );
free(strings);
PRINTF(
"\n"
" case is not significant, and a single command can be associated to up\n"
" to %d different keys. to bind a command to multiple keys, use commas to\n"
" separate them. here are some examples:\n\n",
SKIN_KEY_COMMAND_MAX_BINDINGS );
PRINTF(
" TOGGLE_NETWORK F8 # toggle the network on/off\n"
" CHANGE_LAYOUT_PREV Keypad_7,Ctrl-J # switch to a previous skin layout\n"
"\n"
);
}
static void
help_debug_tags(stralloc_t* out)
{
int n;
#define _VERBOSE_TAG(x,y) { #x, VERBOSE_##x, y },
static const struct { const char* name; int flag; const char* text; }
verbose_options[] = {
VERBOSE_TAG_LIST
{ 0, 0, 0 }
};
#undef _VERBOSE_TAG
PRINTF(
" the '-debug <tags>' option can be used to enable or disable debug\n"
" messages from specific parts of the emulator. <tags> must be a list\n"
" (separated by space/comma/column) of <component> names, which can be one of:\n\n"
);
for (n = 0; n < VERBOSE_MAX; n++)
PRINTF( " %-12s %s\n", verbose_options[n].name, verbose_options[n].text );
PRINTF( " %-12s %s\n", "all", "all components together\n" );
PRINTF(
"\n"
" each <component> can be prefixed with a single '-' to indicate the disabling\n"
" of its debug messages. for example:\n\n"
" -debug all,-socket,-keys\n\n"
" enables all debug messages, except the ones related to network sockets\n"
" and key bindings/presses\n\n"
);
}
static void
help_char_devices(stralloc_t* out)
{
PRINTF(
" various emulation options take a <device> specification that can be used to\n"
" specify something to hook to an emulated device or communication channel.\n"
" here is the list of supported <device> specifications:\n\n"
" stdio\n"
" standard input/output. this may be subject to character\n"
" translation (e.g. LN <=> CR/LF)\n\n"
" COM<n> [Windows only]\n"
" where <n> is a digit. host serial communication port.\n\n"
" pipe:<filename>\n"
" named pipe <filename>\n\n"
" file:<filename>\n"
" write output to <filename>, no input can be read\n\n"
" pty [Linux only]\n"
" pseudo TTY (a new PTY is automatically allocated)\n\n"
" /dev/<file> [Unix only]\n"
" host char device file, e.g. /dev/ttyS0. may require root access\n\n"
" /dev/parport<N> [Linux only]\n"
" use host parallel port. may require root access\n\n"
" unix:<path>[,server][,nowait]] [Unix only]\n"
" use a Unix domain socket. if you use the 'server' option, then\n"
" the emulator will create the socket and wait for a client to\n"
" connect before continuing, unless you also use 'nowait'\n\n"
" tcp:[<host>]:<port>[,server][,nowait][,nodelay]\n"
" use a TCP socket. 'host' is set to localhost by default. if you\n"
" use the 'server' option will bind the port and wait for a client\n"
" to connect before continuing, unless you also use 'nowait'. the\n"
" 'nodelay' option disables the TCP Nagle algorithm\n\n"
" telnet:[<host>]:<port>[,server][,nowait][,nodelay]\n"
" similar to 'tcp:' but uses the telnet protocol instead of raw TCP\n\n"
" udp:[<remote_host>]:<remote_port>[@[<src_ip>]:<src_port>]\n"
" send output to a remote UDP server. if 'remote_host' is no\n"
" specified it will default to '0.0.0.0'. you can also receive input\n"
" through UDP by specifying a source address after the optional '@'.\n\n"
" fdpair:<fd1>,<fd2> [Unix only]\n"
" redirection input and output to a pair of pre-opened file\n"
" descriptors. this is mostly useful for scripts and other\n"
" programmatic launches of the emulator.\n\n"
" none\n"
" no device connected\n\n"
" null\n"
" the null device (a.k.a /dev/null on Unix, or NUL on Win32)\n\n"
" NOTE: these correspond to the <device> parameter of the QEMU -serial option\n"
" as described on http://bellard.org/qemu/qemu-doc.html#SEC10\n\n"
);
}
static void
help_avd(stralloc_t* out)
{
PRINTF(
" use '-avd <name>' to start the emulator program with a given Android\n"
" Virtual Device (a.k.a. AVD), where <name> must correspond to the name\n"
" of one of the existing AVDs available on your host machine.\n\n"
"See -help-virtual-device to learn how to create/list/manage AVDs.\n\n"
" As a special convenience, using '@<name>' is equivalent to using\n"
" '-avd <name>'.\n\n"
);
}
static void
help_sysdir(stralloc_t* out)
{
char systemdir[MAX_PATH];
char *p = systemdir, *end = p + sizeof(systemdir);
p = bufprint_app_dir( p, end );
p = bufprint( p, end, PATH_SEP "lib" PATH_SEP "images" );
PRINTF(
" use '-sysdir <dir>' to specify a directory where system read-only\n"
" image files will be searched. on this system, the default directory is:\n\n"
" %s\n\n", systemdir );
PRINTF(
" see '-help-disk-images' for more information about disk image files\n\n" );
}
static void
help_datadir(stralloc_t* out)
{
char datadir[MAX_PATH];
bufprint_config_path(datadir, datadir + sizeof(datadir));
PRINTF(
" use '-datadir <dir>' to specify a directory where writable image files\n"
" will be searched. on this system, the default directory is:\n\n"
" %s\n\n", datadir );
PRINTF(
" see '-help-disk-images' for more information about disk image files\n\n" );
}
static void
help_kernel(stralloc_t* out)
{
PRINTF(
" use '-kernel <file>' to specify a Linux kernel image to be run.\n"
" the default image is 'kernel-qemu' from the system directory.\n\n"
" you can use '-debug-kernel' to see debug messages from the kernel\n"
" to the terminal\n\n"
" see '-help-disk-images' for more information about disk image files\n\n"
);
}
static void
help_ramdisk(stralloc_t* out)
{
PRINTF(
" use '-ramdisk <file>' to specify a Linux ramdisk boot image to be run in\n"
" the emulator. the default image is 'ramdisk.img' from the system directory.\n\n"
" see '-help-disk-images' for more information about disk image files\n\n"
);
}
static void
help_system(stralloc_t* out)
{
PRINTF(
" use '-system <file>' to specify the intial system image that will be loaded.\n"
" the default image is 'system.img' from the system directory.\n\n"
" NOTE: In previous releases of the Android SDK, this option was named '-image'.\n"
" And using '-system <path>' was equivalent to using '-sysdir <path>' now.\n\n"
" see '-help-disk-images' for more information about disk image files\n\n"
);
}
static void
help_image(stralloc_t* out)
{
PRINTF(
" This option is obsolete, you should use '-system <file>' instead to point\n"
" to the initial system image.\n\n"
" see '-help-disk-images' for more information about disk image files\n\n"
);
}
static void
help_data(stralloc_t* out)
{
PRINTF(
" use '-data <file>' to specify a different /data partition image file.\n\n"
" see '-help-disk-images' for more information about disk image files\n\n"
);
}
static void
help_wipe_data(stralloc_t* out)
{
PRINTF(
" use '-wipe-data' to reset your /data partition image to its factory\n"
" defaults. this removes all installed applications and settings.\n\n"
" see '-help-disk-images' for more information about disk image files\n\n"
);
}
static void
help_cache(stralloc_t* out)
{
PRINTF(
" use '-cache <file>' to specify a /cache partition image. if <file> does\n"
" not exist, it will be created empty. by default, the cache partition is\n"
" backed by a temporary file that is deleted when the emulator exits.\n"
" using the -cache option allows it to be persistent.\n\n"
" the '-no-cache' option can be used to disable the cache partition.\n\n"
" see '-help-disk-images' for more information about disk image files\n\n"
);
}
static void
help_no_cache(stralloc_t* out)
{
PRINTF(
" use '-no-cache' to disable the cache partition in the emulated system.\n"
" the cache partition is optional, but when available, is used by the browser\n"
" to cache web pages and images\n\n"
" see '-help-disk-images' for more information about disk image files\n\n"
);
}
static void
help_sdcard(stralloc_t* out)
{
PRINTF(
" use '-sdcard <file>' to specify a SD Card image file that will be attached\n"
" to the emulator. By default, the 'sdcard.img' file is searched in the data\n"
" directory.\n\n"
" if the file does not exist, the emulator will still start, but without an\n"
" attached SD Card.\n\n"
" see '-help-disk-images' for more information about disk image files\n\n"
);
}
#if CONFIG_ANDROID_SNAPSHOTS
static void
help_snapstorage(stralloc_t* out)
{
PRINTF(
" Use '-snapstorage <file>' to specify a repository file for snapshots.\n"
" All snapshots made during execution will be saved in this file, and only\n"
" snapshots in this file can be restored during the emulator run.\n\n"
" If the option is not specified, it defaults to 'snapshots.img' in the\n"
" data directory. If the specified file does not exist, the emulator will\n"
" start, but without support for saving or loading state snapshots.\n\n"
" see '-help-disk-images' for more information about disk image files\n"
" see '-help-snapshot' for more information about snapshots\n\n"
);
}
static void
help_no_snapstorage(stralloc_t* out)
{
PRINTF(
" This starts the emulator without mounting a file to store or load state\n"
" snapshots, forcing a full boot and disabling state snapshot functionality.\n\n"
""
" This command overrides the configuration specified by the parameters\n"
" '-snapstorage' and '-snapshot'. A warning will be raised if either\n"
" of those parameters was specified anyway.\n\n"
);
}
static void
help_snapshot(stralloc_t* out)
{
PRINTF(
" Rather than executing a full boot sequence, the Android emulator can\n"
" resume execution from an earlier state snapshot (which is usually\n"
" significantly faster). When the parameter '-snapshot <name>' is given,\n"
" the emulator loads the snapshot of that name from the snapshot image,\n"
" and saves it back under the same name on exit.\n\n"
" If the option is not specified, it defaults to 'default-boot'. If the\n"
" specified snapshot does not exist, the emulator will perform a full boot\n"
" sequence instead, but will still save.\n\n"
" WARNING: In the process of loading, all contents of the system, userdata\n"
" and SD card images will be OVERWRITTEN with the contents they\n"
" held when the snapshot was made. Unless saved in a different\n"
" snapshot, any changes since will be lost!\n\n"
" If you want to create a snapshot manually, connect to the emulator console:\n\n"
" telnet localhost <port>\n\n"
" Then execute the command 'avd snapshot save <name>'. See '-help-port' for\n"
" information on obtaining <port>.\n\n"
);
}
static void
help_no_snapshot(stralloc_t* out)
{
PRINTF(
" This inhibits both the autoload and autosave operations, forcing\n"
" emulator to perform a full boot sequence and losing state on close.\n"
" It overrides the '-snapshot' parameter.\n"
" If '-snapshot' was specified anyway, a warning is raised.\n\n"
);
}
static void
help_no_snapshot_load(stralloc_t* out)
{
PRINTF(
" Prevents the emulator from loading the AVD's state from the snapshot\n"
" storage on start.\n\n"
);
}
static void
help_no_snapshot_save(stralloc_t* out)
{
PRINTF(
" Prevents the emulator from saving the AVD's state to the snapshot\n"
" storage on exit, meaning that all changes will be lost.\n\n"
);
}
static void
help_no_snapshot_update_time(stralloc_t* out)
{
PRINTF(
" Prevent the emulator from sending an unsolicited time update\n"
" in response to the first signal strength query after loadvm,\n"
" to avoid a sudden time jump that might upset testing. (Signal\n"
" strength is queried approximately every 15 seconds)\n\n"
);
}
static void
help_snapshot_list(stralloc_t* out)
{
PRINTF(
" This prints a table of snapshots that are stored in the snapshot storage\n"
" file that the emulator was started with, then exits. Values from the 'ID'\n"
" and 'TAG' columns can be used as arguments for the '-snapshot' parameter.\n\n"
" If '-snapstorage <file>' was specified as well, this command prints a "
" table of the snapshots stored in <file>.\n\n"
" See '-help-snapshot' for more information on snapshots.\n\n"
);
}
#endif
static void
help_skindir(stralloc_t* out)
{
PRINTF(
" use '-skindir <dir>' to specify a directory that will be used to search\n"
" for emulator skins. each skin must be a subdirectory of <dir>. by default\n"
" the emulator will look in the 'skins' sub-directory of the system directory\n\n"
" the '-skin <name>' option is required when -skindir is used.\n"
);
}
static void
help_skin(stralloc_t* out)
{
PRINTF(
" use '-skin <skin>' to specify an emulator skin, each skin corresponds to\n"
" the visual appearance of a given device, including buttons and keyboards,\n"
" and is stored as subdirectory <skin> of the skin root directory\n"
" (see '-help-skindir')\n\n" );
PRINTF(
" note that <skin> can also be '<width>x<height>' (e.g. '320x480') to\n"
" specify an exact framebuffer size, without any visual ornaments.\n\n" );
}
/* default network settings for emulator */
#define DEFAULT_NETSPEED "full"
#define DEFAULT_NETDELAY "none"
static void
help_shaper(stralloc_t* out)
{
int n;
NetworkSpeed* android_netspeed;
NetworkLatency* android_netdelay;
PRINTF(
" the Android emulator supports network throttling, i.e. slower network\n"
" bandwidth as well as higher connection latencies. this is done either through\n"
" skin configuration, or with '-netspeed <speed>' and '-netdelay <delay>'.\n\n"
" the format of -netspeed is one of the following (numbers are kbits/s):\n\n" );
for (n = 0; !android_core_get_android_netspeed(n, &android_netspeed); n++) {
PRINTF( " -netspeed %-12s %-15s (up: %.1f, down: %.1f)\n",
android_netspeed->name,
android_netspeed->display,
android_netspeed->upload/1000.,
android_netspeed->download/1000. );
free(android_netspeed);
}
PRINTF( "\n" );
PRINTF( " -netspeed %-12s %s", "<num>", "select both upload and download speed\n");
PRINTF( " -netspeed %-12s %s", "<up>:<down>", "select individual up and down speed\n");
PRINTF( "\n The format of -netdelay is one of the following (numbers are msec):\n\n" );
for (n = 0; !android_core_get_android_netdelay(n, &android_netdelay); n++) {
PRINTF( " -netdelay %-10s %-15s (min %d, max %d)\n",
android_netdelay->name, android_netdelay->display,
android_netdelay->min_ms, android_netdelay->max_ms );
free(android_netdelay);
}
PRINTF( " -netdelay %-10s %s", "<num>", "select exact latency\n");
PRINTF( " -netdelay %-10s %s", "<min>:<max>", "select min and max latencies\n\n");
PRINTF( " the emulator uses the following defaults:\n\n" );
PRINTF( " Default network speed is '%s'\n", DEFAULT_NETSPEED);
PRINTF( " Default network latency is '%s'\n\n", DEFAULT_NETDELAY);
}
static void
help_http_proxy(stralloc_t* out)
{
PRINTF(
" the Android emulator allows you to redirect all TCP connections through\n"
" a HTTP/HTTPS proxy. this can be enabled by using the '-http-proxy <proxy>'\n"
" option, or by defining the 'http_proxy' environment variable.\n\n"
" <proxy> can be one of the following:\n\n"
" http://<server>:<port>\n"
" http://<username>:<password>@<server>:<port>\n\n"
" the 'http://' prefix can be omitted. If '-http-proxy <proxy>' is not used,\n"
" the 'http_proxy' environment variable is looked up and any value matching\n"
" the <proxy> format will be used automatically\n\n" );
}
static void
help_report_console(stralloc_t* out)
{
PRINTF(
" the '-report-console <socket>' option can be used to report the\n"
" automatically-assigned console port number to a remote third-party\n"
" before starting the emulation. <socket> must be in one of these\n"
" formats:\n\n"
" tcp:<port>[,server][,max=<seconds>]\n"
" unix:<path>[,server][,max=<seconds>]\n"
"\n"
" if the 'server' option is used, the emulator opens a server socket\n"
" and waits for an incoming connection to it. by default, it will instead\n"
" try to make a normal client connection to the socket, and, in case of\n"
" failure, will repeat this operation every second for 10 seconds.\n"
" the 'max=<seconds>' option can be used to modify the timeout\n\n"
" when the connection is established, the emulator sends its console port\n"
" number as text to the remote third-party, then closes the connection and\n"
" starts the emulation as usual. *any* failure in the process described here\n"
" will result in the emulator aborting immediately\n\n"
" as an example, here's a small Unix shell script that starts the emulator in\n"
" the background and waits for its port number with the help of the 'netcat'\n"
" utility:\n\n"
" MYPORT=5000\n"
" emulator -no-window -report-console tcp:$MYPORT &\n"
" CONSOLEPORT=`nc -l localhost $MYPORT`\n"
"\n"
);
}
static void
help_dpi_device(stralloc_t* out)
{
PRINTF(
" use '-dpi-device <dpi>' to specify the screen resolution of the emulated\n"
" device. <dpi> must be an integer between 72 and 1000. the default is taken\n"
" from the skin, if available, or uses the contant value %d (an average of\n"
" several prototypes used during Android development).\n\n", DEFAULT_DEVICE_DPI );
PRINTF(
" the device resolution can also used to rescale the emulator window with\n"
" the '-scale' option (see -help-scale)\n\n"
);
}
static void
help_audio(stralloc_t* out)
{
PRINTF(
" the '-audio <backend>' option allows you to select a specific backend\n"
" to be used to both play and record audio in the Android emulator.\n\n"
" use '-audio none' to disable audio completely.\n\n"
);
}
static void
help_scale(stralloc_t* out)
{
PRINTF(
" the '-scale <scale>' option is used to scale the emulator window to\n"
" something that better fits the physical dimensions of a real device. this\n"
" can be *very* useful to check that your UI isn't too small to be usable\n"
" on a real device.\n\n"
" there are three supported formats for <scale>:\n\n"
" * if <scale> is a real number (between 0.1 and 3.0) it is used as a\n"
" scaling factor for the emulator's window.\n\n"
" * if <scale> is an integer followed by the suffix 'dpi' (e.g. '110dpi'),\n"
" then it is interpreted as the resolution of your monitor screen. this\n"
" will be divided by the emulated device's resolution to get an absolute\n"
" scale. (see -help-dpi-device for details).\n\n"
" * finally, if <scale> is the keyword 'auto', the emulator tries to guess\n"
" your monitor's resolution and automatically adjusts its window\n"
" accordingly\n\n"
" NOTE: this process is *very* unreliable, depending on your OS, video\n"
" driver issues and other random system parameters\n\n"
" the emulator's scale can be changed anytime at runtime through the control\n"
" console. see the help for the 'window scale' command for details\n\n" );
}
static void
help_trace(stralloc_t* out)
{
PRINTF(
" use '-trace <name>' to start the emulator with runtime code profiling support\n"
" profiling itself will not be enabled unless you press F9 to activate it, or\n"
" the executed code turns it on programmatically.\n\n"
" trace information is stored in directory <name>, several files are created\n"
" there, that can later be used with the 'traceview' program that comes with\n"
" the Android SDK for analysis.\n\n"
" note that execution will be slightly slower when enabling code profiling,\n"
" this is a necessary requirement of the operations being performed to record\n"
" the execution trace. this slowdown should not affect your system until you\n"
" enable the profiling though...\n\n"
);
}
#ifdef CONFIG_MEMCHECK
static void
help_memcheck(stralloc_t* out)
{
PRINTF(
" use '-memcheck <flags>' to start the emulator with memory access checking\n"
" support.\n\n"
" <flags> enables, or disables memory access checking, and also controls\n"
" what events are going to be logged by the memory access checker.\n"
" <flags> can be one of the following:\n"
" 1 - Enables memory access checking with default logging (\"LIRW\"), or\n"
" 0 - Disables memory access checking, or\n"
" A combination (in no particular order) of the following:\n"
" L - Logs memory leaks on process exit.\n"
" I - Logs attempts to use invalid pointers in free, or realloc routines.\n"
" R - Logs memory access violation on read operations.\n"
" W - Logs memory access violation on write operations.\n"
" N - Logs new process ID allocation.\n"
" F - Logs guest's process forking.\n"
" S - Logs guest's process starting.\n"
" E - Logs guest's process exiting.\n"
" C - Logs guest's thread creation (clone).\n"
" B - Logs libc.so initialization in the guest system.\n"
" M - Logs module mapping and unmapping in the guest system.\n"
" A - Logs all emulator events. Equala to \"LIRWFSECANBM\" combination.\n"
" e - Logs error messages, received from the guest system.\n"
" d - Logs debug messages, received from the guest system.\n"
" i - Logs information messages, received from the guest system.\n"
" a - Logs all messages, received from the guest system.\n"
" This is equal to \"edi\" combination.\n\n"
" note that execution might be significantly slower when enabling memory access\n"
" checking, this is a necessary requirement of the operations being performed\n"
" to analyze memory allocations and memory access.\n\n"
);
}
#endif // CONFIG_MEMCHECK
#ifdef CONFIG_STANDALONE_UI
static void
help_list_cores(stralloc_t* out)
{
PRINTF(
" use '-list-cores localhost to list emulator core processes running on this machine.\n"
" use '-list-cores host_name, or IP address to list emulator core processes running on\n"
" a remote machine.\n"
);
}
static void
help_attach_core(stralloc_t* out)
{
PRINTF(
" the -attach-core <console socket> options attaches the UI to a running emulator core process.\n\n"
" the <console socket> parameter must be in the form [host:]port, where 'host' addresses the\n"
" machine on which the core process is running, and 'port' addresses the console port number for\n"
" the running core process. Note that 'host' value must be in the form that can be resolved\n"
" into an IP address.\n\n"
" Use -list-cores to enumerate console ports for all currently running core processes.\n"
);
}
#endif // CONFIG_STANDALONE_UI
static void
help_show_kernel(stralloc_t* out)
{
PRINTF(
" use '-show-kernel' to redirect debug messages from the kernel to the current\n"
" terminal. this is useful to check that the boot process works correctly.\n\n"
);
}
static void
help_shell(stralloc_t* out)
{
PRINTF(
" use '-shell' to create a root shell console on the current terminal.\n"
" this is unlike the 'adb shell' command for the following reasons:\n\n"
" * this is a *root* shell that allows you to modify many parts of the system\n"
" * this works even if the ADB daemon in the emulated system is broken\n"
" * pressing Ctrl-C will stop the emulator, instead of the shell.\n\n"
" See also '-shell-serial'.\n\n" );
}
static void
help_shell_serial(stralloc_t* out)
{
PRINTF(
" use '-shell-serial <device>' instead of '-shell' to open a root shell\n"
" to the emulated system, while specifying an external communication\n"
" channel / host device.\n\n"
" '-shell-serial stdio' is identical to '-shell', while you can use\n"
" '-shell-serial tcp::4444,server,nowait' to talk to the shell over local\n"
" TCP port 4444. '-shell-serial fdpair:3:6' would let a parent process\n"
" talk to the shell using fds 3 and 6.\n\n"
" see -help-char-devices for a list of available <device> specifications.\n\n"
" NOTE: you can have only one shell per emulator instance at the moment\n\n"
);
}
static void
help_logcat(stralloc_t* out)
{
PRINTF(
" use '-logcat <tags>' to redirect log messages from the emulated system to\n"
" the current terminal. <tags> is a list of space/comma-separated log filters\n"
" where each filter has the following format:\n\n"
" <componentName>:<logLevel>\n\n"
" where <componentName> is either '*' or the name of a given component,\n"
" and <logLevel> is one of the following letters:\n\n"
" v verbose level\n"
" d debug level\n"
" i informative log level\n"
" w warning log level\n"
" e error log level\n"
" s silent log level\n\n"
" for example, the following only displays messages from the 'GSM' component\n"
" that are at least at the informative level:\n\n"
" -logcat '*:s GSM:i'\n\n"
" if '-logcat <tags>' is not used, the emulator looks for ANDROID_LOG_TAGS\n"
" in the environment. if it is defined, its value must match the <tags>\n"
" format and will be used to redirect log messages to the terminal.\n\n"
" note that this doesn't prevent you from redirecting the same, or other,\n"
" log messages through the ADB or DDMS tools too.\n\n");
}
static void
help_no_audio(stralloc_t* out)
{
PRINTF(
" use '-no-audio' to disable all audio support in the emulator. this may be\n"
" unfortunately be necessary in some cases:\n\n"
" * at least two users have reported that their Windows machine rebooted\n"
" instantly unless they used this option when starting the emulator.\n"
" it is very likely that the problem comes from buggy audio drivers.\n\n"
" * on some Linux machines, the emulator might get stuck at startup with\n"
" audio support enabled. this problem is hard to reproduce, but seems to\n"
" be related too to flaky ALSA / audio driver support.\n\n"
" on Linux, another option is to try to change the default audio backend\n"
" used by the emulator. you can do that by setting the QEMU_AUDIO_DRV\n"
" environment variables to one of the following values:\n\n"
" alsa (use the ALSA backend)\n"
" esd (use the EsounD backend)\n"
" sdl (use the SDL audio backend, no audio input supported)\n"
" oss (use the OSS backend)\n"
" none (do not support audio)\n"
"\n"
" the very brave can also try to use distinct backends for audio input\n"
" and audio outputs, this is possible by selecting one of the above values\n"
" into the QEMU_AUDIO_OUT_DRV and QEMU_AUDIO_IN_DRV environment variables.\n\n"
);
}
static void
help_raw_keys(stralloc_t* out)
{
PRINTF(
" this option is deprecated because one can do the same using Ctrl-K\n"
" at runtime (this keypress toggles between unicode/raw keyboard modes)\n\n"
" by default, the emulator tries to reverse-map the characters you type on\n"
" your keyboard to device-specific key presses whenever possible. this is\n"
" done to make the emulator usable with a non-QWERTY keyboard.\n\n"
" however, this also means that single keypresses like Shift or Alt are not\n"
" passed to the emulated device. the '-raw-keys' option disables the reverse\n"
" mapping. it should only be used when using a QWERTY keyboard on your machine\n"
" (should only be useful to Android system hackers, e.g. when implementing a\n"
" new input method).\n\n"
);
}
static void
help_radio(stralloc_t* out)
{
PRINTF(
" use '-radio <device>' to redirect the GSM modem emulation to an external\n"
" character device or program. this bypasses the emulator's internal modem\n"
" and should only be used for testing.\n\n"
" see '-help-char-devices' for the format of <device>\n\n"
" the data exchanged with the external device/program are GSM AT commands\n\n"
" note that, when running in the emulator, the Android GSM stack only supports\n"
" a *very* basic subset of the GSM protocol. trying to link the emulator to\n"
" a real GSM modem is very likely to not work properly.\n\n"
);
}
static void
help_port(stralloc_t* out)
{
PRINTF(
" at startup, the emulator tries to bind its control console at a free port\n"
" starting from 5554, in increments of two (i.e. 5554, then 5556, 5558, etc..)\n"
" this allows several emulator instances to run concurrently on the same\n"
" machine, each one using a different console port number.\n\n"
" use '-port <port>' to force an emulator instance to use a given console port\n\n"
" note that <port> must be an *even* integer between 5554 and 5584 included.\n"
" <port>+1 must also be free and will be reserved for ADB. if any of these\n"
" ports is already used, the emulator will fail to start.\n\n" );
}
static void
help_ports(stralloc_t* out)
{
PRINTF(
" the '-ports <consoleport>,<adbport>' option allows you to explicitely set\n"
" the TCP ports used by the emulator to implement its control console and\n"
" communicate with the ADB tool.\n\n"
" This is a very special option that should probably *not* be used by typical\n"
" developers using the Android SDK (use '-port <port>' instead), because the\n"
" corresponding instance is probably not going to be seen from adb/DDMS. Its\n"
" purpose is to use the emulator in very specific network configurations.\n\n"
" <consoleport> is the TCP port used to bind the control console\n"
" <adbport> is the TCP port used to bind the ADB local transport/tunnel.\n\n"
" If both ports aren't available on startup, the emulator will exit.\n\n");
}
static void
help_onion(stralloc_t* out)
{
PRINTF(
" use '-onion <file>' to specify a PNG image file that will be displayed on\n"
" top of the emulated framebuffer with translucency. this can be useful to\n"
" check that UI elements are correctly positioned with regards to a reference\n"
" graphics specification.\n\n"
" the default translucency is 50%%, but you can use '-onion-alpha <%%age>' to\n"
" select a different one, or even use keypresses at runtime to alter it\n"
" (see -help-keys for details)\n\n"
" finally, the onion image can be rotated (see -help-onion-rotate)\n\n"
);
}
static void
help_onion_alpha(stralloc_t* out)
{
PRINTF(
" use '-onion-alpha <percent>' to change the translucency level of the onion\n"
" image that is going to be displayed on top of the framebuffer (see also\n"
" -help-onion). the default is 50%%.\n\n"
" <percent> must be an integer between 0 and 100.\n\n"
" you can also change the translucency dynamically (see -help-keys)\n\n"
);
}
static void
help_onion_rotation(stralloc_t* out)
{
PRINTF(
" use '-onion-rotation <rotation>' to change the rotation of the onion\n"
" image loaded through '-onion <file>'. valid values for <rotation> are:\n\n"
" 0 no rotation\n"
" 1 90 degrees clockwise\n"
" 2 180 degrees\n"
" 3 270 degrees clockwise\n\n"
);
}
static void
help_timezone(stralloc_t* out)
{
PRINTF(
" by default, the emulator tries to detect your current timezone to report\n"
" it to the emulated system. use the '-timezone <timezone>' option to choose\n"
" a different timezone, or if the automatic detection doesn't work correctly.\n\n"
" VERY IMPORTANT NOTE:\n\n"
" the <timezone> value must be in zoneinfo format, i.e. it should look like\n"
" Area/Location or even Area/SubArea/Location. valid examples are:\n\n"
" America/Los_Angeles\n"
" Europe/Paris\n\n"
" using a human-friendly abbreviation like 'PST' or 'CET' will not work, as\n"
" well as using values that are not defined by the zoneinfo database.\n\n"
" NOTE: unfortunately, this will not work on M5 and older SDK releases\n\n"
);
}
static void
help_dns_server(stralloc_t* out)
{
PRINTF(
" by default, the emulator tries to detect the DNS servers you're using and\n"
" will setup special aliases in the emulated firewall network to allow the\n"
" Android system to connect directly to them. use '-dns-server <servers>' to\n"
" select a different list of DNS servers to be used.\n\n"
" <servers> must be a comma-separated list of up to 4 DNS server names or\n"
" IP addresses.\n\n"
" NOTE: on M5 and older SDK releases, only the first server in the list will\n"
" be used.\n\n"
);
}
static void
help_cpu_delay(stralloc_t* out)
{
PRINTF(
" this option is purely experimental, probably doesn't work as you would\n"
" expect, and may even disappear in a later emulator release.\n\n"
" use '-cpu-delay <delay>' to throttle CPU emulation. this may be useful\n"
" to detect weird race conditions that only happen on 'lower' CPUs. note\n"
" that <delay> is a unit-less integer that doesn't even scale linearly\n"
" to observable slowdowns. use trial and error to find something that\n"
" suits you, the 'correct' machine is very probably dependent on your\n"
" host CPU and memory anyway...\n\n"
);
}
static void
help_no_boot_anim(stralloc_t* out)
{
PRINTF(
" use '-no-boot-anim' to disable the boot animation (red bouncing ball) when\n"
" starting the emulator. on slow machines, this can surprisingly speed up the\n"
" boot sequence in tremendous ways.\n\n"
" NOTE: unfortunately, this will not work on M5 and older SDK releases\n\n"
);
}
static void
help_gps(stralloc_t* out)
{
PRINTF(
" use '-gps <device>' to emulate an NMEA-compatible GPS unit connected to\n"
" an external character device or socket. the format of <device> is the same\n"
" than the one used for '-radio <device>' (see -help-char-devices for details)\n\n"
);
}
static void
help_keyset(stralloc_t* out)
{
char temp[256];
PRINTF(
" use '-keyset <name>' to specify a different keyset file name to use when\n"
" starting the emulator. a keyset file contains a list of key bindings used\n"
" to control the emulator with the host keyboard.\n\n"
" by default, the emulator looks for the following file:\n\n"
);
bufprint_config_file(temp, temp+sizeof(temp), KEYSET_FILE);
PRINTF(
" %s\n\n", temp );
bufprint_config_path(temp, temp+sizeof(temp));
PRINTF(
" however, if -keyset is used, then the emulator does the following:\n\n"
" - first, if <name> doesn't have an extension, then the '.keyset' suffix\n"
" is appended to it (e.g. \"foo\" => \"foo.keyset\"),\n\n"
" - then, the emulator searches for a file named <name> in the following\n"
" directories:\n\n"
" * the emulator configuration directory: %s\n"
" * the 'keysets' subdirectory of <systemdir>, if any\n"
" * the 'keysets' subdirectory of the program location, if any\n\n",
temp );
PRINTF(
" if no corresponding file is found, a default set of key bindings is used.\n\n"
" use '-help-keys' to list the default key bindings.\n"
" use '-help-keyset-file' to learn more about the format of keyset files.\n"
"\n"
);
}
static void
help_old_system(stralloc_t* out)
{
PRINTF(
" use '-old-system' if you want to use a recent emulator binary to run\n"
" an old version of the Android SDK system images. Here, 'old' means anything\n"
" older than version 1.4 of the emulator.\n\n"
" NOTE: using '-old-system' with recent system images is likely to not work\n"
" properly, though you may not notice it immediately (e.g. failure to\n"
" start the emulated GPS hardware)\n\n"
);
}
#ifdef CONFIG_NAND_LIMITS
static void
help_nand_limits(stralloc_t* out)
{
PRINTF(
" use '-nand-limits <limits>' to enable a debugging feature that sends a\n"
" signal to an external process once a read and/or write limit is achieved\n"
" in the emulated system. the format of <limits> is the following:\n\n"
" pid=<number>,signal=<number>,[reads=<threshold>][,writes=<threshold>]\n\n"
" where 'pid' is the target process identifier, 'signal' the number of the\n"
" target signal. the read and/or write threshold'reads' are a number optionally\n"
" followed by a K, M or G suffix, corresponding to the number of bytes to be\n"
" read or written before the signal is sent.\n\n"
);
}
#endif /* CONFIG_NAND_LIMITS */
static void
help_bootchart(stralloc_t *out)
{
PRINTF(
" some Android system images have a modified 'init' system that integrates\n"
" a bootcharting facility (see http://www.bootchart.org/). You can pass a\n"
" bootcharting period to the system with the following:\n\n"
" -bootchart <timeout>\n\n"
" where 'timeout' is a period expressed in seconds. Note that this won't do\n"
" anything if your init doesn't have bootcharting activated.\n\n"
);
}
static void
help_tcpdump(stralloc_t *out)
{
PRINTF(
" use the -tcpdump <file> option to start capturing all network packets\n"
" that are sent through the emulator's virtual Ethernet LAN. You can later\n"
" use tools like WireShark to analyze the traffic and understand what\n"
" really happens.\n\n"
" note that this captures all Ethernet packets, and is not limited to TCP\n"
" connections.\n\n"
" you can also start/stop the packet capture dynamically through the console;\n"
" see the 'network capture start' and 'network capture stop' commands for\n"
" details.\n\n"
);
}
static void
help_charmap(stralloc_t *out)
{
PRINTF(
" use '-charmap <file>' to use key character map specified in that file.\n"
" <file> must be a full path to a kcm file, containing desired character map.\n\n"
);
}
static void
help_prop(stralloc_t *out)
{
PRINTF(
" use '-prop <name>=<value>' to set a boot-time system property.\n"
" <name> must be a property name of at most %d characters, without any\n"
" space in it, and <value> must be a string of at most %d characters.\n\n",
BOOT_PROPERTY_MAX_NAME, BOOT_PROPERTY_MAX_VALUE );
PRINTF(
" the corresponding system property will be set at boot time in the\n"
" emulated system. This can be useful for debugging purposes.\n\n"
" note that you can use several -prop options to define more than one\n"
" boot property.\n\n"
);
}
static void
help_shared_net_id(stralloc_t* out)
{
PRINTF(
" Normally, Android instances running in the emulator cannot talk to each other\n"
" directly, because each instance is behind a virtual router. However, sometimes\n"
" it is necessary to test the behaviour of applications if they are directly\n"
" exposed to the network.\n\n"
" This option instructs the emulator to join a virtual network shared with\n"
" emulators also using this option. The number given is used to construct\n"
" the IP address 10.1.2.<number>, which is bound to a second interface on\n"
" the emulator. Each emulator must use a different number.\n\n"
);
}
#define help_no_skin NULL
#define help_netspeed help_shaper
#define help_netdelay help_shaper
#define help_netfast help_shaper
#define help_noaudio NULL
#define help_noskin NULL
#define help_nocache NULL
#define help_no_jni NULL
#define help_nojni NULL
#define help_initdata NULL
#define help_no_window NULL
#define help_version NULL
#define help_memory NULL
#define help_partition_size NULL
typedef struct {
const char* name;
const char* template;
const char* descr;
void (*func)(stralloc_t*);
} OptionHelp;
static const OptionHelp option_help[] = {
#define OPT_FLAG(_name,_descr) { STRINGIFY(_name), NULL, _descr, help_##_name },
#define OPT_PARAM(_name,_template,_descr) { STRINGIFY(_name), _template, _descr, help_##_name },
#define OPT_LIST OPT_PARAM
#include "android/cmdline-options.h"
{ NULL, NULL, NULL, NULL }
};
typedef struct {
const char* name;
const char* desc;
void (*func)(stralloc_t*);
} TopicHelp;
static const TopicHelp topic_help[] = {
{ "disk-images", "about disk images", help_disk_images },
{ "keys", "supported key bindings", help_keys },
{ "debug-tags", "debug tags for -debug <tags>", help_debug_tags },
{ "char-devices", "character <device> specification", help_char_devices },
{ "environment", "environment variables", help_environment },
{ "keyset-file", "key bindings configuration file", help_keyset_file },
{ "virtual-device", "virtual device management", help_virtual_device },
{ "sdk-images", "about disk images when using the SDK", help_sdk_images },
{ "build-images", "about disk images when building Android", help_build_images },
{ NULL, NULL, NULL }
};
int
android_help_for_option( const char* option, stralloc_t* out )
{
OptionHelp const* oo;
char temp[32];
/* the names in the option_help table use underscore instead
* of dashes, so create a tranlated copy of the option name
* before scanning the table for matches
*/
buffer_translate_char( temp, sizeof temp, option, '-', '_' );
for ( oo = option_help; oo->name != NULL; oo++ ) {
if ( !strcmp(oo->name, temp) ) {
if (oo->func)
oo->func(out);
else
stralloc_add_str(out, oo->descr);
return 0;
}
}
return -1;
}
int
android_help_for_topic( const char* topic, stralloc_t* out )
{
const TopicHelp* tt;
for ( tt = topic_help; tt->name != NULL; tt++ ) {
if ( !strcmp(tt->name, topic) ) {
tt->func(out);
return 0;
}
}
return -1;
}
extern void
android_help_list_options( stralloc_t* out )
{
const OptionHelp* oo;
const TopicHelp* tt;
int maxwidth = 0;
for ( oo = option_help; oo->name != NULL; oo++ ) {
int width = strlen(oo->name);
if (oo->template != NULL)
width += strlen(oo->template);
if (width > maxwidth)
maxwidth = width;
}
for (oo = option_help; oo->name != NULL; oo++) {
char temp[32];
/* the names in the option_help table use underscores instead
* of dashes, so create a translated copy of the option's name
*/
buffer_translate_char(temp, sizeof temp, oo->name, '_', '-');
stralloc_add_format( out, " -%s %-*s %s\n",
temp,
(int)(maxwidth - strlen(oo->name)),
oo->template ? oo->template : "",
oo->descr );
}
PRINTF( "\n" );
PRINTF( " %-*s %s\n", maxwidth, "-qemu args...", "pass arguments to qemu");
PRINTF( " %-*s %s\n", maxwidth, "-qemu -h", "display qemu help");
PRINTF( "\n" );
PRINTF( " %-*s %s\n", maxwidth, "-verbose", "same as '-debug-init'");
PRINTF( " %-*s %s\n", maxwidth, "-debug <tags>", "enable/disable debug messages");
PRINTF( " %-*s %s\n", maxwidth, "-debug-<tag>", "enable specific debug messages");
PRINTF( " %-*s %s\n", maxwidth, "-debug-no-<tag>","disable specific debug messages");
PRINTF( "\n" );
PRINTF( " %-*s %s\n", maxwidth, "-help", "print this help");
PRINTF( " %-*s %s\n", maxwidth, "-help-<option>", "print option-specific help");
PRINTF( "\n" );
for (tt = topic_help; tt->name != NULL; tt += 1) {
char help[32];
snprintf(help, sizeof(help), "-help-%s", tt->name);
PRINTF( " %-*s %s\n", maxwidth, help, tt->desc );
}
PRINTF( " %-*s %s\n", maxwidth, "-help-all", "prints all help content");
PRINTF( "\n");
}
void
android_help_main( stralloc_t* out )
{
stralloc_add_str(out, "Android Emulator usage: emulator [options] [-qemu args]\n");
stralloc_add_str(out, " options:\n" );
android_help_list_options(out);
/*printf( "%.*s", out->n, out->s );*/
}
void
android_help_all( stralloc_t* out )
{
const OptionHelp* oo;
const TopicHelp* tt;
for (oo = option_help; oo->name != NULL; oo++) {
PRINTF( "========= help for option -%s:\n\n", oo->name );
android_help_for_option( oo->name, out );
}
for (tt = topic_help; tt->name != NULL; tt++) {
PRINTF( "========= help for -help-%s\n\n", tt->name );
android_help_for_topic( tt->name, out );
}
PRINTF( "========= top-level help\n\n" );
android_help_main(out);
}
|