fix(android): wait for a fresh PAG frame after FlutterView resume - #109
Closed
EverMPChat wants to merge 3 commits into
Closed
fix(android): wait for a fresh PAG frame after FlutterView resume#109EverMPChat wants to merge 3 commits into
EverMPChat wants to merge 3 commits into
Conversation
added 3 commits
August 19, 2026 14:46
原因:PAG flush 成功早于 Flutter 首次合成 Texture,直接切换仍会短暂暴露黑色初始缓冲。 影响:Android 首帧和 Surface 恢复时先在遮罩下合成 Texture 一帧;iOS 与其他平台时序保持不变。
原因:FlutterView 重挂载时 PAG Surface 未必触发销毁,旧 ready 状态会暴露黑色 Texture。 影响:Android 生命周期恢复时可由共享组件重新武装首帧门控;其他平台和普通暂停语义不变。
Author
|
Superseded by #110, opened from the public EverMPChat fork. This pull request used a private head repository and is therefore not suitable for upstream review. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fix the Android black frame that can appear when a FlutterView containing a PAG Texture is detached by a native tab and later resumed.
The branch is intentionally based on
feature/fix_surfaceatab78a6a4fcbfca99064bfc3fe498111f10023095so it retains the newer FlutterSurfaceProducerlifecycle support.Fixes #108
Changes
onFrameReadyonly after a successful flush for the current generation;onFrameUnavailablewhen the Surface or lifecycle becomes invalid;defaultBuilderand wait one Flutter compositor frame before revealing it;PAGViewState.pauseForLifecycle()for native-tab detach paths where no Surface-destroyed callback arrives;start()flush the current progress before starting the animator;Why a lifecycle-specific pause
A normal animation pause must preserve existing display semantics. Native tab switching additionally needs to invalidate the previous ready state, because the underlying FlutterView can be detached without a matching
SurfaceProducer.Callback.onSurfaceDestroyedcallback.Keeping this behavior in the shared adapter avoids requiring every Flutter page to add its own overlay or host-specific lifecycle handler.
Verification
flutter test --coverage test/pag_view_frame_state_test.dart: 6/6 passedThe host app keeps libpag 4.5.85 through Gradle conflict resolution; this PR does not change the plugin dependency declaration.