1717package  com.google.firebase.perf.session 
1818
1919import  com.google.firebase.perf.session.gauges.GaugeManager 
20+ import  com.google.firebase.perf.util.Constants 
2021import  com.google.firebase.perf.v1.ApplicationProcessState 
2122import  com.google.firebase.sessions.api.SessionSubscriber 
2223import  java.util.UUID 
@@ -27,22 +28,24 @@ class FirebasePerformanceSessionSubscriber(override val isDataCollectionEnabled:
2728  override  val  sessionSubscriberName:  SessionSubscriber .Name  =  SessionSubscriber .Name .PERFORMANCE 
2829
2930  override  fun  onSessionChanged (sessionDetails :  SessionSubscriber .SessionDetails ) {
30-     val  currentPerfSession =  SessionManager .getInstance().perfSession()
31+     val  sessionManager =  SessionManager .getInstance()
32+     val  currentPerfSession =  sessionManager.perfSession()
3133    val  gaugeManager =  GaugeManager .getInstance()
3234
3335    //  A [PerfSession] was created before a session was started.
34-     if  (currentPerfSession.aqsSessionId()  ==   null ) {
36+     if  (currentPerfSession.aqsSessionId().equals( Constants . UNDEFINED_AQS_ID ) ) {
3537      currentPerfSession.setAQSId(sessionDetails)
36-       gaugeManager
37-         .logGaugeMetadata(currentPerfSession.aqsSessionId(), ApplicationProcessState .FOREGROUND )
38+       gaugeManager.logGaugeMetadata(
39+         currentPerfSession.aqsSessionId(),
40+         ApplicationProcessState .FOREGROUND 
41+       )
3842      gaugeManager.updateGaugeCollection(ApplicationProcessState .FOREGROUND )
3943      return 
4044    }
4145
4246    val  updatedSession =  PerfSession .createWithId(UUID .randomUUID().toString())
4347    updatedSession.setAQSId(sessionDetails)
44-     SessionManager .getInstance().updatePerfSession(updatedSession)
45-     GaugeManager .getInstance()
46-       .logGaugeMetadata(updatedSession.aqsSessionId(), ApplicationProcessState .FOREGROUND )
48+     sessionManager.updatePerfSession(updatedSession)
49+     gaugeManager.logGaugeMetadata(updatedSession.aqsSessionId(), ApplicationProcessState .FOREGROUND )
4750  }
4851}
0 commit comments