gmscompat: synthesize GSF package presence when GmsCore is installed - #432
Open
Alex9001 wants to merge 1 commit into
Open
gmscompat: synthesize GSF package presence when GmsCore is installed#432Alex9001 wants to merge 1 commit into
Alex9001 wants to merge 1 commit into
Conversation
Apps that probe com.google.android.gsf via PackageManager fail to enable FCM on fresh GrapheneOS installs where GSF is absent. When verified Play Services is visible to the caller, synthesize a minimal PackageInfo/ApplicationInfo for GSF so presence checks succeed. Real GSF installation remains blocked. Bug: GrapheneOS/os-issue-tracker#8567 Co-authored-by: Cursor <cursoragent@cursor.com>
Alex9001
marked this pull request as ready for review
August 21, 2026 15:24
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.
Summary
When
com.google.android.gsfis absent,ApplicationPackageManagerreturns a minimal syntheticPackageInfo/ApplicationInfofor GSF so third-party presence checks succeed — but only when verified Play Services (com.google.android.gms) is installed and visible to the caller. The synthetic object carries onlypackageName+enabled; no GmsCore signatures, version codes, or sharedUserId are copied. Real GSF installation remains blocked.Visibility-dependent gate
The GmsCore check goes through the normal PackageManager query, so it is subject to the caller's package visibility of
com.google.android.gms. That is intentional: an app that can see GmsCore is precisely an app where FCM is viable, so the shim engages exactly when the presence answer is useful — and never for apps that couldn't use FCM anyway. The gate also verifiesapplicationInfo.ext().getPackageId() == PackageId.GMS_CORE, rejecting lookalikes that lack the verified Google signing key.Motivation
GrapheneOS/os-issue-tracker#8567
Hikvision-family apps (Hik-Connect, Guarding Vision, HiLook, Annke Vision) gate FCM on a GSF package-presence probe; FCM itself works through GmsCore on GrapheneOS.
Non-goals
Test plan
Device tests require a GrapheneOS build/flash with this patch (not done yet):
Community APK workaround meanwhile: https://github.com/Alex9001/hikvision-grapheneos-fcm-patch