Skip to content

Commit aa0da1f

Browse files
committed
Better logging
1 parent ad7217a commit aa0da1f

File tree

2 files changed

+8
-31
lines changed

2 files changed

+8
-31
lines changed

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,13 @@
2020
import androidx.annotation.Nullable;
2121
import androidx.annotation.VisibleForTesting;
2222
import com.google.firebase.perf.config.ConfigResolver;
23+
import com.google.firebase.perf.logging.AndroidLogger;
2324
import com.google.firebase.perf.util.Clock;
2425
import com.google.firebase.perf.util.Timer;
2526
import com.google.firebase.perf.v1.SessionVerbosity;
27+
import com.google.firebase.sessions.SessionDetails;
28+
import com.google.firebase.sessions.api.SessionSubscriber;
29+
2630
import java.util.List;
2731
import java.util.Objects;
2832
import java.util.UUID;
@@ -69,7 +73,9 @@ private PerfSession(@NonNull Parcel in) {
6973
/** Returns the sessionId of the object. */
7074
public String sessionId() {
7175
// TODO(b/394127311): Verify edge cases.
72-
return Objects.requireNonNull(SessionManagerKt.Companion.getPerfSessionToAqs().get(internalSessionId)).getSessionId();
76+
SessionSubscriber.SessionDetails sessionDetails = SessionManagerKt.Companion.getPerfSessionToAqs().get(internalSessionId);
77+
AndroidLogger.getInstance().debug("AQS for " + this.internalSessionId + " is " + sessionDetails);
78+
return Objects.requireNonNull(sessionDetails).getSessionId();
7379
}
7480

7581
protected String getInternalSessionId() {

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

Lines changed: 1 addition & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636

3737
/** Session manager to generate sessionIDs and broadcast to the application. */
3838
@Keep // Needed because of b/117526359.
39-
public class SessionManager extends AppStateUpdateHandler {
39+
public class SessionManager {
4040

4141
@SuppressLint("StaticFieldLeak")
4242
private static final SessionManager instance = new SessionManager();
@@ -74,7 +74,6 @@ public SessionManager(
7474
this.gaugeManager = gaugeManager;
7575
this.perfSession = perfSession;
7676
this.appStateMonitor = appStateMonitor;
77-
registerForAppState();
7877
}
7978

8079
/**
@@ -99,34 +98,6 @@ public void setApplicationContext(final Context appContext) {
9998
});
10099
}
101100

102-
// @Override
103-
// public void onUpdateAppState(ApplicationProcessState newAppState) {
104-
// super.onUpdateAppState(newAppState);
105-
//
106-
// if (appStateMonitor.isColdStart()) {
107-
// // We want the Session to remain unchanged if this is a cold start of the app since we already
108-
// // update the PerfSession in FirebasePerfProvider#onAttachInfo().
109-
// return;
110-
// }
111-
//
112-
// if (newAppState == ApplicationProcessState.FOREGROUND) {
113-
// // A new foregrounding of app will force a new sessionID generation.
114-
// PerfSession session = PerfSession.createWithId(UUID.randomUUID().toString());
115-
// updatePerfSession(session);
116-
// } else {
117-
// // If the session is running for too long, generate a new session and collect gauges as
118-
// // necessary.
119-
// if (perfSession.isSessionRunningTooLong()) {
120-
// PerfSession session = PerfSession.createWithId(UUID.randomUUID().toString());
121-
// updatePerfSession(session);
122-
// } else {
123-
// // For any other state change of the application, modify gauge collection state as
124-
// // necessary.
125-
// startOrStopCollectingGauges(newAppState);
126-
// }
127-
// }
128-
// }
129-
130101
/**
131102
* Checks if the current {@link PerfSession} is expired/timed out. If so, stop collecting gauges.
132103
*

0 commit comments

Comments
 (0)