Skip to content

Conversation

anasofiagribeiro
Copy link
Contributor

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.

if (lastbundle.equals(intent.getBundleExtra(com.twofortyfouram.locale.api.Intent.EXTRA_BUNDLE))) {
return;
}
updateValues(intent);
if(U.isExternalAccessDisabled(context)) return;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line should be moved above the four lines that are newly added. If the external access pref is disabled then the receiver should not run anything, period.

@farmerbb
Copy link
Owner

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
Copy link
Owner

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

@farmerbb farmerbb merged commit dfa33b5 into farmerbb:master Jul 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants