Skip to content

Commit 9731146

Browse files
committed
Revert internal perf session id
1 parent 21d4778 commit 9731146

File tree

3 files changed

+11
-17
lines changed

3 files changed

+11
-17
lines changed

firebase-perf/src/main/java/com/google/firebase/perf/session/FirebasePerformanceSessionSubscriber.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,16 @@ class FirebasePerformanceSessionSubscriber(private val dataCollectionEnabled: Bo
1717

1818
override fun onSessionChanged(sessionDetails: SessionSubscriber.SessionDetails) {
1919
AndroidLogger.getInstance().debug("AQS Session Changed: $sessionDetails")
20-
val currentInternalSessionId = SessionManager.getInstance().perfSession().internalSessionId
20+
val perfSessionId = SessionManager.getInstance().perfSession().sessionId()
2121

2222
// There can be situations where a new [PerfSession] was created, but an AQS wasn't
2323
// available (during cold start).
24-
if (perfSessionToAqs[currentInternalSessionId] == null) {
25-
perfSessionToAqs[currentInternalSessionId] = sessionDetails
24+
if (perfSessionToAqs[perfSessionId] == null) {
25+
perfSessionToAqs[perfSessionId] = sessionDetails
2626
} else {
2727
val newSession = PerfSession.createNewSession()
2828
SessionManager.getInstance().updatePerfSession(newSession)
29-
perfSessionToAqs[newSession.internalSessionId] = sessionDetails
29+
perfSessionToAqs[newSession.sessionId()] = sessionDetails
3030
}
3131
}
3232

firebase-perf/src/main/java/com/google/firebase/perf/session/PerfSession.java

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
/** Details of a session including a unique Id and related information. */
3131
public class PerfSession implements Parcelable {
3232

33-
private final String internalSessionId;
33+
private final String sessionId;
3434
private final Timer creationTime;
3535

3636
private boolean isGaugeAndEventCollectionEnabled = false;
@@ -54,27 +54,21 @@ public static PerfSession createNewSession() {
5454

5555
/** Creates a PerfSession with the provided {@code sessionId} and {@code clock}. */
5656
@VisibleForTesting(otherwise = VisibleForTesting.PACKAGE_PRIVATE)
57-
public PerfSession(String internalSessionId, Clock clock) {
58-
this.internalSessionId = internalSessionId;
57+
public PerfSession(String sessionId, Clock clock) {
58+
this.sessionId = sessionId;
5959
creationTime = clock.getTime();
6060
}
6161

6262
private PerfSession(@NonNull Parcel in) {
6363
super();
64-
internalSessionId = in.readString();
64+
sessionId = in.readString();
6565
isGaugeAndEventCollectionEnabled = in.readByte() != 0;
6666
creationTime = in.readParcelable(Timer.class.getClassLoader());
6767
}
6868

6969
/** Returns the sessionId of the object. */
7070
public String sessionId() {
71-
return FirebasePerformanceSessionSubscriber.Companion.getInstance()
72-
.getAqsMappedToPerfSession(this.internalSessionId);
73-
}
74-
75-
@VisibleForTesting(otherwise = VisibleForTesting.PACKAGE_PRIVATE)
76-
public String getInternalSessionId() {
77-
return internalSessionId;
71+
return this.sessionId;
7872
}
7973

8074
/**
@@ -202,7 +196,7 @@ public int describeContents() {
202196
* @param flags Additional flags about how the object should be written.
203197
*/
204198
public void writeToParcel(@NonNull Parcel out, int flags) {
205-
out.writeString(internalSessionId);
199+
out.writeString(sessionId);
206200
out.writeByte((byte) (isGaugeAndEventCollectionEnabled ? 1 : 0));
207201
out.writeParcelable(creationTime, 0);
208202
}

firebase-perf/src/main/java/com/google/firebase/perf/session/SessionManager.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ public void stopGaugeCollectionIfSessionRunningTooLong() {
114114
public void updatePerfSession(PerfSession perfSession) {
115115
// Do not update the perf session if it is the exact same sessionId.
116116
if (Objects.equals(
117-
perfSession.getInternalSessionId(), this.perfSession.getInternalSessionId())) {
117+
perfSession.sessionId(), this.perfSession.sessionId())) {
118118
return;
119119
}
120120

0 commit comments

Comments
 (0)