[myTouch 4G Android Development] ..Cory..:
Made by pepcisko!!! I just wanted to post this here for those of you who have forgotten about the V6 Supercharger! :)

Original post here! Go hit the thanks button for him!

======================================================================

Contents

Patcher Information - Post 1 (this post)

[*]Simplified Tutorial - Post 2http://xdaforums.com/showpost.php?p=31917581&postcount=2

[*]Download/Changelog - Post 3

======================================================================

----------------------------------------------------------------------------------------------------------------------------------------------

I hate that Zeppelinrox's thread is being cluttered with OT questions about this.. so opening a new thread. Please post any JellyScreamPatcher.exe questions here. Thanks.

----------------------------------------------------------------------------------------------------------------------------------------------

[experimental] Windows tool for patching services.jar for V6 SuperCharger

Opening note: When replying to this post, please do not quote it!!! Or quote selectively.

For each fully quoted reply a puppy will die somewhere in the world. If you love puppies as much as I do, you'll stop quoting long posts.. thank you :)

----------------------------------------------------------------------------------------------------------------------------------------------

#include <std_disclaimer.h>
/*
* Your warranty is now void.. LOL I guess you knew it already.
*
* I am not responsible for bricked devices, dead SD cards,
* thermonuclear war, or you getting fired because your phone bootloops. Please
* do some research if you have any concerns about features included in my utility
* before using it! YOU and only YOU are choosing to make these modifications.
* I'm providing no ETA's, though usually I'm responding PM's in a timely manner ;)
*
* While the tool provides some backup functionality, allowing you to roll back to
* a working system, feel free to create a nandroid backup trying this ;)
*
*/

For downloads and changelog, see Post #2

----------------------------------------------------------------------------------------------------------------------------------------------

Preface:

Many of us V6 Supercharger users have been flashing nightlies nightly and dailies daily, resulting in the need for a patched services.jar almost daily :P since the automatic web patcher no longer works for Android 4.1.1 Jellybean files, we had to stick with manually patching this files as described in Zep's guide here. Eventually Zep prepared several versions of the Jelly_Scream_Smali_Patcher_Test_x.sh script, which does the job perfectly, but the user still has to get his services.jar, extract the .smali files, put them to the phone, put the script to the phone, run it in the phone's terminal, copy the patched .smali files back to the PC etc. etc. and for many of us, this is time consuming (and difficult for others). Time is money, right? :)

Currently, this tool is using a ported version of the ALL_ROMS_Ultimate_Jar_Power_Tools-Jelly_ISCream+Maximum_MultiTasking_Mods-Smali_Patcher_Test_11.sh script for patching.

So... here an automated workflow, which assumes a few things:

you are running a MS Windows operating system (tested on Win7 x64)

you have Java installed. This was tested with Java7, should run fine on Java 6 as well. In the Q&A section below I provide a link to download Java. Make sure that java.exe is accessible from any folder (is in PATH). Java 7 installs the binaries into the windows/system32 folder, so I hope you have that folder in your PATH. If not, just google how to add a folder to the PATH, there are many tutorials on the web.

[optional] you know how to connect your phone to the PC via USB

[optional] you have ADB drivers installed (either via Android SDK or from your phone's manufacturer)

[optional] you know how to enable USB debugging in your phone and did that :)

[optional] the USB connection mode is NOT "mass storage" (for the online mode) - please set it to "Charge only" or "None" (varies from device to device)

How to patch the services.jar file

The following assumes you have a "stock" (or unchanged) services.jar in your phone's ROM or in my tool's framework subfolder .

After running the tool and passing the initial screen, you will be presented with a choice between online and offline mode.

Online mode

Online mode assumes that the phone is connected via USB. In this mode, the tool can pull all the information from the phone. Not only the files, but system variables, as well as some debug info (e.g. is the ROM odexed?)

Connect the phone via USB

Enable connection mode "Charge only" or "None". This won't work, if the phone is in "Mass Storage" mode!

Sit back and enjoy (and don't forget to answer the tool's questions!)

After patching there will be a warm reboot

Offline mode

Offline mode means, that there will be no interaction of the tool with the phone via USB. You need to do all the file transfers and in case of odexed ROMs, the final in-phone patching, manually. Also you will have to enter some other information into the tool manually.

make sure to copy your /system/framework/services.jar to the tool's framework folder. If you have an odexed ROM (e.g. stock), copy the whole /system/framework folder contents to the tool's framework folder.

make sure to know your system's version because the tool will ask for it

make sure to know your BOOTCLASSPATH variable. It can be pulled from the phone using the command

adb.exe set | grep BOOTCLASSPATH

make sure you know if the ROM is odexed or not

After patching, you will need to transfer the patched files to the phone and perform manual patching/replacement:

Odexed ROM:

For odexed ROMs, there is some more patching required that you can do in the phone.

copy services.jar from the 'dist' folder to the sdcard

copy 'dexopt-wrapper' from the 'odex' folder to the sdcard

copy 'dexopt-wrapper.sh' from the 'scripts' folder to the sdcard

Make sure they are in the card's root folder !!

In the phone, open Script Manager or any other app that can run shell scripts with superuser rights.

Open the app, run the dexopt-wrapper.sh script. A warm reboot may occur, since the script will restart the framework

Reboot to recovery, Clean Cache, Clean Dalvik Cache

That's it :)

Deodexed ROM:

update-signed.zip in the dist folder

Copy this file to your sdcard, then reboot to cwm recovery and install it from there. Then do a Dalvik Cache wipe, Cache wipe and reboot.

services.jar in the dist folder

You can copy this file to phone's /system/framework folder and replace the existing one. Make sure that the new file will have owner/group 'root' and permissions 644. Then reboot to recovery, clean Cache & Dalvik Cache.

Rollback

In case something goes wrong, there should be a message about that in the activity.log file.

Feel free to send this file to me - either attach (not paste!!!) the file to a post in this thread, or upload it to any of the cloud services and tell me the URL. I'll take a look.

Before patching, the tool creates backup of the files as a CWM recovery compatible update.zip file. It will sit in the backup folder. This is your way back to a working system. Of course, you can do a nandroid backup..

So what is the tool actually doing?

Very easy to explain.

it pulls the services.jar (and odex files if needed) from your phone to the working folder (or takes an existing one that you put into the folder)

it uses the baksmali.jar to decompile the services.jar/odex

creates a backup of the unchanged files

it runs a ported perl version (and compiled to exe) of Zeppelinrox's JellyScream patcher script (v6) to patch the .smali files

it uses smali.jar to compile the new classes.dex

inserts the new classes.dex back to the services.jar

[optionally] it pushes the new services.jar back to the phone

[optionally] for ODEXed ROMs, created services.odex from the patched services.jar

[optionally] for deODEXed ROMs, it creates and signs an update.zip that can be flashed in CWM recovery

collects the garbage and exits with a nice message .. LOL

Q&A

Q: It doesn't decompile the services.jar and complains that the .smali files don't exist !!!

A: Yeah, probably your Java is crap. Install Java JRE from Oracle's web (http://java.com/en/download/index.jsp), it will offer you the latest version. I tested with Java 7, but latest releases of Java 6 should work as well.

Q: Getting java errors "not recognized" "not found" and so !!!

A: You probably don't have the java executable in the system PATH. Search the web on how to do this. Typically, Java7 installs its binaries to the <system>:\Windows\System32 folder, other versions may act differently.

Q: I'm getting bootloops after patching the services.jar with this tool!

A: Make sure to Wipe Cache, Wipe Dalvik Cache and Fix permissions in the CWM recovery. ALso, feel free to send me your original services.jar, I'll take a look. If you have an odexed ROM, send me the whole /system/framework folder and the activity.log file generated while using this tool in "online" mode.

Q: After reboot with the new services.jar file, it says "Android is upgrading" and optimizing apps, even though I did not wipe my dalvik cache.

A: Well, yes that is expected. It will take a while, depending on how many apps you have installed.

Q: Will my phone's memory be blazing fast and effective after this?

A: No, you still have to run the V6 Supercharger script.

Q: Does it run on Linux?

A: Not yet, but it will. I need some more internal testing to release a Linux version.

Q: Does it run on ODEXed ROMs?

A: Yes !!!

Q: Why is the executable so large???

A: Blame PAR :) long story short, I wrote my stuff in Perl and used Perl to port Zep's stuff as well. Then I compiled the script to exe using the PAR::Packer package, resulting in the huge executable. I know, there is another way, to use Activestate's PDK (Perl Development Kit), but the license is approx. $250 and I just don't have that money for spending on a single tool. PDK creates much smaller files (approx. 1/3rd), but for now we have to stick with what we have :)

Q: Tool fails and in the log I see messages like "failed to copy 'C:/super/backup/services.jar' to '/mnt/sdcard/services.jar': Permission denied"

A: Make sure the USB connection mode is other than "Mass Storage". It can be "Charge Only" or "None", really this is depending on the device you own.

Q: Isn't there a virus included in the executable?

A: LOL.. No. This community gave me a lot since 2007 and I have no intention to harm it in any way. If you are using NOD32 and it starts complaining about the URL to my file I posted above, let me know. ESET support is pretty quick in identifying and fixing false warnings :)

Enjoy.. and feel free to PM me in case of any questions. I'll keep this post updated all the time.

Thanks

- Zeppelinrox for the V6 Supercharger and the associated scripts/tools

- Rexstor for the ODEX guide

- Android community for all the other tools (smali/baksmali/sign)

- Google for Android... luv ya!!!

If you feel like I deserve a beer for what I've done, feel free to consider donating to Zeppelinrox first as I'm just making his fabulous work a tiny bit more accessible. And if you still think I deserve a beer, you can use the button below.