Does Android lower the download rate when the screen turns off?
Asked Answered
W

1

11

I observed that I can download a file faster if I use wget with the screen on application, that acquires a screen dim wake lock than doing the same without this application and having the screen turned off.. I downloaded exactly the same file (from my apache web server) and the time is almost two times faster when I used the screen on application. To download the file I use a ported versions of wget.. And here is my question:

Does Android lower the download rate when the screen turns off?

Or due to the fact that the screen on app acquires a wake lock, forces the CPU to be always on, so more CPU cycles are spent for the download process.. I am a little bit confused..

Wrigley answered 3/10, 2011 at 15:48 Comment(0)
M
14

Short answer is yes, Android sometimes does lower the download rate when the screen turns off. According to this Android bug report (starred by 90 users),

It seems that, even with "Wifi Sleep Policy" set to "Never", the wifi on some Android devices will enter Power Save mode (a.k.a. PSP mode) when the screen turns off.

PSP mode apparently causes the wifi device to sleep, but wake up periodically and ask its access point to deliver packets that were addressed to to the device while it was asleep. This necessarily causes additional, "spiky" network latency. This additional latency means that some network-oriented applications experience problems when the screen turns off.

This more or less correlates with the behavior you're describing. This issue affects only some phones, not all, and only some versions of Android. I suggest you visit the bug report above, there is a long discussion of this issue.

How to solve this issue

There is a workaround for Android 2.3 at least: You need to acquire WIFI_MODE_HIGH_PERF lock:

In this Wi-Fi lock mode, Wi-Fi will be kept active as in mode WIFI_MODE_FULL but it operates at high performance with minimum packet loss and low packet latency even when the device screen is off. This mode will consume more power and hence should be used only when there is a need for such an active connection.

CPU clock scaling in Android

Android is based on Linux kernel, and uses CPUFreq Governors to adjust CPU frequency to conserve the battery. Exact policies and frequencies vary from vendor to vendor and are subject to change. There are also utilities that let you adjust these policies, but they all require rooted phone. Usually, Android phones lower CPU frequency and use "powersave" governor when the screen is turned off.

However, I don't think network traffic on a phone is CPU-bound. That is, even when in power-safe mode, network throughput is a bottleneck, not CPU speed.

Mousy answered 15/10, 2011 at 3:18 Comment(4)
Thank you for you response. I haven't noticed that. I make another simple experiment. I run a native counter in an infinite while loop (while(1)) equipped with a signal handler. I run for 3 minutes and after this interval sent it a signal using the Android Alarm Manager and force it to dump the counter value. When the screen was off the counter value was almost 500.000.000 and when the screen was on was almost 1.000.000.000, that is the double value! Is this happen for the same reason? Does Android under-clock the CPU when is in screen off mode too?Wrigley
Expaned my answer about CPU scalingMousy
The wifi WIFI_MODE_HIGH_PERF lock did not worked for us is a similar situation (we used ntpd and when screen was off the synch was destroyed due to the very big delays that wifi sleep policy caused), so we just adjust the screen off timeout. Greetings from TNL Thanasis :PMargay
Thank you all for the answers! Manos, greetings from DCS :PWrigley

© 2022 - 2024 — McMap. All rights reserved.