Skip to content

Add Android Wi-Fi Direct browser companion - #11

Merged
MDHaarith merged 3 commits into
mainfrom
feature/android-wifi-direct-companion
Oct 23, 2026
Merged

MDHaarith merged 3 commits into
mainfrom
feature/android-wifi-direct-companion

Conversation

@MDHaarith

Copy link
Copy Markdown
Owner

Summary

  • Add an Android Wi-Fi Direct sharing session with QR codes and a browser companion for phones without the app.
  • Stream uploads and resumable downloads through the existing transfer engine, with session authentication, parallel uploads, and cleanup when sharing ends.
  • Document setup, permissions, security, and real-device performance limitations.

Testing

  • Android unit tests: 43 passed, 1 skipped.
  • Debug APK build completed.
  • Linux cargo test: 46 passed.
  • Real-phone transfer speed, 5 GHz behavior, iPhone connectivity, and group cleanup remain unverified.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-23T08:47:53.328087Z 0d4e81d New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: acae2c9b13

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

}
out.flush()
// shortcut: resumed ranges do not complete transfer history; track coverage if resume completion reporting is needed.
if (start == 0L && count == f.size) engine.browserDownloaded(t.id, f.id)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Complete transfers after a successful resumed download

When an interrupted download is resumed with Range: bytes=N-, the server successfully streams the remaining bytes but this condition prevents browserDownloaded from ever marking the file complete because start != 0. The transfer therefore remains TRANSFERRING after the browser has received the whole file and is eventually recorded as cancelled when the companion session closes; track acknowledged range coverage or otherwise complete a successfully resumed file.

Useful? React with 👍 / 👎.

The home screen now shows a "Share with a phone without the app" button,
which shifts every screen built on it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1d9b1523d5

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +41 to +44
if (ContextCompat.checkSelfPermission(context, permission) == PackageManager.PERMISSION_GRANTED) {
AirBridgeService.start(context); controller.start()
} else request.launch(permission)
onDispose { controller.dispose() }

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Restore the prior receiving state when leaving

When a user whose normal receiving service is disabled opens this screen, AirBridgeService.start() sets the persistent settings.receiving flag to true, but onDispose only disposes the Wi-Fi Direct controller. Returning home therefore leaves AirBridge visible and its foreground service running indefinitely, rather than limiting service lifetime to this companion session; preserve the previous setting and stop or restore the service when the screen closes.

Useful? React with 👍 / 👎.

Comment thread linux/ui/companion.js
if (!res.ok) throw new Error(data.message || "The computer refused");
let sentBefore = 0;
const loaded = files.map(() => 0);
const started = performance.now();

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Settle or cancel every parallel upload after a failure

If any one of the three concurrent XHRs rejects, Promise.all immediately enters the catch/finally path and clears session.busy, while the other worker loops continue uploading and may start additional queued files. The UI then reports failure and permits another send even though the receiver still has an active transfer, so a retry is rejected as busy and data continues moving in the background; abort the remaining XHRs or wait for all workers to settle before clearing the busy state.

Useful? React with 👍 / 👎.

- Wrap the handle around display cutouts
- Animate its pull, fade it while idle, and dim it in fullscreen

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0d4e81d39d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

if (Build.VERSION.SDK_INT >= 33) context.registerReceiver(receiver, filter, Context.RECEIVER_NOT_EXPORTED) else context.registerReceiver(receiver, filter)
registered = true
scope.launch { delay(30 * 60_000L); stop("Session timed out") }
scope.launch { delay(30_000); if (active && companion == null) stop("Could not create network. Enable Location on Android 12 or older, then retry.") }

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Fall back when no peer joins the 5 GHz group

When 5 GHz group creation succeeds but the other phone cannot see or join that band, companion is initialized as soon as the owner group forms, so this timeout no longer runs and the auto-band retry is never attempted; the only fallback is on createGroup failure. Such phones remain unable to connect for the entire session, so keep the timeout active until a peer/browser actually connects and then recreate the group with automatic band selection.

Useful? React with 👍 / 👎.

@MDHaarith
MDHaarith merged commit 85a839f into main Oct 23, 2026
4 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