Skip to content

Put app into temporary whitelist when a high-priority GCM message is received #650

Closed

Description

@tmolitor-stud-tu

This is what Google's implementation does, too.
Right now Conversations/Pix-Art Messenger is not able to start the background service when invoked by microg: java.lang.IllegalStateException: Not allowed to start service Intent { act=fcm_message_received cmp=de.pixart.messenger/.services.XmppConnectionService (has extras) }: app is in background uid UidRecord{7a9723f u0a90 RCVR idle change:idle|uncached procs:1 seq(0,0,0)}

Apparently a fix can be found in this repository (see latest 3 commits):
https://github.com/ale5000-git/android_packages_apps_GmsCore/commits/master

From Google manual:

Under certain circumstances, a background app is placed on a temporary whitelist for several minutes. While an app is on the whitelist, it can launch services without limitation, and its background services are permitted to run. An app is placed on the whitelist when it handles a task that's visible to the user, such as:

Handling a high-priority Firebase Cloud Messaging (FCM) message.
[...]

Full ADB Log:

10-27 14:15:44.023  1706  2729 D GmsGcmMcsInput: Incoming message: DataMessageStanza{id=BEB0EEC7, from=704216717863, category=de.pixart.messenger, token=eb800d, app_data=[AppData{key=account, value=eb800d399b77ee0cf3ab04b6061a619579391988}], from_trusted_server=false, persistent_id=0:1540689343877703%a1639bd6b1d8a549, ttl=2419200, sent=1540689343873}
10-27 14:15:44.063  1706  2729 D GmsGcmMcsSvc: Target: ResolveInfo{486cf9c de.pixart.messenger/com.google.firebase.iid.FirebaseInstanceIdReceiver m=0x108000}
10-27 14:15:44.085  1706  2729 D GmsGcmMcsInput: Incoming message: DataMessageStanza{id=BEB0EEC9, from=704216717863, category=de.pixart.messenger, token=eb800d, app_data=[AppData{key=account, value=eb800d399b77ee0cf3ab04b6061a619579391988}], from_trusted_server=false, persistent_id=0:1540689343876666%a1639bd6b1d8a549, ttl=2419200, sent=1540689343872}
10-27 14:15:44.100   821   839 I ActivityManager: Start proc 11355:de.pixart.messenger/u0a90 for broadcast de.pixart.messenger/com.google.firebase.iid.FirebaseInstanceIdReceiver
10-27 14:15:44.113  1706  2729 D GmsGcmMcsSvc: Target: ResolveInfo{f501da5 de.pixart.messenger/com.google.firebase.iid.FirebaseInstanceIdReceiver m=0x108000}
10-27 14:15:44.207 11355 11355 I MultiDex: VM with version 2.1.0 has multidex support
10-27 14:15:44.208 11355 11355 I MultiDex: Installing application
10-27 14:15:44.208 11355 11355 I MultiDex: VM has multidex support, MultiDex support library is disabled.
10-27 14:15:44.238 11355 11355 D FirebaseApp: com.google.firebase.auth.FirebaseAuth is not linked. Skipping initialization.
10-27 14:15:44.240 11355 11355 D FirebaseApp: com.google.firebase.crash.FirebaseCrash is not linked. Skipping initialization.
10-27 14:15:44.241 11355 11355 D FirebaseApp: com.google.android.gms.measurement.AppMeasurement is not linked. Skipping initialization.
10-27 14:15:44.241 11355 11355 I FirebaseInitProvider: FirebaseApp initialization successful
10-27 14:15:44.284   821  1071 W ActivityManager: Background start not allowed: service Intent { act=fcm_message_received cmp=de.pixart.messenger/.services.XmppConnectionService (has extras) } to de.pixart.messenger/.services.XmppConnectionService from pid=11355 uid=10090 pkg=de.pixart.messenger
10-27 14:15:44.288 11355 11380 E AndroidRuntime: FATAL EXCEPTION: Firebase-PushMessageReceiver
10-27 14:15:44.288 11355 11380 E AndroidRuntime: Process: de.pixart.messenger, PID: 11355
10-27 14:15:44.288 11355 11380 E AndroidRuntime: java.lang.IllegalStateException: Not allowed to start service Intent { act=fcm_message_received cmp=de.pixart.messenger/.services.XmppConnectionService (has extras) }: app is in background uid UidRecord{7a9723f u0a90 RCVR idle change:idle|uncached procs:1 seq(0,0,0)}
10-27 14:15:44.288 11355 11380 E AndroidRuntime:        at android.app.ContextImpl.startServiceCommon(ContextImpl.java:1521)
10-27 14:15:44.288 11355 11380 E AndroidRuntime:        at android.app.ContextImpl.startService(ContextImpl.java:1477)
10-27 14:15:44.288 11355 11380 E AndroidRuntime:        at android.content.ContextWrapper.startService(ContextWrapper.java:650)
10-27 14:15:44.288 11355 11380 E AndroidRuntime:        at de.pixart.messenger.services.PushMessageReceiver.onMessageReceived(PushMessageReceiver.java:25)
10-27 14:15:44.288 11355 11380 E AndroidRuntime:        at com.google.firebase.messaging.FirebaseMessagingService.zzd(Unknown Source:402)
10-27 14:15:44.288 11355 11380 E AndroidRuntime:        at com.google.firebase.iid.zzg.run(Unknown Source:26)
10-27 14:15:44.288 11355 11380 E AndroidRuntime:        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
10-27 14:15:44.288 11355 11380 E AndroidRuntime:        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
10-27 14:15:44.288 11355 11380 E AndroidRuntime:        at com.google.android.gms.common.util.concurrent.zza.run(Unknown Source:7)
10-27 14:15:44.288 11355 11380 E AndroidRuntime:        at java.lang.Thread.run(Thread.java:764)
10-27 14:15:44.295   821   840 I ActivityManager: Showing crash dialog for package de.pixart.messenger u0
10-27 14:15:44.301   821  1227 W ActivityManager: Background start not allowed: service Intent { act=fcm_message_received cmp=de.pixart.messenger/.services.XmppConnectionService (has extras) } to de.pixart.messenger/.services.XmppConnectionService from pid=11355 uid=10090 pkg=de.pixart.messenger
10-27 14:15:44.305 11355 11382 I Process : Sending signal. PID: 11355 SIG: 9
10-27 14:15:44.315   821   839 W BroadcastQueue: Permission Denial: receiving Intent { act=android.intent.action.DROPBOX_ENTRY_ADDED flg=0x10 (has extras) } to ProcessRecord{efa0321 1814:eu.thedarken.wldonate/u0a88} (pid=1814, uid=10088) requires android.permission.READ_LOGS due to sender android (uid 1000)
10-27 14:15:44.330   821  1612 I ActivityManager: Process de.pixart.messenger (pid 11355) has died: fore RCVR
10-27 14:15:44.331   821   841 W zygote  : kill(-11355, 9) failed: No such process
10-27 14:15:44.336   821  1640 W ActivityManager: Ignoring remove of inactive process: ProcessRecord{ddb0ae3 0:de.pixart.messenger/u0a90}
10-27 14:15:44.352   821   840 W AppOps  : Finishing op nesting under-run: uid 1000 pkg android code 24 time=0 duration=0 nesting=0
10-27 14:15:44.373   821   841 W zygote  : kill(-11355, 9) failed: No such process
10-27 14:15:44.373   821   841 I zygote  : Successfully killed process cgroup uid 10090 pid 11355 in 42ms

Activity

  1. changed the title [-]Put app into temporary whitelist when an high-priority GCM message is received[/-] [+]Put app into temporary whitelist when a high-priority GCM message is received[/+] on Oct 28, 2018
  2. ale5000-git commented on Oct 28, 2018

    @ale5000-git
    Member

    I haven't been able to test the code yet but I hope to test it and put it in my installer soon.

  3. tmolitor-stud-tu commented on Oct 28, 2018

    @tmolitor-stud-tu
    Author

    @ale5000-git would be nice if it was in the official microg builds, too.

    Many people use the LineageOF for microg (https://lineage.microg.org/) which is a fork of LineageOS with microg already included.

  4. eMPee584 commented on Feb 1, 2019

    @eMPee584

    It really should be included if even the specs say that! #:shipit:

  5. added this to the 0.2.7 milestone on Jun 2, 2019
  6. ale5000-git commented on Jun 2, 2019

    @ale5000-git
    Member

    The problem should be fixed in the new version of microG GmsCore released yesterday, I'm closing this for now.
    Please try it and report back.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions