From 3d71e4894956aa79406b7a86a22769b003523876 Mon Sep 17 00:00:00 2001 From: generatedunixname89002005287564 Date: Fri, 13 Sep 2024 09:00:53 -0700 Subject: [PATCH] fbandroid/libraries/components/litho-rendercore-transitions/src/main/java/com/facebook/litho/choreographercompat/ChoreographerCompatImpl.java Reviewed By: jocelynluizzi13 Differential Revision: D62630517 fbshipit-source-id: 45b942091519736dc849a661b3939f4f926e1178 --- .../litho/choreographercompat/ChoreographerCompatImpl.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/litho-rendercore-transitions/src/main/java/com/facebook/litho/choreographercompat/ChoreographerCompatImpl.java b/litho-rendercore-transitions/src/main/java/com/facebook/litho/choreographercompat/ChoreographerCompatImpl.java index 25bfdf6ffec..e29112ab355 100644 --- a/litho-rendercore-transitions/src/main/java/com/facebook/litho/choreographercompat/ChoreographerCompatImpl.java +++ b/litho-rendercore-transitions/src/main/java/com/facebook/litho/choreographercompat/ChoreographerCompatImpl.java @@ -22,6 +22,7 @@ import android.os.Looper; import android.view.Choreographer; import androidx.annotation.VisibleForTesting; +import com.facebook.infer.annotation.Nullsafe; import com.facebook.litho.WorkContinuationInstrumenter; import com.facebook.rendercore.utils.ThreadUtils; import javax.annotation.Nullable; @@ -32,6 +33,7 @@ * *

This code was taken from the facebook/rebound repository. */ +@Nullsafe(Nullsafe.Mode.LOCAL) public class ChoreographerCompatImpl implements ChoreographerCompat { private static final long ONE_FRAME_MILLIS = 17; @@ -56,10 +58,12 @@ public static ChoreographerCompat getInstance() { /** Set the ChoreographerCompat instance for tests. */ @VisibleForTesting public static void setInstance(@Nullable ChoreographerCompat choreographerCompat) { + // NULLSAFE_FIXME[Field Not Nullable] sInstance = choreographerCompat; } private final @Nullable Handler mHandler; + // NULLSAFE_FIXME[Field Not Initialized] private Choreographer mChoreographer; @VisibleForTesting @@ -92,6 +96,7 @@ public void postFrameCallback(FrameCallback callbackWrapper) { if (IS_JELLYBEAN_OR_HIGHER && mChoreographer != null) { choreographerPostFrameCallback(callbackWrapper.getFrameCallback()); } else { + // NULLSAFE_FIXME[Nullable Dereference] mHandler.postDelayed(callbackWrapper.getRunnable(), 0); } } @@ -105,6 +110,7 @@ public void postFrameCallbackDelayed(FrameCallback callbackWrapper, long delayMi if (IS_JELLYBEAN_OR_HIGHER && mChoreographer != null) { choreographerPostFrameCallbackDelayed(callbackWrapper.getFrameCallback(), delayMillis); } else { + // NULLSAFE_FIXME[Nullable Dereference] mHandler.postDelayed(callbackWrapper.getRunnable(), delayMillis + ONE_FRAME_MILLIS); } } @@ -116,6 +122,7 @@ public void removeFrameCallback(FrameCallback callbackWrapper) { if (IS_JELLYBEAN_OR_HIGHER && mChoreographer != null) { choreographerRemoveFrameCallback(callbackWrapper.getFrameCallback()); } else { + // NULLSAFE_FIXME[Nullable Dereference] mHandler.removeCallbacks(callbackWrapper.getRunnable()); } }