firebase / firebase/firebase-android-sdk
Why is the API 34+ importance-based app-start check not used below API 34?
- Dominant language
- Java
- Stars
- 2.6k
- Forks
- 710
- Avg merge
- 2d 23h
- Merged PRs (30d)
- 34
Description
### Background
`app_start` being suppressed on API 34+ (#8103). The old timing-window heuristic was replaced on API 34+ by a `RunningAppProcessInfo.importance` read at first capture. The changelog says "Pre-API-34 behavior is unchanged."
So today there are two different signals:
- **Below 34** — `StartFromBackgroundRunnable` is posted to the main Looper from `FirebasePerfEarly` (`FirebasePerfEarly.java:55`). If it runs before the first `onActivityCreated`, the start is treated as background (`AppStartTrace.java:350-356`).
- **34+** — `ActivityManager.getMyMemoryState()` importance is read once during `registerActivityLifecycleCallbacks`. Only `IMPORTANCE_FOREGROUND` allows the trace (`AppStartTrace.java:360`).
### Question
`ActivityManager.getMyMemoryState()` has been available since API 16, and `AppStartCause.readImportance()` already runs on **every** API level (`AppStartCause.java:79`). Only the classification is gated:
```java
if (apiLevel >= 34) {
Cause cause = importance == IMPORTANCE_FOREGROUND
? Cause.FOREGROUND
: Cause.UNKNOWN;
return new AppStartCause(cause, importance, apiLevel);
}
// API < 34: legacy AppStartTrace logic owns the decision.
return new AppStartCause(Cause.UNKNOWN, importance, apiLevel);
```
What specifically blocks using the importance signal below API 34?
Contributor guide
Research direction
Start with AppStartCause.java:79, FirebasePerfEarly.java:55, and AppStartTrace.java:350-360 to trace how importance and lifecycle timing interact across API levels. Review related history and tests, then document the compatibility or behavioral reason for the API 34 gate; done means the expected behavior below API 34 is clearly established.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, firebase, java
- Domain
- mobile-dev, performance
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100