Skip to content

firebase-perf: document why the importance signal is gated to API 34+ - #8532

Open
jrodiz wants to merge 1 commit into
firebase:mainfrom
jrodiz:feature/jrc--8509.Document.API.34.importance.gate.rationale
Open

firebase-perf: document why the importance signal is gated to API 34+#8532
jrodiz wants to merge 1 commit into
firebase:mainfrom
jrodiz:feature/jrc--8509.Document.API.34.importance.gate.rationale

Conversation

@jrodiz

@jrodiz jrodiz commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Answers #8509 (follow-up question to #8103 / PR #8326). Documentation only: no behavior change, no API change, no CHANGELOG entry.

Why

AppStartCause.capture() reads RunningAppProcessInfo.importance on every API level but classifies on it only from API 34 up. The comment at the gate said what happened (// API < 34: legacy AppStartTrace logic owns the decision.) and not why, leaving the reasoning only in the PR body for #8326. This moves it to the gate.

Changes

AppStartCause.java: class javadoc notes that the importance read isn't version-gated (getMyMemoryState is API 16+) and only the classification is; capture()'s javadoc records the rationale; the inline comment notes that importance is recorded below 34 so the two signals can be compared before any future tier flip.

AppStartTrace.java: resolveIsStartedFromBackground() points at AppStartCause#capture and references #8509 alongside #8103.

The rationale recorded

  1. No pre-API-34 defect. [firebase-perf] _app_start suppressed on API >=34 for large apps — 50ms MAX_BACKGROUND_RUNNABLE_DELAY threshold insufficient (b/339891952 follow-up) #8103 is an API-34+ ordering change; below 34 the legacy check classifies correctly (API 33 launcher tap: activity.resumed 84 ms, runnable 101 ms).
  2. The signals aren't equivalent. PROCESS_STATE_BOUND_TOP maps to IMPORTANCE_FOREGROUND, so a process forked by a foreground app binding one of its services samples FOREGROUND, and a warm start that follows would be admitted as _app_start, which the pre-34 path suppresses today.
  3. Importance-driven suppression fails silently, where the legacy check fails the other way. On 34+ that trade beat losing the trace entirely; below 34 there's nothing on the other side of it.
  4. The procState → importance mapping isn't one function pre-34. procStateToImportanceForTargetSdk returns the *_PRE_26 / *_PRE_28 constants below targetSdk 26, and minSdk here is 23.
  5. No production data backs the swap on that population: the 34+ flip rests on four emulator images across three scenarios, plus the device reports in [firebase-perf] _app_start suppressed on API >=34 for large apps — 50ms MAX_BACKGROUND_RUNNABLE_DELAY threshold insufficient (b/339891952 follow-up) #8103 and Firebase Performance does not send app start traces on some devices (API 34 Pixel 7) #5920.

AppStartCause.capture reads RunningAppProcessInfo.importance on every API
level but classifies on it only from 34 up, and the comment at the gate
said what happened without saying why. Records the rationale in place.
Documentation only; no behavior change. Answers firebase#8509.
@gemini-code-assist

Copy link
Copy Markdown
Contributor
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

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