Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content

RCS: integrate Constellation/Asterism services and add regression coverage - #3976

Open
TotyLabs wants to merge 105 commits into
microg:masterfrom
TotyLabs:rcs-constellation-asterism
Open

TotyLabs wants to merge 105 commits into
microg:masterfrom
TotyLabs:rcs-constellation-asterism

Conversation

@TotyLabs

@TotyLabs TotyLabs commented Nov 8, 2026

Copy link
Copy Markdown

Summary

Google Messages RCS setup depends on phone-number verification and consent APIs provided by Play services. This PR integrates the existing Constellation and Asterism implementation into GmsCore and adds regression coverage for those services and supporting components.

Refs #2994.

Changes

  • Integrate the Constellation and Asterism modules, service registration, manifests, and build dependencies.
  • Use the existing implementation line for IID, signing-key, consent, and verification-state handling.
  • Add regression coverage for:
    • Empty IID tokens and signing failures.
    • Key acknowledgement and key regeneration behavior.
    • Consent state and persistence.
    • Cache behavior, cancellation, and isolation between simulated subscriptions.
    • Simulated SMS/challenge processing.
    • Android service binding, Binder/AIDL transport, and callbacks.

Validation

On the integrated branch at f23820fcab91a8eb111caa7d37aadd2a3d8d241e:

  • Unit tests: 135 passed, 0 failed.
  • Android 15/API 35 emulator instrumentation: Constellation 13/13 and Asterism 2/2 passed.
  • Instrumented test APKs built successfully.

The full microG APK build was attempted but did not complete: Gradle failed at :play-services-auth:compileDebugAidl because it could not resolve DeviceManagementInfoResponse, whose AIDL declaration is in play-services-auth-base. The root cause of this AIDL dependency-resolution failure has not yet been confirmed. Full APK assembly is therefore unverified, and the requested lint tasks did not complete.

I plan to investigate and cover this build/AIDL issue in a follow-up commit or revision.

Compatibility with a pinned Google Messages APK has not been verified. No physical-device, real-SIM provisioning, or bidirectional RCS messaging test was performed. These results do not establish carrier/backend acceptance or end-to-end RCS interoperability.

Attribution

The original Constellation and Asterism implementations are by @opstic in #3359 and #3360. Related follow-up work includes #3851 and #3924, with their original contributors credited there.

This PR integrates and tests work based on those contributions; it does not claim the existing implementations or fixes as original work.

Remaining validation

Resolve the AIDL build failure, complete full APK assembly and lint, then validate against a specific Google Messages version. Physical-device validation of provisioning and outgoing/incoming RCS with a real SIM, no root, and a locked bootloader remains outstanding.

Restore the missing TS.43 verifier, IID token request implementation,
module registration, real service routing, and phone verification settings
from the existing RCS source. Compose the retained consent fallback with
the current caller-cancellation behavior and wire its existing unit checks.

Source integration only; device RCS connectivity is not established by this commit.
Concurrent first use must share the persisted EC key so published public keys and later IID signatures agree. Add a focused concurrency regression preserving existing key acknowledgement.
Parse the hexadecimal platform ID as unsigned before retaining its Long bit representation. High-bit values now remain device IDs instead of falling through to the build-ID hash. Existing cached IDs and absent/malformed-input fallback are unchanged.

Operation: BH-RCS-DEVICE-ID-268D
Check coroutine activity after synchronous token lookup, before success delivery,
and before mapping an ordinary failure to a callback. Cancellation during blocked
credential work now stops subsequent delivery and unnecessary signing.

Extend the existing cancellation class with three real job-cancellation cases.
The actual six-case class reproduced three failures on ae5d278 and passed all six
with this handler using coroutines 1.7.3 and JUnit 4.13.2 in a focused JVM run.
Android, AIDL and unused auth boundaries were inert in that focused run; combined
Android validation remains with the existing RCS integration branch owner.
Merge the existing AuthManager concurrency and unsigned Android-ID fixes,
preserving both contributor commits as parents. Compose the exact SWE
DroidGuard rev4.53 packet with the retained VM-cache and nullable-reply
corrections and their existing unit tests.

DroidGuard packet SHA-256:
6a2054da41d5c2afdcd75102d8d87fe61abe13ce0e0c510923d60d5094b09ab9
Original RCS source: 1a18528

Combined cloud build follows this source snapshot. Device provisioning,
RCS send/receive, and bounty acceptance remain unestablished.
Merge the exact 268D contribution and retain its commit as a parent.
Check activity after synchronous token lookup and before success or error
callbacks, with three existing-suite regressions for real job cancellation.

This source snapshot is queued for the combined build. Physical RCS
provisioning and message delivery remain outside the cloud build evidence.
The combined Kotlin build rejects smart casts of PackageInfo.signingInfo
because the framework property is mutable. Capture the value once in the
API28+ branch, retaining null rejection and the single-signer certificate
pin. The pre-28 signature path is unchanged.

Addresses the actual compileDebugKotlin failure from combined build04.
Recheck coroutine activity after synchronous telephony queries and before success or error callbacks. Add the focused subscription-query cancellation case to the existing Constellation suite.

The source and test are prepared for the existing integration runner; the new test has not been executed while shared build storage is full.
Merge the exact phone-verification cancellation contribution and retain
its source commit as a parent. Recheck coroutine activity after synchronous
telephony work and before callbacks, with the supplied regression case.

Fix the two APK compilation failures from run37185388964: retain the
initialized VM proxy in a nonnullable local and type the empty legacy
snapshot map explicitly. Optional rb behavior and failure handling remain.

The preceding source passed57 existing unit cases; the combined source
and added PNV case require the next pinned APK build.
RCS-TS43-RESPONSE-CLOSE-4545. Scope both carrier ODSA and EAP responses with use, preserving existing response bodies, HTTP history, status/error mapping and request counts. ODSA previously threw for non-success status before consuming or closing the body.

The four added Ts43ResponseLifecycleTest methods execute genuine OkHttp loopback exchanges and assert connectionReleased events. Three consecutive ODSA 403 responses retained all three connections before the fix (0 released); the repaired path releases all three. Successful ODSA, EAP token early return and EAP rejection retain their original results, history and one-request behavior.

Focused JVM execution used the exact production HTTP-handler bodies, the same complete test class, actual generated Wire types and entitlement/EAP helpers, OkHttp 4.12.0, Kotlin 2.2.21 and JUnit 4.13.2. Android framework dependencies were mocked and logging was inert. Baseline 3/4 passed, repaired 4/4 passed in 1.640s. No provider requests, full Gradle/APK build or device RCS outcome is asserted. Existing Constellation command: :play-services-constellation-core:testDebugUnitTest --tests org.microg.gms.constellation.core.verification.Ts43ResponseLifecycleTest.

Additive contribution based on current integration 71c28a2; preserve the original RCS delivery and BountyHub claim route.

Attribution: GPT-6 Astra Pro / Astra-4545-RCS / ChatGPT cloud harness 4545e3eb7081.
Build replacement inboxes transactionally, disposing partial construction on failure while retaining the original exception and previously owned inboxes. Add one failure-path regression to MtSmsInboxScopeTest.

Focused replay with exact extracted production scope and the unchanged eight-case test candidate: baseline compiles and fails the new regression (expected disposed [1,2], actual []); candidate compiles and passes 8/8. JDK 17.0.20.1, Kotlin 2.2.21, JUnit 4.13.2, coroutine 1.10.2, existing injected factory seam. No Android receiver, full-module, APK or device proof is claimed.

Component carrier skips the inherited full Debug/Release matrix; the existing RCS combined workflow remains the integration validation route. Operation RCS-MTSMS-PREPARE-CLEANUP-FA9A.
Map failures from TelephonyManager service lookup and subscription-specific
manager creation through the same carrier error response as authentication.
SecurityException reports unable-to-read-subscription, unsupported APIs
report not-supported, and other platform failures retain reflection-error.
Validate challenge data and the TS43 unsupported case before platform calls.

Source-only additive contribution for the existing RCS microg#2994 integration.
No new test or build run; combined integration validation remains pending.
Integrate the tested two-file MT SMS resource-lifecycle contribution while retaining the existing RCS branch and source ancestry. The existing combined RCS workflow remains the validation route; the carrier avoids an additional inherited Debug/Release matrix.
Compose the tested two-file response lifecycle contribution with the existing MT-SMS integration. Preserve both source ancestries and use the planned combined RCS workflow for module and APK validation.
Compose the six-file EAP identity/cache contribution and CarrierId platform-error mapping on top of the shared MT-SMS registration and TS.43 response-lifecycle merges. Preserve response.use cleanup around EAP authentication.

EAP-AKA derives authentication keys from the exact identity used in the request, including its realm. Discard a cached VM database row if its VM file is unavailable so normal download can proceed. Guard platform manager lookup inside the existing CarrierId error mapping.

Leaf source contributions (applied as diffs, not parent metadata):
- EAP identity: 2fc243e
- DroidGuard VM cache: 0ec61c8
- CarrierId platform errors: 703fd5e

Next dedicated validation run covers all four module suites and the combined VtmDefaultDebug APK. Physical Google Messages RCS acceptance remains pending.

Integration: GPT-6 Astra Pro / ChatGPT cloud / a07bfe951f29.
Integrate carrier verification platform error handling
Keep later account signals when a Gaia ID is absent, resolve missing IDs through the existing account-ID token path, and skip unresolved entries. Serialize an omitted targeted-SIM phone number hint as an empty Wire value instead of throwing before Sync.

Apply exact published Opus leaf diffs, preserving the shared integration and source attribution without importing unrelated commit metadata:
- 4313a69 (Gaia ID handling, three focused cases)
- 6bfaa9c (optional phone hint, two focused cases)

Parent639051d2 additionally records the already-composed CarrierId contribution ancestry without changing its tree. The existing Constellation suite will execute these cases in the next combined build. No device RCS result is asserted.

Integration: GPT-6 Astra Pro / ChatGPT cloud / a07bfe951f29.
woahwhattheheck and others added 22 commits October 5, 2026 22:46
Bound mock server waits and generate the server AT_MAC for the announced EAP identity so the TS.43 exchange test exercises the successful AKA response path.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@leafusfluffy

Copy link
Copy Markdown

I checked out this fork, and i can confirm it works.

Screenshot_20261113-094810 Screenshot_20261113-094751

I tested it on OnePlus 12 with YAAP Rom on Android 17 with a polish provider "Nju [Basically Orange]" RCS Connected and im able to recieve / send messages just fine.

@leafusfluffy

Copy link
Copy Markdown

However i did observe some weirdness out of this:

  1. First Sync didn't verify. The first verifyPhoneNumber returned Sync response: 1 verifications → Unverified. State: UNKNOWN together with Server acknowledged client public key. microG then reported success with no token, Messages logged Unable to retrieve MSISDN Token and backed off ~2h. Force-running the provisioning job again right after (key already acked) verified the number and RCS connected. Maybe worth re-syncing automatically after the first key ack, or not returning SUCCESS for an UNKNOWN-only response.
  2. IID token failure was a GCM settings issue, not Constellation: ensureAppRegistrationAllowed threw for com.google.android.gms itself (Cloud Messaging / confirm-new-apps), and later calls just hit the client-side RETRY_LATER backoff. After fixing microG's Cloud Messaging settings and force-stopping GmsCore, registration for sender 496232013492 worked and Asterism consent succeeded.
  3. Messages logs Google Play services out of date … Requires 254500000 but found 252432035 and disables TS.43 (hasMinTs43GmsCoreVersion: false). Didn't matter for the SMS/UPI path here, but TS.43 carriers might need a higher gmsVersion.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@TotyLabs

Copy link
Copy Markdown
Author

Thanks for the detailed report, and for confirming that RCS works on your OnePlus 12 with Nju. I pushed 8a160ce to address the first-Sync case. The change makes at most one authenticated Sync retry when the initial unauthenticated response acknowledges the same current public key and all targeted raw verification results are UNKNOWN, with no errors. A key acknowledgement is not treated as phone-number verification: verification state is processed from the final response, and the public RPC SUCCESS status and callback contract remain unchanged. The Constellation core unit suite passes locally (130/130), as do Kotlin compilation, module assembly, and the Auth AIDL task. I couldn’t verify the backend’s next_sync_time or rate-limit behavior, or test Messages on a device. If you have time, could you try a fresh first provisioning with this commit and check whether it obtains the MSISDN token without manually rerunning the job? Agreed that the IID issue you described was due to Cloud Messaging settings, and that TS.43’s GmsCore version gate is separate; this change does not modify either.

@TotyLabs

Copy link
Copy Markdown
Author

Hi! Just following up on this PR.

Are there any outstanding concerns or changes needed to move the review forward? I'd be happy to address them and provide additional testing if necessary.

Thanks for your time!

aprashnasuraj2-dev added a commit to aprashnasuraj2-dev/GmsCore that referenced this pull request Dec 2, 2026
Add Constellation phone-number verification and Asterism consent support,
including service wiring, state handling, provisioning behavior, and
regression coverage for Binder, SIM/SMS verification, EAP-AKA, and TS.43.

Harden TS.43 cookie lifecycle, response cleanup, request history, HTTP error
classification, and authentication-attempt boundaries. Reconcile the
integration with current upstream master without reverting unrelated changes.

Based on the Constellation/Asterism work in microg#3359 and microg#3360 and subsequent
RCS integration work in microg#3851 and microg#3976.

Refs microg#2994.
Resolve the PushRegisterService unregister request formatting conflict while preserving the master implementation.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.

4 participants