Skip to content

Fix baseline profile generation 8630355174009459809#640

Merged
theovilardo merged 22 commits intoperf/baseline-prof-integrationfrom
fix-baseline-profile-generation-8630355174009459809
Dec 25, 2025
Merged

Fix baseline profile generation 8630355174009459809#640
theovilardo merged 22 commits intoperf/baseline-prof-integrationfrom
fix-baseline-profile-generation-8630355174009459809

Conversation

@theovilardo
Copy link
Copy Markdown
Owner

No description provided.

theovilardo and others added 22 commits December 24, 2025 12:31
Introduces a `is_benchmark` intent flag to streamline app startup during Baseline Profile generation, bypassing setup screens and permission dialogs for a more stable and direct launch to the main screen.

- **MainActivity.kt**:
  - Reads a new `is_benchmark` boolean extra from the intent.
  - Skips the `SetupScreen` if `is_benchmark` is true.
  - Prevents the "All Files Access" dialog from appearing during benchmark runs.

- **BaselineProfileGenerator.kt**:
  - Simplifies the generation script to perform only a cold start and a brief wait, removing complex UI interactions (tab navigation, scrolling, sheet opening) that caused instability.
  - Launches the app with the `--ez is_benchmark true` flag to ensure a direct path to the `HomeScreen`.
  - Grants `MANAGE_EXTERNAL_STORAGE` and `POST_NOTIFICATIONS` permissions via shell commands before the run to avoid system dialogs.

- **HomeScreen.kt**:
  - Adds `ReportDrawnWhen` to signal when the screen is fully drawn, using the presence of songs or the `is_benchmark` flag as a trigger.
  - Suppresses the app rebrand dialog when in benchmark mode.

- **Build & Dependencies**:
  - Adds a new `benchmark` build type in `app/build.gradle.kts` that inherits from `release` but is debuggable.
  - Updates `benchmark-macro-junit4` and `baselineprofile` libraries to version `1.3.3`.
  - Includes the `baselineprofile` module in the Gradle project settings.
…t frame detection checks that cause timeouts on some devices.
…n Xiaomi devices during Baseline Profile generation.
…o capture complex animations and heavy UI components.
…o ensure playback starts in BaselineProfileGenerator.
Improves the reliability and robustness of the `BaselineProfileGenerator` and `StartupBenchmarks` to handle inconsistencies across different devices and languages.

- **`gradle.properties`**:
  - Adds `androidx.benchmark.suppressErrors=EMULATOR,LOW-BATTERY,THERMAL` to prevent benchmark failures in non-ideal CI environments.

- **`StartupBenchmarks.kt`**:
  - Switches to `BaselineProfileMode.UseIfAvailable` from `Require` to prevent failures on devices where profiles aren't strictly enforced (e.g., Samsung/OneUI).
  - Simplifies the benchmark setup by hardcoding the package name and reducing iterations to 5 for faster validation.
  - Removes the complex setup block in favor of a straightforward `pressHome()` and `startActivityAndWait()`.

- **`BaselineProfileGenerator.kt`**:
  - **Internationalization**: Replaces hardcoded English UI strings with regex patterns (`Pattern.compile`) to match both English and Spanish text (e.g., "Queue|Cola", "Library|Biblioteca").
  - **Error Handling**: Implements a robust rescue mechanism for profile generation failures. If a `flush profiles` error occurs, it now attempts to copy the generated profile to multiple common storage locations (`/Download`, `/sdcard`, and app-specific external storage) and logs `adb pull` commands for easy manual retrieval.
  - **UI Interaction**:
    - Simplifies and stabilizes UI interaction logic, making clicks more resilient and removing brittle waits.
    - Improves navigation between tabs and interaction with the player sheet.
    - Increases `maxIterations` from 1 to 3 for a more comprehensive profile.
@chatgpt-codex-connector
Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@theovilardo theovilardo merged commit 1d5e1e6 into perf/baseline-prof-integration Dec 25, 2025
@lostf1sh lostf1sh deleted the fix-baseline-profile-generation-8630355174009459809 branch January 16, 2026 20:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant