Skip to content

Commit 5b6ce5d

Browse files
committed
Update comments
1 parent 177bc5d commit 5b6ce5d

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

firebase-perf/src/main/java/com/google/firebase/perf/metrics/AppStartTrace.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@ public class AppStartTrace implements ActivityLifecycleCallbacks, LifecycleObser
7575
private static final @NonNull Timer PERF_CLASS_LOAD_TIME = new Clock().getTime();
7676
private static final long MAX_LATENCY_BEFORE_UI_INIT = TimeUnit.MINUTES.toMicros(1);
7777

78+
// If the `mainThreadRunnableTime` was set earlier than this this duration, the assumption
79+
// is that it was called immediately before `onActivityCreated` in foreground starts on API 34+.
7880
private static final long MAX_BACKGROUND_RUNNABLE_DELAY = TimeUnit.MILLISECONDS.toMicros(100);
7981

8082
// Core pool size 0 allows threads to shut down if they're idle
@@ -329,7 +331,8 @@ private void recordOnDrawFrontOfQueue() {
329331
* <p>
330332
* If it's prior to API 34, it's always set to true if `mainThreadRunnableTime` was set.
331333
* <p>
332-
* If it's on or after API 34, and it was called less than 100ms before `onActivityCreated`, the
334+
* If it's on or after API 34, and it was called less than `MAX_BACKGROUND_RUNNABLE_DELAY`
335+
* before `onActivityCreated`, the
333336
* assumption is that it was called immediately before the activity lifecycle callbacks in a
334337
* foreground start.
335338
* See https://github.com/firebase/firebase-android-sdk/issues/5920.
@@ -343,7 +346,8 @@ private void resolveIsStartedFromBackground() {
343346

344347
// If the `minaThreadRunnableTime` was set prior to API 34, it's always assumed that's it's
345348
// a background start.
346-
// Otherwise it's assumed to be a background start if the runnable was set more than 100ms
349+
// Otherwise it's assumed to be a background start if the runnable was set more than
350+
// `MAX_BACKGROUND_RUNNABLE_DELAY`
347351
// before the first `onActivityCreated` call.
348352
// TODO(b/339891952): Investigate removing the API check, and setting a more precise delay.
349353
if ((Build.VERSION.SDK_INT < 34)

0 commit comments

Comments
 (0)