Overview
Many Chinese-market Android smartphones (Xiaomi HyperOS/MIUI, OPPO/OnePlus ColorOS, realme UI, vivo OriginOS) include Google Mobile Services (GMS) frameworks out of the box, yet restrict key Google capabilities via system feature XML declarations—most notably cn.google.services.
When this feature flag is advertised to Android’s PackageManager, Google apps and Play Services enforce China-specific limitations: Google Location History cannot be turned on, Google Maps Timeline remains disabled, and the device often fails to appear in the web Google Play device selector. Unlock CN GMS (fei-ke/unlock-cn-gms, module ID com.fei_ke.unlockcngms) eliminates these declarations systemlessly without editing read-only partitions.
Technical Architecture & Payload Internals
Rather than shipping hardcoded static XML files that could break OEM-specific features on mismatched ROMs, unlock-cn-gms-v3.9.zip inspects your live device filesystem inside customize.sh and patches only the exact XML files present on your firmware.
Scanned Partition Paths
customize.sh iterates over the following locations:
/system/etc/permissions/services.cn.google.xml/system/etc/permissions/com.oppo.features.cn_google.xml/vendor/etc/permissions/services.cn.google.xml/vendor/etc/permissions/cn.google.services.xml/product/etc/permissions/services.cn.google.xml/product/etc/permissions/cn.google.services.xml/product/etc/sysconfig/cn_feature.xml/odm/etc/permissions/com.gnss.bds_preference.xml(e.g., Xiaomi 8e5 and multi-partition builds)/my_bigball/etc/permissions/oplus_google_cn_gms_features.xml/my_product/etc/permissions/oplus_google_cn_gms_features.xml/my_heytap/etc/permissions/my_heytap_cn_gms_features.xml(plus/my_heytap/etc/permissions/my_heytap_cn_features.xmlwhen present)
Patching & Dual Mounting Strategy
For every matching file found, customize.sh copies the original XML and removes only the two restriction lines via sed:
<feature name="cn.google.services" />
<feature name="com.google.android.feature.services_updater" />
- System/Vendor/Product Partitions: Copied into
$MODPATH/system/...(or$MODPATH$originwhen already under/system) so Magisk Magic Mount or KernelSU/APatch OverlayFS handles the replacement cleanly. - Standalone OEM Partitions (
/odm,/my_bigball,/my_product,/my_heytap): Because these mount points sit outside/system,customize.shdynamically constructs$MODPATH/post-fs-data.shcontainingmount -o ro,bind ${0%/*}/<file> <origin_path>commands so every matching partition is covered simultaneously.
Installation & Configuration
- Verify that Google Play Services / GMS is enabled on your China-ROM device.
- Flash
unlock-cn-gms-v3.9.zipvia Magisk, KernelSU, or APatch. - Inspect the flash log to confirm each
modify <path>line corresponding to your ROM’s partitions. - Reboot your device.
- Clear cache or force-stop Google Play Services (
com.google.android.gms) and Google Maps (com.google.android.apps.maps) if the Timeline/Location History state was cached prior to flashing.
Common Issues & Troubleshooting
- Multi-Partition Devices (e.g., Xiaomi 8e5 / OPlus): Some ROMs declare
cn.google.servicesin two or more partitions simultaneously (such as/odmand/product, or/my_bigballand/my_product). Do not deletepost-fs-data.sh, as both the standard module overlay and the generated bind mounts are needed together. - After a ROM OTA Update: Because
customize.shcopies your device’s XMLs at flash time, re-flashunlock-cn-gmsafter major system OTA updates so any newly introduced permissions in OEM XML files stay synchronized. - Location History Still Blocked: If
pm list features | grep cn.google.servicesreturns nothing after rebooting yet Location History remains greyed out, combine Unlock CN GMS with LocationReportEnabler via LSPosed to address SIM/MCC checks.
Frequently Asked Questions
Why does customize.sh generate post-fs-data.sh with mount -o ro,bind on OPPO, OnePlus, or Xiaomi devices?
Standard Magisk/KernelSU module overlays reliably mount paths under /system, /vendor, and /product, whereas OEMs such as OPlus (ColorOS/Realme UI) and Xiaomi place restriction XMLs on separately mounted partitions like /my_bigball, /my_product, /my_heytap, and /odm. For those partitions, customize.sh writes mount -o ro,bind commands into post-fs-data.sh so the patched XML overlays the read-only partition early at boot.
Why did flashing fail with No suitable permission file found!?
If none of the 11 scanned XML files exist on your firmware, your ROM either does not ship with cn.google.services restrictions (typical on Global/EEA/AOSP ROMs) or places them under an unlisted vendor path. In that case, the module aborts cleanly without creating empty files.
I flashed Unlock CN GMS, why is Google Location History still unavailable?
Removing cn.google.services unlocks the ROM-level system feature restriction, but Google Play Services may also check SIM MCC/MNC carrier codes or regional flags. As noted by the author, pairing this module with an Xposed module such as LocationReportEnabler (GhostFlying/LocationReportEnabler) may be required depending on your region and carrier.