Skip to content

fix(mobile): harden media input and keep session loading responsive - #3835

Merged
wgqqqqq merged 2 commits into
openBitFun:mainfrom
wgqqqqq:wgq/android-media-session-loading
Nov 9, 2026
Merged

wgqqqqq merged 2 commits into
openBitFun:mainfrom
wgqqqqq:wgq/android-media-session-loading

Conversation

@wgqqqqq

@wgqqqqq wgqqqqq commented Nov 9, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Android could crash when no photo picker or speech-recognition activity was installed, and general chat read selected photos on the UI thread. Opening a session could leave the previous screen visible while it loaded; creating a session also waited for model selection before loading its transcript. On iOS, history photos decoded at full resolution and speech partial results could overwrite manual edits made during dictation.

  • Recover from unavailable or denied system media activities with localized feedback. Keep dictation results scoped to the device/session that launched them, including recreation and callback updates.
  • Prepare general-chat photos asynchronously through the existing bounded image pipeline, retain newer attachments, and sample inline history images to thumbnail resolution.
  • Route pending session opens immediately into the existing conversation loading surface, while retaining compatibility with previously saved shell state.
  • Select a remotely committed new session immediately. Hydrate its transcript in parallel with model selection, preserve new typing and mailbox state, and wait for the selected model before submitting the initial instruction.
  • Bound iOS history image decoding with ImageIO (1024-pixel chat previews, 2560-pixel full-screen views), preserving camera orientation and rejecting invalid bytes.
  • Stop iOS dictation immediately on manual editor changes, including pending authorization; reject results after draft divergence or surface/session/target changes. Keep partial recognition corrections from duplicating text, and avoid deactivating unrelated audio when invalidating idle dictation.
  • Add media and lifecycle regression coverage. Update the image retry test to simulate the host stream reconnecting after its injected network failure.

Type and Areas

Type: bug fix

Areas: native Android and iOS, shared mobile session store

Motivation / Impact

Missing OEM/system media handlers now leave the app usable. Remote conversations open into a loading transition immediately, and a slow model-setting RPC no longer holds back an already-loaded transcript. Sending remains guarded during initialization. Platform activity handling stays in Android; the session lifecycle change stays in the shared feature store. No persisted field becomes required and no wire command or capability requirement changes.

Verification

AI-assisted; focused unit and Android/iOS simulator testing, without a live remote desktop or real speech-provider reproduction.

Passed on this branch, based on upstream main fcf05dd5a:

  • From src/apps/mobile/shared: ./gradlew :core-feature:jvmTest --tests '*RemoteSessionStoreTest' — 108 passed, including gated model initialization, model failure, draft retention and initial-message ordering.
  • From src/apps/mobile/android: ./gradlew :app:assembleDebug :app:testDebugUnitTest --tests '*AppShellStateTest' :app:assembleDebugAndroidTest — build passed; 12 shell-state tests passed.
  • From src/apps/mobile/android: ./gradlew :app:connectedDebugAndroidTest -Pandroid.testInstrumentationRunnerArguments.class=com.openbitfun.mobile.app.ComposerMediaInputTest,com.openbitfun.mobile.app.AccountRemoteScreenTest — 12 passed on a dedicated Android 17 emulator. Covers missing/denied handlers, photo resize/preview/send, unreadable media, dictation restoration/isolation, and remote screen presentation. Handlers/results are injected; real OEM speech providers were not exercised.
  • From src/apps/mobile/ios: ./Testing/run-pure-swift-tests.sh — passed, including actual ImageIO decode checks for 4000×3000 images, full-screen bounds, EXIF rotation, small/invalid images, and dictation partial correction/manual-edit protection.
  • From src/apps/mobile/shared: ./gradlew :core-feature:assembleOpenBitFunMobileCoreDebugXCFramework — passed; the iOS app links a newly generated core containing these session fixes.
  • From src/apps/mobile/ios: xcodebuild -project OpenBitFun.xcodeproj -scheme OpenBitFun -configuration Debug -destination 'platform=iOS Simulator,name=OpenBitFun Streaming QA iPhone' -derivedDataPath /tmp/OpenBitFun-iOS-PR3835 CODE_SIGNING_ALLOWED=NO build — passed with Xcode 26.3.
  • Same iOS build options plus -parallel-testing-enabled NO -only-testing:OpenBitFunUITests/PromptSuggestionUITests test — 1 passed on iOS 26.3; verifies composer draft fill, focus, and keyboard after the editor-binding change. Uses isolated preview data and does not send host commands.
  • pnpm run mobile:ui:check, project plutil -lint, and git diff --check passed.

All Gradle commands used Android Studio's bundled JBR; Apple builds used a process-local Xcode 26.3 developer directory. pnpm run mobile:architecture reports three existing findings: the ClientBuildContractTest reference to HarmonyOS and default arguments in AccountUiState / ConversationModels. The exact same findings reproduce on an unmodified archive of the upstream base; this PR does not change those files or the checker.

Remote scenarios: remote-control behavior exercised with simulated host commands/streams and native emulator tests. No live Relay/SSH, Peer Device Mode, or Detached Dispatch end-to-end run. Real microphone capture, speech permission dialogs/providers, and a full iOS remote conversation were not exercised; the iOS simulator run covers the composer UI. Latest main and open PRs were checked before porting the fixes; no existing PR was found covering these paths.

Reviewer Notes

The conversation loading UI is the existing layout; this changes when it becomes the active route. Unrelated connection-entry redesigns, HarmonyOS presentation edits, website content, and design demos are excluded. iOS keeps its existing native loading transition; there are no theme or layout changes. No permissions, persisted data, or transport formats change.

Checklist

  • This PR is focused and does not include secrets, temporary prompts, generated scratch files, or unrelated artifacts.
  • Relevant verification is recorded above, or skipped checks are explained.
  • User-facing strings, docs, and locales are updated where applicable.

@wgqqqqq wgqqqqq changed the title fix(android): keep media input and session loading responsive fix(mobile): harden media input and keep session loading responsive Nov 9, 2026
@wgqqqqq
wgqqqqq merged commit 51c3193 into openBitFun:main Nov 9, 2026
9 checks passed
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