Skip to content

Commit 8738761

Browse files
committed
Merge branch 'fireperf-aqs' into td/fireperf-aqs
2 parents b94bd77 + fcd270c commit 8738761

File tree

3 files changed

+22
-13
lines changed

3 files changed

+22
-13
lines changed
Submodule lss updated from 9719c1e to ed31caa

firebase-perf/src/main/java/com/google/firebase/perf/FirebasePerformance.java

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -138,11 +138,6 @@ public static FirebasePerformance getInstance() {
138138
// to false if it's been force disabled or it is set to null if neither.
139139
@Nullable private Boolean mPerformanceCollectionForceEnabledState = null;
140140

141-
private final FirebaseApp firebaseApp;
142-
private final Provider<RemoteConfigComponent> firebaseRemoteConfigProvider;
143-
private final FirebaseInstallationsApi firebaseInstallationsApi;
144-
private final Provider<TransportFactory> transportFactoryProvider;
145-
146141
/**
147142
* Constructs the FirebasePerformance class and allows injecting dependencies.
148143
*
@@ -168,11 +163,6 @@ public static FirebasePerformance getInstance() {
168163
ConfigResolver configResolver,
169164
SessionManager sessionManager) {
170165

171-
this.firebaseApp = firebaseApp;
172-
this.firebaseRemoteConfigProvider = firebaseRemoteConfigProvider;
173-
this.firebaseInstallationsApi = firebaseInstallationsApi;
174-
this.transportFactoryProvider = transportFactoryProvider;
175-
176166
if (firebaseApp == null) {
177167
this.mPerformanceCollectionForceEnabledState = false;
178168
this.configResolver = configResolver;
@@ -197,6 +187,9 @@ public static FirebasePerformance getInstance() {
197187
sessionManager.setApplicationContext(appContext);
198188

199189
mPerformanceCollectionForceEnabledState = configResolver.getIsPerformanceCollectionEnabled();
190+
FirebaseSessionsDependencies.register(
191+
new FirebasePerformanceSessionSubscriber(isPerformanceCollectionEnabled()));
192+
200193
if (logger.isLogcatEnabled() && isPerformanceCollectionEnabled()) {
201194
logger.info(
202195
String.format(
@@ -290,7 +283,7 @@ public synchronized void setPerformanceCollectionEnabled(@Nullable Boolean enabl
290283
return;
291284
}
292285

293-
if (configResolver.getIsPerformanceCollectionDeactivated()) {
286+
if (Boolean.TRUE.equals(configResolver.getIsPerformanceCollectionDeactivated())) {
294287
logger.info("Firebase Performance is permanently disabled");
295288
return;
296289
}

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

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import com.google.firebase.perf.util.Clock;
2424
import com.google.firebase.perf.util.Timer;
2525
import com.google.firebase.perf.v1.SessionVerbosity;
26+
import com.google.firebase.sessions.api.SessionSubscriber;
2627
import java.util.List;
2728
import java.util.UUID;
2829
import java.util.concurrent.TimeUnit;
@@ -33,6 +34,7 @@ public class PerfSession implements Parcelable {
3334
private static final String SESSION_ID_PREFIX = "fireperf-session";
3435
private final String sessionId;
3536
private final Timer creationTime;
37+
@Nullable private String aqsSessionId;
3638

3739
private boolean isGaugeAndEventCollectionEnabled = false;
3840

@@ -65,7 +67,7 @@ private PerfSession(@NonNull Parcel in) {
6567
creationTime = in.readParcelable(Timer.class.getClassLoader());
6668
}
6769

68-
/** Returns the sessionId of the object. */
70+
/** Returns the sessionId of the session. */
6971
public String sessionId() {
7072
return this.sessionId;
7173
}
@@ -75,6 +77,19 @@ private String aqsSessionId() {
7577
.getAqsMappedToPerfSession(this.sessionId);
7678
}
7779

80+
/** Returns the AQS sessionId for the given session. */
81+
@Nullable
82+
public String aqsSessionId() {
83+
return aqsSessionId;
84+
}
85+
86+
/** Sets the AQS sessionId for the given session. */
87+
public void setAQSId(SessionSubscriber.SessionDetails aqs) {
88+
if (aqsSessionId == null) {
89+
aqsSessionId = aqs.getSessionId();
90+
}
91+
}
92+
7893
/**
7994
* Returns a timer object that has been seeded with the system time at which the session began.
8095
*/
@@ -124,6 +139,7 @@ public boolean isSessionRunningTooLong() {
124139

125140
/** Creates and returns the proto object for PerfSession object. */
126141
public com.google.firebase.perf.v1.PerfSession build() {
142+
// TODO(b/394127311): Switch to using AQS.
127143
com.google.firebase.perf.v1.PerfSession.Builder sessionMetric =
128144
com.google.firebase.perf.v1.PerfSession.newBuilder().setSessionId(aqsSessionId());
129145

0 commit comments

Comments
 (0)