microg / GmsCore

Free implementation of Play Services
https://microg.org
Apache License 2.0
8.07k stars 1.67k forks source link

Blacklist apps from GCM #431

Open ghost opened 6 years ago

ghost commented 6 years ago

See https://github.com/WhisperSystems/Signal-Android/issues/6895

The only way to test for the presence of GCM is to make the framework call that we're making, which MicroG is apparently returning true for. You can re-enable MicroG after registration and Signal will not attempt to use GCM.

Could this be implemented?

sm4rk0 commented 6 years ago

There's already this option in MicroG (I'm running 0.2.4-105):

ghost commented 6 years ago

Tried that, but Signal still won't register. There's no GCM confirmation, no app added to microG's GCM list.

GCM off

10-20 20:50:22.427 16910 16957 W PushServiceSocket: Push service URL: https://textsecure-service.whispersystems.org
10-20 20:50:22.428 16910 16957 W PushServiceSocket: Opening URL: https://textsecure-service.whispersystems.org/v2/keys/
10-20 20:50:22.703  4066 26811 D GmsGcmRegisterSvc: onHandleIntent: Intent { act=com.google.android.c2dm.intent.REGISTER pkg=com.google.android.gms (has extras) }
10-20 20:50:22.704  4066 26811 D GmsGcmRegisterSvc: registration not allowed
10-20 20:50:22.713 16910 16957 W RegistrationService: 
10-20 20:50:22.713 16910 16957 W RegistrationService: java.io.IOException: SERVICE_NOT_AVAILABLE
10-20 20:50:22.713 16910 16957 W RegistrationService:   at com.google.android.gms.gcm.GoogleCloudMessaging.zza(Unknown Source)
10-20 20:50:22.713 16910 16957 W RegistrationService:   at com.google.android.gms.gcm.GoogleCloudMessaging.register(Unknown Source)
10-20 20:50:22.713 16910 16957 W RegistrationService:   at org.thoughtcrime.securesms.service.RegistrationService.handleCommonRegistration(RegistrationService.java:249)
10-20 20:50:22.713 16910 16957 W RegistrationService:   at org.thoughtcrime.securesms.service.RegistrationService.handleSmsRegistrationIntent(RegistrationService.java:210)
10-20 20:50:22.713 16910 16957 W RegistrationService:   at org.thoughtcrime.securesms.service.RegistrationService.access$000(RegistrationService.java:60)
10-20 20:50:22.713 16910 16957 W RegistrationService:   at org.thoughtcrime.securesms.service.RegistrationService$1.run(RegistrationService.java:97)
10-20 20:50:22.713 16910 16957 W RegistrationService:   at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
10-20 20:50:22.713 16910 16957 W RegistrationService:   at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
10-20 20:50:22.713 16910 16957 W RegistrationService:   at java.lang.Thread.run(Thread.java:761)

GCM on, confirmation enabled

10-20 20:52:27.790 16910 16957 W PushServiceSocket: Push service URL: https://textsecure-service.whispersystems.org
10-20 20:52:27.790 16910 16957 W PushServiceSocket: Opening URL: https://textsecure-service.whispersystems.org/v2/keys/
10-20 20:52:28.073  4066 26883 D GmsGcmRegisterSvc: onHandleIntent: Intent { act=com.google.android.c2dm.intent.REGISTER pkg=com.google.android.gms (has extras) }
10-20 20:52:28.074  4066 26883 D GmsGcmRegisterSvc: No checkin yet, trying to checkin
10-20 20:52:58.071 16910 16957 W RegistrationService: 
10-20 20:52:58.071 16910 16957 W RegistrationService: java.io.IOException: SERVICE_NOT_AVAILABLE
10-20 20:52:58.071 16910 16957 W RegistrationService:   at com.google.android.gms.gcm.GoogleCloudMessaging.zza(Unknown Source)
10-20 20:52:58.071 16910 16957 W RegistrationService:   at com.google.android.gms.gcm.GoogleCloudMessaging.register(Unknown Source)
10-20 20:52:58.071 16910 16957 W RegistrationService:   at org.thoughtcrime.securesms.service.RegistrationService.handleCommonRegistration(RegistrationService.java:249)
10-20 20:52:58.071 16910 16957 W RegistrationService:   at org.thoughtcrime.securesms.service.RegistrationService.handleSmsRegistrationIntent(RegistrationService.java:210)
10-20 20:52:58.071 16910 16957 W RegistrationService:   at org.thoughtcrime.securesms.service.RegistrationService.access$000(RegistrationService.java:60)
10-20 20:52:58.071 16910 16957 W RegistrationService:   at org.thoughtcrime.securesms.service.RegistrationService$1.run(RegistrationService.java:97)
10-20 20:52:58.071 16910 16957 W RegistrationService:   at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
10-20 20:52:58.071 16910 16957 W RegistrationService:   at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
10-20 20:52:58.071 16910 16957 W RegistrationService:   at java.lang.Thread.run(Thread.java:761)

The "Registering with server..." part in Signal takes much longer to fail in the second case.

amo13 commented 6 years ago

I was also facing this problem a few times. For now, the suggested workaround with completely disabling microG Services Core and reenabling it after Signal registration does the job. But the fact that other apps like whatsapp and telegram manage to register even though GCM is present but disabled shows that there must be another solution to test for working GCM... Maybe with Signal connecting both with and without GCM to the server and checking what did work? I can only think of something like that, but I am not a dev

georgedorn commented 6 years ago

@amo13 How do you completely disable microG Services Core? I'm using LineageOS + microG, so it's installed from the beginning.

amo13 commented 6 years ago

@georgedorn Settings > Apps > MicroG > disable