3030/** Details of a session including a unique Id and related information. */ 
3131public  class  PerfSession  implements  Parcelable  {
3232
33+   private  static  final  String  SESSION_ID_PREFIX  = "fireperf-session" ;
3334  private  final  String  sessionId ;
3435  private  final  Timer  creationTime ;
3536
@@ -39,16 +40,9 @@ public class PerfSession implements Parcelable {
3940   * Creates a PerfSession object and decides what metrics to collect. 
4041   */ 
4142  public  static  PerfSession  createNewSession () {
42-     String  prunedSessionId  = UUID .randomUUID ().toString ().replace ("-" , "" );
43+     String  prunedSessionId  = SESSION_ID_PREFIX  +  UUID .randomUUID ().toString ().replace ("-" , "" );
4344    PerfSession  session  = new  PerfSession (prunedSessionId , new  Clock ());
4445    session .setGaugeAndEventCollectionEnabled (shouldCollectGaugesAndEvents ());
45- 
46-     // Every time a PerfSession is created, it sets the AQS to null. Once an AQS is received, 
47-     // SessionManagerKt verifies if this is an active session, and sets the AQS session ID. 
48-     // The assumption is that new PerfSessions *should* be limited to either App Start, or through 
49-     // AQS. 
50-     FirebasePerformanceSessionSubscriber .Companion .getInstance ().reportPerfSession (prunedSessionId );
51- 
5246    return  session ;
5347  }
5448
@@ -57,6 +51,11 @@ public static PerfSession createNewSession() {
5751  public  PerfSession (String  sessionId , Clock  clock ) {
5852    this .sessionId  = sessionId ;
5953    creationTime  = clock .getTime ();
54+     // Every time a PerfSession is created, it sets the AQS to null. Once an AQS is received, 
55+     // SessionManagerKt verifies if this is an active session, and sets the AQS session ID. 
56+     // The assumption is that new PerfSessions *should* be limited to either App Start, or through 
57+     // AQS. 
58+     FirebasePerformanceSessionSubscriber .Companion .getInstance ().reportPerfSession (sessionId );
6059  }
6160
6261  private  PerfSession (@ NonNull  Parcel  in ) {
@@ -71,6 +70,11 @@ public String sessionId() {
7170    return  this .sessionId ;
7271  }
7372
73+   private  String  aqsSessionId () {
74+     return  FirebasePerformanceSessionSubscriber .Companion .getInstance ()
75+         .getAqsMappedToPerfSession (this .sessionId );
76+   }
77+ 
7478  /** 
7579   * Returns a timer object that has been seeded with the system time at which the session began. 
7680   */ 
@@ -121,7 +125,7 @@ public boolean isSessionRunningTooLong() {
121125  /** Creates and returns the proto object for PerfSession object. */ 
122126  public  com .google .firebase .perf .v1 .PerfSession  build () {
123127    com .google .firebase .perf .v1 .PerfSession .Builder  sessionMetric  =
124-         com .google .firebase .perf .v1 .PerfSession .newBuilder ().setSessionId (sessionId ());
128+         com .google .firebase .perf .v1 .PerfSession .newBuilder ().setSessionId (aqsSessionId ());
125129
126130    // If gauge collection is enabled, enable gauge collection verbosity. 
127131    if  (isGaugeAndEventCollectionEnabled ) {
0 commit comments