makepad/libs/toml_parser
Kevin Boos a391f5e347
Overhaul android tooling and platform layers to support Android 8 (#1091)
* Dock: avoid ID collisions in drag/drop; never delete dock root in unsplit_tabs

* Clean up and further harden dock logic around splitting/dragging

* cargo_makepad: Android App Bundle builds, API 26 support, stable toolchain

Overhaul the Android build pipeline. Three related build-tooling
changes that share compile.rs/sdk.rs and so are committed together.

Android App Bundle (.aab) support — required for Google Play uploads:
- New `build-aab` command: compile resources with aapt2, link a
  proto-format APK, assemble the base module, run bundletool, and sign
  with jarsigner.
- New `keystore-create` command wrapping keytool, with a reusable
  keystore sidecar file; new `--keystore*`, `--no-sign`,
  `--version-code`, `--version-name` flags.
- Version codes may be explicit or auto-generated as a monotonic
  YYYYMMDDHH UTC integer.
- Read app id, version, and signing metadata from
  `[package.metadata.packager]` / `[package.metadata.makepad.android]`
  in Cargo.toml; support a custom AndroidManifest.xml template.
- Upgrade the bundled TOML parser for the dotted keys, inline tables,
  and multi-line strings those metadata sections use.
- Download bundletool and copy jarsigner/keytool/aapt2 into the SDK.

minSdkVersion 26:
- Lower the default Android minimum SDK from 33 to 26 and track the
  target SDK (35) separately, emitting minSdkVersion and
  targetSdkVersion independently in the generated manifest; add a
  `--min-sdk-version` override.

Stable Rust toolchain:
- Build Android and iOS on stable instead of nightly. tvOS still needs
  nightly for `-Z build-std`, so the channel is resolved per target.
- Add `ensure_rust_toolchain_installed` (install only when missing).

* Android: load newer NDK symbols at runtime to support API 26

With the minimum SDK lowered to 26, NDK entry points that only exist
on newer API levels can no longer be declared with `extern "C"` —
doing so breaks `dlopen`/startup on API 26-28. Resolve them at
runtime instead:

- amidi_sys: lazily `dlopen` libamidi.so (API 29+) into a cached
  vtable; the wrappers degrade to error/zero returns when the library
  is absent on older devices.
- android_jni: `dlsym` the AChoreographer vsync callbacks, gated on
  the running API level.
- ndk_sys: drop the `extern "C"` declarations for
  `ANativeWindow_setFrameRate` and the Choreographer callbacks;
  android.rs drops the now-unused frame-rate call.
- MakepadActivity: guard `setInitialSurroundingSubText` (API 30+) and
  `layoutInDisplayCutoutMode` (API 28+) behind version checks.
- android_jni: the fallback render-loop thread now exits cleanly when
  the app is torn down.

* Android: automatic and app-controlled system bar appearance

Add a way to control the tint of the status and navigation bar icons,
fixing white-on-white (invisible) icons when an app draws a light
background under a system dark-mode theme.

- New `Cx::set_system_bar_appearance(SystemBarAppearance)`. The default
  `Auto` mode picks dark or light icons from the window background
  luminance; `DarkIcons`/`LightIcons` force the choice.
- The `Window` widget resolves the setting each event cycle — for
  `Auto`, the Rec.709 luma of `pass.clear_color` — and emits
  `CxOsOp::SetSystemBarDarkIcons` only when the resolved value changes.
- On Android this drives `WindowInsetsController.setSystemBarsAppearance`
  (API 30+) or the `SYSTEM_UI_FLAG_LIGHT_*` flags (API 26-29). The tint
  is re-asserted after fullscreen toggles, since the legacy path
  rewrites the whole `systemUiVisibility` bitmask.

* Android: fix soft-keyboard handling and edge-to-edge insets

Several related window-inset and IME fixes, mostly affecting devices
that are not edge-to-edge (Android versions before 15).

- Report safe-area and IME insets as the overlap with the render
  surface, not the raw window-edge insets. On a non-edge-to-edge
  window the surface already sits inside the system bars, so the raw
  insets double-counted — leaving oversized gaps around content and
  above the keyboard.
- Also drive safe-area insets from `onGlobalLayout`, so the app is
  inset correctly from launch instead of drawing under the status bar
  until the first keyboard show or rotation.
- While the keyboard animates, treat the `WindowInsetsAnimation`
  callback as the authoritative per-frame inset source and have the
  layout-driven callbacks defer to it. Read target IME visibility from
  `getRootWindowInsets()` so a show animation is not misread as an
  instant dismissal.
- Only reconfigure the Java IME when the `TextInputConfig` actually
  changes, instead of on every show.
- `KeyboardView`: compute and apply the content shift at keyboard-show
  event time, removing a one-frame lag and a tail-end jump; only
  reconcile post-draw when the focused field actually redrew.
- `Modal::close()`: skip the focus revert when the modal is already
  closed — it was stealing focus from a just-tapped text input and
  causing a first-tap keyboard flicker.
- Hide the keyboard via `WindowInsetsController.hide(ime())` on API 30+.

* platform: don't panic posting actions during shutdown

post_action no longer unwraps the global action sender. It now
silently drops the action if the sender mutex is poisoned, no Cx
sender is installed, or the receiver has been dropped during app
teardown, and only raises the UI signal when the send succeeds.

(Also shortens an over-long field doc comment in cx.rs; no behavior
change.)

* cargo-makepad: link std statically in AAB builds (16 KB page-size fix)

`-C prefer-dynamic` ships std as a separate, 4 KB-aligned libstd.so that
fails Play's 16 KB page-size rule. AAB builds now link std statically;
APK/dev builds keep prefer-dynamic. Also documents {min_sdk_version} in help.
2026-05-22 01:40:29 +02:00
..
src Overhaul android tooling and platform layers to support Android 8 (#1091) 2026-05-22 01:40:29 +02:00
Cargo.toml 1.0.0 2025-05-15 16:46:16 +02:00