Streaming apps provide live streams, free movies, TV shows, and much more, all at the fingertips of your mobile device. Zenith Media forecasts that by 2020, 28% of all global media consumption will be through mobile devices as the mobile internet takes share from almost all other media.
Joining the “bandwagon”, we recently downloaded the Netflix app and started consuming video content on a Nexus 6 phone running Android 6.0.1. Soon after, we noticed significant battery drain of the phone when the phone was not in use, in some cases up to 20% if left unplugged overnight.
Being curious, we filtered the user review of the Android Netflix app in the review tracking tool appbot (https://appbot.co/) to look for battery complaints. We found that we were not alone — the battery complaints from users had gone up significantly last year in May 2018 and was ongoing as of January 2019 (see Figure 1).
Following are some of the user complaints which are mostly around background energy drain.
Battery drain trend follows battery complaints trend
We downloaded various versions of the Netflix app (6.1.0 to 6.20.1) from Google Play store on my Nexus 6 device running Android version 6.0.1. Since the battery leak appears to happen when the app is in background, we performed a 1-minute test 5 times on each version, with Mobile Enerlytics’ Eagle Tester, where for each test, we let the app sit idle in the background (no user interactions and no video streaming). The following table shows all the Netflix app version that we tested.
|Netflix Version tested||Release date|
|6.1.0 build 27354||4/26/18|
|6.3.0 build 27748||5/24/18|
|6.4.0 build 28132||6/4/18|
|6.12.1 build 29733||10/1/18|
|6.20.1 build 31579||12/13/18|
Table 1: Netflix versions and app release date tested by Mobile Enerlytics.
We found that the battery drain trend of the Netflix app (shown in Figure 3) follows the battery complaints trend captured from appbot (shown in Figure 1). The battery drained by the CPU due to the Netflix Android app is significantly higher than the mid-April releases (version 6.1.0).
Root cause analysis
Next, we took a dive into the energy profiling output generated by Eagle Tester and compared the May release version 6.4.0 with the mid-April release version 6.1.0 of Netflix. What we found was that in steady state version 6.1.0 drains only up to 2 mA of current while it is idle in the background (shown in Figure 4).
In contrast, Eagle Tester’s power timeline revealed that version 6.4.0 drains up to 300 mA of current while it is idle in the background (shown in Figure 5). The power timeline further shows that the constant current draw is dominated by ProcessManager thread which is constantly keeping the CPU busy, draining a relatively constant 300mA of current! This thread continues to run even after the user closes the Netflix application.
Digging further, we looked at the strace output of the ProcessManager thread (shown in Figure 6). It shows that the ProcessManager thread is calling the wait4 system call in an infinite loop. wait4 system call is used to wait for child processes to exit. In every version of Netflix that exhibits the high battery draining behavior, the system call always returns an ECHILD error (no child processes) thereby being stuck in an infinite loop in the watchChildren method of the ProcessManager class. Here’s a link to the code for reference: http://androidxref.com/6.0.1_r10/xref/libcore/luni/src/main/java/java/lang/ProcessManager.java#watchChildren.
By using Mobile Enerlytics’ battery drain testing tool Eagle Tester, we were able to determine in minutes that indeed Netflix is constantly leaking battery even when sitting idle in the background. Further, Eagle Tester pinpointed the root cause to be the ProcessManager thread calling wait4 system call in an infinite loop.
Lastly, it is relevant to point out that we tried the Netflix app on other phones and this battery leak behavior of the Netflix app appears to only manifest on Android 6.0.1. According to Android Distribution Dashboard, as of May 10, 2019, an estimated 16.9% of Android devices are running Android 6.0. Are you one of the unlucky few that are affected by this issue? Let us know in the comments!
We reached out to Netflix to inform them of these findings. Netflix confirmed the bug and promptly fixed the bug. We also confirmed that the energy bug no longer exists in the latest version 7.8.0 (see Figure 3 above).