Using a Pixel 9a with sandboxed Google Play Services and I gave it network, notifications, phone, sensors, and allowed it to run unrestricted in the background. I was surprised when push notifications (specifically calls) from VoIP apps such as WhatsApp and Signal were delayed, even though I gave both apps the phone and notification permissions as well especially after looking at the documentation here that says:
You should give a battery optimization exception to Google Play services for features like push notifications to work properly in the background. It isn't needed for the Google Play Store app.
I thought that just meant setting it to unrestricted in the background usage settings. However, I later found out after a debugging session (aided by AI) that because I leave my phone idle for so long (anywhere from 6-12 hours at a time) it entered doze a lot and notifications were delayed by 2-3 minutes (really bad for VoIP apps).
Before I did this, notifications would ring on time in IDLE mode (simulated with adb):
adb shell dumpsys deviceidle force-idle
but when I stepped it up into IDLE_MAINTENANCE:
adb shell dumpsys deviceidle force-idle
adb shell dumpsys deviceidle step
Notifications/VoIP calls were delayed again.
I'm not very familiar with adb commands so I asked AI whitelist GMS from doze (which is what I'm guessing is what happens by default on stock android) using adb:
adb shell dumpsys deviceidle whitelist +com.google.android.gms
And when I want back into IDLE_MAINTENANCE, I did not experience that delay again. I'm wondering if this special quirk can be mentioned in the documentation, or ideally, GMS and other push notification apps (UnifiedPush is another one I think) could benefit from getting a permission toggle that whitelists them from maintenance windows.
I've got a lot to learn about the inner workings of android so if I'm getting anything wrong here just let me know. I don't check the forum very often so apologize in advance for a potential late response.
Thanks for your time everyone!