File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed 
firebase-perf/src/main/java/com/google/firebase/perf/metrics Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -323,6 +323,16 @@ private void recordOnDrawFrontOfQueue() {
323323    logExperimentTrace (this .experimentTtid );
324324  }
325325
326+   /** 
327+    * Sets the `isStartedFromBackground` flag to `true` if the `mainThreadRunnable` time was set 
328+    * from the `StartFromBackgroundRunnable` more than 100ms prior to the first time 
329+    * `onActivityCreated` was called. 
330+    * <p> 
331+    * If it was called less than 100ms before `onActivityCreated` the assumption is that it was a 
332+    * change in order on API 34+ devices where the runnable executes before the activity 
333+    * lifecycle callbacks. 
334+    * See https://github.com/firebase/firebase-android-sdk/issues/5920. 
335+    */ 
326336  private  void  resolveIsStartedFromBackground () {
327337    // If the mainThreadRunnableTime is null, either the runnable hasn't run, or this check has 
328338    // already been made. 
@@ -593,6 +603,7 @@ public StartFromBackgroundRunnable(final AppStartTrace trace) {
593603
594604    @ Override 
595605    public  void  run () {
606+       // Only set the `mainThreadRunnableTime` if `onActivityCreate` has never been called. 
596607      if  (trace .onCreateTime  == null ) {
597608        trace .mainThreadRunnableTime  = new  Timer ();
598609      }
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments