22.12.2024
Since earlier 2024, the official LineageOS build supports Signature Spoofing for MicroG under certain conditions in their mainline builds, such that users can utilize this implementation to have GCM/FCM message notifications on their phone. However, if just installed as normal app, it does have some important quirks which drastically reduce usability.
Such drawbacks include (from my observations):
To get rid of the problems, I've done the steps as follows. Please note: Do make backups of your apps and content in case something goes wrong. In fact, be prepared to re-install messaging apps like Whatsapp or Signal (and have Backups of your Chats). Reasons for that below.
Tools needed:
The problem is that MicroG is missing a key permission when not installed as system app. dumpsys package com.google.android.gms
returns somewhere in its vast output:
android.permission.START_ACTIVITIES_FROM_BACKGROUND: granted=false
.
Manually granting this via pm grant
in the adb shell does not work, because the system's policies prevent it for user apps. Also, user apps cannot wake up as reliably as system apps (at least that is my perception). Hence, the trick is to install MicroG services as system app, or convert it to a system app.
For that, you need the .apk files of both microG's GmsCore, and GsfProxy. In this case, it's best to download them directly from their GitHub presence. There is a Release Section in both projects, don't worry, the GsfProxy is a little older and does not need to be updated.
In the following I suppose you have both downloaded as GmsCore.apk and GsfProxy.apk.
IMPORTANT: First you need to install the apps as root. Otherwise you will be stuck in a bootloop.
Funnily enough, there is a state that I never found described on any issue tracker before. You can (re)install an app as root, but it still will not (yet) be a system app. It is just installed by shell from user 0.
Additionally, if the app exists already, and you miss installing it as root first, Lineage will crash/bootloop when attempting to install it as system app.
So, let's first reinstall the apps as root:
adb root
adb push GmsCore.apk /data/local/tmp/GmsCore.apk
adb push GsfProxy.apk /data/local/tmp/GsfProxy.apk
adb shell
You should have a root command prompt on your phone now.
pm install -g -f --user 0 --full /data/local/tmp/GmsCore.apk
pm install -g -f --user 0 --full /data/local/tmp/GsfProxy.apk
Both commands should respond with "Success". The install parameters are:
Now, you can finally install the apps as System apps.
IMPORTANT: Do exactly as described, do not attempt to push both apps without reboot in between. Otherwise, prepare for a bootloop.
First, convert the GmsCore itself. To push any app to system, the /system must be remounted as read-write (that is the remount,rw command).
adb root
adb shell
mount -o rw,remount /
^D (leave the adb shell)
adb push GmsCore.apk /system/priv-app/GmsCore.apk
adb shell
(ls -la /system/priv-app/) <-- verify that the apk is there
mount -o ro,remount /
^D (leave the adb shell)
adb reboot system
On reboot, Android installs the apk placed in /system/priv-app/ as system app.
And after reboot, we can check if gms now has the permission we were missing:
adb shell
dumpsys package com.google.android.gms
...
> android.permission.START_ACTIVITIES_FROM_BACKGROUND: granted=true
We need to perform the same for GsfProxy:
adb root
adb shell
mount -o rw,remount /
^D (leave the adb shell)
adb push GsfProxy.apk /system/priv-app/GsfProxy.apk
adb shell
(ls -la /system/priv-app/) <-- verify that the apk is there
mount -o ro,remount /
^D (leave the adb shell)
adb reboot system
Finally, we need to check some settings. In MicroG settings, check the self-test. Probably, Battery Optimization is turned off, turn it on again. In the system's app settings, make sure that battery optimization is turned off for both microg and the gsf Services Framework Proxy.
Make sure that Cloud Messaging and Device Registration is still active in the MicroG app. If not, turn on both. You will definitely have to reinstall your messaging apps to make use of GCM.
Otherwise, let's check if the apps still use GCM. Receive a test message from one of your mates on Whatsapp or Signal, and go into the MicroG settings -> Cloud messaging. Tap on the app you received a message on. Check the timestamp of the last message received. If it's from just now, good. Otherwise you need to reinstall the messaging app.
This is an unfortunate one, because all apps assume that your phone either magically has GCM or not. If they have fallen out of sync (either due to this re-installation or earlier on the way), you will have to reinstall them.
IMPORTANT: Just erasing the app's memory and settings will NOT suffice. You have to fully un-install the app and re-download it for this to work.
And that should be it.
Tested on Google Pixel 7 and Google Pixel 7 Pro.