Repository navigation
feat(ui): hint high refresh rate ahead of Settings→Library back-nav (#686) - #687
libravault-pipeline-bot[bot] wants to merge 2 commits into
Conversation
View.setRequestedFrameRate(HIGH) hint (API 35+), gated by an injectable sdkInt for testability. Standalone utility; not wired into the Settings->Library back transition yet.
Wires hintHighRefreshRateForUpcomingFrame() into SettingsScreen's onBack, right before popBackStack() is invoked — the exact path #653's diagnostic build instrumented as the stall's location.
QA verification — PR #687 vs #6860. 1. Acceptance criteria (issue #686, "Investigate" scope)
2. Real test suites — ran in foreground, no shortcuts:
3. Tests actually test something real — verified by hand, not by reading the diff:
4. Regressions — 5. AGENTS.md conventions — commit messages are Conventional Commits and split by concern (utility commit, then wiring commit); branch VerdictImplementation is correct, gated correctly, tests are real (independently verified both directions), full CI-equivalent test matrix is green, and the wiring targets the exact transition the issue describes. The one unmet item — on-device A/B confirmation — is honestly disclosed in the PR body and is a hardware constraint no CI-bound iteration can close; blocking QA on it would just bounce this forever between agents with no path to resolution. Recommend a human re-run the A/B harness on the original Samsung device before/at merge, per the PR's own request. QA verdict: PASS |
There was a problem hiding this comment.
Principal review — verdict: human-merge
Code review
Read the full diff plus surrounding context (SettingsScreen.kt's findActivity/activity usage, LibravaultNavHost.kt's onBack wiring, core/ui's existing OrientationLockTest for the JUnit5+MockK convention this PR claims to follow). The change itself is sound:
- API claims independently verified against the real android.jar, not taken on faith. Ran
javapagainst this environment's actual SDK platforms:android-34/android.jar: nosetRequestedFrameRateonViewat all.android-35/android.jar:public void setRequestedFrameRate(float)and theREQUESTED_FRAME_RATE_CATEGORY_*constants (allfloat) are present, confirming the PR's API-35-only claim and that the call signature matches.android.view.Windowhas nosetFrameRate/suggestFrameRatemethod at all in API 35 (only unrelatedsetFrameRateBoostOnTouchEnabled/setFrameRatePowerSavingsBalanced), andSurface.setFrameRaterequires a realSurfacewith 2-3 args — confirming the PR's correction of the issue's premise is accurate, not just plausible-sounding.Build.VERSION_CODES.VANILLA_ICE_CREAM == 35,UPSIDE_DOWN_CAKE == 34— matches the test's sdk gating values.core/ui'scompileSdkis pinned at 36 (gradle/libs.versions.toml:59comment), so API 35 symbols resolve at compile time.
hintHighRefreshRateForUpcomingFrame's injectable-sdkIntpattern genuinely mirrorsOrientationLockTest's style (JUnit5 + MockK, no Robolectric) — checked both files side by side.- Wiring in
SettingsScreen.kt:125-131is a minimal, correctly-gatedactivity?.window?.decorView?.hint...()call ahead of the existingonBack(), following the same safe-call-on-nullable-activitypattern already used elsewhere in the file (activity?.let(...)for billing). No new NPE risk, no new networking, no sensitive-path touch (classify_pr_risk.pyconfirms: 57 changed lines, no sensitive-path match →risk:low, and the label was applied after the last commit, so it isn't stale). - Ran the tests myself, not just the PR's/QA's claim of green:
./gradlew :core:ui:testDebugUnitTest :feature:settings:testFdroidDebugUnitTest→BUILD SUCCESSFUL in 4m 3s. ConfirmedFrameRateHintTest's two cases both ran and passed via the JUnit XML report (core/ui/build/test-results/testDebugUnitTest/TEST-....FrameRateHintTest.xml, 2 tests, 0 failures). Real assertions (verify { view.setRequestedFrameRate(...) }/verify(exactly = 0)) against a relaxed mock, not a tautology. - AGENTS.md conventions followed: tests shipped with the change, "prove a new test can fail" honored per the PR's own account (not independently re-verified by me since I already have my own green run — QA already did this inversion check and I have no reason to doubt a mechanical claim I can otherwise reproduce).
Why this is routing to a human anyway
Despite risk:low and a clean code review, the actual CI never ran on this PR's final (or any) commit, and per review policy an unconfirmable "did CI actually run" is treated the same as a CONFIRMED finding rather than resolved in favor of auto-merge. This isn't a guess — I confirmed the gap directly via the Actions API:
- The only two
JVM Testsworkflow runs forfeature/686-frame-rate-hint(33047049679for the first commit,33047170529for the final commitfc23bcf) both have theirtestjob (Unit & Integration Tests (JVM)) showconclusion: skipped— because both fired while the PR was still in draft (github.event.pull_request.draft == falsewas false at trigger time;ready_for_reviewdidn't land until06:48:25Z, after both pushes). - No workflow run of any kind exists for the
ready_for_reviewevent itself for this branch (checked viagh api repos/LibraVault/reader/actions/workflows/jvm-tests.yml/runsand the repo-wide runs list) — despitejvm-tests.ymlexplicitly listingready_for_reviewin its trigger types for exactly this reason. Same gap applies toios-app-build.yml/ui-tests.yml(Build Android App,Compose UI Testsetc. allskippedtoo). - This is the exact root cause already tracked in #433 (open,
status:in-progress):dev-agent'sgh pr readycall uses the defaultGITHUB_TOKEN, and GitHub Actions doesn't create new workflow runs for events produced by that token, so marking a PR ready never actually retriggers the CI that's supposed to gate it. #687 is exactly the shape #433 calls out as the least visible case: both commits landed beforeready_for_review, nothing pushed after, so there's nosynchronizeevent to paper over the gap either. Not filing a new issue — left a comment on #433 noting this as another live occurrence instead, per the same precedent set on #684's review.
Net effect: my own review and QA's are both independently substantive (and I personally reran and confirmed the real test suite green, which is stronger evidence than #684 had), but the PR's actual required GitHub Actions checks (Unit & Integration Tests (JVM), Build Android App, Compose UI Tests) have literally never executed against any commit in this PR. That gap, not any defect in the change itself, is why this needs a human rather than auto-merge.
Suggested next step for whoever picks this up: push a trivial commit (or otherwise force a new synchronize event) to get one real CI run before merging — the code itself looks correct and is independently verified by hand, but it should still get its real CI signal before landing.
Summary
Investigation follow-up to #686 (split from #653 — confirmed pre-existing Samsung One UI display-refresh-rate characteristic, not a regression).
Real-device A/B evidence in #653 root-caused an ~830-900ms stall on Samsung One UI hardware to
RefreshRateModeManagerreactively renegotiating the panel's refresh rate (idle→high-refresh) at the exact moment the Settings→Library back transition needs a frame presented.Important correction from the issue text: neither
Window.setFrameRate()norsuggestFrameRate()actually exist in the Android API — I checked the real android.jar (compileSdk 36) directly. The two real candidates are:Surface.setFrameRate()(API 30+) — needs a realSurface, which a plain ActivityWindowdoesn't expose without aSurfaceView. Not a practical fit for this codebase's Compose screens.View.setRequestedFrameRate(float)(API 35+ only) — the view-level, non-Surface, non-game API Google added specifically for this "hint ahead of an upcoming transition" use case.This PR implements the second one:
View.hintHighRefreshRateForUpcomingFrame()(core/ui), callingsetRequestedFrameRate(REQUESTED_FRAME_RATE_CATEGORY_HIGH)on the decor view, gated behindSDK_INT >= 35(no-op below that — the method doesn't exist there). Wired intoSettingsScreen's back action specifically (the exact path #653's diagnostic build instrumented:onBacktap →popBackStack()), ahead of the pop.What this PR does NOT do (and why)
ab-test-settings-stall.sh) lives on the reporting device's paired Mac, which isn't reachable from here. I cannot confirm whether this hint actually changes the measuredpopBackStack()→ON_RESUMEwindow on real Samsung hardware — only that the API call is correctly gated and fires with the arguments the docs recommend. This needs a human with the original test device to re-run the A/B harness before/after this change to close the loop the issue actually asks for.setRequestedFrameRateis documented as an advisory, per-invalidation hint (the system uses the highest category requested by any view invalidated in a given frame to pick the next frame's rate) rather than a persistent vote likeSurface.setFrameRate, so there shouldn't be a lingering high-refresh vote to clear — flagging this reasoning explicitly in case it's wrong, since I can't observe real display-pipeline behavior from here.Testing
core/ui'sFrameRateHintTest(JUnit5 + MockK, matching this module's existingOrientationLockTestpattern): verifies the call fires withREQUESTED_FRAME_RATE_CATEGORY_HIGHatsdkInt = 35, and does nothing below it. Confirmed both assertions go red when the guard is inverted, per AGENTS.md's "prove a new test can fail" rule../gradlew :core:ui:testDebugUnitTestpasses locally.@Config(sdk = [35])(existing tests here cap at 34), so I avoided depending on it and used an injectablesdkIntparameter instead.Not tracking any
sensitive_pathsglobs.Closes #686