Repository navigation
K2GO-376 feat(contentexchange): wireless Share receiver (scan + pull) - #697
Merged
Merged
Conversation
…rt carrier) Pull the sender-scoped items over the hotspot and import them through the existing flow. NetworkImportCarrier is the only sender-specific dependency (HTTP to the sender gate, token in the X-Share-Token header, 409-staging retry, per-connection Wi-Fi binding); stage and ingest are unchanged from the disk path. Add ShareUrls and ShareManifestReader (pure, unit-tested), ContentReceiveFragment (scan, fetch manifest, free-space preflight), ContentImportService.startNetwork, and ImportCarrier.onAllDelivered (POST /complete on a clean finish). Wi-Fi join uses the system invite QR (mirrors Clone); no new permission or dependency.
A receiver that is also hosting a hotspot owns 192.168.49.1 (the fixed LocalOnlyHotspot AP IP, the same one the sender uses), so the kernel traps the connection to the sender on loopback and the receiver reaches itself. Stop our own hotspot when Receive starts and wait until the sender IP is no longer a local interface (NetworkInterface sees p2p0; ConnectivityManager does not) before connecting.
The receiver pulls each item over plain HTTP from the sender hotspot/Wi-Fi IP; the loopback-only policy (ADFA-4714) blocked it. Share is LAN-only and token-gated, and the ad-hoc QR pairing cannot provision HTTPS.
…efresh Sender offers a selector when both a hotspot and a Wi-Fi address exist, so a peer on the same network pulls over Wi-Fi instead of the Wi-Fi Direct link. The QR re-renders on any network change (new DHCP IP) so it never carries a stale address.
Import has no box-prepare phase, so the export two-phase bar stayed at 0. Add a single-phase mode that fills 0..100 from the downloaded bytes.
Finish left the progress screen orphaned over the manager; show progress on its own back-stack entry so Finish pops cleanly. Also log the manifest-fetch exception that was silently swallowed.
Export/Share/Delete labels wrapped to two lines in their third-width slots; single line plus autosize (down to ~20%) keeps each on one line.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Add the receiver half of wireless Share (K2GO-376): join the sender hotspot (or
the same Wi-Fi), scan the invite QR, then pull the sender-scoped items over the
LAN from its cx-core /v1/share gate and import them through the existing import
flow. Also lands the fixes found bringing the two-phone flow up: permit cleartext
HTTP on the LAN pull, a hotspot/Wi-Fi transport selector on the sender QR, a
single-phase per-item progress bar, a clean receive-to-finish navigation, and
autosizing the manager action buttons.
Why
Share is the network twin of the merged disk Import: the only sender-specific
part is where the bytes come from. The LAN pull is plain HTTP (QR pairing cannot
provision HTTPS) and the share token gates each request; the app denied cleartext
by default (ADFA-4714 scoped it to loopback), which blocked the pull, so the base
config now permits cleartext. The sender may be reachable over its hotspot or over
shared Wi-Fi with different addresses, so the sender picks which address the QR
advertises.
Scope
X-Share-Token header never the URL, 409-staging retry, per-socket Wi-Fi pinning),
data/ShareManifestReader, domain/ShareUrls, presentation/ContentReceiveFragment
(scan, manifest summary, free-space preflight).
both addresses exist, with live QR refresh on network change (NetworkStateLiveData).
gated LAN Share. Reverses the loopback-only scope from ADFA-4714.
ImportProgressFragment, the ZXing ScanContract, ShareHandshake.decode, WifiNetworkBinder.
UI changes
New user-facing strings (parked in strings_untranslated.xml; migration to 33
locales is the follow-up PR):
nothing to receive.
New UI uses M3 tokens / MaterialButton styles (no hardcoded color), so both themes
follow; the action bar and transport selector were checked light and dark on device.
Verification
assembleStandardDebug + testStandardDebugUnitTest green (+2 JVM test files:
ShareUrlsTest, ShareManifestReaderTest). Two-pass code review done. End-to-end
two-phone flow verified on device (Samsung A16 sender -> Oppo receiver over Wi-Fi,
full scoped set imported).