Commit b8f20ea
committed
firebase-perf: widen background-start timing window to 1000ms (#8103)
The API-34 fix in 22.0.2 (PR #7281) used a 50 ms MAX_BACKGROUND_RUNNABLE_DELAY
to tell cold foreground starts from genuine background starts. That threshold
was calibrated against a near-empty test app on API 35, where the gap between
StartFromBackgroundRunnable firing and the first onActivityCreated was ~10 ms.
On API 34+ physical devices, the gap is dominated by Android's main-thread vs
Binder scheduling, not by app work:
- 316 ms on a minimal ContentProvider repro (issue #5920, PhilGlass).
- 204 ms on a large production app (issue #8103, manavchandrakar29011994).
50 ms is well below both, so _app_start is unconditionally suppressed for
typical real-world apps on the very devices the fix was meant to support.
Bump MAX_BACKGROUND_RUNNABLE_DELAY to 1000 ms. The mechanism (timing window)
and the warm-start guard introduced in PR #7281 (mainThreadRunnableTime is
only set when onCreateTime == null) are unchanged. Genuine warm starts where
the process was forked for background work seconds-to-minutes before any
activity launch are still suppressed, since their gap far exceeds 1000 ms and
MAX_LATENCY_BEFORE_UI_INIT (60 s) remains the upper backstop.
Tests:
- Rename the existing 50 ms tests to _within1000ms / _moreThan1000ms.
- Add testStartFromBackground_largeAppGap_isForegroundStart: ~300 ms gap on
API 34 now logs the trace (regression-locks #8103).
- Add testStartFromBackground_warmStart_stillSuppressed: 10 s gap is still
suppressed.1 parent f5b1aba commit b8f20ea
3 files changed
Lines changed: 78 additions & 6 deletions
File tree
- firebase-perf
- src
- main/java/com/google/firebase/perf/metrics
- test/java/com/google/firebase/perf/metrics
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
3 | 7 | | |
4 | 8 | | |
5 | 9 | | |
| |||
Lines changed: 13 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
76 | 76 | | |
77 | 77 | | |
78 | 78 | | |
79 | | - | |
80 | | - | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
81 | 92 | | |
82 | 93 | | |
83 | 94 | | |
| |||
Lines changed: 61 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
239 | 239 | | |
240 | 240 | | |
241 | 241 | | |
242 | | - | |
| 242 | + | |
243 | 243 | | |
244 | 244 | | |
245 | 245 | | |
| |||
248 | 248 | | |
249 | 249 | | |
250 | 250 | | |
251 | | - | |
| 251 | + | |
252 | 252 | | |
253 | 253 | | |
254 | 254 | | |
| |||
267 | 267 | | |
268 | 268 | | |
269 | 269 | | |
270 | | - | |
| 270 | + | |
271 | 271 | | |
272 | 272 | | |
273 | 273 | | |
| |||
276 | 276 | | |
277 | 277 | | |
278 | 278 | | |
279 | | - | |
| 279 | + | |
280 | 280 | | |
281 | 281 | | |
282 | 282 | | |
| |||
293 | 293 | | |
294 | 294 | | |
295 | 295 | | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
296 | 353 | | |
297 | 354 | | |
298 | 355 | | |
| |||
0 commit comments