pub fn update_if_active(
        &mut self,
        update_factory: impl FnOnce() -> TreeUpdate,
    ) -> Option<QueuedEvents> {
        match &mut self.state {
            State::Inactive => None,
            State::Placeholder(_) => {
                let tree = Tree::new(update_factory(), true);
                let mut events = Vec::new();
                enqueue_window_content_changed(&mut events);
                let state = tree.state();
                if let Some(focus) = state.focus() {
                    enqueue_focus_event_if_applicable(&mut events, &mut self.node_id_map, &focus);
                }
                self.state = State::Active(tree);
                Some(QueuedEvents(events))
            }
            State::Active(tree) => {
                let mut events = Vec::new();
                update_tree(&mut events, &mut self.node_id_map, tree, update_factory());
                Some(QueuedEvents(events))
            }
        }
    }
If and only if the tree has been initialized, call the provided function
and apply the resulting update. Note: If the caller's implementation of
[`ActivationHandler::request_initial_tree`] initially returned `None`,
the [`TreeUpdate`] returned by the provided function must contain
a full tree.

If a [`QueuedEvents`] instance is returned, the caller must call
[`QueuedEvents::raise`] on it.

This method may be safely called on any thread, but refer to
[`QueuedEvents::raise`] for restrictions on the context in which
it should be called.
platforms/android/src/adapter.rs