Android
AuraScore 83/100

Jetpack Compose Generative Canvas State Matrix

Design a rock-solid state management and gesture matrix for interactive, generative inpainting and multimodal canvas UI.

Use this template when designing interactive Android UI components that handle multimodal image prompts, live masking, and generative feedback loops. It establishes a complete state-machine matrix across Compose lifecycles and background diffusion tasks.

Template

Role: Staff Android UI Systems Engineer specializing in Jetpack Compose architecture, custom graphics rendering, and generative UI workflows.

Context

  • UI Framework Version: {{compose_version}}
  • Generation Latency Threshold: {{inpainting_latency_threshold}}
  • Canvas Mask Resolution: {{brush_mask_resolution}}
  • Backend Generation Route: {{diffusion_backend_endpoint}}
  • State Restoration Pattern: {{state_restoration_strategy}}
  • Android Minimum SDK: {{target_api_level}}

Task

Produce an exhaustive declarative UI state matrix and gesture dispatch specification for a multimodal generative canvas, ensuring deterministic transitions between user sketching, prompt submission, asynchronous diffusion, and final rendering.

Method

  1. Map user touch and stylus interactions (brush strokes, mask erasure, bounding boxes) to declarative state holders within {{compose_version}}.
  2. Define bitmap mask serialization pathways supporting {{brush_mask_resolution}} without blocking the Android main thread.
  3. Model lifecycle transitions (configuration changes, app backgrounding) using {{state_restoration_strategy}} during active generation.
  4. Design perceptual latency mitigations (shimmer overlays, progressive tile reveals) for operations taking up to {{inpainting_latency_threshold}}.
  5. Formulate network and on-device fallback dispatch logic targeting {{diffusion_backend_endpoint}}.
  6. Evaluate low-memory event handling and graphics memory reclaiming across devices on {{target_api_level}}.
  7. Construct a state-to-event dispatch matrix linking every UI event to ViewModel mutations and side effects.

Constraints

  • State definitions MUST obey strict unidirectional data flow (UDF) conventions.
  • MUST NOT perform synchronous bitmap allocations or tensor preprocessing on the main UI thread.
  • Canvas rendering logic MUST be fully functional across all versions supported by {{target_api_level}}.
  • Every intermediate generative state MUST define explicit error and retry transitions.

Output format

Provide the architectural specification organized as:

  • Section 1: Canvas Interaction & Gesture State Matrix (Markdown table mapping Gestures, Compose State, Pointer Events, and Redraw Triggers)
  • Section 2: Generation Lifecycle & Async Pipeline Matrix (Markdown table mapping Task Status, UI Feedback, Network Event, and Error Boundary)
  • Section 3: State Restoration & Memory Eviction Matrix (Markdown table detailing Process Death, Configuration Change, and Low-Memory Scenarios)
  • Section 4: Jetpack Compose State Interface Blueprint (Kotlin pseudo-code, under 40 lines)

Self-review

  • Ensure all variables are properly interpolated in the method and constraints.
  • Check that the gesture matrix accounts for high-frequency stylus input without frame drops.
  • Confirm clear distinction between local mask rendering and remote generation dispatch.
AuraScore breakdown
83/100Provisional
Instruction clarity15/15 · Strong

Explicit role, a named task, and discrete steps the model can follow.

Context architecture12/12 · Strong

Background, inputs and variables the model needs before it starts.

Constraint engineering12/12 · Strong

Hard boundaries — what the model must and must not do.

Output specification6/14 · Thin

A named, field-level shape for the response.

Reasoning structure10/10 · Strong

Ordered work items that force analysis before an answer.

Model compatibility10/10 · Strong

Length and structure that travel across frontier models.

Token efficiency5/10 · Thin

Signal density — instruction weight without padding.

Reusability7/7 · Strong

Documented variables so the scaffold adapts to new inputs.

Robustness5/5 · Strong

Quality bar, assumptions and behaviour when inputs are thin.

Observed performance1/5 · Thin

How much real usage the template has behind it.

developers
developers-android
image-multimodal-prompting
android
jetpack-compose
generative-ui