Remove All Ads from XDA
Find Your Device:
Or Continue to Thread: [V6U9RC13]For Your Lag(4x) Do …
13th March 2011, 06:45 AM |#2  
zeppelinrox's Avatar
OP Senior Member
Thanks Meter: 21,737
Donate to Me
================================================== =================
If this information is helpful, please Rate the thread 5 Stars and click Thanks!
================================================== =================

Hacking services.jar

What's this for? - Froyo, Gingerbread, Honeycomb, ICS, Jelly Bean AND Sense 4.0+!

ICS and Jelly Bean - Jelly ISCream Mod (SuperCharge Your Launcher)
Note 1: Earlier Android ROMS need ONLY The V6 SuperCharger Script to SuperCharge the launcher!
Note 2: The webapp is NOT working on some newer roms! The strings to be edited are slightly different and the webapp needs updating!
It also lacks the newest edits and is NOT recommended for the time being!

Froyo and Up - Maximum MultiTasking Mods - Includes -=Maximum Overdrive=- and The Time Killer Killer

Sense 4.0 and Up - Non-Sense App Limit

See the -=Ultimate Jar Power Tools=- thread for more details about the Multitasking and Sense mods!
Use the Ultimate Jar Power Tools patcher script to automate Step 5 (the smali edits) in the tutorial below!
Or use my latest -=Ultimatic Jar Patcher Tools=- to do ALL the Steps in the tutorial! It works for DEODEX and ODEX ROMS and can be run on Windows/Linux/Mac OSX OSes!

================================================== =================
Jelly ISCream Mod Information!
================================================== =================
The NEW Ultimatic Jar Patcher Tools and Ultimate Jar Power Tools patcher script include all the -=NEW=- Jelly ISCream edits described in Step 5 - PLUS many more! (over 50 edits!)
These additional edits truly makes your launcher SuperCharged!
They also apply the latest Maximum MultiTasking Mods
The webapp hasn't been updated so it's NOT recommended.

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

Installation - Easy as 1, 2, 3!

1. Run the NEWEST V6 SuperCharger script as always.

Note: You may get Segmentation Fault errors running the V6 SuperCharger script on ICS due to a flakey su (superuser) binary.

To resolve the issue, you can:
A) Go HERE for a fixed su binary. No more fugly segfaults! - Thanks to wraithdu (only for superuser.apk on ICS)
B) Go HERE and get the SuperCharger Starter Kit!

2. Patch and install services.jar - by whichever method you like best. Your options are, in order of EFFECTIVENESS:

Note: Options A, B and C require Java to be installed on your computer - Click to Verify Java Installation

Option A) Use one of the -=Ultimatic Jar Patcher Tools=- (exe or zip) which DO EVERYTHING for you "Fully Ultimatically" on DEODEX & ODEX ROMS!

Goto Step 3 if you did this!

Option B below is the next preferred method - but there's manual work involved.

Option B) Follow the complete tutorial below and use -=Ultimate Jar Power Tools=- patcher script to automate Step 5 - the actual smali editing!
There are actually 56 edits performed via script... many more than what is specified in the tutorial!

Note that the script allows you to choose the level of your Launcher's Super Strength! (BulletProof, Die-Hard, or Hard To Kill)
Also be sure to have the necessary smali files in the same folder as the script!

ODEX ROMS - ALL Stock ROMS are ODEX (I think... ) So if you have a services.odex file, press the button!
All but Step 5 is automated on Windows with a batch script courtesy of rexstor .
See [Guide][Batch][Odex Rom only!] To get another 50% v6 Supercharged script for ICS!
So you'd run the batch script, and for the editing, run my Ultimate Jar Power Tools patcher script in Step 5
Goto Step 3 if you did this!

Option C) Follow the complete tutorial below without using any Patcher tool.
This is actually pointless to do - there are less edits and it's more work And the laziest people should just do D) below lol
Goto Step 3 if you did this!

Option D) Use the latest Update 9 RC* and select ICS Service Centre's Automatic Transmission! (OUT OF DATE)
Seemless webapp integration and installation to "Lock home in Memory"
Note: This is currently out of date - latest edits and Maximum MultiTasking Mods are NOT included and it does not work on Jelly Bean!
Goto Step 3 if you did this!

Option E) ICS OOM Priority Charger webapp. Same effectiveness as D) but done manually (OUT OF DATE)
Latest Update 9 RC* can install and apply permissions via ICS Service Centre's manual mode
Important: The webapp WON'T WORK for ODEX roms! So if you have a services.odex file, you have use a more effective option above
Also won't work on Jelly Bean ROMS!

More Webapp Info
Just go to with your devices browser and follow instructions!

In case of upload problems: If your Android browser closes while selecting file to upload, use Opera Mini web browser because it lets you select a file from within the app. Just copy services.jar to the sdcard first

CWM zip option is available!

But if you don't get the CWM zip, and instead download the modded services.jar, you can:

A) Do Steps 8 to 10 below! But first In Terminal Emulator, just type su and enter, busybox mount -o remount,rw /system and enter (Mount system as read/write).
B) Use the ICS Service Centre's manual mode in V6U9RC*

Help for webapp: Go to , channel #v6_supercharger and talk to blk_jack (or me if I'm there)
* All roms (odex & deodex) - to install a patched services.jar/odex, you can use the ICS Service Centre's manual mode in V6U9RC9+ (for Steps 8 and 9 below).
* If you ever have trouble applying permissions to services.jar/odex, just run the ICS Service Centre and permissions gets applied everytime just before returning to the main menu!

3. SuperClean & ReStart! (ie. Wipe Dalvik Cache & Reboot)

Notes: For decent launcher detection use at least V6U9 RC6.9 or newer and check the bOOM Stick to see if the launcher the desired ADJ value!
.......... - Boot will take a LONG time as it "optimizes all your apps"
.......... - If it doesn't boot (unlikely if you did the edits yourself), try wiping caches (not data)
.......... - If it still doesn't boot, you can always just re-flash your current untouched rom but do have a backup nevertheless.
.......... - If you get FCs, fixing permissions will solve that. (Use the "Fix Emissions" Option in the latest V6 SuperCharger Script! )

That's It!

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

OK I got ICS SuperCharged!!

The problem with SuperCharging ICS is that ICS doesn't read ADJ values from build.prop or local.prop - they are hardcoded into services.jar!
So the script alone can only give you a 50% SuperCharge Level with only the V6 SuperCharger script.
Patching services.jar gives you the other 50% along with a SuperCharged Launcher!

ICS users still have to run the V6 SuperCharger script just like before! Use V6U9 RC6.9 or newer for decent launcher status detection!

Note: Of course, the V6 SuperCharger script is ALL YOU NEED on all previous Android ROMS!

So the mod below is for getting the Launcher at a SuperCharged Priority on ICS!
This is akin to the ADJ entries in build.prop or local.prop on earlier Android ROMS which don't work on ICS.

What gets changed?

I rearranged Priorties on ICS like so:
System                -16                     (stock)
Persistent Process    -12                     (stock)
ForeGround app          0                     (stock)
Home Launcher           1 (Die-Hard Launcher) (stock=6)
Perceptible app         2                     (stock)
Visible app             3                     (stock=1)
Heavyweight app         4                     (stock=3)
Previous app            5                     (stock=7)
Service                 6                     (stock=5)
Backup app              7                     (stock=4)
Service_b               8                     (stock)
Hidden app min          9                     (stock)
Hidden app max         15                     (stock)
As you can see, there are ALOT more app categories now lol
I also decided to give a new app category a higher priority - Previous Apps.

Users with low ram devices will definitely be pleased with that
I was actually able to load Angry Birds, ran a different app, and went back to Angry Birds and it didn't have to restart.
It's practically unheard of for that game to stay in memory like that on my device
I really don't understand the logic of making Previous apps more killable than some app that you were using awhile ago (ie Service) so I fixed it

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

How To:

This will make it easier [Guide][Tutor]Jar/Apk baksmali smali compiler and decompiler
Important! - Get the MOST RECENT smali/baksmali binaries located here (remove the version number so they are called smali.jar and baksmali.jar)

Click to Verify Java Installation - smali/baksmali requires Java to be installed on your computer.

ODEX ROMS: If you have an odex rom (ie. you have a services.odex file) you have extra work. See this
..................... - Watch for dark red text for odex specific instructions! Some of which were initially found in this services.odex hacking guide.
..................... - Going with the odex guide above, you will also need the dexopt-wrapper utility.
..................... - Download the utility "dexopt-wrapper". (Do a search - you'll find it.)
..................... - Mount system as read/write. Open up Terminal and type: su, enter, busybox mount -o remount,rw /system
..................... - Copy it to /system/bin and apply correct permissions.
..................... - In terminal type: chmod 755 /system/bin/dexopt-wrapper, enter.

OR... You can convert your ODEX ROM into an easily modded deodexed one. Here are a few options to do that:
..................... xdaAutoTool (Windows - the first 3 posts have 3 different tools!)
..................... AutoAPKTool + AutoDeodexTool (Linux port of xdaAutoTool)
..................... Auto Deodex & Zipalign Tool (Windows - looks easy)
..................... Manually Deodex and Odex Back (Windows - geeky)

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

Step 1. So grab the tutorial zip from above and unzip into a folder, say C:\super, along with the smali and baksmali jar files. This is all you need apart from a text editor and a zip program like 7zip or WinRAR.
............ Put services.jar (make sure you have a backup) in C:\super.
............ ODEX ROMS: Put services.jar AND services.odex in C:\super. (Note that services.jar will be very small with only a META-INF folder inside)

Step 2. Open up a dos/command prompt and navigate to the folder by typing cd c:\super

Step 3. Type: java -jar baksmali.jar -x services.jar -o classout (services jar gets decompiled into a classout folder.) Leave the dos/command prompt window open.
............ ODEX ROMS: Copy /system/framework folder(with all the jar+odex files) to c:\super
........................ Type: java -jar baksmali.jar -x -a <api_level> -d framework services.odex -o classout
........................ api_level is a number. See this page. So if you're on froyo, you put -a 8. On gingerbread it's -a 9 or -a 10.
........................ If you get an error: Add the $BOOTCLASSPATH to the above command.
........................ So do this command on your device using terminal emulator OR adb shell (easier): echo $BOOTCLASSPATH
........................ Example: You'll get something like this:
........................ Remove the paths (/system/framework/) so end up with core.jar:core-junit.jar:bouncycastle.jar:ext.jar:framework.jar:f ramework2.jar:android.policy.jar:services.jar:apac he-xml.jar
........................ Now, your final command becomes:
java -jar baksmali.jar -a ## -x -c :junit.jar:bouncycastle.jar:ext.jar:framework.jar:f ramework2.jar:android.policy.jar:services.jar:apac he-xml.jar services.odex -o classout
........................ NOTE: This command may FAIL if you don't put the colon (:) after the "-c " and before that list of .jar files.

Step 4. Open explorer and navigate down to c:\super\classout\com\android\server\am folder and find ActivityManagerService.smali

Step 5. Use the -=Ultimate Jar Power Tools=- patcher script to perform the following edits (IT actually does TONS more for a smoother SuperCharge!)
Get it from THIS THREAD, and run it like my other scripts and be sure to have both ProcessList.smali AND ActivityManagerService.smali in the same folder as the patcher script! (Erm.... put them on your phone, run the Power Tools script, then copy the new smali files back to where you found them!)

Note that the Jelly ISCream Mod will read the previous ADJ values from ProcessList.smali, searches for those ADJs and replaces them with SuperCharged ones in BOTH smali files!

Then go to Step 6

If you don't wanna go the easy way... click the button!
Open ActivityManagerService.smali in notepad or notepad++ and make following smali edits.

a. Note that the "====" are breaks and NOT part of the smali file
b. Underlined is the search term so you can find the location in the file easily.
... - The search term includes the "quotes" and is CaSe SEnsiTive (ie. select Match Case in search) so you should actually only get 1 hit for all but 1 search.
... - There are 5 hits for "backup" with quotes but just scroll down from the previous edit you'll find it (heh. the previous edit is for "previous" lol)
c. Bold is the edit (note that each edited line begins with "const/4 v10, " Update: New roms now have "const/4 v11, " or "const/4 v14, " instead)
d. (Italized) is the ORIGINAL value

So, for example, the first edit for "visible" apps:
const/4 v10, 0x3 (0x1)

Originally, it looks like: const/4 v10, 0x1
After edit, it looks like: const/4 v10, 0x3

Ok... so here it is


.line 13728
const/4 v2, 0x1

if-le v10, v2, :cond_118

.line 13729
const/4 v10, 0x3 (0x1)

.line 13730
const-string v2, "visible"

move-object/from16 v0, p1


if-ne v0, v2, :cond_154

.line 13768
const/4 v10, 0x4 (0x3)

.line 13769
const/16 v27, 0x1

.line 13770
const/4 v2, 0x0

move-object/from16 v0, p1

iput-boolean v2, v0, Lcom/android/server/am/ProcessRecord;-&gt;hidden:Z

.line 13771
const-string v2, "heavy"

move-object/from16 v0, p1


.line 13777
const/4 v10, 0x1(0x6) Note that this is for Die-Hard Launcher! To BulletProof it, make it 0x0, HTK 0x2

.line 13778
const/16 v27, 0x1

.line 13779
const/4 v2, 0x0

move-object/from16 v0, p1

iput-boolean v2, v0, Lcom/android/server/am/ProcessRecord;-&gt;hidden:Z

.line 13780
const-string v2, "home"

move-object/from16 v0, p1


.line 13788
const/4 v10, 0x5(0x7)

.line 13789
const/16 v27, 0x1

.line 13790
const/4 v2, 0x0

move-object/from16 v0, p1

iput-boolean v2, v0, Lcom/android/server/am/ProcessRecord;-&gt;hidden:Z

.line 13791
const-string v2, "previous"

move-object/from16 v0, p1


.line 13808
const/4 v10, 0x7(0x4)

.line 13809
const-string v2, "backup"

move-object/from16 v0, p1



.line 13828
const/4 v2, 0x6(0x5)

if-le v10, v2, :cond_203

.line 13829
const-string v2, "started-bg-ui-services"

move-object/from16 v0, p1


.line 13837
const/4 v10, 0x6(0x5)

.line 13838
const-string v2, "started-services"

move-object/from16 v0, p1



.line 13845
const/4 v2, 0x6(0x5)

if-le v10, v2, :cond_203

.line 13846
const-string v2, "started-bg-services"

move-object/from16 v0, p1


This next part is actually hard to search for so I'm posting a large segment which contains 3 edits that make a HUGE difference!
To make it a little easier, search for "bg-services"
There are 2 hits - The second one is at the bottom of this segment.
Also, not that only one of them begin with the typical "const/4 v10, ", the other 2 begin with "const/4 v2, "


const-string v11, "service"

goto/16 :goto_3e1

.line 13932
iget v2, v15, Lcom/android/server/am/ConnectionRecord;-&gt;flags:I

const/high16 v5, 0x4000

and-int/2addr v2, v5

if-eqz v2, :cond_496

const/4 v2, 0x2

if-ge v12, v2, :cond_496

const/4 v2, 0x2

if-le v10, v2, :cond_496

.line 13935
const/4 v10, 0x2

goto :goto_471

.line 13936
const/4 v2, 0x3 (0x1)

if-le v12, v2, :cond_49b

.line 13937
move v10, v12

goto :goto_471

.line 13939
const/4 v2, 0x1

move-object/from16 v0, p1

iput-boolean v2, v0, Lcom/android/server/am/ProcessRecord;-&gt;pendingUiClean:Z

.line 13940
const/4 v2, 0x3 (0x1)

if-le v10, v2, :cond_471

.line 13941
const/4 v10, 0x3 (0x1)

goto :goto_471

.line 13995
.end local v3 #client:Lcom/android/server/am/ProcessRecord;
.end local v4 #myHiddenAdj:I
.end local v11 #adjType:Ljava/lang/String;
.end local v12 #clientAdj:I
.end local v13 #clist:Ljava/util/ArrayList;,"Ljava/util/ArrayList<lcom android="" server="" am="" connectionrecord;="">;"
.end local v15 #cr:Lcom/android/server/am/ConnectionRecord;
.end local v17 #i:I
.end local v22 #kt:Ljava/util/Iterator;,"Ljava/util/Iterator<ljava util="" arraylist<lcom="" android="" server="" am="" connectionrecord;="">;&gt;;"
.end local v26 #s:Lcom/android/server/am/ServiceRecord;
move/from16 v0, p2

if-le v10, v0, :cond_4b6

.line 13996
move/from16 v10, p2

.line 13997
const/4 v2, 0x0

move-object/from16 v0, p1

iput-boolean v2, v0, Lcom/android/server/am/ProcessRecord;-&gt;hidden:Z

.line 13998
const-string v2, "bg-services"

Save it.

Step 6. Go back to the dos/command prompt and type: java -Xmx512M -jar smali.jar classout -o classes.dex (this creates classes.dex)
............ ODEX ROMS: Type the same command as above.

Step 7. Open up services.jar with 7zip or WinRAR (you will see a classes.dex file inside) and drag the newly created classes.dex into the window to refresh services.jar with the new classes.dex
............ Mount system as read/write. Open up terminal and type: su, enter, busybox mount -o remount,rw /system
............ ODEX ROMS: Do the above steps (though there won't be an existing classes.dex - just add it anyway) and then do the following, edited segment from the services.odex hacking guide:

Copy the new services.jar file into the root of your phone's sd card.
Originally Posted by software_samurai

Create a new services.odex file from the new services.jar file:
In terminal, type: cd /sdcard, enter, dexopt-wrapper services.jar services.odex $BOOTCLASSPATH, enter.

Here's the "special sauce": copy over the "signature" from the current .odex file into the new .odex file. do NOT continue until this command succeeds!
Hint: the file size of the new services.odex file should not change!
In terminal, type: busybox dd if=/system/framework/services.odex of=/sdcard/services.odex bs=1 count=20 skip=52 seek=52 conv=notrunc

Now copy /sdcard/services.odex to /system/framework and overwrite the original (backed up, yes?) services.odex

Go to Step 9

Step 8. Copy the new services.jar into your /system/framework folder.
............ ODEX ROMS: SKIP this step!

Step 9. a. In terminal type: cd /system/framework, enter, chown 0.0 services.jar, enter, chmod 644 services.jar, enter
................ ODEX ROMS: In terminal do: cd /system/framework, enter, chown 0.0 services.odex, enter, chmod 644 services.odex, enter
............ b. OR... you can just put it into a copy of your rom and flash that!

Step 10. SuperClean & ReStart! (ie. Wipe Dalvik Cache & Reboot)

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

It was a pain in the ass to find because the settings that get applied actually ignore any setting that is given.
It's all over-ridden by a calculated routine
So I just turned the tables to have it over-ride settings to be SuperCharged

Remember that you will still need to run V6 SuperCharger to get your minfrees and grouping fix/adj limits in place.

Was this useful info? If so...
Please HIT THANKS and Give a 5 Star Rating!
Last edited by zeppelinrox; 28th March 2014 at 07:04 PM.
The Following 1,306 Users Say Thank You to zeppelinrox For This Useful Post: [ View ] Gift zeppelinrox Ad-Free