Back out "Adjust animation batch numbers to be consistent when controlled by native"

Summary:
This change caused crashes in animations on some surfaces.

Changelog: [Internal]

Reviewed By: JoshuaGross

Differential Revision: D28013969

fbshipit-source-id: 95845c69d6e67d59582ea14ad08cbf42fd3e2f8f
This commit is contained in:
Andrei Shikov
2021-04-27 04:00:16 -07:00
committed by Facebook GitHub Bot
parent 841756b150
commit ef0db95300
5 changed files with 29 additions and 60 deletions
@@ -174,7 +174,7 @@ public class NativeAnimatedModule extends NativeAnimatedModuleSpec
}
private void addOperation(UIThreadOperation operation) {
operation.setBatchNumber(getCurrentBatchNumber());
operation.setBatchNumber(mIsInBatch ? mCurrentBatchNumber : -1);
mOperations.add(operation);
}
@@ -184,7 +184,7 @@ public class NativeAnimatedModule extends NativeAnimatedModuleSpec
}
private void addPreOperation(UIThreadOperation operation) {
operation.setBatchNumber(getCurrentBatchNumber());
operation.setBatchNumber(mIsInBatch ? mCurrentBatchNumber : -1);
mPreOperations.add(operation);
}
@@ -342,13 +342,6 @@ public class NativeAnimatedModule extends NativeAnimatedModuleSpec
ReactChoreographer.CallbackType.NATIVE_ANIMATED_MODULE, mAnimatedFrameCallback);
}
private long getCurrentBatchNumber() {
if (mBatchingControlledByJS && !mIsInBatch) {
return -1;
}
return mCurrentBatchNumber;
}
@VisibleForTesting
public void setNodesManager(NativeAnimatedNodesManager nodesManager) {
mNodesManager.set(nodesManager);
@@ -433,9 +426,6 @@ public class NativeAnimatedModule extends NativeAnimatedModuleSpec
@Override
public void startOperationBatch() {
if (ANIMATED_MODULE_DEBUG) {
FLog.d(NAME, "Start JS operation batch " + mCurrentBatchNumber);
}
mBatchingControlledByJS = true;
mIsInBatch = true;
mCurrentBatchNumber++;
@@ -443,9 +433,6 @@ public class NativeAnimatedModule extends NativeAnimatedModuleSpec
@Override
public void finishOperationBatch() {
if (ANIMATED_MODULE_DEBUG) {
FLog.d(NAME, "Finish JS operation batch " + mCurrentBatchNumber);
}
mBatchingControlledByJS = true;
mIsInBatch = false;
mCurrentBatchNumber++;