Skip to content

feat(mobile-android): polish large screens, accessibility and release builds - #4768

Open
AatmanAJ wants to merge 821 commits into
CapSoftware:mainfrom
AatmanAJ:feat/mobile-android-polish
Open

AatmanAJ wants to merge 821 commits into
CapSoftware:mainfrom
AatmanAJ:feat/mobile-android-polish

Conversation

@AatmanAJ

@AatmanAJ AatmanAJ commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

Stacked on the screen recording PR (#4767), which sits on the earlier Android PRs. Only 17 commits are new here: 18f7b915e to 9f6bb8c1c, then merges of the screen recording PR at a815032ce, ea0b673b6 and f6b46f39d, then 258c555b4, a recording notification fix that now belongs to the screen recording PR, then a merge of the screen recording PR at 86848ea4b, then the review fixes 5ff41caf9, c383ffd72, 6f50ca33c, 0c6f44e7f and a8d5a33de, then merges of the screen recording PR at 708826e8d, with its review fixes, at 93baba987, which brings in the sign-in fixes from #4734, at 26e17865d and 327fd2925, with two fixes after review, and at ff6ac86df, e2b7fe556, 0ba4261de and fe5ddde9b. It brings in the review fixes from the earlier Android PRs, among them: sign-out clears notifications and stops playback, Cap images send the video access token, paging carries on after a refresh and shows its errors, the screen stays on while a Cap plays, an upload that storage asks to send later is retried, and lint no longer fails when a newer Kotlin is released. A last merge of the screen recorder branch (8424af1d6) brings in the recording engine's fix that keeps the debug pattern recorder's footage when saving stops early (077ea1786, #4764). Once the PRs below merge this shows only its own diff.

The last PR in the Android stack: large screens, accessibility and release polish.

What is in it

  • Two panes on large screens. A window that is at least medium in both width and height (a tablet, or an open foldable) shows the Caps tab as the library beside the open Cap, with "Pick a Cap" and "Choose a Cap from your library to watch it here." until one is chosen. Both layouts read one back stack, split into library pages, the open Cap and what was pushed from it, so folding or unfolding keeps the Cap open, as the iOS split view does. The library pane is 300 to 380 dp wide and uses compact rows: a 116 dp thumbnail with a duration badge, the title, the owner and date, the stats, and the selected state. The long-press menu is shared with the card. Opening a folder in the library keeps the Cap open beside it, and back closes the open Cap before it leaves a folder.
  • Orientation. Outside fullscreen video a phone stays in portrait, and a window that is at least 600 by 480 dp held either way rotates freely, matching the iOS rule. Checking both ways round matters for windows 480 to 599 dp wide: they show two panes in landscape, and a check on the current size alone locked them in portrait once turned upright, so they could not turn back. The fullscreen player still asks for landscape and restores the policy when it closes. Android 16 already ignores orientation requests for apps targeting it on displays whose smallest width is 600 dp or more.
  • TalkBack. Sign-in, the library, the Cap screen, the player, comments and sharing were checked against the labels and hints the iPhone app gives VoiceOver. The labels were already in place. Four hints were missing and are now click labels: a reaction button ("add your reaction at the current moment"), a reaction count ("play from the first one"), a timeline marker ("play from this moment") and the composer's time pin ("change the moment this comment is attached to").
  • Font scale and reduced motion. The count on a timeline marker badge now keeps the fixed 9 point size the iOS badge uses instead of spilling over the timeline at large text. With animations removed, a reaction burst now stays in place for its 1.5 seconds instead of vanishing at once.
  • Edge to edge. Tab content now takes the horizontal safe drawing insets, so a foldable's inner display cutout or a side navigation bar cannot sit over the library or the player now that large screens rotate.
  • R8. Release builds are shrunk and obfuscated with the optimising Android defaults and the rules the libraries ship. The app needs no rules of its own, so there is no proguard-rules.pro. :app:testReleaseShrunkUnitTest runs R8 again over the release classes with the configuration the release build printed, writing class files instead of DEX, and runs app/src/testRelease on the JVM against the shrunk classes: the Caps back stack saved and restored through Navigation 3's serialiser, which finds each route's serialiser by reflection; the iOS caps and bootstrap fixtures decoded and passed through the snapshot cache; and pending uploads written, marked uploaded and read back.
  • Baseline profile. A baselineprofile test module and generator, on the Baseline Profile Gradle plugin 1.5.0 and Macrobenchmark 1.5.0, plus ProfileInstaller 1.4.1 in the app. ./gradlew :app:generateBaselineProfile records a cold start on a connected device. The generated baseline and startup profiles are committed under app/src/release/generated/baselineProfiles, recorded on an API 35 emulator.

The fix for the recording notification on Android 10 (258c555b4) and its test, ScreenRecordingTest.tappingTheNotificationStopsTheRecordingWhileOtherCapNotificationsShow, are in the screen recording PR (#4767), as ea2f8ebb5, and come back here with the merge at 86848ea4b, so they no longer show in this diff. The device runs below at 258c555b4 include that test.

Fixed after review

  • Opening another Cap in two panes (5ff41caf9). Opening a Cap from the link sheet, a Loom import or the recorder while a Cap was open in two panes stacked a second Cap, so the library pane showed the first Cap instead of the library. It now replaces the open Cap and the pages opened from it; one pane still opens it on top. Test: LibraryTwoPaneTest.anotherCapReplacesTheOpenOneAndItsPagesInTwoPanes.
  • Reselecting the open Cap (5ff41caf9). Choosing the open Cap again in the library while its analytics were showing replaced it with a plain route, so a Cap opened at a time or a comment lost them and got a new player. It now keeps the open Cap and closes only the pages opened from it. Test: LibraryTwoPaneTest.reselectingALinkedCapKeepsItsTimeAndCommentAndClosesItsAnalytics.
  • Signing in again while the last session's data is still being removed (c383ffd72). Since sign-out was added in feat(mobile-android): add sign-in, the saved session and sign-out #4734, the sign-in screen showed while the old session's local data was still being removed in the background, so a quick new sign-in could lose its uploads and recordings to that cleanup. A new session is now saved only once every pending cleanup has finished, and the sign-in screen still shows at once. Test: AppModelTest.aNewSessionWaitsForTheLastSessionsDataToBeRemoved.
  • The editor in two panes (0c6f44e7f). With the editor in the right pane, the library beside it stayed usable, so choosing another Cap, opening a link or importing from Loom replaced the open Cap and dropped the editor with its unsaved changes. The editor now covers the whole Caps area, as it does on a phone, so it can only be left through its own Cancel and Save, which already ask before discarding changes and wait for a save to finish. The library keeps its scroll position while the editor covers it (a8d5a33de), because all of its displays now share one saved state holder. Tests: EditorTest.theEditorCoversTheLibraryInTwoPanes and EditorTest.theLibraryKeepsItsPlaceAfterTheEditorInTwoPanes, on the tablet AVD (API 35), where EditorTest and MainShellTest pass 17 of 17 at a8d5a33de.
  • Shrunk release tests in CI (6f50ca33c). The Android job now runs :app:testReleaseShrunkUnitTest as well as building the release.
  • A recording's link is marked as copied before it reaches the clipboard (5d4081dc1 in the screen recording PR, merged at fe5ddde9b). The recent item used to be marked only after the link was on the clipboard, so anything woken by the clipboard could see it unmarked.

Each test fails with its fix taken out and passes with it in place.

Screenshots

Tablet AVD (API 35, 2560 by 1600), light and dark: "Pick a Cap", a Cap open beside the library, and the Cap at font scale 2.0 with the marker badge on the timeline.

Light Dark
Tablet, Pick a Cap, light Tablet, Pick a Cap, dark
Tablet, a Cap open beside the library, light Tablet, a Cap open beside the library, dark
Tablet, font scale 2.0, light Tablet, font scale 2.0, dark

Foldable AVD (API 35), unfolded: "Pick a Cap", a Cap open beside the compact rows, and font scale 2.0.

Light Dark
Unfolded, Pick a Cap, light Unfolded, Pick a Cap, dark
Unfolded, a Cap open, light Unfolded, a Cap open, dark
Unfolded, font scale 2.0, light Unfolded, font scale 2.0, dark

The same Cap after folding, still open, on the outer display; then predictive back mid-gesture from a Cap on API 37 (the library previewed behind it) and API 35.

Folded, light Folded, dark Back, API 37 Back, API 35
Folded, the Cap still open, light Folded, the Cap still open, dark Predictive back mid-gesture, API 37 Predictive back mid-gesture, API 35

Where it differs from iOS, on purpose

  • No held layout. iOS holds the split layout while the editor or the fullscreen player is up. On Android the fullscreen state lives in the player, which survives the layout change, so nothing is held. The editor is not in the app yet.
  • Predictive back on Android 13 to 15. With targetSdk 37 it was already on for Android 16 and later. The <application> element now sets android:enableOnBackInvokedCallback="true" with tools:targetApi="33", so Android 13 to 15 play the back preview too. The app handles back only through BackHandler and the back dispatcher, with no onBackPressed or key overrides, so the existing back behaviour carries over.
  • The baseline profile journey stops at sign-in. A release build cannot be pointed at the fixture server, so the library is not part of the journey yet.
  • New dependencies: Material 3 Adaptive 1.3.0 for the window size class, ProfileInstaller 1.4.1 (already on the classpath through Compose), and for the generator only, the Baseline Profile plugin and Macrobenchmark JUnit4 1.5.0 with 15 artefacts of their own. All are Apache 2.0, read from their POMs, and the README's licence table is updated.

Tests

  • capkit, :capkit:test: 270 tests, none new in this PR.
  • JVM, :app:testDebugUnitTest: 532 tests, 10 of them new. 7 in LibraryTwoPaneTest: the back stack splits at the last Cap; a stack without a Cap is all library; selecting a Cap replaces the open one and what was pushed from it; selecting the open Cap again keeps it, including its start time, and closes what was pushed from it; a folder opens under the open Cap in two panes, and only from the top screen in one. 3 in OrientationPolicyTest: a window 540 dp wide may rotate held either way, which fails with the old rule; a phone stays in portrait either way; a tablet rotates.
  • Shrunk release classes, :app:testReleaseShrunkUnitTest: 3 tests, all new in ReleaseShrinkTest.
  • Media module, :media:testDebugUnitTest: 66 tests, none new in this PR.

Device runs

On emulators against the fixture server. The instrumented suites ran on 258c555b4. The screens ran on d5ce89385, the commit before the orientation fix; the orientation checks ran on both.

  • Instrumented suites at 258c555b4, on the API 37 and API 29 phone AVDs booted with an emulated front and back camera. API 29: app 100 of 100 and media 41 of 41. API 37: app 97 of 100 and media 41 of 41. The crash buffers were empty after every suite.
  • The 3 API 37 failures are in CapDetailTest and pass on API 29: playAndPause and aShareLinkWithATimeOpensTheCapThere with "ComposeNotIdleException: Idling resource timed out: possibly due to compose being busy.", and aChosenSpeedIsKeptAfterTheAppIsOpenedAgain, which opened the speed menu but could not find the "1.5×" option. In an earlier run on this emulator, at d5ce89385, the fixture video did not play: its H.264 decoder failed in MediaCodec.queueInputBuffer and the Cap screen showed "This video can't play right now.", which is the likely cause.
  • MainShellTest (5 tests, including both back cases) passes on the tablet AVD (API 35) and an API 35 phone, and on an API 33 phone at 9f6bb8c1c and again at ea0b673b6.
  • Two panes: the screenshots above. Folding with a Cap open keeps it open on the outer display, and unfolding brings back the two panes.
  • Orientation, on an API 35 phone (1080 by 2424): at 411 dp wide the app stays in portrait, and fullscreen video turns to landscape. With the density set so the window is 540 dp wide, the app before the fix, launched in landscape, showed two panes and rotated, but once turned upright it locked to portrait and stayed there when the device turned back. With the fix it follows the device both ways, fullscreen video still turns to landscape and gives the rotation back when it closes, and at the normal density it still stays in portrait.
  • Predictive back, with the system back animation on, on API 35 and 37 at d5ce89385 and on API 33 at ea0b673b6: back from a Cap in a folder goes to the folder, the library, then the home screen. New folder and Open a Cap link close on one back, in 3 of 3 tries each from a fresh launch on API 33. Import from Loom closed on one back in 2 of 3 tries on API 35 and 37; on API 35 the first back of the other try closed the keyboard, as it does in any sheet with a focused field. On API 33 the link field had the keyboard up in all 3 tries, and the first back closed the keyboard and left the sheet open. Back from the Record page returns to the library. Mid-gesture, API 37 previews the library behind the page and API 35 insets the page with the arrow; API 33 shows the arrow only.
  • Cold start, API 35 phone AVD, the release build of 9f6bb8c1c with the app's baseline and startup profiles, signed with a debug key, am start -W TotalTime to the sign-in screen, a force-stop before every launch. 10 launches with the profile installed through ProfileInstaller and compiled with cmd package compile -f -m speed-profile, and 10 after cmd package compile --reset, alternating one of each so that load on the shared host falls on both. With the profile: median 189.5 ms, 176 to 220 ms. Reset: median 194 ms, 184 to 215 ms. On this emulator the journey ends at sign-in and the difference is within the spread, so this shows the profile installs and compiles, not a measurable start-up gain; a library screen journey and a physical device would say more.
  • After the merge at 93baba987, on the API 37 AVD: SignInTest and BrowserSignInTest pass 15 of 15, and ScreenRecordingTest.signingOutFromCapDuringARecordingStopsItBeforeRemovingItsFiles passes.

Checked

  • ./gradlew spotlessCheck :capkit:test :app:testDebugUnitTest :app:lintDebug :app:assembleDebug :app:assembleRelease :app:assembleDebugAndroidTest :app:testReleaseShrunkUnitTest :baselineprofile:compileNonMinifiedReleaseKotlin :baselineprofile:assembleNonMinifiedRelease :media:testDebugUnitTest :media:lintDebug :media:assembleDebugAndroidTest passes on 258c555b4, with 270 capkit, 532 app, 3 shrunk release and 66 media JVM tests, on a8d5a33de, with 272 capkit, 537 app, 3 shrunk release and 66 media JVM tests, on the merge 708826e8d, with 272 capkit, 538 app, 3 shrunk release and 66 media JVM tests, and on the merges 93baba987, 26e17865d and 327fd2925, each with 272 capkit, 545 app, 3 shrunk release and 66 media JVM tests, and on the merges ff6ac86df, e2b7fe556 and 0ba4261de, each with 273 capkit, 552 app, 3 shrunk release and 66 media JVM tests, and on the merge fe5ddde9b, with 273 capkit, 553 app, 3 shrunk release and 66 media JVM tests.
  • With the kotlinx serialization consumer rules removed from the configuration, the shrunk tests still pass: R8 keeps the route companions and their serializer() methods by name either way, so the tests show the shrunk app restores its back stack, not that those rules are what make it work.

Not checked

  • On a device or emulator, still to run:
    1. Opening a folder with a Cap open in two panes, then back, and rotating the tablet and the unfolded foldable themselves.
    2. TalkBack through sign-in, the library (cards and compact rows), the Cap screen, the player, comments and sharing, including the four new hints.
    3. Font scale 2.0 on screens other than the Cap screen, and a reaction burst with animations removed.
    4. Edge to edge in landscape on the foldable, with a display cutout at the side.
    5. Predictive back on the password sheet, and closing the open Cap in two panes before leaving a folder.
    6. The minified release build beyond cold start: sign in, play, upload, record with the camera and the screen.
    7. A baseline profile journey past sign-in, and cold start on a physical device.
  • A physical phone or tablet.

Confidence Score: 5/5RetriggerView in Greptile

The changes appear safe to merge, with one non-blocking gap remaining in the recording test.

Findings

  1. P2 Lost footage passes the test ▶
Fix with agent prompt
### Issue 1
apps/mobile-android/app/src/androidTest/kotlin/so/cap/mobile/ScreenRecordingTest.kt:undefined-328
The new saving test only checks that the service reaches `Idle`. `ScreenRecordingService` also reaches `Idle` when it discards a recording, so this test can pass even when footage is lost. Wait for a video segment before stopping, then check that the recording remains saved with a positive duration.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Summary

Adds Android large-screen layouts, accessibility hints, release shrinking checks, and baseline profiles.

  • Android users can sign in and manage, watch, and share Caps in the Cap app.
  • Large windows keep the Cap library beside the selected Cap.
  • Android users can record video and upload it in the background.
  • Android release builds are shrunk and ship with startup profiles.

Reviews (21) · Last reviewed commit: "Merge branch 'feat/mobile-android-screen..." · Reviewed by Greptile

@vercel

vercel Bot commented Dec 2, 2026

Copy link
Copy Markdown
Contributor

@AatmanAJ is attempting to deploy a commit to the Cap Software Inc Team on Vercel.

A member of the Team first needs to authorize it.

Comment thread .github/workflows/ci.yml Resolved
@AatmanAJ

AatmanAJ commented Dec 2, 2026

Copy link
Copy Markdown
Contributor Author

@greptileai review

@AatmanAJ

AatmanAJ commented Dec 2, 2026

Copy link
Copy Markdown
Contributor Author

@greptileai review

@AatmanAJ

AatmanAJ commented Dec 2, 2026

Copy link
Copy Markdown
Contributor Author

@greptileai review

2 similar comments
@AatmanAJ

AatmanAJ commented Dec 2, 2026

Copy link
Copy Markdown
Contributor Author

@greptileai review

@AatmanAJ

AatmanAJ commented Dec 2, 2026

Copy link
Copy Markdown
Contributor Author

@greptileai review

@AatmanAJ

AatmanAJ commented Dec 2, 2026

Copy link
Copy Markdown
Contributor Author

@greptileai review

@AatmanAJ

AatmanAJ commented Dec 2, 2026

Copy link
Copy Markdown
Contributor Author

@greptileai review

@AatmanAJ

AatmanAJ commented Dec 2, 2026

Copy link
Copy Markdown
Contributor Author

@greptileai review

@AatmanAJ

AatmanAJ commented Dec 2, 2026

Copy link
Copy Markdown
Contributor Author

@greptileai review

1 similar comment
@AatmanAJ

AatmanAJ commented Dec 2, 2026

Copy link
Copy Markdown
Contributor Author

@greptileai review

@AatmanAJ

AatmanAJ commented Dec 2, 2026

Copy link
Copy Markdown
Contributor Author

@greptileai review

.also { collecting.cancel() }
}

assertNotNull(idle)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Lost footage passes the test

The new saving test only checks that the service reaches Idle. ScreenRecordingService also reaches Idle when it discards a recording, so this test can pass even when footage is lost. Wait for a video segment before stopping, then check that the recording remains saved with a positive duration.

Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/mobile-android/app/src/androidTest/kotlin/so/cap/mobile/ScreenRecordingTest.kt
Line: 328

Comment:
**Lost footage passes the test**

The new saving test only checks that the service reaches `Idle`. `ScreenRecordingService` also reaches `Idle` when it discards a recording, so this test can pass even when footage is lost. Wait for a video segment before stopping, then check that the recording remains saved with a positive duration.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

This branch has not been deployed

No deployments
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