MCPcopy Create free account
hub / github.com/NativeScript/SimDeck / accessibility_tree

Method accessibility_tree

packages/server/src/android.rs:718–739  ·  view source on GitHub ↗
(
        &self,
        id: &str,
        max_depth: Option<usize>,
    )

Source from the content-addressed store, hash-verified

716 }
717
718 pub fn accessibility_tree(
719 &self,
720 id: &str,
721 max_depth: Option<usize>,
722 ) -> Result<Value, AppError> {
723 let serial = self.serial_for_id(id)?;
724 let max_depth = max_depth.unwrap_or(80).min(80);
725 let mut last_error = None;
726 for attempt in 1..=ANDROID_UIAUTOMATOR_DUMP_ATTEMPTS {
727 match self.android_accessibility_tree_for_serial(&serial, max_depth) {
728 Ok(tree) => return Ok(tree),
729 Err(error) => last_error = Some(error),
730 }
731 if attempt < ANDROID_UIAUTOMATOR_DUMP_ATTEMPTS {
732 thread::sleep(ANDROID_UIAUTOMATOR_DUMP_RETRY_DELAY);
733 }
734 }
735
736 Err(last_error.unwrap_or_else(|| {
737 AppError::native("Unable to capture Android UIAutomator hierarchy.")
738 }))
739 }
740
741 fn android_accessibility_tree_for_serial(
742 &self,

Callers 2

accessibility_tree_valueFunction · 0.80
accessibility_pointFunction · 0.80

Calls 3

serial_for_idMethod · 0.80
sleepFunction · 0.50

Tested by

no test coverage detected