Repository navigation
Conversation
A patched app is signed with LSPatch's key, so Google Play services refuses it wherever it checks the caller's certificate, Google sign-in among them. The MicroG option redirects the app's GMS intents, provider calls and actions to an installed MicroG, and declares the original certificate in both forms MicroG builds read: fake-signature with FAKE_PACKAGE_SIGNATURE for a ROM with signature spoofing, and app.revanced.android.gms.SPOOFED_PACKAGE_SIGNATURE (the certificate's SHA-1) for ReVanced GmsCore. QUERY_ALL_PACKAGES lets the loader find MicroG, since the app's own queries name only Google Play services. An intent the app addresses to itself keeps its action, including when it arrives through readFromParcel: the Google sign-in library opens its own SignInHubActivity with com.google.android.gms.auth.GOOGLE_SIGN_IN, and that activity finishes on any other action. The option is recorded in the patch config, so a re-patch keeps it, and is offered in the manager and as --microg on the command line. Co-Authored-By: NkBe <HSSkyBoy@outlook.com> Co-Authored-By: MrZhongzq <108169409+mrzhongzq@users.noreply.github.com>
MicroG looks a patched app's push receiver up by its own RECEIVE action, and the receiver only accepts a sender holding com.google.android.c2dm.permission.SEND, a signature permission of Google Play services that MicroG cannot hold, so every push it delivered was dropped. With MicroG on, every com.google.android.c2dm.* string in the manifest -- intent-filter actions and permissions alike -- is renamed to ReVanced GmsCore's app.revanced.android.c2dm.*, the same rename Morphe applies; the manifest editor never descends into intent filters, so this is a pass of its own. Two hooks carried over from NPatch are removed. The ContentResolver.call retry rewrote its arguments after the call had already returned and then swallowed the SecurityException, so callers got null instead of an error. The getPackageInfo hook reported the app's own certificate as MicroG's, which matches no check a GMS client makes.
…ts own Everything the option does is specific to MicroG RE (ReVanced GmsCore): the SPOOFED_PACKAGE_SIGNATURE metadata, the app.revanced C2DM rename and the redirect to app.revanced.android.gms. Upstream microG installs as Google Play services itself, so it needs no redirect, and renaming its standard C2DM actions would stop its pushes. The option is now "MicroG RE support" (--microg-re), and the redirect no longer falls back to org.microg.gms, which the C2DM rename would leave without pushes. fake-signature with FAKE_PACKAGE_SIGNATURE is the one declaration upstream microG can use, through a ROM with signature spoofing, so it becomes an option of its own (--fake-signature) rather than a side effect of MicroG RE support. Both are recorded in the patch config so a re-patch keeps them.
The loader has to see MicroG RE to start the redirect, and the app's own queries do not name it. Granting every package's visibility for that is broader than the option needs: a manager-mode app already holds QUERY_ALL_PACKAGES, and an integrated one can add it through the added permissions. The option's description and the loader's warning now say so.
Let a patched app use Google sign-in and push through MicroG RE
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.
Problem
A patched app is signed with LSPatch's key, so Google Play services refuses it wherever it checks the caller's certificate; Google sign-in fails with
UNREGISTERED_ON_API_CONSOLE. MicroG RE (ReVanced GmsCore) can stand in for it, but only if the app's traffic reaches it and it knows the app's original certificate.This supersedes #84, which no longer applies to master and cannot be edited by maintainers. The redirect is ported from NPatch's current version of that work; its authors are credited as co-authors.
Solution
An opt-in MicroG RE support option (
--microg-re, also in the manager), recorded in the patch config so a re-patch keeps it.Patch time — the manifest gets:
app.revanced.android.gms.SPOOFED_PACKAGE_SIGNATURE: the original certificate's SHA-1, which MicroG RE reports to Google instead of the caller's.com.google.android.c2dm.*string renamed toapp.revanced.android.c2dm.*. MicroG RE finds the push receiver by its own RECEIVE action, and the receiver only accepts senders holdingcom.google.android.c2dm.permission.SEND, a signature permission MicroG RE cannot hold. The manifest editor never descends into intent filters, so the rename is a separate pass over the AXML.Run time —
GmsRedirectorrewrites the package, component, action and provider authority of GMS-bound intents and provider calls to MicroG RE, and maps C2DM actions both ways.CHOOSE_ACCOUNTgoes to the system account picker; the chimera authority is left to Google Play services.Differences from #84 and NPatch:
readFromParcel: the sign-in library opens its ownSignInHubActivitywithGOOGLE_SIGN_IN, and that activity finishes on any other action.ContentResolver.callretry. It rewrote arguments after the call had returned and swallowed theSecurityException, so callers got null instead of an error.getPackageInfohook. It reported the app's own certificate as MicroG's, which matches no check a GMS client makes.Scope:
--fake-signaturedeclaresfake-signaturewithFAKE_PACKAGE_SIGNATUREfor a ROM with signature spoofing, as a separate option, also recorded in the patch config.<queries>don't cover. Local mode already holdsQUERY_ALL_PACKAGES; integrated mode needs it added through the added permissions. The option's description and the loader's log say so.Validation
On a Pixel 10 (Android 17), ReVanced GmsCore installed beside Google Play services, local mode:
--microg-re,--fake-signatureand neither, in both modes, carries exactly the entries above.Not covered:
--fake-signature(no ROM with signature spoofing at hand).