Skip to content

Validate unreleased changes on Android emulator and iOS simulator - #79

Merged
codenameakshay merged 6 commits into
mainfrom
t3/validate-unreleased-changes-devices
Oct 16, 2026
Merged

codenameakshay merged 6 commits into
mainfrom
t3/validate-unreleased-changes-devices

Conversation

@codenameakshay

Copy link
Copy Markdown
Owner

This is the 3.4.0 release gate. I ran the unreleased changes (3.3.0..08933f1, PRs #77 and #78) on an Android 16 (API 36) emulator, an Android 9 (API 28) emulator, and an iOS 27 simulator. This PR fixes the three plugin bugs I found and records the results in doc/reliability-audit-2026-10.md → Device validation. It does not bump the version, edit the ## Unreleased heading, tag, or publish.

Bugs fixed

ID Problem Fix Regression test
B3 (regression in the unreleased iOS transport) Every iOS download failed after Photos access was granted, with PHPhotosErrorDomain 3302. The bounded transport saves to async-wallpaper-<UUID>.download, and Photos validates a file resource by its extension. A uniformTypeIdentifier option alone did not help. After ImageIO validates the file, rename it with the extension of the decoded type (UTType on iOS 14+, MobileCoreServices on iOS 13). Swift: testPhotosFileIsNamedForTheDecodedImageType, testUndecodableDownloadIsNotRenamedForPhotos
B1 (since 2021, also in 3.3.0) fitCenter video live wallpapers were stretched to the screen. They mapped to MediaPlayer.VIDEO_SCALING_MODE_SCALE_TO_FIT, and MediaPlayer has no letterbox mode. VideoFitRenderer: SurfaceTexture → GLES2 quad inside the fitCenter rectangle on black. Used only for fitCenter; centerCrop keeps the direct MediaPlayer path. JVM: VideoFitViewportTest
B2 (also in 3.3.0, in the code V1/V2 reworked) While a video was prepared, a new video engine blocked the app's main thread (which also runs Flutter) for the whole copy. preparePending held the replacement lock that the engine takes on the main thread. On the emulator, a 223 MB file parked the main thread for 2–4 s and skipped 220 frames. Add a mutation lock for writers. The replacement lock now covers only recovery, cleanup, and the final renames. JVM: AtomicFileReplacementTest › a slow candidate copy does not block the wallpaper engine (timed out before the fix)

Codex review fixes:

  • C1/C2 (553698a): promotion rejects instead of waiting when another plugin instance is mutating, and pending-candidate ownership tokens stop stale promotions. Tests: AtomicFileReplacementTest, VideoPendingOwnershipTest.
  • C3/C4 (704cdad): a renderer init timeout no longer falls back onto a surface EGL may still own, and teardown balances eglInitialize.

I declined Codex's larger surface-lease design (about 500 new lines, not run on a device) as too much new concurrency for a release gate. The second Codex round found no actionable issues.

Verification

  • Step 1 on HEAD, with the pinned Flutter 3.41.4:
    • flutter test (60 package + 10 example), flutter analyze, dart format, tool/check_pigeon.sh
    • Swift transport tests: 17/17
    • :async_wallpaper:testDebugUnitTest: 135 tests in 21 suites
    • :async_wallpaper:lintDebug: 0 errors
    • flutter build apk --debug
  • flutter build ios --simulator --debug fails on this host with 3.41.4. Xcode 27's lipo rejects the multi-arch -verify_arch call (E1), and Xcode 27 requires a 15.0 deployment target (E4). It passes with Flutter 3.47.5 and produces x86_64 arm64. CI's macos-14 job is not affected.
  • Device scenarios: the scenario table in the doc covers capabilities, the 120-combination static matrix, scale-mode screenshots, cropper/picker/chooser, U1 IDN hosts and rejection codes, G1 shader rejections, GPU rendering, video promotion with injected crash states and a kill sweep, R1–R3 kill sweeps, interval/charging/time-of-day/boot triggers, the API 28 download pre-check, and iOS Photos (Allow, Don't Allow, and error paths).
  • After all fixes, I re-ran the video flows on API 36 and API 28: letterbox geometry, reapply across modes, kill -9, sleep/wake, a rotated clip, and the main thread during a large prepare.

Not verified

  • G2: the emulator always offers pbuffer configs.
  • Real GPUs and OEM pickers/targets.
  • An iOS 13 runtime: none can be installed.
  • Doze/standby timing.
  • Renderer driver-hang paths.

Six observations are left for follow-up (O1–O6 in the doc), for example Uri.isAbsolute rejecting #fragment URLs and OpenGL textures sampling upside down with v_uv.

🤖 Generated with Claude Code

codenameakshay and others added 6 commits October 16, 2026 22:21
The video engine mapped fitCenter to MediaPlayer's SCALE_TO_FIT, which
stretches the video to the surface. On a 1080x2400 emulator a 1280x720
video filled the whole screen out of proportion.

Draw fitCenter videos through a SurfaceTexture with OpenGL ES 2 inside
the aspect-preserving rectangle, on a black clear. The renderer has its
own thread, is created and released with the player, and waits until
the wallpaper surface is free on release. centerCrop keeps the direct
MediaPlayer path.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
preparePending held the repository's replacement lock while it copied
the source stream. The wallpaper engine takes that lock on the main
thread when its surface is created, so a large or slow video source
blocked the main thread, and with it the Flutter UI, until the copy
finished. On the emulator a 223 MB file parked the main thread for
2-4 s and skipped 220 frames.

Serialize mutations with a separate mutation lock and take the
replacement lock only for recovery, temporary cleanup, and the final
renames. Readers still take only the replacement lock, so the video
and its scale mode are still read from one snapshot.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The bounded download transport streams into a temporary file named
async-wallpaper-<UUID>.download and passed that URL to Photos. Photos
validates a file resource by its extension, so every save failed with
PHPhotosErrorDomain 3302 on the iOS 27 simulator. A uniformTypeIdentifier
option alone did not help.

After ImageIO validates the download, rename it with the preferred
extension of the decoded type and give Photos that file. iOS 13 uses the
MobileCoreServices lookup.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Main-thread promotion must not wait for a source copy in another plugin
instance. Reject contention before changing repository state.

Keep pending ownership across prepare and promote so a delayed preview
cannot promote another instance’s video. Preserve persisted-pending
recovery for fresh repository instances.
When renderer initialization exceeded its wait, create() returned null
and the engine attached MediaPlayer to the wallpaper surface that EGL
might still connect to. Throw instead, so the engine takes its player
failure path and never attaches a second producer. Only a renderer that
failed and released the surface falls back to the stretched path.

Balance each successful eglInitialize with eglTerminate during teardown,
as the shader wallpaper renderer does.

Found by Codex review.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Add the Android API 36/28 emulator and iOS 27 simulator results for
the unreleased changes: devices and tools, scenario results, the bug
ledger (B1-B3, C1-C4), observations left for later, environment
limitations, and what still cannot be verified.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@codenameakshay
codenameakshay merged commit bccfc67 into main Oct 16, 2026
6 checks passed
@codenameakshay
codenameakshay deleted the t3/validate-unreleased-changes-devices branch October 16, 2026 18:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant