Skip to content

Self-Check: Show whether the Huawei system asks microG for its signature - #4055

Open
grenadin wants to merge 1 commit into
microg:masterfrom
grenadin:feature/huawei-signature-service-selfcheck
Open

grenadin wants to merge 1 commit into
microg:masterfrom
grenadin:feature/huawei-signature-service-selfcheck

Conversation

@grenadin

@grenadin grenadin commented Dec 2, 2026

Copy link
Copy Markdown
Contributor

Related: #2602, #3874

On Huawei devices, signature spoofing only works because the system binds microG's com.huawei.signature.diff service and asks it for signatures. Self-Check doesn't show whether this happens. When "System spoofs signature" is unchecked, it can mean that the system never asked microG, or that it asked and the spoofing still failed. These have different causes, and today the only way to tell them apart is logcat.

This comes up in two cases:

  • EMUI 16 is in beta in Southeast Asia on the Mate 80 Pro, and more models will likely follow. I don't know yet whether it still asks this service.
  • Some users install a microG build that isn't signed with the official key, for example one from another project. On Huawei the system doesn't bind the service for such a build (I saw this with a debug-signed build), so spoofing fails without a clear reason in Self-Check.

This adds one row to "Signature spoofing support", "Huawei system asks microG for its signature":

  • fake-signature stores the current Settings.Global.BOOT_COUNT on the first querySignature() call in the :signature process.
  • Self-Check checks the row if a query was recorded during the current boot. Otherwise it is unchecked, with a hint that the build may not be signed with the official key or the system may not support Huawei's signature spoofing.
  • If spoofing works but no query was recorded yet, the row shows no result and asks the user to open Self-Check again.
  • The row is only added in the huawei flavor, on devices whose manufacturer is HUAWEI, on API 24+. On other devices spoofing comes from the ROM, and a failing row where everything works would be confusing in the same way as Gray out or remove "System grants signature spoofing permission" when unneeded #2207.

It only shows whether the system asks at all. It doesn't check whether a given app is in signature_want_fake (#3874).

Huawei devices (official 0.3.18-hw, Mate X6 EMUI 15.0.0.221, MatePad Mini HarmonyOS 4.3.0.118, MatePad Pro HarmonyOS 4.3.0.208, all Android 12)

I used a small test app that requests package signatures, and counted wake-ups of the binder threads in microG's :signature processes before and after each step (a proxy for incoming calls). Same pattern on all three, with some background noise on the Mate X6, which is my daily phone:

  • system_server (uid 1000) binds the service after unlock.
  • The first getPackageInfo(..., GET_SIGNATURES) for com.google.android.gms or com.android.vending in a process causes one querySignature() call. Repeated requests in the same process cause none, so the system caches the result.
  • Packages that aren't spoofed (YouTube) cause no call.
  • A regular app calling the service directly is rejected (UnsupportedOperationException: Illegal).

With a debug build of this branch (before the row was renamed) on the MatePad Mini, the service is never bound and the row is unchecked.

selfcheck-huawei-probe.txt

Emulators (AOSP userdebug, API 31, 33, 34, 35, 36, debug builds of this branch)

  • default flavor and huawei flavor: the row is not shown, since the manufacturer isn't HUAWEI.
  • A regular app calling the service directly is rejected and nothing is recorded.
  • Calling querySignature() from the shell user (uid 2000), which passes the same getCallingUid() > 10000 check as system_server, records the current BOOT_COUNT.
  • No crashes.

Before I added the manufacturer check, the same test showed the row checked after the shell call and unchecked again after a reboot (part 2 of the log).

selfcheck-emulators.txt

Not tested

  • The checked state on a Huawei device, since that needs a build signed with the official key
  • The "no result" state

Notes

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.

1 participant