FORUMS
Remove All Ads from XDA

[Mod][Xposed] Amplify - Battery Extender - Control alarms, services, and wakelocks

819 posts
Thanks Meter: 3,403
 
By cryptyk, Senior Member on 21st August 2014, 01:33 AM
Post Reply Email Thread
Amplify puts you in control of how your device uses your battery by controlling how often your device can wake up, and how long it can stay awake. Use the recommended settings for easy battery savings, or dig in and customize every alarm, service, and wakelock on your device.
Here are some highlights:
  • A beautiful design, inspired by L Material Design principles. Your choice of Light or Dark.
  • A stable blocking engine
  • Comprehensive measuring of the time wasted and time saved because of alarms and wakelocks
  • Support for Lollipop and SELinux.
  • A growing list of descriptions of the alarms, services, and wakelocks in plain English (and other languages coming soon!)
  • A Pro package that lets you control any alarm, service, or wakelock on the device
  • Translated by the community into Chinese, Czech, Finnish, French, German, Greek, Italian, Japanese, Malay, Portuguese, Polish, Romanian, Russian, Spanish, and more
  • Tasker integration
  • An open source codebase so you can see how it works, or build it yourself

3.3.7 is the latest version, available in the Google Play Store.

You can learn more at Amplify for Android.

The In-App purchases allow you to unlock the Pro package that lets you customize the alarms, services, and wakelocks on your device. Without the pro package, you can control the worst battery hogs: NlpWakelock, NlpCollectorWakeLock, ALARM_WAKEUP_LOCATOR, and ALARM_WAKE_ACTIVITY_DETECTION.

May you have a long [battery] life!
Ryan


Watch this excellent review by Chris Nacca for an introduction, and to answer most of your questions

FAQ for problems

I donated but Amplify doesn't recognize my donation
This is frustrating. The reason is because of the way that the Play Store handles In-App-Billing when apps are installed from different places (like sideloading, Xposed repo, and sometimes from the Play Store app). The fix is usually simple:
1) Uninstall Amplify from your device
2) Go to the Play Store on your computer and install Amplify from the Play Store web interface.
For some reason this tends to link the accounts more reliably than installing from the Play Store on the device.

It won't let me donate, or I see an error message when trying to donate
There are a few reasons this happens. It's always because Google reports that In App Billing isn't available for your device. Here are the causes I've seen:
  • You installed Amplify from the Xposed installer instead of from the Play Store, which causes problems due to a bug in Google Play
  • You have the Play Store or Google Play Services Greenified
  • You have blocked some part of the Play Store from running with Service Blocker, or another XPosed module
  • You purchased Amplify with a different Google account than the one you're using now
  • You have Lucky Patcher installed
  • You're from a country where In-App Billing is not available (not common)
  • You need to update your Google Play Store or Google Play Services (not common)
  • I just did an update to Amplify in the Play Store and it takes a couple of hours for Google to update their servers with the new version (not common)

I had Lucky Patcher installed. I uninstalled it but Amplify still doesn't work
Lucky Patcher makes permanent changes to your system. Simply uninstalling it doesn't work. Here's something to try, courtesy of @mikeezy187:
- Uninstall lucky patcher
- Go into settings
- Go to apps
- Go to Google Play Store
- Clear Cache and app data
- Uninstall Google Play Store updates and it will ask you if you want to restore Google Play Store to its stock settings
- Click Yes
- Reboot

Amplify gets stuck on the screen checking for Xposed, or says Xposed isn't installed
If you're positive that Xposed is running properly, and that Amplify is checked in the Modules list, and you've done a soft reboot:
When it gets stuck, swipe from the left side of the screen, choose Settings, then push the back button to bypass these checks.

Additional details

I have a bug or feature request.
Cool. Thanks for helping out! Please go file the issue here, on GitHub. You can also upvote bugs and feature requests there.

I'd like to help with translations.
That would be AWESOME. Please check here to get started.

Why is Play Services such a battery killer:
1) If Google Location Services are turned on, it sets an alarm to wakeup every 60 seconds, check the network location, and broadcast ALARM_WAKEUP_LOCATOR.
2) Everytime ALARM_WAKEUP_LOCATOR fires, Google Search receives the broadcast and grabs an NlpWakeLock and NlpCollectorWakeLock.
3) Those wakelocks hold the keep the device on for 5-15 seconds. This means that the device is actually awake for about 15 seconds per minute, or 25% of the time!

What are the consequences of reducing alarm and wakelock frequency?
It depends on the alarm. The defaults are well tested and don't have negative impacts. They just save battery life. If you start blocking unknown alarms and wakelocks, it may stop things from working. You can always disable the module at boot to fix things. The latest knowledge base was created by @1ceb0x and is being maintained by the community. I regularly include their findings in Amplify. You can find the knowledge base here: https://docs.google.com/spreadsheets...gid=2072742181

I blocked something and now my device won't boot!
To disable Xposed during boot, you have to repeatedly tap one of the hardware buttons (Power, Volume, or Home) on your device during startup. During boot, your device will vibrate twice when it detects the first key press. You'll then have five seconds to press that same button four more times, with each keystroke producing a short single vibration. After ending with a long vibration, your device will disable and prevent most of Xposed's actions, allowing you to go back to Amplify settings and fix what you broke.

What do the numbers mean, and how do I use this thing?
Check out this awesome intro video by Shiwak that explains the basics of how Amplify works.

I still get a ton of Wakelocks showing up in BetterBatteryStats
Short version: Those aren't really wakelocks. You can ignore them. Please go check in WakeLock Detector, and you'll see that they don't show up there.

Long version: Admittedly, I don't know *exactly* why they're showing up in BBS, but not in Wakelock Detector. I did a ton of testing today and can confirm that my device showed 988 NlpWakeLocks in BBS, but only 20 in WLD. During that time, I also had logcat running and a custom hook in the Android stats code. Logcat didn't show any of those phantom wakelocks, the Android stats code doesn't record them, Amplify doesn't see them, and WLD doesn't see them. BBS is [awesomely] open source, so I went digging a bit. I don't see anything obviously wrong in the code, but for some reason it's getting the counts wrong. Here's the interesting piece: It's getting the TIME SPENT in the wakelocks correct. That's why you see something absurd like 2000 wakelocks and only 6 seconds of lock time. If it were really that many wakelocks, your lock time would be much, much higher.

Where's the source code?
It's here: https://github.com/rsteckler/unbounce-android
A couple of things:
1) Don't judge. I need to do some cleanup, but wanted to post the repo early so people can take a look at what it does.
2) Pull requests are welcome.

I didn't read the FAQ
The band will not perform unless there is a bowl of M&Ms backstage, with all of the brown ones removed.

Where's the change log?
It's here: https://github.com/rsteckler/unbounc...commits/master

What are the best settings?
There is no "best" for everyone because every device is different. Check out this helpful thread from @Celestial Fury for a guide that walks you through an awesome baseline, and gives you advice on how to tune further.

What's an alarm vs. a wakelock, and how are they related with regards to Nlp (Network Location Provider)?
An alarm wakes your device from deep sleep, scheduled using the RTC (Real Time Clock). For example, Google Play Services schedules an alarm every 60 seconds to wake up the device with the ALARM_WAKEUP_LOCATOR alarm. That's why I didn't try to stop the wakelocks at first, but instead tried to stop the alarms. I don't even want the device to wakeup in the first place!
Once the alarm fires, the Nlp service wants to get your location and send it back to google. This requires keeping the device awake for a few (5-15) seconds. To keep the device awake, Google Play Services grabs the NlpWakeLock. This is the second point we can modify the system, but it only puts the device back to sleep once it's already awake.
A couple of other things: This is why I recommend starting with just the alarms. It's less intrusive, and stops the device from waking up at all. Most people will probably be fine with the settings 240, 240, 0, 0. There are other things that can cause an NlpWakeLock, though, including third party apps. If the alarms don't work by themselves for you, you can also slow down the frequency of the wakelocks directly in the settings.

Are there any ads in Amplify?
Nope. Never have been, and never will be.

What information do you collect about me?
Two things:
1) Every 24 hours, Amplify will upload anonymous stats about your alarms, wakelocks, and services. I use these to generate the Global Stats you see on the home screen. The only thing that's stored is the number of events and the time they spent. I don't collect the names of the events, or anything about you.
2) When you launch the UI, I use Google Analytics to collect some information about your device. Specifically, the version of Amplify that you're using, the type of device you have, what country you're in, the version of Android you're using, etc. I use this information to make the app better. For example, it tells me how many people have the app installed in each country. This helps me know which language translations will be the most helpful. It also helps me know which versions of the app people will be upgrading from so I can make those transitions smooth. In my Google Analytics account, I have the options to share your data with Google and Third parties turned off. You can also read Google's Privacy Policy if you want to know how they use the data.

Do you sell my data?
Nope. Never.
I only collect information about how many alarms, wakelocks, and services you have, and how long they spend keeping your device awake. I never track the actual names. That data is only used to display Global Stats on the home screen. It's never used in any other way, period. You can opt out of global stats on the settings screen.
The other data collected for Google Analytics is only used to make the app better. I don't do anything else with it and no third parties get access to it.
No other data is collected beyond those two things.

How do I know that the code on GitHub is actually the code you push to the Play Store?
I don't think there's a way to verify that. You just have to trust me. If that makes you nervous, I encourage you to build the GitHub code yourself.

Can I get Pro features by donating via PayPal, Bitcoins, or something else?
Sadly, no. The Google Play Store Terms of Service require that I use the Google Play Store IAP system to collect donations. I also don't plan on distributing non-Google IAP versions outside of the Play Store because of the effort involved. I'd rather spend my time making Amplify better, instead of maintaining two copies of the code and writing a new donation system. Sorry if you're one of the people affected by that.

Thanks, and let me know if it works for you!
Ryan
Attached Files
File Type: apk Amplify-v3.3.7.apk - [Click for QR Code] (1.03 MB, 11424 views)
The Following 666 Users Say Thank You to cryptyk For This Useful Post: [ View ] Gift cryptyk Ad-Free
 
 
alex91s
21st August 2014, 01:43 AM |#2  
Guest
Thanks Meter: 0
 
More
What are the consequences of reducing its frequency? Are there any negatives?
21st August 2014, 01:49 AM |#3  
OP Senior Member
Thanks Meter: 3,403
 
More
Quote:
Originally Posted by alex91s

What are the consequences of reducing its frequency? Are there any negatives? if not, why don't reducing it more?

I don't know all of the consequences, but it should be pretty safe because you're able to completely disable Google Location Services without major disruption.
For myself, I think 4 minutes is a good balance between the apps that depend on Network Location and battery life. Once I verify with you guys that it works and doesn't cause problems on different setups, I'll make the timing adjustable so you can decide for yourself what you want the threshold to be.

Thanks,
Ryan
The Following 21 Users Say Thank You to cryptyk For This Useful Post: [ View ] Gift cryptyk Ad-Free
21st August 2014, 05:08 PM |#4  
OP Senior Member
Thanks Meter: 3,403
 
More
After two days using this, my battery use has gone from about 5% per hour to about 2% per hour when the phone is idle.
The ALARM_WAKEUP_LOCATOR in BBS has gone from 1.1/minute to 15/hour.
The next biggest wakeup is now ALARM_WAKEUP_ACTIVITY_DETECTION, so I'm going to tackle that one next.

I'm on an HTC One M8, and would appreciate if someone can confirm on a different device, as well.

Thanks,
Ryan
The Following 13 Users Say Thank You to cryptyk For This Useful Post: [ View ] Gift cryptyk Ad-Free
alex91s
21st August 2014, 05:11 PM |#5  
Guest
Thanks Meter: 0
 
More
Not sure If it's working here (Moto X 4.4.4). Take a look:

The Following User Says Thank You to For This Useful Post: [ View ] Gift Ad-Free
21st August 2014, 05:27 PM |#6  
OP Senior Member
Thanks Meter: 3,403
 
More
Quote:
Originally Posted by alex91s

Not sure If it's working here (Moto X 4.4.4). Take a look:

It's hard to tell with WLD because it doesn't show the source of the alarms that wakeup the device.

You should notice a decrease in NlpWakeCollectorWakelock, but you'd have to run it for some time before and after to see the difference in the count.

BBS shows the alarms that actually wake up the device, and the frequency. WLD just shows the wakelocks, and the count. The problem is that you'd need to run it for the same amount of time to calculate the frequency.

In any case, I'd love even your subjective opinion on your battery life today vs. yesterday.

Thanks,
Ryan
The Following 5 Users Say Thank You to cryptyk For This Useful Post: [ View ] Gift cryptyk Ad-Free
Corndude
21st August 2014, 06:52 PM |#7  
Guest
Thanks Meter: 0
 
More
Any chance you could put a setting in that would allow us to set the time by ourself?
21st August 2014, 07:36 PM |#8  
GermainZ's Avatar
Retired Forum Moderator / Recognized Developer / XDA Portal Team
Thanks Meter: 8,787
 
More
Quote:
Originally Posted by Corndude

Any chance you could put a setting in that would allow us to set the time by ourself?

He says it's planned in the OP, which you should've read.
The Following 6 Users Say Thank You to GermainZ For This Useful Post: [ View ]
21st August 2014, 08:46 PM |#9  
nIGhT-SoN's Avatar
Senior Member
Flag Mioveni
Thanks Meter: 69
 
More
Giving a try right now since I hate how much NIp keeps my phone awake.
The Following User Says Thank You to nIGhT-SoN For This Useful Post: [ View ] Gift nIGhT-SoN Ad-Free
21st August 2014, 10:34 PM |#10  
metalboy94's Avatar
Senior Member
Flag Bucharest
Thanks Meter: 168
 
More
Gonna give it a shot too. For reference, this is how my NLP wakelocks looked like on my previous charge. I have Location History on since I use Cerberus, so I suppose I should notice any improvements.

Sent from my LG-D802 using XDA Free mobile app
Attached Images
File Type: jpg 1408656846966.jpg - [Click for QR Code] (51.3 KB, 15463 views)
The Following User Says Thank You to metalboy94 For This Useful Post: [ View ] Gift metalboy94 Ad-Free
21st August 2014, 10:50 PM |#11  
OP Senior Member
Thanks Meter: 3,403
 
More
Quote:
Originally Posted by metalboy94

Gonna give it a shot too. For reference, this is how my NLP wakelocks looked like on my previous charge. I have Location History on since I use Cerberus, so I suppose I should notice any improvements.

Sent from my LG-D802 using XDA Free mobile app

Your stats are REALLY good, as is. Nice!
The Following User Says Thank You to cryptyk For This Useful Post: [ View ] Gift cryptyk Ad-Free
Post Reply Subscribe to Thread

Tags
alarm, amplify, nlp, wakelock, xposed

Guest Quick Reply (no urls or BBcode)
Message:
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes