MCPcopy Create free account
hub / github.com/AshampooSystems/boden / createEmulatorDevice

Method createEmulatorDevice

bauer/androidrunner.py:111–139  ·  view source on GitHub ↗
(self, androidAbi, deviceName)

Source from the content-addressed store, hash-verified

109 self.logger.info("Done updating packages.")
110
111 def createEmulatorDevice(self, androidAbi, deviceName):
112
113 # create the virtual device that we want to use for the emulator.
114 # --force causes an existing device to be overwritten.
115 self.logger.info("Creating virtual device %s for emulator...", deviceName)
116
117 emulatorAbi = self.getEmulatorAbi(androidAbi)
118
119 createDeviceCommand = '"%s" create avd --name "%s" --force --abi google_apis/%s --package "system-images;android-%s;google_apis;%s"' % \
120 ( self.avdManagerPath,
121 deviceName,
122 emulatorAbi,
123 self.buildExecutor.androidEmulatorApiVersion,
124 emulatorAbi )
125
126 # avdmanager will ask us wether we want to create a custom profile. We do not want that,
127 # so we pipe a "no" into stdin
128 answerFile, answerFilePath = tempfile.mkstemp()
129 try:
130 os.write(answerFile, "no\n".encode("ascii"))
131 os.close(answerFile)
132
133 with open(answerFilePath, "r") as answerFile:
134 subprocess.check_call(createDeviceCommand, stdout=self.subprocess_out, shell=True, stdin=answerFile, env=self.androidEnvironment)
135
136 finally:
137 os.remove(answerFilePath)
138
139 return deviceName
140
141 def bootEmulator(self, deviceName, androidAbi):
142 self.logger.info("Starting emulator...");

Callers 1

runMethod · 0.95

Calls 4

getEmulatorAbiMethod · 0.95
writeMethod · 0.45
closeMethod · 0.45
removeMethod · 0.45

Tested by

no test coverage detected