Repository navigation
Keep the Android app running while its window is hidden - #142
Merged
Merged
Conversation
Try
reviewed
Nov 11, 2026
Owner
|
Merged, thanks! |
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.
Follow-up to #140, using the activity as the window handle as suggested there.
SystemApi::Window*on Android is now theANativeActivity*, which lives as long as the activity.AndroidApi::nativeWindow()returns its currentANativeWindow, or null while the activity is hidden.APP_CMD_TERM_WINDOWno longer closes the app: rendering just stops until NativeActivity provides a new window.VSwapchainholdsANativeWindow_acquireon the window its surface was created from. Onreset()it recreates the surface if the current window differs, andcurrentBackBuffer()throwsSwapchainSuboptimalwhen it differs, so detection doesn't depend on the driver reporting anything.About A-B-A: the swapchain's reference keeps the old window alive until the surface is destroyed, so a new window can't get the same address. If the same pointer comes back, it's the same window object, and the existing surface is still valid for it.