• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright (C) 2018 The Android Open Source Project
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 #pragma once
15 
16 #include "android/base/StringView.h"
17 
18 // Includes enough for <avdname>.ini and config.ini
19 // Examples shown alongside.
20 // Only purely integer fields are not strings.
21 struct AvdGenerateInfo {
22     const char* sdkHomeDir;
23     // Target system image (android-19, android-26, etc.)
24     const char* sysimgTarget;
25     // config.ini
26     const char* name; // AvdId=api26
27     const char* playStoreEnabled; // PlayStore.enabled=false
28     const char* abi; // abi.type=x86
29     const char* displayname; // avd.ini.displayname=api26
30     const char* encoding; // avd.ini.encoding=UTF-8
31     const char* dataPartitionSize; // disk.dataPartition.size=2G
32     const char* fastbootChosenSnapshotFile; // fastboot.chosenSnapshotFile=
33     const char* fastbootForceChosenSnapshotBoot; // fastboot.forceChosenSnapshotBoot=no
34     const char* fastbootForceColdBoot; // fastboot.forceColdBoot=no
35     const char* fastbootForceFastBoot; // fastboot.forceFastBoot=yes
36     const char* hwAccelerometer; // hw.accelerometer=yes
37     const char* hwArc; // hw.arc=false
38     const char* hwAudioInput; // hw.audioInput=yes
39     const char* hwAudioOutput; // hw.audioOutput=yes
40     const char* hwBattery; // hw.battery=yes
41     const char* hwCameraBack; // hw.camera.back=virtualscene
42     const char* hwCameraFront; // hw.camera.front=emulated
43     const char* hwCpuArch; // hw.cpu.arch=x86
44     const char* hwCpuModel; // hw.cpu.model=???
45     int hwCpuNcore; // hw.cpu.ncore=4
46     const char* hwDpad; // hw.dPad=no
47     const char* hwDeviceHash2; // hw.device.hash2=MD5:bc5032b2a871da511332401af3ac6bb0
48     const char* hwDeviceManufacturer; // hw.device.manufacturer=Google
49     const char* hwDeviceName; // hw.device.name=Nexus 5X
50     const char* hwGps; // hw.gps=yes
51     const char* hwGpuEnabled; // hw.gpu.enabled=yes
52     const char* hwGpuMode; // hw.gpu.mode=auto
53     const char* hwInitialOrientation; // hw.initialOrientation=Portrait
54     const char* hwKeyboard; // hw.keyboard=yes
55     int hwLcdDensity; // hw.lcd.density=420
56     int hwLcdHeight; // hw.lcd.height=1920
57     int hwLcdWidth; // hw.lcd.width=1080
58     const char* hwMainKeys; // hw.mainKeys=no
59     int hwRamSize; // hw.ramSize=1536
60     const char* hwSdCard; // hw.sdCard=yes
61     const char* hwSensorsOrientation; // hw.sensors.orientation=yes
62     const char* hwSensorsProximity; // hw.sensors.proximity=yes
63     const char* hwTrackball; // hw.trackBall=no
64     const char* imageSysdir1; // image.sysdir.1=system-images\android-26\google_apis_playstore\x86
65     const char* runtimeNetworkLatency; // runtime.network.latency=none
66     const char* runtimeNetworkSpeed; // runtime.network.speed=full
67     const char* sdcardSize; // sdcard.size=512M
68     const char* showDeviceFrame; // showDeviceFrame=yes
69     const char* skinDynamic; // skin.dynamic=yes
70     const char* skinName; // skin.name=nexus_5x
71     const char* skinPath; // skin.path=A:\android-sdk\skins\nexus_5x
72     const char* tagDisplay; // tag.display=Google Play
73     const char* tagId; // tag.id=google_apis_playstore
74     int vmHeapSize; // vm.heapSize=228
75 };
76 
77 void generateAvd(const AvdGenerateInfo& avdGenerateInfo);
78 
79 void generateAvdWithDefaults(android::base::StringView avdName,
80                              android::base::StringView sdkRootPath,
81                              android::base::StringView sdkHomePath,
82                              android::base::StringView androidTarget,
83                              android::base::StringView variant,
84                              android::base::StringView abi);
85 
86 void deleteAvd(android::base::StringView avdName,
87                android::base::StringView sdkHomePath);
88