In Android N (until Android P included), the internal View. findFrameMetricsObserver() method did not check the nullability of the mFrameMetricsObservers field, leading to possible NPE when trying to remove a listener that wasn't yet added.
Motivation
Some customer have seen a crash with an NPE thrown from the Android View when removing the FrameMetricsListener via the JankStats library.
Even though all versions of the official Android View are written in a way that NPE should never happen, those crash still occurred.
Merging #1981 (eca3a98) into develop (768fa8a) will decrease coverage by 0.10%.
Report is 1 commits behind head on develop.
The diff coverage is 100.00%.
What does this PR do?
Fixes #1976
In Android N (until Android P included), the internal View. findFrameMetricsObserver() method did not check the nullability of the
mFrameMetricsObservers
field, leading to possible NPE when trying to remove a listener that wasn't yet added.Motivation
Some customer have seen a crash with an NPE thrown from the Android View when removing the
FrameMetricsListener
via theJankStats
library. Even though all versions of the official Android View are written in a way that NPE should never happen, those crash still occurred.