@@ -53,6 +53,7 @@ public class AppStateMonitor implements ActivityLifecycleCallbacks {
53
53
"androidx.core.app.FrameMetricsAggregator" ;
54
54
55
55
private static volatile AppStateMonitor instance ;
56
+ private static boolean hasFrameMetricsAggregator = false ;
56
57
57
58
private final WeakHashMap <Activity , Boolean > activityToResumedMap = new WeakHashMap <>();
58
59
private final WeakHashMap <Activity , Trace > activityToScreenTraceMap = new WeakHashMap <>();
@@ -76,7 +77,6 @@ public class AppStateMonitor implements ActivityLifecycleCallbacks {
76
77
77
78
private boolean isRegisteredForLifecycleCallbacks = false ;
78
79
private boolean isColdStart = true ;
79
- private boolean hasFrameMetricsAggregator = false ;
80
80
81
81
public static AppStateMonitor getInstance () {
82
82
if (instance == null ) {
@@ -213,7 +213,7 @@ public synchronized void onActivityResumed(Activity activity) {
213
213
}
214
214
215
215
// Screen trace is after session update so the sessionId is not added twice to the Trace
216
- if (isScreenTraceSupported (activity ) && configResolver .isPerformanceMonitoringEnabled ()) {
216
+ if (isScreenTraceSupported () && configResolver .isPerformanceMonitoringEnabled ()) {
217
217
// Starts recording frame metrics for this activity.
218
218
/**
219
219
* TODO: Only add activities that are hardware acceleration enabled so that calling {@link
@@ -453,8 +453,10 @@ protected boolean isScreenTraceSupported() {
453
453
private static boolean hasFrameMetricsAggregatorClass () {
454
454
try {
455
455
Class <?> initializerClass = Class .forName (FRAME_METRICS_AGGREGATOR_CLASSNAME );
456
+ hasFrameMetricsAggregator = true ;
456
457
return true ;
457
458
} catch (ClassNotFoundException e ) {
459
+ hasFrameMetricsAggregator = false ;
458
460
return false ;
459
461
}
460
462
}
0 commit comments