From 7a3e6ae48fd392bad2156a1f2a0e639d09243326 Mon Sep 17 00:00:00 2001 From: Joshua Gross Date: Sun, 20 Feb 2022 11:42:08 -0800 Subject: [PATCH] Add logging to detect inconsistencies with peeked/polled animation operations Summary: Just trying something out. Changelog: [Internal] Reviewed By: ShikaSD Differential Revision: D34369919 fbshipit-source-id: 236f886fcc000a444bad494fd738688425159f21 --- .../facebook/react/animated/NativeAnimatedModule.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/ReactAndroid/src/main/java/com/facebook/react/animated/NativeAnimatedModule.java b/ReactAndroid/src/main/java/com/facebook/react/animated/NativeAnimatedModule.java index 887440dea97..e419c57a164 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/animated/NativeAnimatedModule.java +++ b/ReactAndroid/src/main/java/com/facebook/react/animated/NativeAnimatedModule.java @@ -252,6 +252,15 @@ public class NativeAnimatedModule extends NativeAnimatedModuleSpec // won't cause any errors to execute it earlier than expected (just a bit of UI jank at worst) // so we just continue happily along. UIThreadOperation polledOperation = operationQueue.poll(); + if (peekedOperation != polledOperation) { + ReactSoftExceptionLogger.logSoftException( + NAME, + new RuntimeException( + "Inconsistency detected: peeked animation operation different from polled: " + + peekedOperation + + " / " + + polledOperation)); + } if (polledOperation == null) { return; }