This specification is maintained by the AgentRules Working Group. Have enhancements or want to claim maintainership?Submit Specification →
mobilecritical PriorityID: android-15-baseline-profiles-frame-pacing-standard

Android 15 Baseline Profiles Ahead-Of-Time Frame Pacing Standard

Mandates deterministic Ahead-Of-Time (AOT) profile compilation using Jetpack Macrobenchmark and Baseline Profile Gradle Plugin on Android 15. Eliminates runtime JIT de-optimizations and class verification micro-stutters to enforce strict 8.33ms UI thread frame pacing on 120Hz Jetpack Compose display surfaces. Guarantees automated profile generation and integration within release binaries to ensure zero initial-fling dropped frames.

Prohibited Anti-Pattern: Shipping Unprofiled Jetpack Compose Release Binaries Relying on JIT Compilation for Critical Paths

Export Ready-to-Drop Configuration

Select format below to copy code or download file directly.

---
description: Android 15 Baseline Profiles Ahead-Of-Time Frame Pacing Standard - Mandates deterministic Ahead-Of-Time (AOT) profile compilation using Jetpack Macrobenchmark and Baseline Profile Gradle Plugin on Android 15. Eliminates runtime JIT de-optimizations and class verification micro-stutters to enforce strict 8.33ms UI thread frame pacing on 120Hz Jetpack Compose display surfaces. Guarantees automated profile generation and integration within release binaries to ensure zero initial-fling dropped frames.
globs: **/macrobenchmark/**/*.kt, **/benchmark/**/*.kt, **/build.gradle.kts, app/build.gradle.kts, **/BaselineProfileGenerator.kt
alwaysApply: true
verified_by: "agentrules.org"
license: "CC-BY-4.0"
source: "https://agentrules.org/rules/android-15-baseline-profiles-frame-pacing-standard"
---

# Android 15 Baseline Profiles Ahead-Of-Time Frame Pacing Standard

> **Severity**: CRITICAL | **Category**: mobile
> **Anti-Pattern Warning**: Shipping Unprofiled Jetpack Compose Release Binaries Relying on JIT Compilation for Critical Paths

## System Constraints
You are a Principal Software Architect enforcing the Android 15 Baseline Profiles Ahead-Of-Time Frame Pacing Standard. Mandate continuous 120Hz (8.33ms) UI deadline compliance on Jetpack Compose screens. Reject any release configuration or macrobenchmark suite that fails to collect, verify, and package AOT baseline profile rules covering critical user journeys.

## Strict Guidelines
- Engineers MUST ALWAYS configure the `androidx.baselineprofile` Gradle plugin in both application and macrobenchmark modules.
- Engineers MUST ALWAYS implement macrobenchmark tests utilizing `BaselineProfileRule.collect()` that cover app cold start and high-velocity fling scrolls on Compose Lazy collections.
- Macrobenchmark verification tests MUST run with `CompilationMode.Partial(baselineProfileMode = BaselineProfileMode.Require)` to fail CI if profile rules do not apply cleanly to release DEX files.
- Engineers MUST NOT disable baseline profile generation or merge steps in release build variants (`saveInSrc = true` and `automaticGenerationDuringBuild = false` for deterministic CI artifact storage).
- Release builds MUST enforce R8 full mode with profile-guided optimization enabled to match method layouts with generated Baseline Profile descriptors.
- Compose UI elements within fling paths MUST use stable parameter types and prefetching keys (`key = { ... }`, `contentType = { ... }`) to avoid dynamic layout allocations outside AOT paths.

## Bad vs Good Implementations
### Macrobenchmark Baseline Profile Generator & Frame Timing Verification

#### Bad Antipattern (AI Common Hallucination)
> **Why it fails**: Fails to generate baseline profiles via BaselineProfileRule, omits FrameTimingMetric, and does not simulate high-velocity fling scrolling. Relies on unoptimized JIT compilation in release builds, triggering class-loading and interpretive execution stutters exceeding 8.33ms on 120Hz panels.
```kotlin
// BAD: Missing baseline profile rule generator and incomplete compilation verification
package com.example.macrobenchmark

import androidx.benchmark.macro.junit4.MacrobenchmarkRule
import androidx.test.ext.junit.runners.AndroidJUnit4
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith

@RunWith(AndroidJUnit4::class)
class StartupBenchmark {
    @get:Rule
    val benchmarkRule = MacrobenchmarkRule()

    @Test
    fun startup() = benchmarkRule.measureRepeated(
        packageName = "com.example.app",
        metrics = emptyList(), // No FrameTimingMetric verification
        iterations = 3
    ) {
        // Cold startup without warm-up or profile collection
        pressHome()
        startActivityAndWait()
        // Does not exercise scrolling or critical paths
    }
}
```

#### Production Standard (Correct)
> **Standard**: Uses BaselineProfileRule to record cold startup and fling gesture DEX paths directly into the baseline profile. Enforces CompilationMode.Partial(BaselineProfileMode.Require) alongside FrameTimingMetric to mathematically verify that zero frames breach the 8.33ms deadline on 120Hz displays.
```kotlin
// GOOD: Deterministic Baseline Profile generation with Compose scroll path and FrameTimingMetric
package com.example.macrobenchmark

import androidx.benchmark.macro.BaselineProfileMode
import androidx.benchmark.macro.CompilationMode
import androidx.benchmark.macro.FrameTimingMetric
import androidx.benchmark.macro.StartupMode
import androidx.benchmark.macro.junit4.BaselineProfileRule
import androidx.benchmark.macro.junit4.MacrobenchmarkRule
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.uiautomator.By
import androidx.test.uiautomator.Direction
import androidx.test.uiautomator.Until
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith

@RunWith(AndroidJUnit4::class)
class ProductionBaselineProfileBenchmark {
    @get:Rule
    val baselineProfileRule = BaselineProfileRule()

    @get:Rule
    val benchmarkRule = MacrobenchmarkRule()

    @Test
    fun generateBaselineProfiles() = baselineProfileRule.collect(
        packageName = "com.example.app",
        includeInStartupProfile = true
    ) {
        pressHome()
        startActivityAndWait()
        
        // Wait for Compose list to render and execute fling scroll to AOT-compile layout paths
        device.wait(Until.hasObject(By.res("feed_list")), 5_000)
        val list = device.findObject(By.res("feed_list"))
        list.setGestureMargin(device.displayWidth / 5)
        list.fling(Direction.DOWN)
        device.waitForIdle()
    }

    @Test
    fun verifyFramePacingUnderBaselineProfile() = benchmarkRule.measureRepeated(
        packageName = "com.example.app",
        metrics = listOf(FrameTimingMetric()),
        compilationMode = CompilationMode.Partial(baselineProfileMode = BaselineProfileMode.Require),
        startupMode = StartupMode.COLD,
        iterations = 10
    ) {
        pressHome()
        startActivityAndWait()
        val list = device.wait(Until.findObject(By.res("feed_list")), 5_000)
        list.fling(Direction.DOWN)
        device.waitForIdle()
    }
}
```

Recommended MCP Servers (mcp-serverlist.com)

Equip agent with system tools to verify code for this stack.

Architectural Specification & Invariant Rationale

Architectural Invariant Design: Android 15 Baseline Profiles Ahead-Of-Time Frame Pacing Standard

Android 15 Baseline Profiles Ahead-Of-Time Frame Pacing Standard defines an industrial-grade behavioral standard for mobile engineering. Mandates deterministic Ahead-Of-Time (AOT) profile compilation using Jetpack Macrobenchmark and Baseline Profile Gradle Plugin on Android 15. Eliminates runtime JIT de-optimizations and class verification micro-stutters to enforce strict 8.33ms UI thread frame pacing on 120Hz Jetpack Compose display surfaces. Guarantees automated profile generation and integration within release binaries to ensure zero initial-fling dropped frames. Modern software architectures require strict adherence to deterministic patterns to guarantee high availability, maintainability, and zero security vulnerabilities.

Framework Paradigm Shift & Drift MechanicsLLMs are trained on millions of open-source repositories containing outdated code, legacy idioms, and unpatched antipatterns. When coding assistants generate implementations for this stack, they default to common statistical tokens: Shipping Unprofiled Jetpack Compose Release Binaries Relying on JIT Compilation for Critical Paths Without an explicit system instruction file, developers spend hours debugging silent failures.
Failure Modes & Production Blast Radius

Hazard Analysis: What Breaks Without This Rule

The following failure modes have been cataloged from hundreds of hours of production code reviews where AI assistants produced non-compliant implementations:

Failure ModeAI Symptom (The Anti-Pattern)SeverityProduction Impact & Remedy
AI Hallucination & Deprecation DriftShipping Unprofiled Jetpack Compose Release Binaries Relying on JIT Compilation for Critical PathsCritical
Violating this industrial standard introduces regression bugs, security risks, and unexpected runtime failures in production.
Enforce explicit behavioral system directives across all AI coding assistants in your repository.
Silent Architecture InconsistencyAI assistants produce mixed paradigms across files, creating fragmented codebase conventions.Medium
Increases cognitive load during code reviews and leads to maintenance debt across engineering teams.
Pin project conventions in .cursor/rules, CLAUDE.md, and AGENTS.md so all team agents follow identical guardrails.
Architectural Directives in Detail

Step-by-Step Production Directives

Each rule constraint below is injected into the AI agent's system prompt to establish deterministic boundaries:

1

Engineers MUST ALWAYS configure the `androidx.baselineprofile` Gradle plugin in both application and macrobenchmark modules.

Engineers MUST ALWAYS configure the `androidx.baselineprofile` Gradle plugin in both application and macrobenchmark modules.

Rationale:AI models frequently generate unconstrained code here because statistical language distributions lack project-specific architectural context. Mandating this directive ensures that generated code adheres to verified industrial production requirements.
Enforcement:Integrated into the Agent Pack rule file. When Cursor, Claude Code, or Codex processes this prompt, it applies this constraint before emitting syntax.
2

Engineers MUST ALWAYS implement macrobenchmark tests utilizing `BaselineProfileRule.collect()` that cover app cold start and high-velocity fling scrolls on Compose Lazy collections.

Engineers MUST ALWAYS implement macrobenchmark tests utilizing `BaselineProfileRule.collect()` that cover app cold start and high-velocity fling scrolls on Compose Lazy collections.

Rationale:AI models frequently generate unconstrained code here because statistical language distributions lack project-specific architectural context. Mandating this directive ensures that generated code adheres to verified industrial production requirements.
Enforcement:Integrated into the Agent Pack rule file. When Cursor, Claude Code, or Codex processes this prompt, it applies this constraint before emitting syntax.
3

Macrobenchmark verification tests MUST run with `CompilationMode.Partial(baselineProfileMode = BaselineProfileMode.Require)` to fail CI if profile rules do not apply cleanly to release DEX files.

Macrobenchmark verification tests MUST run with `CompilationMode.Partial(baselineProfileMode = BaselineProfileMode.Require)` to fail CI if profile rules do not apply cleanly to release DEX files.

Rationale:AI models frequently generate unconstrained code here because statistical language distributions lack project-specific architectural context. Mandating this directive ensures that generated code adheres to verified industrial production requirements.
Enforcement:Integrated into the Agent Pack rule file. When Cursor, Claude Code, or Codex processes this prompt, it applies this constraint before emitting syntax.
4

Engineers MUST NOT disable baseline profile generation or merge steps in release build variants (`saveInSrc = true` and `automaticGenerationDuringBuild = false` for deterministic CI artifact storage).

Engineers MUST NOT disable baseline profile generation or merge steps in release build variants (`saveInSrc = true` and `automaticGenerationDuringBuild = false` for deterministic CI artifact storage).

Rationale:AI models frequently generate unconstrained code here because statistical language distributions lack project-specific architectural context. Mandating this directive ensures that generated code adheres to verified industrial production requirements.
Enforcement:Integrated into the Agent Pack rule file. When Cursor, Claude Code, or Codex processes this prompt, it applies this constraint before emitting syntax.
5

Release builds MUST enforce R8 full mode with profile-guided optimization enabled to match method layouts with generated Baseline Profile descriptors.

Release builds MUST enforce R8 full mode with profile-guided optimization enabled to match method layouts with generated Baseline Profile descriptors.

Rationale:AI models frequently generate unconstrained code here because statistical language distributions lack project-specific architectural context. Mandating this directive ensures that generated code adheres to verified industrial production requirements.
Enforcement:Integrated into the Agent Pack rule file. When Cursor, Claude Code, or Codex processes this prompt, it applies this constraint before emitting syntax.
6

Compose UI elements within fling paths MUST use stable parameter types and prefetching keys (`key = { ... }`, `contentType = { ... }`) to avoid dynamic layout allocations outside AOT paths.

Compose UI elements within fling paths MUST use stable parameter types and prefetching keys (`key = { ... }`, `contentType = { ... }`) to avoid dynamic layout allocations outside AOT paths.

Rationale:AI models frequently generate unconstrained code here because statistical language distributions lack project-specific architectural context. Mandating this directive ensures that generated code adheres to verified industrial production requirements.
Enforcement:Integrated into the Agent Pack rule file. When Cursor, Claude Code, or Codex processes this prompt, it applies this constraint before emitting syntax.
Technical Questions & Answers

Frequently Asked Technical Questions

Common questions developers face when configuring AI coding assistants for this stack:

Q:Why is Android 15 Baseline Profiles Ahead-Of-Time Frame Pacing Standard critical for AI coding assistants?

Mandates deterministic Ahead-Of-Time (AOT) profile compilation using Jetpack Macrobenchmark and Baseline Profile Gradle Plugin on Android 15. Eliminates runtime JIT de-optimizations and class verification micro-stutters to enforce strict 8.33ms UI thread frame pacing on 120Hz Jetpack Compose display surfaces. Guarantees automated profile generation and integration within release binaries to ensure zero initial-fling dropped frames. Without explicit behavioral boundaries, AI coding assistants (Cursor, Claude Code, Windsurf, Codex) rely on training data averages, which frequently produce deprecated, inefficient, or vulnerable code patterns.

Q:How does adopting this rule prevent AI hallucinations?

This rule explicitly declares what the AI must avoid (Shipping Unprofiled Jetpack Compose Release Binaries Relying on JIT Compilation for Critical Paths) and prescribes verified positive examples. Grounding the LLM with negative and positive pairs eliminates guesswork.

Q:Which AI coding environments are supported?

This specification is multi-platform compatible: Cursor (.cursor/rules/*.mdc & .cursorrules), Anthropic Claude Code (CLAUDE.md), Windsurf (.windsurfrules), Codex / Cline (AGENTS.md), and GitHub Copilot (.github/copilot-instructions.md).

Q:Can I combine this rule with other technology stacks?

Yes. Use the Interactive Stack Builder or download an Agent Pack to merge this rule with other frontend, backend, database, security, and DevOps rules without syntax collision.

Open Specification · CC BY 4.0·Free for Personal, Team & Commercial In-Repo Use

Citation & Open Source Attribution Guidelines

This specification is licensed under Creative Commons Attribution 4.0 International (CC BY 4.0). You are completely free to adapt and share this rule in your workspace. If citing, including in public AI benchmark datasets, or redistributing, attribution to AgentRules.org is required.

Related MOBILE Rules

View all rules →
1 Rule in Stack

Android