farmerbb / SecondScreen

Better screen mirroring for Android devices
Apache License 2.0
304 stars 55 forks source link

Improve energy efficiency by applying Dynamic Retry Delay Energy Pattern + Cache Energy Pattern #72

Closed anasofiagribeiro closed 4 years ago

anasofiagribeiro commented 4 years ago

This improves the energy efficiency of SecondScreen by applying the Dynamic Retry Delay Energy Pattern and the Cache Energy Pattern for mobile applications.

The energy pattern was applied in SecondScreenIntentService.java and AndroidManifest.xml (for the Dynamic Retry Delay Energy Pattern) and TaskerConditionReceiver.java (for the Cache Energy Pattern). The general idea for the first one is to avoid accessing an internet connection if the connection is down . In particular, a class NetworkStateReceiver will be created in the java file that checks for an internet connection. The general idea for the second one is to avoid performing unnecessary operations by using cache mechanisms. In particular, the operations in method onReceive will only execute if the bundles changes.

farmerbb commented 4 years ago

Thanks for your contribution. SecondScreen does not access the network whatsoever - it doesn't even declare android.permission.INTERNET in its manifest. So I don't believe that the changes to the SecondScreenIntentService and the AndroidManifest are needed.

I am happy to accept the changes to the TaskerConditionReceiver however, assuming that these changes do not break interop with SecondScreen and Tasker in any way.

farmerbb commented 4 years ago

SecondScreen's sister app, Taskbar, also has a TaskerConditionReceiver where similar changes could be made:

https://github.com/farmerbb/Taskbar/blob/master/app/src/playstore/java/com/farmerbb/taskbar/receiver/TaskerConditionReceiver.java