Closed Zhuinden closed 8 years ago
Hopefully fixed with 1.0-alpha1.2
Not fixed. Attempted fixes failed, so 1.0-alpha1.5 might still have this.
Will need to reproduce through test, and eliminate the error, rather than just sharpshooting.
This probably came over from Flow 1.0-alpha itself.
The error is not in Flow 1.0-alpha, it's in SingleRootDispatcher.
If two rotations are done during a state transition, onMeasure()
is never called.
ViewUtils.waitForMeasure(newView, new ViewUtils.OnMeasuredCallback() {
@Override
public void onMeasured(View view, int width, int height) {
Animator animator = DispatcherUtils.createAnimatorForViews(animatedKey, previousView, newView, direction);
if(animator != null) {
animator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
finishTransition(previousView, root, callback);
}
});
animator.start();
} else {
finishTransition(previousView, root, callback);
}
}
});
Sometimes, onMeasured()
is never called, and as a result, the state transition will never finish.
Well... technically there is more to it than that.
Apparently the issue is that the dispatcher can be removed midway, and the onMeasure()
won't be called.
There is another issue that the InternalLifecycleIntegration
fragment isn't properly bound by application.registerLifecycleCallbacks()
if the screen is rotated while the app is still starting up.. but I haven't been able to reproduce it reliably.
There can be a traversal in which
nextHistory == null
andstate == DISPATCHED
.Flowless1.0-alpha1.1 does not handle this special case
created == true
, butpendingTraversal != null
, but the pending traversal will never finish.The newly added fix for the
midflight
reentrance test might helpHowever, the traversal would only call
traversal.next
ifonTraversalCompleted()
is called, which in this case might be never.This special case must be analyzed further and fixed.