Skip to content

Commit

Permalink
Add null check rootView to fix issue firebase#6367
Browse files Browse the repository at this point in the history
  • Loading branch information
lehcar09 committed Oct 11, 2024
1 parent 60a5e4c commit 7ce3da7
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -355,10 +355,12 @@ public synchronized void onActivityResumed(Activity activity) {
final boolean isExperimentTTIDEnabled = configResolver.getIsExperimentTTIDEnabled();
if (isExperimentTTIDEnabled) {
View rootView = activity.findViewById(android.R.id.content);
rootView.getViewTreeObserver().addOnDrawListener(onDrawCounterListener);
FirstDrawDoneListener.registerForNextDraw(rootView, this::recordOnDrawFrontOfQueue);
PreDrawListener.registerForNextDraw(
rootView, this::recordPreDraw, this::recordPreDrawFrontOfQueue);
if(rootView != null) {
rootView.getViewTreeObserver().addOnDrawListener(onDrawCounterListener);
FirstDrawDoneListener.registerForNextDraw(rootView, this::recordOnDrawFrontOfQueue);
PreDrawListener.registerForNextDraw(
rootView, this::recordPreDraw, this::recordPreDrawFrontOfQueue);
}
}

if (onResumeTime != null) { // An activity already called onResume()
Expand Down

0 comments on commit 7ce3da7

Please sign in to comment.