element-hq / element-hq/element-android
Battery drain caused by Element not being able to detect loss of connectivity due to the Rethink firewall
- Dominant language
- Kotlin
- Stars
- 3.7k
- Forks
- 917
- PR merge metrics
- No merged PRs in 30d
Description
### Steps to reproduce
1. Install Element 1.5.30 from F-Droid
2. Login and change the "Background sync mode" to "Optimised for real time"
3. Go to app info, change the "Power Saver" from "Smart Background Running" to "Run in Background" and turn on "Auto startup"
4. Leave phone charged at 60% overnight
5. Wake up with the battery at the 30% level
### Outcome
#### What did you expect?
For Element not to drain the battery.
#### What happened instead?
Element drained the battery.
#### More info
I have a [Tasker](https://play.google.com/store/apps/details?id=net.dinglisch.android.taskerm&hl=pl&gl=US) profile that turns on aeroplane mode between 21:00 and 6:30 if the display is turned off, otherwise it turns off aeroplane mode back. For example, if I turn on my phone at 22:00 then it's going to turn off aeroplane mode and once I turn the display off it's going to turn the aeroplane mode back on. If the display is turned off, and it's 6:31 then it's going to turn the aeroplane mode off.
Rethink DNS + Firewall says that Element tried to make a connection to `matrix-client.matrix.org` **177224 times** (see image 1). It stopped spamming like that at 6:37 (see image 2), **which is when the aeroplane is turned back off**.
I'm going to include the battery usage below, see image 3, 4 and the "Device estimated power use" at 5.
I'm going to send verbose logs from the Element app and the output of the `adb bugreport` in the Element's bug report screen as well. You can view it by using this [public instance](https://bathist.online/) or by [self-hosting it yourself](https://developer.android.com/topic/performance/power/setup-battery-historian). The red line in the bugreport means that the battery history log overflow has been detected in the bugreport, which means that the visual timeline does not show events after the overflow. Perhaps caused by Element?
Also, I don't recall having this issue on the older version of Element, so I'm going to try doing that.
|1|2|3|4|5|
|:---:|:---:|:---:|:---:|:---:|
|
|
|
|
|
|
### Your phone model
Oppo A31 2020 CPH2015
### Operating system version
ColorOS v6.1.2 and Android 9
### Application version and app store
Element 1.5.30 from F-Droid
### Homeserver
matrix.org
### Will you send logs?
Yes
### Are you willing to provide a PR?
No
Contributor guide
Assessment
This issue has not been assessed yet.