feat: simplify receiving and remove arbitrary limits

- Use fixed port 8787 and reconnect automatically after Wi-Fi loss
- Remove session expiry, APK expiry, size caps, and upload deadlines
- Replace manual keys with watch-approved browser access
- Improve streaming, storage recovery, and resource cleanup
- Preserve explicit Android installation consent
- Document retained safeguards and expand emulator coverage
This commit is contained in:
Meghdad committed 2026-10-15 19:50:10 +03:30
1 parent 1a64de5515
commit 6e41db2a74
41 files changed
+1241 -561

No files matched your search

+24 -24
View File
@@ -1,45 +1,45 @@
# Architecture
Pakkit is a single Android application for Wear OS. The watch hosts both the native review/install experience and a static HTML/CSS/JavaScript interface delivered to a browser over local Wi-Fi.
Pakkit is a Wear OS application that serves its bundled HTML/CSS/JavaScript interface to a browser over Wi-Fi. The watch owns access approval, package review and Android installation. The browser can transfer files and observe state; it cannot request installation.
## Ownership
| Package | Responsibility |
| --- | --- |
| `ui` | Native watch views, circular scrolling, QR, browser approval and package review |
| `transfer` | Live receiving state, Wi-Fi lifecycle, fixed-port server, browser access and streamed HTTP bodies |
| `apk` | Inspected metadata, content/compatibility checks, streaming integrity and durable state model |
| `data` | Private files and one durable package review |
| `install` | User-requested Android sessions, system consent and verified installer callbacks |
| Package | Responsibility |
| ---------- | -------------------------------------------------------------------------------------------- |
| `ui` | WatchActivity, round scrolling, status glyphs and watch design tokens |
| `transfer` | Receiving state, Wi-Fi service, local HTTP endpoint, framing and bounded upload body |
| `apk` | APK metadata, package inspection, compatibility/space/integrity rules and typed review state |
| `data` | PackageStore: one staged APK and its durable review/installation state |
| `install` | ApkInstaller, validated system callback and pending system approval intent |
The native UI composes Android platform views. The web app is served directly from `app/src/main/assets/web`; there is no frontend build step, CDN, WebView, account, backend or internet requirement for transfer. The only explicit runtime library is ZXing Core. A separate Gradle application under `qa/fixture` supplies a signed test APK exclusively to the instrumentation APK.
There is no frontend build step, CDN, cloud relay, account or transfer backend. ZXing Core is the only explicit runtime library. `qa/fixture` supplies a signed test APK to instrumentation only; browser tools and large generated fixtures never ship.
## Receiving lifecycle
WatchActivity starts ReceiveService only after an explicit action. The non-exported connectedDevice foreground service owns the notification/stop action, a requested Wi-Fi network, a timed partial CPU wake lock and a ten-minute deadline. It waits for link properties and binds LocalHttpServer to that network’s private IPv4 address and an ephemeral port. Network loss or address change ends the session. START_NOT_STICKY and absence of boot receivers prevent automatic resurrection.
An explicit watch action starts the non-exported connectedDevice foreground service. It requests Wi-Fi without a product timeout and listens on **8787**. IPv4 is preferred; unscoped IPv6 is supported. Only an actual local interface address is bound. A busy port is a clear failure, not an instruction to fall back to a random port.
LocalHttpServer owns the listener, two workers, four queued connections, tracked sockets, HTTP routing and one streamed upload. Service teardown closes the listener and accepted sockets, stops workers, unregisters the Wi-Fi callback, removes callbacks and releases the CPU lock. The display is not held awake. The session can continue while the display sleeps, subject to firmware and OS constraints.
Network loss closes the listener and active sockets, resets live transfer progress and leaves receiving enabled. The outstanding network request supplies new link properties; the listener rebinds automatically. Browser access belongs to the service and survives a listener rebind. An IP change still requires opening the new address. Stop, OS timeout and destruction close network resources and clear access. START_NOT_STICKY and the absence of boot receivers prevent silent reopening after process death.
`Receiving` holds an immutable, volatile snapshot in memory. Updates are tagged with the owning service instance, so a stopped session’s workers cannot change a later session. UI notifications are coalesced onto the main thread and observers are removed on pause. Private links and byte counters are never written to preferences. Process death invalidates the session; the user starts a fresh one.
Idle receiving holds no CPU wake lock. An actual upload/inspection owns one, released in finally. Two workers, four queued sockets, exact HTTP framing and idle-read protection bound concurrent resource use. A header parsing budget prevents slow headers from retaining a worker indefinitely. These do not impose a transfer-duration or package-size ceiling. Screen-off operation remains subject to the OS and firmware.
## Durable package state
`Receiving` publishes an immutable in-memory snapshot through coalesced main-thread observers. Service ownership and listener-close guards prevent stale workers from modifying later state. The server's close/commit lock prevents a file being staged after Stop. UI observers are removed on pause; byte counters and browser credentials are not persisted.
PackageStore retains one PendingApk: UUID, creation time, inspected metadata, an InstallState, detail and optional installer session ID. It preserves a stable private storage schema across application updates. All writers share a lock; staging refuses replacement of an existing review, and updates require the current package ID. Dismissed reviews cannot be resurrected by late callbacks.
## Browser access
Files use app-private UUID filenames. Complete APKs remain eligible for review for 24 hours. Launch cleanup removes expired reviews and old unreferenced files. Partial/rejected uploads are deleted in a finally block. Installation success or dismissal deletes the staged APK. Expiry is an eligibility deadline with lazy disk cleanup, not a scheduled background deletion promise.
The QR and displayed address are ordinary URLs without secrets. On page load, a same-origin POST requests browser access. The watch shows the browser/device description and peer address. Its Allow/Not now actions approve or deny a random, session-only access credential. The browser stores the credential in localStorage isolated to this scheme/host/port and sends it in Authorization headers. Reloads and tabs in the same browser profile do not ask again. Storage-denied browsers use memory and may need approval after reload. An explicit retry can request approval after denial. Unknown peers cannot replace the prompt already under consideration. One pending slot bounds unauthenticated request allocation; further decision records require a watch action. Approvals have no time or browser-count quota.
## HTTP and trust
Only approved credentials can observe package status or upload. Host and POST Origin must resolve numerically to this listener's address/port; IPv6 compression is normalized without allowing hostnames. Static assets come from a fixed allowlist. CSP, no-cache/no-referrer/nosniff, no CORS and no framing remain in force. HTTP is unencrypted and requires trusted networking; authentication does not provide transport confidentiality.
Each session generates a 192-bit random key embedded in the private URL fragment. JavaScript removes it from visible history after page load and keeps it in memory for Authorization headers. A reload without the fragment requires the key again. A fixed asset allowlist prevents filesystem traversal. APIs require the key; uploads also require the exact Origin. Exact Host validation resists DNS rebinding. No CORS, framing, external scripts/styles/fonts, cached responses or browser-controlled installation endpoints are enabled.
## Streaming and storage
HttpProtocol accepts a small HTTP/1.1 subset: GET/POST, one request per connection, 8 KiB total headers, 4 KiB lines, unique headers and no chunked/Expect framing. Uploads require decimal Content-Length in 1..50 MiB and application/octet-stream. UploadBody reads exactly that length, treats truncation as failure and reports progress at most four times per second. A 64 KiB buffer writes the private file while computing SHA-256. Storage reserve and bounded ZIP/manifest inspection precede review. SDK, ABI, complete-package and self-update checks are centralized in the APK package.
Uploads use File/XHR and raw octet-stream with a positive, 64-bit Content-Length. There is no application byte ceiling or total-duration timeout. A 64 KiB buffer writes to an app-private UUID file while computing SHA-256. UploadBody reads exactly the declared length and throttles progress updates. Available disk bytes are checked before writing; ENOSPC and interrupted reads fail with recovery copy and delete the partial file.
Local HTTP is unencrypted. Link secrecy and Host/Origin/hash checks do not protect against a LAN observer or active attacker. Use a trusted network. Possession of the link allows file submission, while watch review and the Android installer remain separate consent boundaries.
Receipt inspects ZIP directory and Android metadata without unpacking assets into memory. Complete-package, SDK, processor and Play self-update policy checks precede review. There are no arbitrary directory-entry, expanded-data or manifest-size caps. Android's parser, package format and device resources still impose real constraints.
PackageStore retains PendingApk with UUID, receipt time, metadata, state, detail and installer session ID. The private schema remains stable across updates. A review never expires by age. PakkitApplication cleans unreferenced files at process startup, before any upload exists; activity recreation cannot delete a transfer in progress. Success/removal deletes the staged file. A new upload can replace a terminal installed/failed review. An unfinished review is preserved. Updates require the matching package ID, so dismissed reviews cannot be resurrected.
## Installation
InstallState progresses from READY to INSTALLING, then CONFIRM when Android requires user action, and finally INSTALLED or FAILED. ApkInstaller runs off the main thread only after the watch’s Install action. It rechecks source trust, expiry, private-file digest and compatibility before creating a MODE_FULL_INSTALL session with USER_ACTION_REQUIRED. It never bypasses source approval, verification or system consent.
Only a watch action starts ApkInstaller. Returning from granting source permission continues that specific request. The worker verifies source trust, the saved file's digest, current SDK/ABI compatibility and space for the staging copy. It reuses the receipt metadata proven by the digest, rather than repeating archive inspection. Android's installer determines actual installation allocation and verifies the package.
The explicit mutable PendingIntent targets a non-exported InstallReceiver. The receiver requires the active package ID, a non-null matching session ID and an installation/confirmation state. A pending action exposes only Android’s returned confirmation intent, through the watch UI or an immutable notification PendingIntent. State changes refresh the UI through PackageStore preferences; the receiver does not hold an Activity reference. Interrupted confirmation can be retried.
MODE_FULL_INSTALL and USER_ACTION_REQUIRED preserve supported system consent. The non-exported receiver accepts only the active job, matching non-null session ID and expected state. When Pakkit is visible, Android's returned consent intent opens once automatically; Continue is available for recovery. Optional notification denial does not block in-app approval. Native INSTALLED state only follows Android STATUS_SUCCESS.
Optional notification denial leaves the in-app consent flow usable. Firmware that cannot expose usable source approval or installation consent is unsupported for external installs and directs users to Google Play. Read PLATFORM.md and RELEASE.md before making distribution claims.
See [restriction rationale](RESTRICTIONS.md), [platform constraints](PLATFORM.md) and [validation](VALIDATION.md) for the distinction between product behavior and OS/distribution requirements.
+4 -4
View File
@@ -13,9 +13,9 @@
## Themes and layout
The native watch UI uses midnight `#090B17` to limit lit OLED pixels, lavender-white text and semantic mint/error surfaces. Body and secondary copy, badges and action gradient endpoints have automated contrast checks. Actions have a minimum 48 dp height and scalable text. Proportional margins and bottom padding allow controls to move into the usable center of a round display. The QR is sized to screen width and positioned within the circular safe area; the full URL and connection disclosure are available through **View link**, with native back navigation. The home screen pairs a compact parcel/wordmark with a visible receiving action. Source permission is requested at the app review, where its purpose is clear.
The native watch UI uses midnight `#090B17` to limit lit OLED pixels, lavender-white text and semantic mint/error surfaces. Body and secondary copy, badges and action gradient endpoints have automated contrast checks. Actions have a minimum 48 dp height and scalable text. Proportional margins and bottom padding allow controls to move into the usable center of a round display. The QR is sized to screen width and positioned within the circular safe area; the ordinary fixed-port address is readable below the QR, without a link-details step. The home screen pairs a compact parcel/wordmark with a visible receiving action. Source permission is requested at the app review, where its purpose is clear.
The browser leads with the official tagline, original parcel artwork and a compact Choose / Send / Wear indicator. Mobile layouts omit the redundant journey explainer. It follows prefers-color-scheme with an explicit in-session toggle. Dark is midnight with violet/cyan lighting; light uses soft lavender and white surfaces. A two-column desktop layout becomes a single-column layout at smaller widths. The maintained CSS, HTML and JavaScript are readable source files, formatted with the optional web development tools. Native browser controls, semantic headings, focus rings, file labels and a live status region support keyboard and assistive access.
The browser leads with the official tagline, original parcel artwork and a compact Choose / Send / Wear indicator. The compact state indicator replaces a lengthy journey explainer. It follows prefers-color-scheme with an explicit in-session toggle. Dark is midnight with violet/cyan lighting; light uses soft lavender and white surfaces. A two-column desktop layout becomes a single-column layout at smaller widths. The maintained CSS, HTML and JavaScript are readable source files, formatted with the optional web development tools. Native browser controls, semantic headings, focus rings, file labels and a live status region support keyboard and assistive access.
## Motion and product states
@@ -32,7 +32,7 @@ Write for the person wearing the watch: short, warm, specific and calm. Let the
| Moment | Watch | Browser |
| --- | --- | --- |
| Start | Pakkit + official tagline; Start receiving | Official tagline; Choose app |
| Connect | Scan to send; View link | Connected to your watch |
| Connect | Scan to connect; Allow browser | A quick hello; Connected to your watch |
| Transfer | On its way + actual percentage | On its way + actual percentage |
| Check | Just checking… | Just checking… |
| Review | Ready to install; Install or contextual Allow installs | Made it to your watch |
@@ -40,4 +40,4 @@ Write for the person wearing the watch: short, warm, specific and calm. Let the
| Success | All yours.; Open app | Looks good on you. |
| Failure | Couldn’t install + specific recovery | Let’s try that again + specific recovery |
Watch screen copy lives in Android string resources. Deliberately written package-validation messages are marked with `UserMessage`; unknown file/platform exceptions are replaced with recovery copy at the UI boundary, while installer diagnostics stay in logs. Notification copy follows the same voice. The app name and official tagline are shared branding resources. Browser result changes are announced with a live region, and color is never the only state indicator.
Watch screen copy lives in Android string resources. Deliberately written package-validation messages are marked with `UserMessage`; unknown file/platform exceptions are replaced with recovery copy at the UI boundary, while installer diagnostics stay in logs. Notification copy follows the same voice. There are no key-entry forms, expiry countdowns, file-size warnings or repeated watch-layout warnings. The app name and official tagline are shared branding resources. Browser result changes are announced with a live region, and color is never the only state indicator.
+17 -6
View File
@@ -14,8 +14,8 @@
```sh
./gradlew :app:assembleDebug :app:assembleDebugAndroidTest :app:testDebugUnitTest :app:lint :app:bundleRelease
adb devices
python 3 scripts/test-emulators.py --watch emulator-5554 --skip-build
python 3 scripts/test-emulators.py --watch emulator-5554 --small --skip-build
python3 scripts/test-emulators.py --watch emulator-5554 --skip-build
python3 scripts/test-emulators.py --watch emulator-5554 --small --skip-build
```
Use actual serials from `adb devices`. The runner refuses serials that do not start with `emulator-` and requires the watch feature. It never selects a physical device. It connects the watch to the virtual AndroidWifi access point, installs only the app/test APKs and saves results under `app/build/reports/validation`. The small-screen run temporarily uses 192 dp and 1.3x font scaling, restoring the previous size, density and font setting in a finally block.
@@ -33,7 +33,7 @@ npm test --prefix web-tests
npm run format:check --prefix web-tests
```
These tests serve the actual bundled assets with a local API fixture and exercise 320/390/768/1440 px widths, both themes, manual session-key entry, file rejection, upload errors/retry, system-status transitions and cancellation. This isolates browser interactions; it does not stand in for watch networking. An existing Chromium executable can be selected with PLAYWRIGHT_CHROMIUM_EXECUTABLE_PATH.
These tests serve the actual bundled assets with a local API fixture and exercise 320/390/768/1440 px widths, both themes, watch-approval/denial/retry states without manual keys, empty-file rejection, a 64 MiB streamed browser upload, upload errors/retry, system-status transitions and cancellation. This isolates browser interactions; it does not stand in for watch networking. An existing Chromium executable can be selected with PLAYWRIGHT_CHROMIUM_EXECUTABLE_PATH.
Playwright and Prettier are development dependencies only, locked in web-tests/package-lock.json. There is no Node toolchain in the Android runtime or asset build. `npm run format --prefix web-tests` formats web assets and browser tests; use standard Kotlin formatting for native source.
@@ -42,12 +42,23 @@ Playwright and Prettier are development dependencies only, locked in web-tests/p
Complete Chrome’s first-run setup in the Android Emulator, leave Chrome open, and run:
```sh
python 3 scripts/test-emulators.py --watch emulator-5554 --browser emulator-5556 --skip-build
python3 scripts/test-emulators.py --watch emulator-5554 --browser emulator-5556 --skip-build
```
Both emulators must use the shared virtual Wi-Fi network. Android Emulator 36.5+ [supports direct communication between emulator instances](https://developer.android.com/studio/run/emulator-networking-interconnect). The runner starts Pakkit through its visible receiving action, reads the private link from the actual watch UI, connects Playwright to Chrome on the Android Emulator through a local ADB forward, and submits the signed QA fixture. Chrome sends the real XHR directly to the watch’s private Wi-Fi address. The test asserts watch review, then dismisses the fixture and ends the session. Debug forwarding is test infrastructure; no debug endpoint or test mode ships in Pakkit. The forward is removed afterward and the watch app is stopped even on failure.
Both emulators must use the shared virtual Wi-Fi network. Android Emulator 36.5+ [supports direct communication between emulator instances](https://developer.android.com/studio/run/emulator-networking-interconnect). The runner starts Pakkit through its visible receiving action, reads the fixed-port address from the actual watch UI, connects Playwright to Chrome on the Android Emulator through a local ADB forward, approves the browser using the visible **Allow browser** watch control, and submits the signed QA fixture. Chrome sends the real XHR directly to the watch’s private Wi-Fi address. The test asserts watch review, then dismisses the fixture and ends the session. Debug forwarding is test infrastructure; no debug endpoint or test mode ships in Pakkit. The forward is removed afterward and the watch app is stopped even on failure.
An uninitialized Chrome instance or isolated/older emulator network requires environment setup; the runner does not silently substitute mock transport. Keep private session URLs out of committed logs. Generated screenshots and API summaries live under app/build/reports/validation.
An uninitialized Chrome instance or isolated/older emulator network requires environment setup; the runner does not silently substitute mock transport. No URL token or manual session key is used. Generated screenshots and API summaries live under app/build/reports/validation.
## Large APK validation
Build the normal fixture, then generate a separately signed fixture with a stored 64 MiB asset:
```sh
python3 scripts/create-large-fixture.py
python3 scripts/test-emulators.py --watch emulator-5554 --browser emulator-5556 --large --skip-build
```
The resulting APK is about 66 MiB. `--bytes` can select another asset size based on the test device's actual storage. The generator copies and signs incrementally, does not modify source assets, and writes only under ignored app/build/qa. Chrome receives the test file in its own emulator storage; CDP selects that file directly, avoiding Playwright's unrelated 50 MB in-memory buffer limit. The real web app uploads the File using XHR. Generated large fixtures are never included in the app/test APK or release bundle. The runner removes the Chrome-side copy afterward.
## Fixture and release inspection
+3 -3
View File
@@ -4,7 +4,7 @@
Pakkit requests a local Wi-Fi connection, hosts its browser assets and accepts a complete APK. Watch review initiates the public Android PackageInstaller session with user action required. Receiving a file is not proof that firmware permits installation.
[Wear OS network guidance](https://developer.android.com/training/wearables/data/network-communication) documents independent HTTP/TCP/UDP access. Pakkit uses a requested Wi-Fi network and a listener bound to its private IPv4 address; a proxied/default internet route is insufficient for inbound LAN access. Guest-network isolation, VPNs, firewalls and browser local-network restrictions can prevent access. IPv6-only networks and resumable/split-package uploads are outside the current scope.
[Wear OS network guidance](https://developer.android.com/training/wearables/data/network-communication) documents independent HTTP/TCP/UDP access. Pakkit uses a requested Wi-Fi network and a listener bound to its Wi-Fi IPv4 or unscoped IPv6 address on port 8787; a proxied/default internet route is insufficient for inbound LAN access. Guest-network isolation, VPNs, firewalls and browser local-network restrictions can prevent access. Link-local IPv6 addresses that require client-specific zones and byte-range resume are not supported. Split-package sets require a separate multi-file installation flow.
[Standalone Wear apps](https://developer.android.com/training/wearables/apps/standalone-apps) support a QR/browser flow. The manifest declares required watch hardware and standalone=true. A watch’s OEM onboarding requirements remain independent of Pakkit’s transfer functionality.
@@ -14,11 +14,11 @@ Pakkit requests a local Wi-Fi connection, hosts its browser assets and accepts a
[PackageInstaller](https://developer.android.com/reference/android/content/pm/PackageInstaller) supports sessions, pending system user action and final success/failure results. Pakkit explicitly requires user action and handles Android’s returned consent intent. A source setting or API existing on Android does not establish that every Wear OS firmware exposes usable permission/confirmation UI. Unsupported firmware directs the user to Google Play. No root, privileged installer, hidden component, debugging client or verification bypass is implemented.
APK inspection checks size, bounded archive structure, readable signing metadata, complete-package status, SDK, ABI and storage reserve. It rejects Pakkit self-updates. It does not certify malware safety, final signature validity, runtime behavior, every hardware feature or a suitable circular layout. Android makes the final installation decision. Verification/security policy can block an otherwise well-formed upload.
APK inspection checks actual package content, readable signing metadata, complete-package status, SDK and ABI. File sizes are constrained by device storage and Android, not a product ceiling. It rejects Pakkit self-updates. It does not certify malware safety, final signature validity, runtime behavior, every hardware feature or a suitable circular layout. Android makes the final installation decision. Verification/security policy can block an otherwise well-formed upload.
## Lifecycle and permissions
A user-started [connectedDevice foreground service](https://developer.android.com/develop/background-work/services/fgs/service-types#connected-device) supports a bounded local transfer with an external device. CHANGE_NETWORK_STATE supports the Wi-Fi request and this service type’s prerequisite. The service exposes a stop action and releases its network/CPU resources at termination. This design bounds resource use but does not replace hardware battery/thermal testing.
A user-started [connectedDevice foreground service](https://developer.android.com/develop/background-work/services/fgs/service-types#connected-device) supports user-controlled local transfer with an external device. CHANGE_NETWORK_STATE supports the Wi-Fi request and this service type’s prerequisite. The service exposes a stop action and releases its network resources at termination. CPU wake ownership exists only while receiving/inspecting an actual file. This design bounds resource use but does not replace hardware battery/thermal testing.
[Local network protections](https://developer.android.com/privacy-and-security/local-network-permission) apply to incoming TCP too. Target 36 uses INTERNET for implicit local access. Before raising the target to 37, implement/test ACCESS_LOCAL_NETWORK runtime consent. Browser permissions can impose separate constraints. Keep this guidance aligned with the target SDK and supported firmware.
+5 -3
View File
@@ -2,12 +2,14 @@
Pakkit transfers the APK you select in a browser directly to your Wear OS watch over local Wi-Fi. The browser assets and QR generation are bundled with the watch application. No account, backend, analytics, advertising, remote font or cloud relay is used.
Receiving sessions generate a private URL/key that stays in process memory. Keep the link private and use trusted Wi-Fi. Local HTTP is unencrypted: someone able to observe or alter network traffic may access it. Pakkit removes the key from visible browser history after loading; the browser and operating system still control their own browsing data and behavior.
The watch displays an ordinary local address and QR code. A browser requests access and the user approves it on the watch. The watch keeps a random access credential plus the approval decision in process memory. The browser stores the credential in localStorage for Pakkit’s exact origin (scheme, host and port), and sends it automatically only to this app’s API. Browser/device descriptions are inferred from request headers, and the peer's network address is shown for approval. There is no manual key entry. Approvals are cleared when receiving stops or the process ends. Browsers control their own site-storage retention. A stored credential becomes unusable when the watch clears its receiving session, even if it remains in browser storage.
Local HTTP is unencrypted: someone able to observe or alter network traffic may access it. Use Wi-Fi you trust. Watch approval is access control, not encryption.
APKs and package-review metadata are stored in private watch storage. Pakkit reads package/signing metadata and computes a hash to detect corruption or changed staged files. This is not malware certification. Installation requires your watch action and Android’s system consent. Android can independently verify or block packages under its own policies.
Partial/rejected uploads are deleted. Successful installation or dismissing the review deletes the staged file. Pending APKs expire for installation after 24 hours and are cleaned on the next app launch; they may remain in private storage until then. Pakkit retains one durable review. Backups and device transfer of private app data are disabled. Uninstalling Pakkit removes its private data; installed apps are separate.
Partial/rejected uploads are deleted. Successful installation or dismissing the review deletes the staged file. Pending APKs do not expire by age. Uncommitted files left by process interruption are removed at the next process startup. A new upload may replace an installed or failed review. Pakkit retains one durable review. Backups and device transfer of private app data are disabled. Uninstalling Pakkit removes its private data; installed apps are separate.
Sessions end within ten minutes, on Wi-Fi loss or when stopped. Ending network access does not cancel an already committed Android installation. Process death requires a new session and key.
Receiving remains enabled until the user stops it or the operating system ends it. Network loss suspends the listener and interrupts an active upload; receiving resumes when Wi-Fi returns. Ending network access does not cancel an already committed Android installation. Process death requires starting receiving and approving browser access again.
Before publication, supply the legal developer identity, support contact and hosted privacy-policy URL. Reconcile the final binary, system behavior and Google Play Data safety declaration. This file is the product disclosure source, not a completed Play submission.
+56
View File
@@ -0,0 +1,56 @@
# Product restrictions and their reasons
Pakkit should finish useful work, not stop because a product timer or file-size preset ran out. This audit covers receiving, browser access, files, lifecycle, installation and resource use.
## Removed or redesigned
| Previous behavior | Current behavior |
| --- | --- |
| Receiving ends after ten minutes | No app-imposed session deadline. Receiving stays on until stopped or the OS ends it. |
| Wi-Fi loss ends receiving | The listener closes, interrupted uploads are discarded, and the service waits for Wi-Fi. It binds again automatically. Browser approvals survive a rebind in the same service. |
| A new port for every session | Port **8787**, including after restarts. A genuine port collision is reported rather than silently changing the address. |
| URL secrets and manual key entry | A normal address and QR code. The browser requests access automatically; the watch approves it once per receiving session. A session-only credential stored in browser-origin storage handles subsequent requests and reloads. No keys appear in the interface, address or history. |
| 50 MiB APK limit | No application size ceiling. Positive 64-bit lengths, streaming, available storage and Android's installer determine what fits. |
| Five-minute browser upload deadline | No total XHR deadline. An upload can continue as long as data keeps arriving. |
| 24-hour expiry of a received APK | A pending review remains available until removed or installed. Process-start cleanup only deletes uncommitted/orphaned files. |
| Three-times-file-size reserve plus 20 MiB | Upload checks the bytes needed for the incoming file. Installation checks space for its staging copy; Android handles actual extraction/allocation failures. No multiplier or arbitrary reserve. |
| ZIP entry count, individual-entry, expanded-total and manifest-size caps | No preset archive caps. Inspection reads ZIP directory metadata and Android package metadata without unpacking all assets or loading the APK into memory. Runtime/parser limits remain real hardware constraints. |
| Rejection based on the browser filename | File extension is a picker hint, not an acceptance rule. The watch validates actual APK content. Empty files still cannot be installed. |
| Private IPv4 address required | Wi-Fi IPv4 or reachable, unscoped IPv6 addresses. Equivalent IPv6 spellings are accepted by the Host/Origin checks. |
| Repeated archive inspection at install | One inspection at receipt. A streamed digest verifies that those bytes are unchanged before installation; current SDK/ABI checks and Android verification still apply. |
| Separate Continue tap for normal system consent | A visible Pakkit activity opens Android's returned approval intent once. Continue remains a recovery action, not an obligatory extra step. Returning from granting source permission continues the requested installation. |
| Clear a finished/failed review on the watch before sending another | The browser can choose another app immediately. A new upload replaces terminal reviews. |
| Watch-layout warning based on a missing optional feature flag | Removed. Absence of that declaration does not prove the app will fail or have an unsuitable layout. |
| Duplicate trust warnings in the review | Installation remains an explicit decision, without repeating warnings at each step. Connection privacy details remain accessible in the browser. |
## Retained protections
| Protection | Concrete reason |
| --- | --- |
| Start/Stop receiving and foreground-service visibility | User control over a network listener and its battery/network use. No boot start or automatic restart after process death. |
| Watch approval for a new browser | An address on a shared network is not authentication. Nearby devices must not be able to upload unsolicited files. Browser descriptions are hints; they are not verified identities. |
| Revocation on Stop/process death | Explicitly closing receiving must revoke access. No trust survives a new receiving service. |
| One pending browser request | An unauthenticated peer cannot allocate an unbounded request list or replace the prompt under consideration. Each additional decision record requires a watch action. Existing approvals are not evicted by a time or browser-count quota. |
| Literal Host and same-origin POST checks; no CORS; origin-scoped credentials; CSP | Protects against DNS rebinding, cross-site submissions and unnecessary script access to credentials. IPv4/IPv6 normalization does not permit arbitrary hostnames. |
| 8 KiB headers, 4 KiB lines, unique headers, exact Content-Length | Bounds unauthenticated parsing memory and prevents ambiguous framing, request smuggling and unbounded body reads. Browser File/XHR supplies a length; chunked/Expect/pipelined bodies are not part of this endpoint. |
| Five-second header parsing budget and 15-second read inactivity timeout | Abandoned or deliberately stalled sockets must not occupy the watch's small worker pool forever. These measure stalled request I/O, not receiving-session age or total transfer duration. A slow but continuously progressing upload has no total deadline. |
| Five-second browser status probe | Detects an unreachable receiver and retries automatically. It neither cancels uploads nor expires access. |
| Two workers, four queued sockets, one active upload | Bounds threads, open sockets, concurrent disk writes and CPU wake ownership on the watch. Extra connections retry; no package size limit follows from this resource bound. |
| One unfinished package review | Prevents a new upload from overwriting an app currently under review or installation. Finished/failed reviews do not block the next upload. This is Pakkit's bounded workflow, not an Android package-count restriction. |
| Complete, readable, signed APK; SDK/processor checks | A partial/split APK cannot be installed alone by this single-APK flow, and Android rejects incompatible or unsigned packages. Package inspection is not malware certification. |
| Private UUID paths, digest check, matched installer callback/session | Prevents traversal, changed staged files and stale/forged callbacks changing the current review. |
| Pakkit self-updates use Google Play | The [REQUEST_INSTALL_PACKAGES policy](https://support.google.com/googleplay/android-developer/answer/12085295?hl=en) restricts self-update use. Removing this check would compromise the intended distribution model. |
| Source approval, explicit watch install action and system consent | Supported [PackageInstaller](https://developer.android.com/reference/android/content/pm/PackageInstaller) behavior and user control. Browser access never authorizes installation. |
| Minimum API 31 | The implementation explicitly uses USER_ACTION_REQUIRED and other API 31 native behavior. Supporting older systems would require a separately tested compatibility path, not deleting a guard. |
## Actual limits and recovery
No arbitrary byte ceiling does not mean infinite capacity. Android file lengths and installer sizes use signed 64-bit values; actual disk capacity, package format, parser memory, firmware security policy and available system installation UI remain authoritative. Storage checks are snapshots: another app can consume space afterward. ENOSPC failures produce a storage recovery message and partial files are deleted.
The worker hashes and writes using a 64 KiB buffer. APK assets are not inflated in memory. CPU wake ownership is limited to an actual upload/inspection and released in finally; idle receiving holds no CPU wake lock. Wi-Fi is requested for as long as receiving is enabled. Long screen-off availability, firmware power management, thermal behavior and battery consumption still require hardware measurement. The OS may suspend or stop background execution; Pakkit does not promise to defeat that behavior. See [Wear networking](https://developer.android.com/training/wearables/data/network-communication) and [foreground-service types](https://developer.android.com/develop/background-work/services/fgs/service-types#connected-device).
Partial uploads restart from the beginning, with the selected browser File retained for retry. Byte-range resume is not implemented. Link-local IPv6 addresses requiring a client-specific zone identifier cannot be advertised portably; the receiver prefers IPv4, then unscoped IPv6. Wi-Fi isolation, firewalls, browser permissions and address changes are network/platform constraints. The port is fixed; the router still assigns the watch's IP address.
HTTP remains unencrypted. Watch approval and credentials do not defend against a party able to read or alter LAN traffic. The product is for trusted networks; no remote relay, router port-forwarding feature or internet exposure is configured by Pakkit. The browser's connection details explain this without an additional confirmation dialog.
Credentials are origin-scoped rather than cookies: [HTTP cookies share a host across ports](https://www.rfc-editor.org/rfc/rfc6265#section-8.5), while [Web Storage is origin-isolated](https://html.spec.whatwg.org/multipage/webstorage.html). Another app serving a different port on the watch must not inherit Pakkit access. The bundled script uses automatic Authorization headers only for its relative API requests; no credential appears in the address or interface. Local storage is not encryption and remains readable by same-origin script, which is why external scripts, inline script and untrusted HTML rendering are excluded.
+10 -10
View File
@@ -8,10 +8,10 @@ See DEVELOPMENT.md for the commands and environment setup. Results are generated
| Check | Scope |
| ------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| JVM tests | Bounded copy/digest, IDs, expiry, SDK/ABI/storage policy, strict HTTP framing/auth/length, exact upload-body reads and progress throttling, native watch contrast |
| Wear instrumentation | Signed archive inspection, self-update/invalid archive rejection, typed storage persistence/expiry, late callback rejection, changed-file rejection, official system consent, real socket upload/auth/Host/Origin/size checks, stop cleanup, stale-worker isolation, circular QR and reachable actions |
| JVM tests | Streaming copy/digest beyond the previous limit, IDs, SDK/ABI/available-storage policy, strict HTTP framing/authority/64-bit lengths, watch-gated browser access, exact upload-body reads and progress throttling, native watch contrast |
| Wear instrumentation | Signed archive inspection, self-update/invalid archive rejection, typed storage persistence without expiry and failed-write rollback, late callback rejection, changed-file rejection, official system consent, real socket upload/access/Host/Origin/storage checks, stop cleanup/revocation, upload wake-lock release, stale-worker isolation, Wi-Fi reconnection, IPv6 listener/port collision behavior, circular QR and reachable actions |
| Small round screen | Review controls and QR geometry at 192 dp with 1.3x text, restoring emulator configuration afterward |
| Browser UI | Four widths, dark/light, private-key entry, invalid files, error/retry, watch/system-status transitions and cancellation, using actual assets with an API fixture |
| Browser UI | Four widths, dark/light, keyless approval/denial/retry, reload and cross-port credential isolation, invalid files, error/retry, watch/system-status transitions and cancellation, using actual assets with an API fixture |
| Android-to-Wear transfer | Chrome on Android Emulator -> actual Wi-Fi HTTP listener on Wear OS Emulator -> verified signed APK waiting for watch review |
| Release | Clean debug/test/release builds, Android lint, dependency and merged-manifest inspection, fixture exclusion from consumer artifacts |
@@ -21,23 +21,23 @@ Browser UI fixtures exercise interactions independently; the separate Android Em
## Latest completed run
Product experience validation date: October 15, 2026. No physical device was accessed.
Receiving simplification validation date: October 15, 2026. No physical device was accessed.
- **21 JVM tests passed**, with zero failures/errors.
- **17 native tests passed** on the round Wear OS API 37 emulator, with no skipped assumptions. This includes the public installer’s required-consent callback and refusal of requests after a session deadline.
- **27 JVM tests passed**, with zero failures/errors.
- **21 native tests passed** on the round Wear OS API 37 emulator, with no skipped assumptions. This includes the public installer’s required-consent callback, Wi-Fi loss/recovery without ending receiving, fixed-port reuse/collision behavior, IPv6, metadata rollback and released CPU wake locks after uploads.
- **Five round UI tests passed again** at 192 dp / 1.3x text: the initial receiving action stays visible, review/approval/error/success controls are reachable, connection details and transfer feedback work, and a decodable QR fits inside the circular bezel. Size, density and font scale were restored.
- **16 browser UI checks passed** on Chromium 140.0.7339.16 across four viewport widths and both themes, including connection recovery, keyboard focus, reduced motion and 200% zoom at an effective 320 px layout width, with zero JavaScript errors.
- **Real Android Emulator Chrome 145.0.7632.218 uploaded the signed fixture directly to the Wear OS Emulator over virtual Wi-Fi**, receiving READY review state. The test dismissed its package, ended receiving and removed its local debug forward.
- **18 browser UI checks passed** on Chromium 140.0.7339.16 across four viewport widths and both themes, including connection recovery, keyboard focus, reduced motion and 200% zoom at an effective 320 px layout width, with zero JavaScript errors.
- **Real Android Emulator Chrome 145.0.7632.218 uploaded signed APKs of 69,588,292 bytes and 270,914,884 bytes directly to the Wear OS Emulator over virtual Wi-Fi**, receiving READY review state. The larger APK contains a stored 256 MiB asset, exceeding the removed individual-entry and expanded-content caps. There were zero JavaScript errors and browser access was approved through the visible watch control. The test dismissed its package, ended receiving and removed its local debug forward.
- **Debug, test and release builds succeeded** for the debug app, instrumentation APK, unit tests, lint and optimized release AAB. Lint has zero errors; three remaining warnings are SDK/Gradle/library update notices, not unused code/resources.
- Release inspection found exactly the three bundled web assets, no fixture APK/test payload, no package-visibility queries, one exported launcher and non-exported service/installer receiver. The release dependency graph contains ZXing Core, Kotlin stdlib and its annotations dependency.
- The unchanged Gradle distribution version is checksum-pinned to its official download. Release output is unsigned when signing inputs are absent; incomplete signing configuration fails clearly.
Ten watch product-state screenshots at each tested size, browser screenshots, detailed XML, text logs and browser summaries are generated under app/build/reports and app/build/test-results. They are not source assets or claims of universal hardware/browser support.
Ten watch product-state screenshots at each tested size, browser screenshots, detailed XML, text logs and browser summaries are generated under app/build/reports and app/build/test-results. They are not source assets or claims of universal hardware/browser support. No elapsed-time test certifies indefinite availability: long-duration screen-off/power behavior remains a hardware gate, and the receiver has no product expiry timer. Successful large uploads prove receipt/review, not successful installation of every large app.
## Hardware-specific release matrix
- Fresh Google Play delivery, source approval and system confirmation on supported Galaxy Watch 7 and other firmware/regions, without preexisting source trust or developer setup. Include denied/revoked permission and cancellation.
- Real maximum-size transfers, interruption, ten-minute expiry, repeated sessions, IP/network changes, guest/client-isolated networks, VPNs and browser local-network permission prompts.
- Transfers near actual free-storage capacity, prolonged receiving, interruption, repeated sessions, IP/network changes, guest/client-isolated networks, VPNs and browser local-network permission prompts.
- Long screen-off/Doze behavior, low battery/battery saver, charging transitions, memory/thermal behavior and measured battery consumption. Timed locks and bounded buffers alone are not measurements.
- Actual low storage and processor/SDK/package/update conflicts; system developer verification and managed-device restrictions. The OS is the final compatibility/security authority.
- TalkBack, rotary interaction, large font and physical small-round displays; camera scanning of QR on real displays under varied lighting.