urbandroid-team / dont-kill-my-app

Android vendors, don't kill my app!
Creative Commons Attribution 4.0 International
1.25k stars 2.51k forks source link

network sleeps on huawei honor 8 oreo #52

Open brianjmurrell opened 5 years ago

brianjmurrell commented 5 years ago

There is an additional (presumably power saving) strategy that none of the existing instructions address, AFAICT.

My Huawei Honor 8 running Oreo stops responding on the network a few minutes after the screen goes off. It does not disconnect/disassociate with the AP. When I turn the phone back on it does not re-associate and get a new DHCP lease. It just continues on from where it went to sleep with the same lease and association.

Indeed, while it is sleeping, there is network traffic from and to it (but only if it's originated from the device), so it really does still have networking up and running, it just does not respond to anything trying to reach it. It won't even respond to ARP requests or ICMP Echo Requests.

It of course does response to Google FCM push requests.

Perhaps this should be documented somewhere on your Huawei notes.

petrnalevka commented 5 years ago

Please correct me if I'm wrong, but isn't this the more aggresssive version of Doze mode introduced in Android 7.0? In general Doze mode can kick in just after screen on and it does restrict networking..

brianjmurrell commented 5 years ago

I thought so too. But I have a LineageOS 15.x (Android 7.x) phone which doesn't exhibit this behaviour and have been talking to somebody with a 7.1 phone that doesn't do it either.

brianjmurrell commented 5 years ago

This gets even more interesting (read: annoying).

It seems I can keep the network "awake" by having it plugged into a USB port and with adb running. I'm not sure if both of those are needed, but they prove a useful way to keep the network awake while investigating other issues.

But even with the network awake (i.e. the device continues to respond to pings), apps running on the device, while the screen is off can't seem to get their packets out of the device.

The example I have on hand is linphone-android. It is Firebase push enabled, so it can be killed by doze, etc. and an FCM push can be sent to wake/start it back up and that does work. I can see, using adb logcat that the app does start up once an FCM push is sent. All good to this point.

As soon as linphone-android wakes it tries to register itself with the SIP proxy it's configured to use but I can see (again, using adb logcat) it trying to register, but doing packet traces on the network, I can see that those registration attempts don't actually result in any network traffic. It's like the phone has blocked the app from being able to send it's network traffic out.

None of this happens on my LineageOS 15.x device. It works perfectly as expected with all of the above. Push starts up linphone-android and it successfully registers with the SIP proxy, so the above shenanigans does not seem to be a stock Android issue, at least with Nougat. I wonder if Oreo has added this additional nasty behaviour.

I would really like to understand if this is stock Android 8.x or if this is more Huawei mucking about.