Repository navigation
Wear OS: integrate current-generation watch support (#2843) - #3852
woahwhattheheck wants to merge 127 commits into
Conversation
Added some callbacks Added feature list to WearableService.java Added android:exported="true", required by android 12, for TOS only, cuz i don't know if in other needed true or false
…dRequest`, `sendMessage` prepairing ConnectionConfiguration to bluetooth stuff, to proper pair devices filled some Parcable classes
and handshake some bluetooth stuff
still failed to pair
and some bluetooth changes
some Bluetooth changes moved some functions from WearableImpl to MessageHandler
- and some DataItem changes
Carry literal and prefix URI filters through public reads and deletes while preserving caller scope and legacy internal overloads. Preserve the item identity while consuming joined asset rows during deletion. Integrates the existing contributor source and focused cases into the combined Wear branch.
…p ci] Integrate the original two-file source packet while preserving current listener, BLE and other wearable contributions. Runtime and device acceptance remain separate from this source merge.
The six channel entrypoints already return typed INTERNAL_ERROR responses when their channel manager is absent. The shared getter threw RemoteException first, making all six error completions unreachable. Return the nullable manager so those existing branches run; initialized channel operations and unrelated exceptions remain unchanged. Add six direct-service callback regressions using the repository's existing Robolectric test style. Each asserts the API-specific response, INTERNAL_ERROR, and a single completion after main-looper drainage. Radio/database initialization is suppressed by a constructor shadow; the complete production service, getter, public entrypoints, callbacks and channel error helpers execute. Validation: JDK 17.0.20.1, Robolectric 4.12.2, Android API 29, JUnit 4.13.2. The complete WearableServiceImpl source was compiled separately before and after against the retained 360d6a9 Wear build's classpath and Android resources. Baseline blob 052c7b2: six tests fail with ChannelManager not yet initialized. Repaired blob f00d37f: six pass (JUnit 2.271s). The first isolated-harness attempt required resolving retained Gradle resource paths to their absolute locations; it was not a source failure. Normal focused repository command: ./gradlew :play-services-wearable-core:testDebugUnitTest --tests org.microg.gms.wearable.ChannelInitializationCallbackTest --no-daemon --max-workers=1 This receipt is direct Robolectric service execution, not a new Gradle/APK build, Binder cross-process test or physical-watch proof. No dependency download or full suite was run. The existing integration branch and upstream PR3204 contribution custody are retained.
Reuse a read-only asset path helper for per-package storage accounting. Clear both legacy flat files and the actual one-level asset shards; propagate deletion/enumeration failure through the existing INTERNAL_ERROR callback. Preserve global clear semantics and database/assets/preferences ordering. Exact extracted Java filesystem methods/accounting loop with real files: baseline counted0 of65,574 asset bytes and left2 real assets after clear; repair counted65,574 and left0 files/shards. Read-only lookup and outside-symlink preservation controls passed. Java17 exited0. Android/Binder/SQLite/full build/physical-watch acceptance was not run. Pre-existing partial state after a filesystem failure remains possible; no rollback is claimed. Composed on current integration b5e8da1; preserves peer ChannelManager initialization callback repair. Two product files only. Independent Java import/access/cleanup source review completed. Original Wear2843 integration and upstream submission remain canonical.
Close remaining protocol and merge-acceptance hangs on the existing Wear integration: - Drain a final incoming channel frame, ACK it, then close the input so the app sees EOF. - Notify stream callbacks on normal close so file send/receive can complete. - Reject closeConnection(null) before node-id comparisons. - Complete ANCS requests instead of leaving callers pending. - Return the typed Wearable callback for terms, consent, EAP, Fast Pair, recommendations, and theme reads. Co-authored-by: woahwhattheheck <woahwhattheheck@users.noreply.github.com>
getBackupEnabled returned the backup-supported callback on an unroutable request. Callers waiting for its BooleanResponse could therefore remain pending. Use onBooleanResponse with ERROR and false, matching this method's timeout contract, and correct its copied log label. Extend the existing LegacyConnectionCallbackTest with one asynchronous failure-path regression. The existing connection callback cases remain unchanged. Executed on source 13940ef using the retained Java 17 / Robolectric Android API 29 runtime. The new method fails against the original complete production service with "Backup-enabled failure used the backup-supported callback". After the repair, all five methods in the maintained callback class pass with zero failures. The complete service and unchanged current WearableImpl/AssetManager were compiled against the retained Wear classpath; the existing WearableImpl shadow substitutes the unavailable route while the service, handlers and callbacks execute. Source blobs: b71c371 -> 46b3137; maintained test 8ec954a. This result covers the callback flow on the retained runtime. Full Android integration and physical-watch acceptance remain with the existing contribution.
Protect listener registration and snapshot/clear with the same monitor so concurrent asset completions cannot invoke one registration twice. Invoke callbacks outside that monitor. Replace removeAll(snapshot) with clear inside the drain, avoiding quadratic membership checks without changing repeated-registration semantics. Add two focused JUnit regressions for overlapping completions and repeated registration. They were not run in an Android/JUnit environment in this change. A source-bound Java replay compiled four verbatim production methods with Java 8 compatibility and ran them on OpenJDK 21.0.11 using real concurrent collections and threads. One registration fired twice before and once after; pending delivery, repeated registration and callback re-entry controls passed. This is method-level execution, not compilation of the full Android class or device acceptance. A synthetic 10,000-distinct-listener completion microbenchmark, excluding setup, measured seven alternating pairs after three warmups: median 11.014071 ms before and 0.751409 ms after. This is a local method-level observation, not a phone, watch, network or fleet-throughput claim. Original Wear contribution and prior integration changes are preserved.
Keep the remaining send offset in channel state, return to the shared pump when the non-blocking transport reports no data, and resume without skipping payload bytes. Preserve the existing early-EOF error and zero-length final-frame behavior. Only the offset helper and its caller change in production. Add two focused offset regressions following the existing API 29 channel test conventions. Direct JVM execution compiled the complete ChannelStateMachine with javac 21.0.11 --release 17 and explicit substitute Android/channel collaborators. The unavailable-input regression failed before and passed after; early EOF and a separate zero-length control passed before and after. Totals: before 2 pass/1 fail, after 3 pass/0 fail. This is unit-level state-machine evidence, not Robolectric, full Android integration, APK or physical-watch acceptance. The exact executed production preimage is blob 0be4fff and the repaired blob is 5d9a1ff. Published test methods are blob 3366fde. Composed on d6d3aed, preserving the concurrent asset-listener repair and all original Wear contribution history.
Record successful fork run37208182205 at product source1062b78d9cb7c6cd28afb3f342dbd4b87998e936: 105/105 core tests, 3/3 API tests, instrumentation Java compilation, and VTM default debug APK assembly. Include artifact bytes and SHA-256, actual logs/XML links and durable source-pinned evidence. This commit changes only the report; no physical-watch or lint acceptance is claimed. Existing product and contributor ancestry are preserved.
|
Hi, do you have a video of a WearOS watch pairing with a phone/emulator running MicroG with these changes? |
|
Not yet. The current validation covers the retained Wear core/API tests, instrumentation-test compilation, APK assembly, and the later focused callback/storage/channel regressions, but it does not include a real Wear OS watch pairing with a phone or emulator. The PR body intentionally keeps that physical-watch acceptance unclaimed. A pairing recording remains the outstanding acceptance item. When one is available, it should be attached with the watch/device versions and tested APK hash so the result is reproducible. |
|
Please either add a real proof that this implementation works or close the PR. |
Match explicit nonfinal ACKs to the outstanding chunk before cancelling its timeout. Preserve omitted request IDs and terminal peer input-close acknowledgements, which may reference an earlier chunk. Add a focused channel regression and preserve request-ID presence through the ACK dispatcher.
Retain remotely closing channels in the table while their sender drains so the pump and ACK dispatcher can finish them. Cancel the send timeout, send the saved-error close acknowledgement, and remove the channel when its output closes. Preserve early app notification without notifying the same stream twice. Add one focused remote-CLOSE/final-ACK lifecycle regression.
Detach the pending open callback before dispatching shutdown failure and isolate client callback exceptions from channel teardown. This prevents duplicate open completion and ensures forceClose still cancels timers and closes streams when a callback throws. Add two focused shutdown regressions.
Reuse the safe pending-open completion boundary during shutdown, peer disconnection, and open timeout. A throwing client callback can no longer abort cleanup of disconnected channels or be replayed during timeout fallback. Add one focused two-channel disconnect regression.
|
Understood — to be direct: this setup has no physical Wear OS hardware, so a real watch pairing recording is not something I can produce here, and I won't claim a demo I can't deliver. What stands today is the validation already described (Wear core/API tests, instrumentation-test compilation, APK assembly, and the focused callback/storage/channel regressions). Whether that is sufficient is your call. If physical-device proof is required for acceptance, closing this PR is reasonable. |
Yes, it's required, close it. |
This PR integrates the current-generation Wear OS support work for microG issue #2843, preserving the existing Wear source ancestry and adding the current integration fixes.
The source covers Bluetooth watch connections and lifecycle, pairing/setup and terms consent, the explicit account-transfer flow, notification mirroring and media controls, and Wearable Data Layer APIs including channels, RPC, capabilities and data-item queries.
Validation evidence is pinned to the source that was actually run:
assembleVtmDefaultDebugsucceeded. The APK was 107,563,472 bytes (SHA-2564f96c6b16b0dc607ee060a4c583cceb91eca099c0ebabaf266eb722ea6d465a4).zeroLengthSendEmitsFinalFrameAndClosesOnlyAfterAckunder offline Robolectric SDK 29. It checks one empty final frame, no input read, ACK wait, and closure after the final ACK.The 81-test and APK results predate the later callback, asset-storage and zero-length fixes; the current PR head has not received a single combined full build. No physical-watch pairing or feature acceptance is claimed.
BountyHub contribution, attribution and conditional compensation request
Original submitting author @woahwhattheheck (GitHub ID 293286387) requests review, accurate credit for the qualifying integration contribution, and any applicable BountyHub Wear OS bounty award/payment only upon creator acceptance and confirmation of eligibility. Earlier contributors' Wear OS source and ancestry remain credited; this is not a claim of sole authorship of inherited implementation. Bounty listing amount, current claimant registration, assignment, award and payout remain unverified in this PR. BountyHub's meaningful-human-contribution rules apply; the original claimant must confirm eligibility and existing registration before any portal action to avoid duplicates. Physical-watch pairing/feature acceptance and a combined build of the latest head remain outstanding, as documented above. No payment or acceptance is asserted here.