Keep the activity alive across configuration changes - #117
Open
iflyhere wants to merge 1 commit into
Open
Conversation
VideoActivity declares no android:configChanges, so every configuration change destroys and recreates it. onCreate() re-runs the whole bring-up and onPause()/onStop() tear the link down first, which means a few seconds of black screen and a fresh USB/wfb-ng/decoder init. That fires more often than it looks: - window resize in multi-window / freeform / desktop mode (screenSize, smallestScreenSize, screenLayout) - also how the app is presented on Android XR headsets, where the panel is user resizeable - attaching a keyboard or a dock (keyboard, keyboardHidden, navigation) - rotation (orientation) Handling those in-process is enough: the layout is ConstraintLayout based and re-measures itself, the activity keeps no configuration dependent state, and none of those qualifiers select alternative resources in this project, so no onConfigurationChanged() override is needed. uiMode and density are deliberately not in the list: values-night/ and the mipmap-*dpi buckets do depend on them, so those two still need a recreate to pick up the right resources. Also: - android:resizeableActivity="true" - be explicit rather than relying on the target SDK default - android.hardware.touchscreen android:required="false" - the implicit default is required=true, which marks the app incompatible with any ground station driven by a pointer or a gamepad instead of a touchscreen
This was referenced Aug 27, 2026
PR Summary by QodoPreserve VideoActivity across configuration changes
AI Description
Diagram
High-Level Assessment
Files changed (1)
|
Code Review by Qodo🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)
Great, no issues found!Qodo reviewed your code and found no material issues that require reviewTip of the day💡 Did you know, you can ask Qodo to dismiss a finding you disagree with, with your reason on record |
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.
Manifest only, no code changes.
The problem
VideoActivitydeclares noandroid:configChanges, so any configuration changedestroys and recreates the activity. That is not cheap here:
onPause()/onStop()stop the video player, the wfb-ng adapters and the VPN service, andonCreate()then re-runs the whole bring-up — USB open, wfb-ng start, decoderwait for SPS/PPS. In practice a few seconds of black screen and a fresh USB
permission/enumeration cycle.
It fires more often than it looks:
(
screenSize,smallestScreenSize,screenLayout) — this is also how theapp is presented on Android XR headsets, where the panel is user-resizeable,
so a nudge of the window edge drops the link mid flight
keyboard,keyboardHidden,navigation)orientation)The change
Handling those in-process is enough — the layout is
ConstraintLayoutbased andre-measures itself, the activity keeps no configuration-dependent state, and none
of those qualifiers select alternative resources in this project (there is no
layout-land, novalues-sw*dp), so noonConfigurationChanged()override isneeded.
android:screenOrientationis left alone.uiModeanddensityare deliberately not in the list:values-night/andthe
mipmap-*dpibuckets do depend on them, so those two still need a recreateto pick up the right resources. Losing the link on a dark-mode switch is the
lesser evil compared to a half-themed UI.
android:resizeableActivity="true"is set explicitly rather than relying on thetarget SDK default.
Plus one unrelated one-liner in the same file:
The implicit default is
required="true", which marks the app as incompatiblewith any ground station that is driven by a pointer or a gamepad instead of a
touchscreen (headsets, TV boxes, kiosk displays). Happy to split that out if you
would rather keep this PR to the config changes.
Part of a small series of independent fixes found while profiling the receive path.
Each one is standalone and mergeable on its own, in any order — no dependencies
between them, and no shared files except
VideoActivity.java/VideoPlayer.*,which touch different methods:
All five compile clean for arm64-v8a + armeabi-v7a.