Implement animation disable mechanism for instrumentation tests#519
Implement animation disable mechanism for instrumentation tests#519temcguir wants to merge 14 commits into
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces a mechanism to disable animations within the application, primarily for testing purposes. It adds a LocalDisableAnimations CompositionLocal, updates MainActivity to read a disable_animations flag from TestStorage or an intent extra, and modifies various UI components to bypass animations when this flag is active. The review feedback focuses on making the implementation more idiomatic to Jetpack Compose by using conditional transitions within AnimatedVisibility and animateFloatAsState instead of manual if-else blocks, which reduces code duplication and nesting.
f690aa2 to
f0645f5
Compare
6729224 to
5a8505a
Compare
7f851fe to
91972d9
Compare
e68a94a to
d53a760
Compare
15c632d to
55e516e
Compare
55e516e to
744111f
Compare
cd0685f to
88f4489
Compare
88f4489 to
69475db
Compare
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces a mechanism to disable animations during tests by adding a LocalDisableAnimations CompositionLocal and passing a KEY_DISABLE_ANIMATIONS extra through the MainActivity intent. This flag is then used across various UI components to bypass or snap animations. The review feedback suggests replacing an arbitrary delay(50) in ScreenFlashOverlay with yield() to prevent test flakiness, and using EnterTransition.None instead of fadeIn(animationSpec = snap()) in LockSwitchCaptureButtonNucleus for architectural consistency.
| } | ||
|
|
||
| is Success -> { | ||
| // TODO(kimblebee@): add app setting to enable/disable dynamic color |
There was a problem hiding this comment.
can get rid of this todo
Problem
Continuous animations (like screen flash, focus pulse, audio amplitude) keep the Compose runtime busy, causing Espresso's idle checks to fail or time out on slow emulators.
Solution
Implemented a
LocalDisableAnimationsCompositionLocalto provide a flag to disable or snap animations.MainActivitybased on an intent extra.UiTestUtilviaTestStoragearguments passed from the build configuration.Impact
Drastically reduces CPU load and Espresso timeouts by stopping background animations during tests.