Skip to content

Commit 10f003f

Browse files
committed
continue throwing above API 28, since this NPE is fixed in API 29
1 parent a8b28e3 commit 10f003f

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

firebase-perf/src/main/java/com/google/firebase/perf/application/FrameMetricsRecorder.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
package com.google.firebase.perf.application;
1616

1717
import android.app.Activity;
18+
import android.os.Build;
1819
import android.util.SparseIntArray;
1920
import androidx.core.app.FrameMetricsAggregator;
2021
import androidx.fragment.app.Fragment;
@@ -113,7 +114,10 @@ public Optional<PerfFrameMetrics> stop() {
113114
// failing when the view is not hardware-accelerated. Successful addFrameMetricsListener
114115
// stores an observer in a list, and initializes the list if it was uninitialized. Invoking
115116
// View.removeFrameMetricsListener(listener) throws IAE if it doesn't exist in the list, or
116-
// throws NPE if the list itself was never initialized.
117+
// throws NPE if the list itself was never initialized. This NPE is fixed in API 29.
118+
if (ex instanceof NullPointerException && Build.VERSION.SDK_INT > Build.VERSION_CODES.P) {
119+
throw ex;
120+
}
117121
logger.warn(
118122
"View not hardware accelerated. Unable to collect FrameMetrics. %s", ex.toString());
119123
data = Optional.absent();

0 commit comments

Comments
 (0)