Skip to content

Avoid calling updateState() for completed animations and add tests#4737

Merged
liannacasper merged 2 commits intomasterfrom
codex/find-issue-with-morphanimation-updates
Apr 12, 2026
Merged

Avoid calling updateState() for completed animations and add tests#4737
liannacasper merged 2 commits intomasterfrom
codex/find-issue-with-morphanimation-updates

Conversation

@liannacasper
Copy link
Copy Markdown
Collaborator

Motivation

  • Prevent updateState() from being invoked after an animation reports it is no longer in progress to avoid redundant state mutations and duplicate completion handling.
  • Ensure the completed flag is correctly reset if an animation is restarted so completion callbacks and post-runnables are executed exactly once per lifecycle.

Description

  • Added a guard in ComponentAnimation.updateAnimationState() so updateState() is only called when isInProgress() returns true.
  • Kept the existing completion notification logic but ensure completed is set to false when the animation is still in progress to handle restarts.
  • Added AnimationManagerTest.java with two tests: testFinishedAnimationDoesNotUpdateStateAgainBeforeRemoval and testAlreadyFinishedAnimationRunsCompletionWithoutUpdateState to verify the new behavior.

Testing

  • Ran the new unit tests in maven/core-unittests: AnimationManagerTest containing both tests, and both tests passed.

Codex Task

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 12, 2026

✅ Continuous Quality Report

Test & Coverage

Static Analysis

Generated automatically by the PR CI workflow.

@shai-almog
Copy link
Copy Markdown
Collaborator

shai-almog commented Apr 12, 2026

Android screenshot updates

Compared 37 screenshots: 36 matched, 1 updated.

  • ValidatorLightweightPicker — updated screenshot. Screenshot differs (320x640 px, bit depth 8).

    ValidatorLightweightPicker
    Preview info: JPEG preview quality 70; JPEG preview quality 70.
    Full-resolution PNG saved as ValidatorLightweightPicker.png in workflow artifacts.

Native Android coverage

  • 📊 Line coverage: 7.77% (4087/52599 lines covered) [HTML preview] (artifact android-coverage-report, jacocoAndroidReport/html/index.html)
    • Other counters: instruction 6.10% (20222/331593), branch 2.91% (929/31974), complexity 3.63% (1112/30629), method 6.37% (912/14307), class 10.58% (201/1899)
    • Lowest covered classes
      • kotlin.collections.kotlin.collections.ArraysKt___ArraysKt – 0.00% (0/6327 lines covered)
      • kotlin.collections.unsigned.kotlin.collections.unsigned.UArraysKt___UArraysKt – 0.00% (0/2384 lines covered)
      • org.jacoco.agent.rt.internal_b6258fc.asm.org.jacoco.agent.rt.internal_b6258fc.asm.ClassReader – 0.00% (0/1519 lines covered)
      • kotlin.collections.kotlin.collections.CollectionsKt___CollectionsKt – 0.00% (0/1148 lines covered)
      • org.jacoco.agent.rt.internal_b6258fc.asm.org.jacoco.agent.rt.internal_b6258fc.asm.MethodWriter – 0.00% (0/923 lines covered)
      • kotlin.sequences.kotlin.sequences.SequencesKt___SequencesKt – 0.00% (0/730 lines covered)
      • kotlin.text.kotlin.text.StringsKt___StringsKt – 0.00% (0/623 lines covered)
      • org.jacoco.agent.rt.internal_b6258fc.asm.org.jacoco.agent.rt.internal_b6258fc.asm.Frame – 0.00% (0/564 lines covered)
      • kotlin.collections.kotlin.collections.ArraysKt___ArraysJvmKt – 0.00% (0/495 lines covered)
      • kotlinx.coroutines.kotlinx.coroutines.JobSupport – 0.00% (0/423 lines covered)

Benchmark Results

Detailed Performance Metrics

Metric Duration
Base64 payload size 8192 bytes
Base64 benchmark iterations 6000
Base64 native encode 1120.000 ms
Base64 CN1 encode 166.000 ms
Base64 encode ratio (CN1/native) 0.148x (85.2% faster)
Base64 native decode 797.000 ms
Base64 CN1 decode 258.000 ms
Base64 decode ratio (CN1/native) 0.324x (67.6% faster)

@shai-almog
Copy link
Copy Markdown
Collaborator

shai-almog commented Apr 12, 2026

Compared 37 screenshots: 37 matched.
✅ Native iOS screenshot tests passed.

Benchmark Results

  • VM Translation Time: 0 seconds
  • Compilation Time: 136 seconds

Detailed Performance Metrics

Metric Duration
Simulator Boot 1000 ms
Simulator Boot (Run) 1000 ms
App Install 6000 ms
App Launch 7000 ms
Test Execution 193000 ms
Base64 payload size 8192 bytes
Base64 benchmark iterations 6000
Base64 native encode 1015.000 ms
Base64 CN1 encode 1338.000 ms
Base64 encode ratio (CN1/native) 1.318x (31.8% slower)
Base64 native decode 824.000 ms
Base64 CN1 decode 1061.000 ms
Base64 decode ratio (CN1/native) 1.288x (28.8% slower)

@liannacasper liannacasper merged commit 9ed10e0 into master Apr 12, 2026
14 of 16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

com.codename1.ui.AnimationManager.isAnimating() returns false but MorphAnimation is still "active"

2 participants