Skip to content

Commit 8d45513

Browse files
committed
more comments
1 parent e5d8365 commit 8d45513

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,14 +108,17 @@ public Optional<PerfFrameMetrics> stop() {
108108
}
109109
Optional<PerfFrameMetrics> data = this.snapshot();
110110
try {
111+
// No reliable way to check for hardware-acceleration, so we must catch retroactively (#2736).
111112
frameMetricsAggregator.remove(activity);
112113
} catch (IllegalArgumentException | NullPointerException ex) {
113114
// Both of these exceptions result from android.view.View.addFrameMetricsListener silently
114115
// failing when the view is not hardware-accelerated. Successful addFrameMetricsListener
115116
// stores an observer in a list, and initializes the list if it was uninitialized. Invoking
116117
// View.removeFrameMetricsListener(listener) throws IAE if it doesn't exist in the list, or
117-
// throws NPE if the list itself was never initialized. This NPE is fixed in API 29.
118+
// throws NPE if the list itself was never initialized (#4184).
118119
if (ex instanceof NullPointerException && Build.VERSION.SDK_INT > Build.VERSION_CODES.P) {
120+
// Re-throw above API 28, since the NPE is fixed in API 29:
121+
// https://android.googlesource.com/platform/frameworks/base/+/140ff5ea8e2d99edc3fbe63a43239e459334c76b
119122
throw ex;
120123
}
121124
logger.warn(

0 commit comments

Comments
 (0)