@@ -55,6 +55,7 @@ public class AppStateMonitor implements ActivityLifecycleCallbacks {
55
55
"androidx.core.app.FrameMetricsAggregator" ;
56
56
57
57
private static volatile AppStateMonitor instance ;
58
+ private static boolean hasFrameMetricsAggregator = false ;
58
59
59
60
private final WeakHashMap <Activity , Boolean > activityToResumedMap = new WeakHashMap <>();
60
61
private final WeakHashMap <Activity , Trace > activityToScreenTraceMap = new WeakHashMap <>();
@@ -78,7 +79,6 @@ public class AppStateMonitor implements ActivityLifecycleCallbacks {
78
79
79
80
private boolean isRegisteredForLifecycleCallbacks = false ;
80
81
private boolean isColdStart = true ;
81
- private boolean hasFrameMetricsAggregator = false ;
82
82
83
83
public static AppStateMonitor getInstance () {
84
84
if (instance == null ) {
@@ -215,7 +215,7 @@ public synchronized void onActivityResumed(Activity activity) {
215
215
}
216
216
217
217
// Screen trace is after session update so the sessionId is not added twice to the Trace
218
- if (isScreenTraceSupported (activity ) && configResolver .isPerformanceMonitoringEnabled ()) {
218
+ if (isScreenTraceSupported () && configResolver .isPerformanceMonitoringEnabled ()) {
219
219
// Starts recording frame metrics for this activity.
220
220
/**
221
221
* TODO: Only add activities that are hardware acceleration enabled so that calling {@link
@@ -441,8 +441,10 @@ protected boolean isScreenTraceSupported() {
441
441
private static boolean hasFrameMetricsAggregatorClass () {
442
442
try {
443
443
Class <?> initializerClass = Class .forName (FRAME_METRICS_AGGREGATOR_CLASSNAME );
444
+ hasFrameMetricsAggregator = true ;
444
445
return true ;
445
446
} catch (ClassNotFoundException e ) {
447
+ hasFrameMetricsAggregator = false ;
446
448
return false ;
447
449
}
448
450
}
0 commit comments