I have a private sideloaded app (signed) that is mainly used to deliver push notifications. The rest of the app is just a single Activity to register with a Pin.
Most of the time things work just fine, but after a certain time each day the app enters the force closed state. Which by convention even Firebase cannot get notifications through.
This happens on multiple different devices. After some time I noticed that there is a very regular pattern to it. And delving into logcat at the right time (before the log overwrites itself) yielded the following results:
07-18 09:00:07.862 1398 4907 I ActivityManager: Force stopping XX.XXXX.XXXX appid=10485 user=0: from pid 14937
07-18 09:00:07.863 1398 4907 I WindowManager: Force removing ActivityRecord{7ac2d00 u0 XX.XXXX.XXXX/crc64993323848f6bc121.MainActivity t1282}
For me this happens every day at a few seconds after 09:00 for other devices it is different, but also daily (and not dependent on the start time of the app)
Looking up the "from pid" it results in:
u0_a243 14937 940 17504584 184708 0 0 S com.android.vending
So the playstore is killing my app? This is why I suspected play protect, since it already questioned the app during sideloading, but I allowed it.
Any lo and behold opening play protect settings the "last run time" corresponds with the time the app is killed.
Is there anything I can do about this, like whitelisting. I have full control over all the client devices so user only settings is not a problem.
What is worth noting is that this problem occured after an update to the app where implemented a bigpicturestyle notification (which has to download the picture in the OnMessageReceived handler) before that everything was working fine, and play protect did not even ask during installation. (but that was a few months ago so maybe it changed in the meantime). Did I do something to set it off?
Edit I found the definitve prrof that is is play protect. But the question remains, why?
yma.a(44): Unwanted app (MUwS) without is_muws flag was returned with verdict POTENTIALLY_UNWANTED on autoscan: XX.XXXX.XXX