makepad/libs/android_state
Admin 759148688f platform: frame pacing, idle apps, GPU pressure and cameras on the HAL
An idle app takes no loop turn: a session's pump blocks until there is
news for it, wakes and GPU results reach only their own session, and a
hosted app builds no frame while its window has no free shared image. Each
window paces at its own display; a texture pass paints only when its window
can show the result and is exactly its render target at every scale. The
direct compositor renders on the discrete GPU when there is one; Mirror and
Extended switch without an output rebuild. Vulkan: a full GPU never makes an
app fall back, fail or spin; upload arenas are pooled; pipeline variants a
batch needs compile before it; a grab of a hosted window no longer loses the
device; the WM's own device is replaceable and apps hear Event::GpuReset.
Every process lifts its open-file limit. Cameras: retry after a failed
open, rotation kept, a synthetic test camera, Cx::video_inputs. Android:
standalone app APKs run on the HAL again, file video decoding, system back
gestures, audio underruns grow the buffer. Frame tracing names who keeps an
app awake; one main-lag meter for macOS and Linux.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-14 07:24:22 +02:00
..
src platform: frame pacing, idle apps, GPU pressure and cameras on the HAL 2026-10-14 07:24:22 +02:00
Cargo.toml platform: HAL-only on every platform; the old backends are deleted 2026-10-13 12:26:21 +02:00
LICENSE Initial commit 2025-05-06 10:11:37 +02:00
README.md Initial commit 2025-05-06 10:11:37 +02:00

makepad-android-state

This crate is responsible for holding Makepad's Android-specific context states. It exists solely to allow external crates to access those Android states without depending on the entirety of Makepad.

These two states are:

  1. The JavaVM instance initialized by the JNI layer.
  • This cannot be set by foreign code outside this crate, as it is only ever set once during the lifetime of the app process.
  1. The current Makepad Activity instance.
  • This can be set by foreign code outside this crate, as the underlying Android platform may tear down and reconstruct the activity instance multiple times during the app's lifetime.
  • However, for safety reasons, we only permit a single caller to obtain the private "set_activity" function, which ensures that only the internal Makepad framework can set the activity instance.

Usage

Note: you probably want to use the robius-android-env crate instead of using this crate directly, or an even higher-level crate that depends on robius-android-env.

External users of this crate should only care about two functions:

  1. get_java_vm(): returns a pointer to the JavaVM instance, through which you can obtain the JNI environment.
  2. get_activity(): returns a pointer to the current Makepad Activity instance.

All other functions are intended for Makepad-internal use only, and will not be useful for external users.