Skip to content

feat(mobile-android): show uploads and recordings as Live Updates - #4762

Open
AatmanAJ wants to merge 783 commits into
CapSoftware:mainfrom
AatmanAJ:feat/mobile-android-live-updates
Open

AatmanAJ wants to merge 783 commits into
CapSoftware:mainfrom
AatmanAJ:feat/mobile-android-live-updates

Conversation

@AatmanAJ

@AatmanAJ AatmanAJ commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

Stacked on the analytics PR (#4761), which sits on the earlier Android PRs. Only the top 13 commits are new here, from 588eb2f0d onwards, including merges of the analytics PR at dacb7306f and 091f9bfbf and three fixes from review. Once the PRs below merge this shows only its own diff.

This PR adds Live Updates, the Android counterpart of the iOS Live Activities.

What is in it

The Android counterpart of the two iOS Live Activities (upload progress and screen recording), built on the upload notifications from the upload PR. Someone uploading a file or importing from Loom now sees the same phases and wording as on an iPhone, in the shade and, on Android 16 QPR2 and later, as a promoted Live Update with a status bar chip.

  • One notifications builder. Notifications lives in the app's services and owns two low importance channels, "Uploads" and "Screen recording".
  • Kinds, phases and wording. Video, photo, Loom import and recording uploads, each through preparing, uploading or importing, finishing, done and failed, with the iOS status line: "Getting ready", "Uploading · 40%", "Uploading photo · 40%", "Importing from Loom · 40%", "Uploading recording · 40%", "Finishing up", "Ready to share", or the error.
  • From the moment of picking. A notification appears while a picked file is being prepared, as the iOS activity does, and gives way to the upload worker's once the Cap exists. A failure before then shows in the same notification.
  • Throttle and stale state. An uploading update waits for 2 percent or 2 seconds, as on iOS. With no update for 45 seconds the line reads "Uploading in the background" and the like.
  • Dismissal. Finished notifications go after 15 minutes and failed ones after an hour, the activity's timings.
  • Screen recording. A builder for the recorder's notification: "Recording your screen" or "Recording screen and camera" with a running timer and "Tap to stop and open your link", then "Saving your recording" with an hourglass once it is stopping. A Stop action shows until then.
  • Promoted Live Updates. From API 36 an upload uses Notification.ProgressStyle, indeterminate while preparing or finishing, with its percentage as the chip text. Promotion is requested on Android 16 QPR2 (API 36.1) and later, which needs POST_PROMOTED_NOTIFICATIONS. Earlier versions keep the plain ongoing notification with a progress bar.
  • Taps. An upload or import notification opens cap://s/<id> once the Cap exists, and the app before then. The recording notification and its Stop action open cap://record/stop, the iOS activity's link.
  • Recording uploads. RecordingUploadFeed is a small interface for the recorder side: each update names the Cap, its title and its phase, and the upload centre shows it as an "Uploading recording" notification with the same throttle, stale state and dismissal.
  • Recorder hooks. The camera recorder PR, stacked on this one, feeds recording uploads through RecordingUploadFeed, and the screen recorder PR posts the recording notification and acts on cap://record/stop.

Screenshots

API 37, light API 37, dark API 29, light
Getting ready
Uploading · 40%
Uploading in the background
Finishing up
Ready to share
Upload failed
Importing from Loom · 60%
Status bar chip, uploading No chip on API 29
Status bar chip, Loom import No chip on API 29

On the emulators at 38847eef8. A fixture upload finishes too quickly to catch every phase, so each one was posted through the app's own Notifications builder from a test harness that is not part of this PR; the real upload path is covered by LiveUpdateShadeTest. API 37 shows the promoted Live Update with its chip, and API 29 the plain notification with a progress bar.

Where it differs from iOS, on purpose

  • Notifications instead of Live Activities. Android has no Dynamic Island or lock screen activity; an ongoing notification, promoted where the system allows it, is the nearest equivalent.
  • The finished notification is separate. "Ready to share" is posted under the Cap while the upload worker's foreground notification closes, so both can show for a moment.
  • Wording in code. The status lines live in Kotlin so that every kind and phase can be checked on the JVM against the iOS strings.
  • UI Automator 2.4.1 is added for the instrumented tests only. It brings two small modules of its own, all three Apache 2.0, and the README's test dependency row is updated.

Fixes from review

  • The analytics PR is merged in. It comes in at dacb7306f, with the settings layer it now carries, and again at 091f9bfbf with its own fixes from review, through a merge rather than a rebase, so the commits the device runs below were made on stay in the branch.

  • The Loom import phases follow the shared import checks. The upload PR's watchLoomImport already removes the import notification when its checks run out, and its upload queue stops every watch when the account changes. The Live Update phases for an import now run inside those checks through followLoomImport, so LoomImportWatchTest can run them against a local server.

  • An upload whose storage link cannot be renewed is kept. The upload PR renews an expired storage link through /api/mobile/uploads/:id/target, which feat(web): re-sign a mobile upload's storage target #4744 adds. Against a server without that route the renewal answers 404, storage refuses the old link with 403, and the worker used to delete the saved upload and fail it for good. It now keeps the upload and leaves WorkManager to try again, so the upload goes through once a server with feat(web): re-sign a mobile upload's storage target #4744 can renew the link. A renewed link that storage also refuses still fails as before. UploadTargetRefreshTest gains one test, and its test for a server without the route now expects the upload to be kept for another try.

  • The preparing notification stays until the worker takes over. It was removed as soon as the upload was queued, so while Android held the worker back, for example until there was a network, nothing showed that an upload was waiting. It now stays until the worker reports progress, which it does after posting its own notification, or until the work ends. Once the Cap exists the notification is tagged with the Cap's ID rather than a random one, so the worker clears it when it shows its own notification or finishes, even if the app was closed in between. UploadTest gains two tests for this.

Depends on

Tests

  • capkit, :capkit:test: 232 tests, 1 of them new in this PR.
  • JVM, :app:testDebugUnitTest: 472 tests, 10 of them new in this PR. Another 8 come in through the analytics PR: 6 from the settings commits and 2 from its fixes from review. LoomImportWatchTest (2): an import that never finishes is cleared after the last check, and a finished one stays as done. LiveUpdateTest (6): every kind and phase, fresh and stale, maps to the iOS status line; percentages round and stay in range; the screen recording wording; the cap://s link; the 2 percent or 2 second throttle; and the 45 second stale state, on virtual time.
  • Instrumented, new LiveUpdateShadeTest (1): a photo uploaded through the fixture leaves a notification titled with the file's name that says "Ready to share", read from the notification manager and, once the shade has opened, from the shade through UI Automator.

Device runs, connectedDebugAndroidTest once per API against the fixture server:

  • API 37 emulator, at 0ac84d286: 85 tests, 81 passed. LiveUpdateShadeTest failed, in the run and when the class was run again: the notification was posted with the right title and text, but the test looked for it before the shade had finished opening. 38847eef8 makes it wait for the text in the shade, and with that it passes on API 37. The other three failures are CapDetailTest playback tests: playAndPause and aShareLinkWithATimeOpensTheCapThere timed out waiting for Compose to go idle, and aChosenSpeedIsKeptAfterTheAppIsOpenedAgain found no "Playback speed 1×" button. They failed the same way when run again, and this PR does not touch playback.
  • API 29 emulator, at 38847eef8: 85 tests, 85 passed, LiveUpdateShadeTest included.

Checked

  • ./gradlew spotlessCheck :capkit:test :app:testDebugUnitTest :app:lintDebug :app:assembleDebug :app:assembleRelease :app:assembleDebugAndroidTest passes on the last commit, 6cb746a47: capkit 232 tests and JVM 472 tests with no failures, and no lint errors or warnings. It also passed on the earlier merge, 788ae5167, and before it, on 38847eef8.

Not checked

  • A late upload getting a fresh storage link from a real server and storage, which needs feat(web): re-sign a mobile upload's storage target #4744 deployed.
  • On a device: the stale re-post after 45 seconds, the dismissal timings and the taps. The shade and chip above come from posted notifications, not from a long real upload.
  • Whether the system promotes these notifications, which also depends on the user's settings.
  • That nothing is posted while the notification permission is denied. Revoking the permission ends the test process, so this is left to the guard in Notifications.post and a manual check.
  • A physical phone.

Confidence Score: 4/5RetriggerView in Greptile

The latest focus changes add no confirmed issue, but the existing Loom Cancel action still needs fixing before merge.

Findings

  1. P1 Cancel leaves Loom imports running ▶
  2. P2 Stalled uploads lose their names ▶
Fix with agent prompt
### Issue 1
apps/mobile-android/app/src/main/kotlin/so/cap/mobile/app/Notifications.kt:101-106
`Notifications.upload` adds “Cancel upload” to Loom imports, but `UploadActionReceiver` only stops work when the Cap has a `PendingUpload` record. Loom imports have no such record. Tapping Cancel only hides the notification; the import continues, and its next progress check posts the notification again.

Hide this action for imports until it can stop the import and its notification updates.

### Issue 2
apps/mobile-android/app/src/main/kotlin/so/cap/mobile/app/LiveUpdate.kt:75-77
`headline` now replaces the file name with a percentage, but `body` drops the file name when an upload becomes stale. After 45 seconds without an update, notifications show only a percentage and “Uploading in the background.” With several uploads, users cannot tell which file each Share or Cancel action belongs to without opening it.

Keep the file name in either the title or body in this state.

---

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

Summary

Adds Android Live Updates for uploads, Loom imports, and recording hooks.

  • Cap users can use the main mobile workflows in a native Android app.
  • Picked files stay visible in upload notifications through completion or failure.
  • Upload and Loom notices show what stage the work has reached.
  • The mobile API carries sign-in state and returns Cap sharing choices.
  • The test fixture follows the active organization selected by the app.

Reviews (20) · Last reviewed commit: "Merge commit '7c4199357efe874dec69abeef3..." · 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.

@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

@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

The switch put a Material ripple on its 44dp square touch target, so
pressing a toggle showed a grey box around the 44x26 track. CapTheme now
provides a press indication that fades the control's own pixels and draws
a focus ring only for keyboard focus, so every clickable, selectable and
toggleable in the design system presses without a box. The switch itself
stretches its knob while held, and CapSwitchTrack lets toggleable rows
show the same switch.
The sign-in and first-run heroes blurred each cloud with Modifier.blur
inside a fixed box. RenderEffect clips the blur to that box, the widest
box was squeezed to the screen width, a page-coloured slab under the
bottom cloud blurred into a black smear in dark mode, nothing outside
the hero was clipped, and API 29 and 30 had no blur at all. SkyHero now
draws the design's exact gradient, rings and clouds, renders the clouds
once into a software bitmap with BlurMaskFilter so every API level and
vendor gets the same result, clips to its bounds and ends in the page
colour. In dark mode the sky runs from blue into the page instead of
through a white cloud bank. Both heroes now reach under the status bar,
which gains a scrim once the page scrolls.
…ttings

Notification rows drew the stock Material switch, which is a different
size and colour from the 44x26 design switch every other settings row
uses. They now show CapSwitchTrack. The two switch lines on Recording
defaults each drew a top and a bottom hairline, so the rule between them
was twice as thick as every other divider.
Keeps this layer's theme root, which already wraps Root in the picture
in picture box.

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