yashsingh1/xdaforums huggingface dataset:
[Android Software Development] GioBozza:
CHANGELOG

v0.2.0

(05/01/2018)

WakeBlock service binds on runtime (this means that, if the core mod is already installed, you do not need to reboot after app installation/update). The service status shown in the app will automatically update on service binding.

Automatic uninstallation/backup restoring

The app can fetch the core mod version

v0.1.8

(02/01/2018)

Fixed core mod classes patching

v0.1.7

(31/12/2017)

Fixed SELinux permissions acquisition

Started implementation of the auto-binding process to avoid reboot on app update (not yet functional)

v0.1.6

(29/12/2017)

Fixed repackaging phase on deodexed devices

v0.1.5

(25/12/2017)

Improved patcher process

Updated baksmali to v2.2.2 (not yet compatible with Android 8.1)

v0.1.4

(10/09/2017)

Fixed bootloop on Samsung devices

Auto-patcher process priority raised to avoid it being killed by the OS

Added Simplified Chinese localization

v0.1.2

(07/09/2017)

Auto-patcher process priority rised to avoid it being killed by the OS

Added Simplified Chinese localization

v0.1.1

(21/08/2017)

Added application automatic backup of previously detected wakelocks

Added support for localization

Removed auto-downloader (now obsolete)

v0.1.0

(17/08/2017)

Initial release
[Android Software Development] GioBozza:
WANT TO INTEGRATE WAKEBLOCK IN YOUR ROM?

We decided to release the core part of the mod to let ROM developers integrate it in their own source code.

Here is the patch for you to simply drag on whichever version of android (should work on 7.x (maybe 6.x?)) and whichever device/ROM you want.

The only things we ask for are (that's not a legal license, but it can make us REALLY upset if you don't do that) :

- You shall credit [MENTION=7087071]GioBozza[/MENTION] for the mod by linking this thread in your ROM post (c'mon, don't write it in the bottom of the post, with size 1!)

- You may include this code to any non-commercial work (you can still get donations, we're cool with those!)

- You can not sell this code or get donations by the code of this mod alone

- You may include the free version of the apk in your ROM (in the future we may release a paid version or an unlock app. Of course, that can not be included.)

- You should redirect users here for support about the mod or the app itself

- You should have fun and save your battery

- You may need to drink some fruit juice afterwards - have that ready!

WHOOP, WHOOP - DOWNLOAD:

v0 Templates - platform/frameworks/base repository.

https://github.com/GiovanniBozzano/wakeblock

REMEMBER: the app takes no privileges at all to manage wakelocks. The ROM can even be without root!

Take note that we will update the "core" (android framework) part of the mod, from time to time. It is versioned, so you can keep track of what happened.

Cheers!
[Android Software Development] i42o:
Thank you. Seems promising
[Android Software Development] DEVILOPS 007:
Nothing shows up in the wake lock section for me
[Android Software Development] pioccd:
Uhm, service is BOUND or UNBOUND?
[Android Software Development] DEVILOPS 007:
It says service is unbound and I flashed the zip and then installed the apk.
[Android Software Development] pioccd:
Please try to flash another time and reinstall the app.
[Android Software Development] CappyT:
After installing the apk, reboot the phone. It should say now "service bound"
[Android Software Development] DEVILOPS 007:
I tried flashing again and installing the app but it still says unbound. Do I need to edit anything like build or host files?
[Android Software Development] CappyT:
Are you on rooted stock 7.1.1? We tested on that, and well... it works. Just needs a reboot after app install and it will continue to work across reboots.
[Android Software Development] DEVILOPS 007:
I'm on resurrection remix 7.1.1 and flash kernel. I guess it isn't supported on this yet but it is only alpha so no worries if I can't get it to work.
[Android Software Development] CappyT:
*** HAVE A BACKUP READY FIRST ****

Try this:

- Download the odex file here (it's the same that you find in the archive, if you want to save data, extract the flashable archive)

- Move the file (with any file browser with root support) to /system/framework/oat/arm64 and replace if asked

- The phone (could) instantly reboot. If not, check if the permissions are rw-r--r-- (644)

- Reboot
[Android Software Development] DEVILOPS 007:
It says unbound after I rebooted

---------- Post added at 11:29 PM ---------- Previous post was at 11:27 PM ----------

Okay about to try, I really appreciate the help BTW you're a very nice person. Whether this works or not thank you.

---------- Post added at 11:32 PM ---------- Previous post was at 11:29 PM ----------

There are no folders in the system framework folder. Only files.

---------- Post added at 11:32 PM ---------- Previous post was at 11:32 PM ----------

Should I add the folders?
[Android Software Development] CappyT:
Well. It means your rom is not odexed.

You can try by creating those folders and put that file there. Can't guarantee btw
[Android Software Development] SimoIanni:
Maybe I found a solution for you, I'm trying on my phone right now, I'll let yow know if it works ASAP

--------

Edit: It didn't work, still searching
[Android Software Development] DEVILOPS 007:
Thanks Bro, I appreciate it. I dont know the difference between these rooms.
[Android Software Development] DEVILOPS 007:
Hopefully you find something. Is it because some roms are aosp and some are odex or something? I'm confused about what the difference is and why it makes this mod not work.
[Android Software Development] GioBozza:
Odexing is the way Android now uses to optimize code and generate .oat or .odex machine code files from .dex smali files.

Some ROMs are deodexed: this means all applications run on .dex files and sometimes even system modules (and that's your case).

Currently the mod is tied to the .odex file, but I'm going to support the deodexed version as well.
[Android Software Development] DEVILOPS 007:
Can I ask, how do you create the zip?
[Android Software Development] Kris6699:
I am having trouble applying the patch, Source is RR (ResurrectionRemix): theslenderhacker@rrbuilder://home/theslenderhacker/RR/frameworks/base$ git apply --check wakeblock1.0.patch

error: patch failed: services/core/java/com/android/server/power/PowerManagerService.java:510

error: services/core/java/com/android/server/power/PowerManagerService.java: patch does not apply
[Android Software Development] JonasVFC:
does anyone tried it on 7.1.2 yet?

edit: it doesn't work. it doesn't boot after flashing the zip
[Android Software Development] GioBozza:
You have to apply the patch manually, as the base code isn't the stock one.
[Android Software Development] DEVILOPS 007:
With lineage are the nightly updates still breaking wakeblock?
[Android Software Development] GioBozza:
Most probably yes. They usally don't change the mod classes, but alter the services.jar/odex.
[Android Software Development] DEVILOPS 007:
What do you do to make wakeblock work on lineage? The method that works fine for me over OTA updates is making a build from the repo and putting the patch file in frameworks/base then applying with git and then make services. Then zip it up and flash it. With lineage is that not working because the services.jar file is constantly changing unlike the rom I use?
[Android Software Development] GioBozza:
Exactly, Lineage OS is currently in heavy delevelopment (and probably will always be), so it's almost useless to try to keep it updated with WakeBlock, unless it's implemented in it's source code and compiled automatically everytime.
[Android Software Development] DEVILOPS 007:
Oh okay thanks for explaining that:D
[Android Software Development] Paz9:
This only works with deodexd roms?
[Android Software Development] SimoIanni:
The process of getting it work on odexed roms (Like stock) is a bit more complicated, however there are not many odexed custom roms as I know so making a tutorial on how to do it isn't a priority.

We are now working on the stock 7.1.2 so we should release it in days.
[Android Software Development] Paz9:
Does this only work on the nexus?

Id like to try it on my stock odex rom if its possible...
[Android Software Development] GioBozza:
I'm currently supporting stock Nexus 6P ROM only, but I plan to add other ROMs in the future. Also, if you are using a custom ROM, the developer could add WakeBlock to it.
[Android Software Development] DEVILOPS 007:
Am I right in saying this mod doesn't support 7.1.2 for odexed and deodexed roms? If so is this going to support it in the future? Thanks
[Android Software Development] GioBozza:
7.1.2 stock will be supported as soon as possible. I will be busy for a week or so and then I'll do it.
[Android Software Development] DEVILOPS 007:
Okay thanks, I appreciate it. :D
[Android Software Development] DEVILOPS 007:
I have a little question. I know how to apply the patch file with git in Linux but for Roms that have no repo on github or one that work is there a way to edit the patch file in manually? I assume so but could someone tell me how it is done please. Thank you:D
[Android Software Development] GioBozza:
Theoretically it can be done, but it's very advanced and it's definitely not worth it. You would have to add and edit big portions of smali code to a ~20.000 lines file.
[Android Software Development] DEVILOPS 007:
Well that's a no go then. Thanks. How would I get this on a deodexed rom where I have the services.jar file but I have no github repo to use which means I can't do make services and stuff to apply the patch unless I'm wrong.

---------- Post added at 04:09 PM ---------- Previous post was at 04:07 PM ----------

I see lucky Patcher has an option to do this but I'm not sure how it works though.
[Android Software Development] GioBozza:
LuckyPatcher is made for small edits, this is a huge one. The only way you can do that is:

A) Hooe that services.jar/odex is the same as the ROM upon which the one you use is based.

B) Ask the developer to implement it.
[Android Software Development] DEVILOPS 007:
Okay thank you. I guess screw it then. Is there no way for me to apply the patch without make services and anything like that if I have the services.jar file? Thanks
[Android Software Development] CappyT:
In theory, It should work with any phone, but it's better to compile from sources, as non-nexus phone are mostly subject to many differences
[Android Software Development] Paz9:
damn

on my huwaei mate 9 im getting alot of *alarm* and deviceidle_maint wakelocks was hoping this would help.

tried installing

says unsupported ROM :(
[Android Software Development] DEVILOPS 007:
Probably cause it isn't a nexus device. Is that wakelock even safe to limit and what time would you set it to?
[Android Software Development] Paz9:
im not sure but it comes from 'Android System' so i guess if i limit it alittle it shouldnt be too bad.
[Android Software Development] SimoIanni:
Good news guys, I finally built wakeblock on stock 7.1.2

As always take a backup of your "/system/framework/oat/arm64/services.odex" file

Downloads:

- Standalone ODEX: MEGA

- Flashable ZIP: MEGA
[Android Software Development] DEVILOPS 007:
I assume it doesn't have any affect on deodexed roms and the patch file will need to still be updated
[Android Software Development] SimoIanni:
The patch is always so nothing has changed
[Android Software Development] xman323:
[MENTION=7087071]GioBozza[/MENTION] I can't thank you enough, this mod made night and day difference in my standby battery usage on my Nexus 6p.

You are a legend sir.
[Android Software Development] DEVILOPS 007:
Can't wait for this to be on 7.1.2 Would love to get this on uber but take your time bro:D
[Android Software Development] Alebr81:
Awesome work

Hi.. I am from Brasil.. so.. sorry for my bad English.

I saw your app and it is awesome.. but it doesn't work on my superstock rom. I have a s7 edge and I believe that your app would be used to every rom.. it is a amplify without e e xposed.. since we are on nougat ... would I be able to make your app to work on my s7 edge superstock rom?any workaround?

Thank you in advance.. you are a great dev.
[Android Software Development] AndrewM3:
So I can flash this on coretx 7.1.2 and download app from playstore and it should work?
[Android Software Development] DEVILOPS 007:
No, this is only for odexed roms. For deodexed roms the patch file needs to be applied to the services.jar file in /system/framework with git. Also the patch file hasn't been updated to 7.1.2 yet.
[Android Software Development] nicesoni_ash:
[MENTION=7087071]GioBozza[/MENTION]

I used the same patch for 7.1.2 and it applied successfully, would there be any need to update this patch for 7.1.2 or should it work as it is? I am yet to build with this patch for 7.1.2.
[Android Software Development] SimoIanni:
As we said the patch doesn't need to be updated, it only needs to be re-applyed
[Android Software Development] DEVILOPS 007:
What do you mean? Can wakeblock be on uber 7.1.2 right now?

---------- Post added at 10:35 AM ---------- Previous post was at 10:26 AM ----------

How comes I've tried applying the patch on roms like DU and it says errors
[Android Software Development] JonasVFC:
can i flash this on a moto z play (since the rom is close to stock android)?
[Android Software Development] DEVILOPS 007:
You can try but make a backup. This mod has only really been made for nexus 6p so don't be surprised if it gives you an error.
[Android Software Development] manalicream:
Is it possible to get a version for the latest pure nexus build (7.1.2)?
[Android Software Development] DEVILOPS 007:
I'm working on that right now.
[Android Software Development] DEVILOPS 007:
Wakeblock on pure Nexus 7.1.2 here.

https://xdaforums.com/nexus-6p/general/taking-wakeblock-requests-t3583397
[Android Software Development] manalicream:
Super!
[Android Software Development] DEVILOPS 007:
What rom are you trying to do? If the roms manifest on github is 7.1.2 then wakeblock will need to be built for 7.1.2. It will bootloop if you build for 7.1.1 and flash on 7.1.2

---------- Post added at 10:43 PM ---------- Previous post was at 10:42 PM ----------

It works fine on 7.1.2. I have already built it for 4 roms on 7.1.2
[Android Software Development] bhanuprasad1981:
Any updates on alarm / regex blocking
[Android Software Development] moi123:
Thanks, you truly rock [MENTION=7494055]DEVILOPS 007[/MENTION] ! :good:
[Android Software Development] tomte28:
Are there any news for wakeblock on stock 7.1.2 May patch (Build N2G47O)?
[Android Software Development] SimoIanni:
I't done, [MENTION=7087071]GioBozza[/MENTION] should load it in days
[Android Software Development] GioBozza:
*** UPDATE ***

I added these new versions to the repository:

7.1.2 (N2G47H, Apr 2017)

7.1.2 (N2G47O, May 2017)

7.1.1 (N4F26U, Apr 2017) should be ready soon for those who stayed behind. :P
[Android Software Development] irule311:
Is it possible to run this mod on a pixel xl?
[Android Software Development] GioBozza:
It is, but I currently don't have enough time to support more devices.

While the app is universal, you can use the templates to apply the core mod to a stock or custom ROM though.
[Android Software Development] tomte28:
Great stuff! It works as expected on my stock Nexus 6P with latest 7.1.2. OTA (N2G47O, May 2017).

Thanks for the quick update :) :good:
[Android Software Development] MrMiami81:
Any updates for pure Nexus 7.1.2 May update for the 6p?
[Android Software Development] DEVILOPS 007:
I'll get on it
[Android Software Development] Face_Plant:
There's no need. The one from the April update still works.
[Android Software Development] DEVILOPS 007:
I won't get on it:D

---------- Post added at 09:31 PM ---------- Previous post was at 09:31 PM ----------

Thank you
[Android Software Development] Face_Plant:
No problem. I wouldn't worry about updating it with every release. Maybe every time it jumps up a version number, like 7.1.1 to 7.1.2, but other than that it should still work.
[Android Software Development] attily89:
The version for Euclidean uploaded is for the last version released today? (7.1.2?)

Probably I did something wrong.

I tried to flash this one and in another try the one for Pure Nexus but in both cases on my Nexus 5:
[Android Software Development] therock3181:
Your service bound. It's all good.
[Android Software Development] GioBozza:
The bottom bar is about the auto-downloader tool. I'll try to make that clear with a less alarming color! :p
[Android Software Development] attily89:
Perfect, thanks guys for your replies :)
[Android Software Development] DEVILOPS 007:
Hi again. I've been trying to apply a patch file and it says something like it failed on line 518. When you have some time I'd really appreciate it if you tell me how to do it manually. Thanks a lot. It wouldn't let me pm you btw. It kept saying message failed to send.

---------- Post added at 09:02 AM ---------- Previous post was at 09:00 AM ----------

[MENTION=7087071]GioBozza[/MENTION] [MENTION=1906835]simolanni[/MENTION]
[Android Software Development] GioBozza:
The patch files sometimes was failing due to many differences betwen ROMs and versions, I replaced it with templates of the classes you need to edit and you will have to do it manually, copying the changes tagged with @ WAKEBLOCK and # WAKEBLOCK.

https://github.com/GiovanniBozzano/...tes-1.0/services/core/java/com/android/server
[Android Software Development] DEVILOPS 007:
Hi, I've looked through the template and see where the @ Wakeblock has been added. However, with my rom I don't see anything that is the same so I can't find where to put it. Could you possibly have a little look at these files and help me please. Thanks a lot.
[Android Software Development] GioBozza:
Well, they are pretty much the same as the template ones.

There are currently 8 code blocks to add, all tagged between "@ WAKEBLOCK" and "# WAKEBLOCK" in templates.

In your

unedited

PowerManagerService.java they should be

before

lines:

541

550

936

953

956

1023

1048

The other class should be

PackageManagerService.java

, not PackageInstallerService.java as you shared.
[Android Software Development] DEVILOPS 007:
Okay, thank you. With the power one I was actually stupid and I somehow missed that. The one I'm having issues with is the PackageManagerService.java. Sorry I accidentally picked the wrong one.
[Android Software Development] GioBozza:
You just need to add the code block

before

line 20025.
[Android Software Development] DEVILOPS 007:
20025? My text editor doesn't search above 999. Anyway, I'll have a look. Thanks a lot I really appreciate it.:)
[Android Software Development] GioBozza:
You can use Sublime Text or something like that to open code text files.
[Android Software Development] Dark_Eyes_:
Any way to get official support for our ROMs?
[Android Software Development] GioBozza:
You can merge the WakeBlock core mod with your ROM source code following the templates on the GitHub repository to make it compatible!

https://github.com/GiovanniBozzano/wakeblock

If you mean auto-download official support, it is not needed because you can compile it with the mod already installed.
[Android Software Development] Dark_Eyes_:
I already did, and I have service bound now. I was wondering how to get supported ROM. See screenshot. By the way, you can still see it says core file not found even if it is there.
[Android Software Development] GioBozza:
The bottom bar is referring to the auto-downloader, which dowloads a modded services.odex and replaces the stock one. With the last app update - which should be up on Google Play Store soon - I tried to make it less alarming by changing the "unsupported" color to gray.

Basically, if you have a custom ROM, the bottom bar can be ignored.

The "CORE FILE NOT FOUND" is about the services.odex. If your ROM is deodexed it is not going to be there. This is also going to be addressed in the upcoming update.
[Android Software Development] Dark_Eyes_:
Great thanks, just a suggestion, maybe you could have just one bar, if the service is unbound, you only show the auto-download bar, and if the service is bound, you only show the first bar since the auto-download bar is useless.

Also, I wanted to point out that a reboot is needed when first installing the app (or updating for that matter) to have service bound, even if the patch is there the whole time. Just to let you know. Appreciate the effort you put into this. Thanks!
[Android Software Development] GioBozza:
The auto-download bar is always visible to check for updates. Let me explain exactly how it works:

When you tap the auto-download bar, this file is downloaded and checked: https://github.com/GiovanniBozzano/wakeblock/blob/master/builds.json

As you can see I separated updates from normal downloads.

The app first checks the original CRC32s to decide if you have a unmodded services.odex and downloads the last modded one given in the URL.

If your services.odex is not available in "originals" (that is, your device, ROM or version is not supported or you already have a modded services.odex), the app checks "updates" to decide if it is the second case and there is an update available.

Thank you for your support anyway!
[Android Software Development] DEVILOPS 007:
[MENTION=7087071]GioBozza[/MENTION] I was wondering, how hard is it to get this mod on a odexed custom rom like DirtyUnicorns for example? I understand how deodexed roms work and I know the services.odex needs to be edited (I think) but not sure what to do. Is it more advanced than deodexed roms? Thanks.
[Android Software Development] GioBozza:
If the source code is available it is just a matter of doing what I do with the stock ROM:

I edit the source code, compile the services.odex/services.jar and then extract and replace the edited classes in the original one, just to be sure not to touch anything else.

If the source code is not available, your only hope is to replace the original classes with the ones you compiled with some other ROM (stock ROM or the base of the custom ROM) and pray that they are the same. They usually are not (OMS Substratum support heavily changes those classes for example). As you saw we are talking about more that 20000 lines of code and just one different line will probably lead to a bootloop.

Either way you will have to edit them on every ROM update if it is not implemented by the ROM developer.
[Android Software Development] DEVILOPS 007:
Okay thanks, I'm probably going to have to say screw that because first I'm not even sure what you mean and second I'm not updating a weekly every week! Thanks for explaining.:)
[Android Software Development] DEVILOPS 007:
Mind if I ask for a wakeblock app Changelog if possible? Do you have one I'm missing somewhere?
[Android Software Development] GioBozza:
I'm currently not writing any changelog in the app due to minor changes. Today I just made little changes to colors and messages and refactored the code a bit.

I promise I'll go on with the major updates as soon as I have free time from university. :D
[Android Software Development] DEVILOPS 007:
Cool, thank you. That's great to hear. I'm looking very forward to regex and possibly alarms and services blocking.:)
[Android Software Development] DEVILOPS 007:
Hi, I've decided I actually want to try this but only for the official builds not the weeklies. If by source code you mean the repository on github then yes I have that. I'm not too sure what to do after that though. Do you have a template for it or is it different than copying lines of code? I'd really appreciate a little help with this. Thanks a lot.:)
[Android Software Development] GioBozza:
The two classes to edit are always the same. For a custom ROM you don't have to extract the classes from the compiled .jar/.odex and put them in the original one as they will be the same (except for the two edited classes obviously). So you just edit it, compile it, grab the compiled services.jar or services.odex whether the ROM is deodexed or odexed and you are done.