We use AnimatedVectorDrawable.reset() to reset the animation to its initial state. This works well on most of the devices. While testing we noticed that on some Huawei devices when reset() is called the animation starts running.
Reproduced on these Huawei devices:
- ANE-LX1 - Android 8.0.0, EMIU 8.0.0
- LYA-L29 - Android 10, EMIU 10.0.0
Any ideas what can I do to fix the problem?
To fix the problem I updated the animation to end in the state it starts. This allowed me to stop using
AnimatedVectorDrawable.reset().Section "Stale state" from this article helped me resolve the problem. Here is the important part of the section:
This is the part that resets the animation to its initial state:
valueFromandvalueToare equal tovalueFromin the secondobjectAnimator.