MCPcopy Index your code
hub / github.com/NativeScript/SimDeck / wait_until_booted

Method wait_until_booted

packages/server/src/android.rs:325–346  ·  view source on GitHub ↗
(&self, id: &str, timeout_duration: Duration)

Source from the content-addressed store, hash-verified

323 }
324
325 pub fn wait_until_booted(&self, id: &str, timeout_duration: Duration) -> Result<(), AppError> {
326 let avd_name = avd_from_id(id)?;
327 let deadline = Instant::now() + timeout_duration;
328 loop {
329 if let Ok(serial) = self.resolve_serial(&avd_name) {
330 if self
331 .run_adb(["-s", &serial, "shell", "getprop", "sys.boot_completed"])
332 .unwrap_or_default()
333 .trim()
334 == "1"
335 {
336 return Ok(());
337 }
338 }
339 if Instant::now() >= deadline {
340 return Err(AppError::native(format!(
341 "Android emulator `{avd_name}` did not finish booting in time."
342 )));
343 }
344 thread::sleep(Duration::from_millis(500));
345 }
346 }
347
348 pub fn screenshot_png(&self, id: &str) -> Result<Vec<u8>, AppError> {
349 let serial = self.serial_for_id(id)?;

Callers 1

boot_android_deviceFunction · 0.80

Calls 4

avd_from_idFunction · 0.85
resolve_serialMethod · 0.80
run_adbMethod · 0.80
sleepFunction · 0.50

Tested by

no test coverage detected