all roms ultimate jar power tools-smali patcher test rc8.sh

Download ALL ROMS Ultimate Jar Power Tools-Smali Patcher Test RC8.Sh

If you can't read please download the document

Upload: hellz-nguyen

Post on 21-Jan-2016

514 views

Category:

Documents


1 download

DESCRIPTION

ROMS Ultimate Jar Power

TRANSCRIPT

#!/system/bin/sh # # Ultimate Jar Power Tools Script RC8 created by zeppelinrox. # # Mod 1. "Jelly ISCream" for ICS and Jelly Bean. This will SuperCharge Your Home Launcher and ADJ/OOM Priorities! # # Mod 2. "Maximum MultiTasking Mods" for Froyo and above has a few parts. # a. "Maximum Overdrive" - This lets you run up to 70 hidden apps instead of the default 15 (RAM permitting) without breaking the lowmemorykiller! # (Huge thanks to Dorimanx from XDA Forums for ideas and the initial m od to bypass the lowmemorykiller for greater multitasking!) # b. "Minimum Hidden Protection" - This keeps 15 hidden apps (doing backg round tasks) in memory before empty apps (least important) can push any of them out. Default is only 2! # c. "Time Killer Killer" - This tries to bypass the 30 minute service in activity limit by increasing it to 24 hours. # d. "Service Preserver" - (Post-ICS ROMS) This prevents service apps (ie . recently ran apps) from being becoming a "worstType" and therefore, less likel y to be killed. # e. "ProActive Booster" - (Pre-ICS ROMS) This changes the processes limi t from 2 to 50 and activities limit from 20 to 70. # f. "Total Recall" - This makes Android remember 50 recent tasks instead of the default 20. (Not yet working properly) # # Mod 3. "Non-Sense App Limit" for Sense 4 and above (Not needed for Sense 3.6 a nd below). # This eliminates additional restrictions introduced with Sense 4. # a. Visible tasks increased from 8 apps to 50 (RAM permitting) # b. Something called "HTC Recent App Fusion" is rendered a non-factor. # # Mods 2 and 3 (where applicable) let you use your RAM to its Fullest MultiTaski ng Potential! # # Usage Notes: # 1. Mods 1 and 2 will edit ActivityManagerService.smali (Froyo and up) and Proc essList.smali (I SCream Sandwich [sic] and Jelly Bean) # Mod 3, for Sense 4 and above, only needs to patch ActivityManagerService.sm ali # 2. The smali file(s) need be in the same location as this script. # 3. Put the files on the sd card and run this script on the Android device itse lf using Script Manager or Terminal Emulator. # Alternatively, you can run it on a PC, whether it be Linux or Mac OSX or Wi ndows (using Cygwin - which is free and easy to set up). # ##################### # IMPORTANT NOTES # ##################### # In case of lag, due to too many apps running, RAISE the minfree levels. # For bettter MultiTasking, LOWER minfree levels. # # It's HIGHLY recommended to use my V6 SuperCharger script to apply these minfre e settings and PROPERLY take advantage of the new priorities! # # For debugging, delete the # at the beginning of the next line to see what may have fubarred. # set -x line================================================= clear 2>/dev/null echo ""echo " Running $0..." echo "" cd "${0%/*}" 2>/dev/null echo $line echo " Ultimate Jar Power Tools!" echo $line echo "" sleep 1 echo " 1. Jelly ISCream (SuperCharge ICS and up)..." echo "" sleep 1 echo " 2. Maximum MultiTasking Mods (Froyo and up)..." echo "" sleep 1 echo " 3. Non-Sense App Limit (Sense 4.0 and up)..." echo "" echo $line echo "" sleep 1 echo " Brought to you by your sometimes..." echo "" sleep 1 echo " ...friendly..." echo "" sleep 1 echo " ...neighborhood..." echo "" sleep 1 echo " -=zeppelinrox=-" echo "" echo $line echo "" sleep 1 echo " So... which files get patched...?" echo "" sleep 1 echo " ALL ROMS have ActivitiyManagerServices.smali..." echo "" sleep 1 echo " ICS ROMS and up also have ProcessList.smali..." echo "" if [ -f "/system/framework/services.jar" ]; then onthephone=yes id=`id`; id=`echo ${id#*=}`; id=`echo ${id%%\(*}`; id=`echo ${id%% *}` if [ -f "$EXTERNAL_STORAGE/ultimatic.tmp" ]; then UltimaticMode=yes rm $EXTERNAL_STORAGE/ultimatic.tmp else sleep 1 echo " See Post 2 of the XDA SuperCharger thread..." echo "" sleep 1 echo " ...and LEARN how to decompile services.jar!" echo "" sleep 1 echo " Put the smali file(s) on the SD Card..." echo "" sleep 1 echo " ...and in the SAME folder as this script!" echo "" if [ "$id" != "0" ] && [ "$id" != "root" ]; thenecho $line echo "" sleep 2 echo " You are NOT running this script as root..." echo "" sleep 3 echo $line echo " ...No SuperUser for you!!" echo $line echo "" sleep 3 echo " ...Please Run as Root and try again..." echo "" echo $line echo "" sleep 3 exit 69 fi fi fi #api="`grep build.version.sdk /system/build.prop | sed 's/.*=//' | tr -d '\r'`" #if [ "$api" -lt 14 ]; then preics=yes #else postics=yes # if [ "`grep "HTC_RECENT_APP_FUSION" ActivityManagerService.smali`" ]; th en Sense4=yes; fi 2>/dev/null #fi if [ ! -f "ActivityManagerService.smali" ]; then missingsmali=yes elif [ "`grep "mProcessList" ActivityManagerService.smali`" ]; then postics=yes if [ ! -f "ProcessList.smali" ]; then missingsmali=yes; fi if [ "`grep "HTC_RECENT_APP_FUSION" ActivityManagerService.smali`" ]; th en Sense4=yes; fi if [ "`grep "ActiveServices" ActivityManagerService.smali`" ]; then jb2= yes; fi else preics=yes fi 2>/dev/null sleep 2 echo $line if [ "$missingsmali" ]; then if [ ! -f "ActivityManagerService.smali" ]; then echo " FAIL: ActivityM anagerService.smali NOT FOUND!" else echo " FAIL: ProcessList.smali NOT FOUND!" fi echo $line echo "" sleep 2 echo " NO SUPERTOOLS FOR YOU!" echo "" echo $line echo "" sleep 2 if [ "$postics" ]; then echo -n " Wiping SD Card"; sleep 1; echo -n "."; sleep 1; echo n "."; sleep 1; echo -n "."; sleep 1; echo -n "."; sleep 1; echo -n "."; sleep 1 ; echo "" echo "" echo $line echo "" sleep 2 echo " Next time, READ POST 2!" echo ""sleep 2 echo " And no, I didn't wipe the SD CArd..." echo "" sleep 2 echo $line echo " That would be CRAZY..." echo $line echo "" sleep 2 echo " ...Or did I?" echo "" sleep 2 echo " oops..." echo "" sleep 3 fi exit 69 fi echo "" echo " Analyzing smali files... keep your skirt on :p" echo "" keyline1=`sed -n '/0xf4t/=' ActivityManagerService.smali` keyline2=`sed -n '/"visible"/=' ActivityManagerService.smali` for i in `sed -n '/"home"/=' ActivityManagerService.smali`; do keyline3=$i; done keyline4=`sed -n '/"started-bg-ui-services"/=' ActivityManagerService.smali` for i in `sed -n '/"bg-services"/=' ActivityManagerService.smali`; do keyline5=$ i; done keyline6=`sed -n '/"home "/=' ActivityManagerService.smali` keyline7=`sed -n '/static oomAdjToImportance/=' ActivityManagerService.smali` for i in `sed -n '/" \/ "/=' ActivityManagerService.smali`; do keyline8=$i; brea k; done keyline9=`sed -n '/method public getMemoryInfo/=' ActivityManagerService.smali` keyline10=`sed -n '/"kill background"/=' ActivityManagerService.smali` keyline11=`sed -n '/"bound-bg-services"/=' ActivityManagerService.smali` if [ ! "`grep -m 5 ".line" ActivityManagerService.smali`" ]; then nodebuginfo=yes keyline3=$(($keyline3+1)) keyline8=$(($keyline8+2)) fi echo $line if [ "$postics" ]; then echo " \"Jelly ISCream\" for Jelly Bean and Ice Cream!" echo $line echo "" sleep 1 echo " Wanna SuperCharge your services.jar?" echo "" sleep 1 echo -n " Enter Y for Yes, any key for No: " read superserv echo "" sleep 1 case $superserv in y|Y)hellzyeah=yes;; *);; esac echo $line fi if [ "$hellzyeah" ]; then echo " In the V6 Thread, this is STEP 5 in Post #2!"echo $line echo "" sleep 1 echo " Because you're too lazy to edit smali files..." echo "" sleep 1 echo " ...and I like showing off... LOL" echo "" sleep 1 echo " I'll edit ActivityManagerService.smali..." echo "" sleep 1 echo " ...and ProcessList.smali" echo "" sleep 1 echo " So they'll be SuperCharged nice, nice..." echo "" echo $line echo "" sleep 1 echo " SuperCharged Launcher Strength..." echo " =================================" echo "" sleep 1 echo " Hard To Kill Launcher is..." echo "" sleep 1 echo " ...Strong BUT Still Killable!" echo "" sleep 1 echo " Die-Hard Launcher is..." echo "" sleep 1 echo " ...VERY Strong and RECOMMENDED!" echo "" sleep 1 echo " BulletProof Launcher is..." echo "" sleep 1 echo " ...Strongest and UNKILLABLE!" echo "" sleep 1 echo " ===========================================" if [ "$onthephone" ]; then busybox echo " \\\\\\\\\\ BULLETPROOF LAUN CHER WARNING! /////" else echo " \\\\\\\\\\ BULLETPROOF LAUNCHER WARNING! /////" fi echo " =======================================" echo "" sleep 1 echo $line echo " This Breaks \"Long-Press Back To Kill\"!" echo $line echo "" sleep 1 echo " If you don't have or don't use this feature..." echo "" sleep 1 echo " ...don't worry about it ;)" echo ""sleep 1 echo $line echo " Note 1: This is NOT for Gamers! (Less Free RAM)" echo $line sleep 1 echo " Note 2: It also does not play nice with Tasker!" echo $line echo "" sleep 1 echo " Select a Launcher Strength..." echo "" echo -n " (H)TK, (B)ulletProof, any key for Die-Hard: " read lstrength echo "" echo $line case $lstrength in h|H)launcheradj=2 echo " SuperCharged Launcher Strength is Hard To Kill!";; b|B)launcheradj=0 echo " SuperCharged Launcher Strength is BulletProof!";; *)launcheradj=1 echo " SuperCharged Launcher Strength is Die-Hard!";; esac echo $line echo "" sleep 1 bkupnew=0x7 hvynew=0x4 homenew=0x$launcheradj prevnew=0x5 visnew=0x3 svcnew=0x6 bkupold=`grep BACKUP_APP_ADJ:.*= ProcessList.smali | awk '{print $NF}'` hvyold=`grep HEAVY_WEIGHT_APP_ADJ:.*= ProcessList.smali | awk '{print $N F}'` homeold=`grep HOME_APP_ADJ:.*= ProcessList.smali | awk '{print $NF}'` prevold=`grep PREVIOUS_APP_ADJ:.*= ProcessList.smali | awk '{print $NF}' ` visold=`grep VISIBLE_APP_ADJ:.*= ProcessList.smali | awk '{print $NF}'` svcold=`grep SERVICE_ADJ:.*= ProcessList.smali | awk '{print $NF}'` svcref=`grep SERVICE_ADJ_REF:.*= ProcessList.smali | awk '{print $NF}'` if [ "$svcold" = "0x0" ] && [ ! "$svcref" ]; then svcref=0x5 sed -i '/ SERVICE_ADJ:/ a\ .field static final SERVICE_ADJ_REF:I = '$svcref ProcessList.smali fi echo " Prior ADJs from ProcessList.smali are..." echo "" sleep 1 echo " HOME_APP_ADJ = $homeold" echo " VISIBLE_APP_ADJ = $visold" echo " PREVIOUS_APP_ADJ = $prevold" echo " HEAVY_WEIGHT_APP_ADJ = $hvyold" if [ "$svcold" != "0x0" ]; then echo " SERVICE_ADJ = $svco ld" else echo " SERVICE_ADJ = $svcref" fi echo " BACKUP_APP_ADJ = $bkupold" echo "" echo $line echo ""sleep 1 echo " New ADJs will be... " echo "" sleep 1 echo " HOME_APP_ADJ = $homenew" echo " VISIBLE_APP_ADJ = $visnew" echo " PREVIOUS_APP_ADJ = $prevnew" echo " HEAVY_WEIGHT_APP_ADJ = $hvynew" echo " SERVICE_ADJ = $svcnew" echo " BACKUP_APP_ADJ = $bkupnew" echo "" echo $line echo "" sleep 1 echo " And... " echo "" sleep 1 echo " Here..." echo "" sleep 1 echo " We... " echo "" sleep 1 echo $line echo " GO!" echo $line echo "" sleep 1 sed -i '/"Background"/,/end method/{ '$(($keyline1+2))'s/'$visold'/'$ visnew'/ '$(($keyline1+4))'s/'$hvyold'/'$ hvynew'/ '$(($keyline1+5))'s/'$bkupold'/' $bkupnew'/ '$(($keyline1+7))'s/'$homeold'/' $homenew'/ '$(($keyline1+8))'s/'$prevold'/' $prevnew'/} /iput.*systemNoUi/,/"started-bg-services"/{ '$(($keyline2-10))',/"visible"/s /'$visold'/'$visnew'/ /"f.*-service"/,/"heavy"/s/'$hvy old'/'$hvynew'/ /"heavy"/,'$(($keyline3-11))'s/' $homeold'/'$homenew'/ /"home"/,/"previous"/s/'$prevold '/'$prevnew'/ /"previous"/,/"backup"/s/'$bkupo ld'/'$bkupnew'/} /"svcb "/,/"fore "/{ /"svcb "/,/"home "/s/'$prevold'/ '$prevnew'/ '$(($keyline6-12))',/"home "/s/' $homeold'/'$homenew'/ '$(($keyline6+6))',/ProcessRecor d/s/'$homeold'/'$homenew'/ /"home "/,/"prcp "/{ s/'$bkup old'/'$bkupnew'/s/'$hvyo ld'/'$hvynew'/} /"prcp "/,/"fore "/s/'$visold'/' $visnew'/} /"total"/,/" \/ "/{'$(($keyline8-36))',/" \/ "/{s/'$home old'/'$homenew'/}} /VISIBLE_APP_ADJ/,/SERVICE_B_ADJ/{ /VISIBLE_APP_ADJ/,/PERCEPTIBLE_A PP_ADJ/s/'$visold'/'$visnew'/ /HEAVY_WEIGHT_APP_ADJ/,/BACKUP_A PP_ADJ/s/'$hvyold'/'$hvynew'/ /BACKUP_APP_ADJ/,/SERVICE_ADJ/s/ '$bkupold'/'$bkupnew'/ /HOME_APP_ADJ/,/PREVIOUS_APP_ADJ /s/'$homeold'/'$homenew'/ /PREVIOUS_APP_ADJ/,/SERVICE_B_AD J/s/'$prevold'/'$prevnew'/} /method public getMemoryInfo/,/HIDDEN_APP_MIN_ADJ/{'$(($ keyline9+8))',/HIDDEN_APP_MIN_ADJ/s/'$homeold'/'$homenew'/}' ActivityManagerServ ice.smali if [ "$svcold" != "0x0" ]; then sed -i '/"Background"/,/end method/{'$(($keyline1+6))'s/'$svcold '/'$svcnew'/} /"top-activity"/,/"started-bg-services"/{'$(($ke yline4-8))',/"started-bg-services"/s/'$svcold'/'$svcnew'/} /"svcb "/,/"fore "/{/"home "/,/"prcp "/{s/'$svco ld'/'$svcnew'/}} /"total"/,/" \/ "/{'$(($keyline8-36))',/" \/ "/{ s/'$svcold'/'$svcnew'/ s/'$prevold'/'$prevnew'/}} /VISIBLE_APP_ADJ/,/SERVICE_B_ADJ/{/SERVICE_ADJ/, /HOME_APP_ADJ/s/'$svcold'/'$svcnew'/} /method public killBackgroundProcesses/,/"kill b ackground"/{'$(($keyline10-14))',/"kill background"/s/'$svcold'/'$svcnew'/}' Act ivityManagerService.smali else sed -i '/"total"/,/" \/ "/{'$(($keyline8-36))',/" \/ "/{s/'$prev old'/'$prevnew'/}}' ActivityManagerService.smali fi if [ "$nodebuginfo" ]; then if [ "$Sense4" ]; then sed -i '/"bound-bg-services"/,/"bg-services"/{ '$(($keyline5-40 ))','$(($keyline5-32))'s/'$visold'/'$visnew'/ '$(($keyline5-24 ))',/"bg-services"/s/'$visold'/'$visnew'/} /static oomAdjToImportance/,/end method/ { '$(($keyline7+30 ))','$(($keyline7+80))'{ s/'$homeold'/'$homenew'/} '$(($keyline7+88 ))','$(($keyline7+112))'{ s/'$hvyold'/'$hvynew'/ s/'$visold'/'$visnew'/}}' ActivityManagerService.smaliif [ "$svcold" != "0x0" ]; then sed -i '/static oomAdjTo Importance/,/end method/{'$(($keyline7+30))','$(($keyline7+80))'{s/'$svcold'/'$s vcnew'/}}' ActivityManagerService.smali; fi else sed -i '/"bound-bg-services"/,/"bg-services"/{ '$(($keyline5-40 ))','$(($keyline5-32))'s/'$visold'/'$visnew'/ '$(($keyline5-24 ))',/"bg-services"/s/'$visold'/'$visnew'/} /static oomAdjToImportance/,/end method/ { '$(($keyline7+7) )','$(($keyline7+12))'s/'$homeold'/'$homenew'/ '$(($keyline7+30 ))','$(($keyline7+38))'s/'$homeold'/'$homenew'/ '$(($keyline7+44 ))','$(($keyline7+76))'{ s/'$hvyold'/'$hvynew'/ s/'$visold'/'$visnew'/}}' ActivityManagerService.smali if [ "$svcold" != "0x0" ]; then sed -i '/static oomAdjTo Importance/,/end method/{'$(($keyline7+44))','$(($keyline7+76))'{s/'$svcold'/'$s vcnew'/}}' ActivityManagerService.smali; fi fi else if [ "$Sense4" ]; then sed -i '/"bound-bg-services"/,/"bg-services"/{ '$(($keyline5-58 ))','$(($keyline5-50))'s/'$visold'/'$visnew'/ '$(($keyline5-36 ))',/"bg-services"/s/'$visold'/'$visnew'/} /static oomAdjToImportance/,/end method/ { '$(($keyline7+40 ))','$(($keyline7+100))'{ s/'$homeold'/'$homenew'/} '$(($keyline7+11 0))','$(($keyline7+136))'{ s/'$hvyold'/'$hvynew'/ s/'$visold'/'$visnew'/}}' ActivityManagerService.smali if [ "$svcold" != "0x0" ]; then sed -i '/static oomAdjTo Importance/,/end method/{'$(($keyline7+40))','$(($keyline7+100))'{s/'$svcold'/'$ svcnew'/}}' ActivityManagerService.smali; fi else sed -i '/"bound-bg-services"/,/"bg-services"/{ '$(($keyline5-58 ))','$(($keyline5-50))'s/'$visold'/'$visnew'/ '$(($keyline5-38 ))',/"bg-services"/s/'$visold'/'$visnew'/} /static oomAdjToImportance/,/end method/ { '$(($keyline7+10 ))','$(($keyline7+16))'s/'$homeold'/'$homenew'/ '$(($keyline7+40 ))','$(($keyline7+48))'s/'$homeold'/'$homenew'/ '$(($keyline7+55))','$(($keyline7+95))'{ s/'$hvyold'/'$hvynew'/ s/'$visold'/'$visnew'/}}' ActivityManagerService.smali if [ "$svcold" != "0x0" ]; then sed -i '/static oomAdjTo Importance/,/end method/{'$(($keyline7+55))','$(($keyline7+95))'{s/'$svcold'/'$s vcnew'/}}' ActivityManagerService.smali; fi fi fi sed -i '/static fields/,/instance fields/{ /BACKUP_APP_ADJ:/s/'$bkupold'/'$ bkupnew'/ /HEAVY_WEIGHT_APP_ADJ:/s/'$hvyol d'/'$hvynew'/ /HOME_APP_ADJ:/s/'$homeold'/'$ho menew'/ /PREVIOUS_APP_ADJ:/s/'$prevold'/ '$prevnew'/ /VISIBLE_APP_ADJ:/s/'$visold'/'$ visnew'/}' ProcessList.smali if [ "$svcold" != "0x0" ]; then sed -i '/static fields/,/instance fields/{/SERVICE_ADJ:/s/'$svco ld'/'$svcnew'/}' ProcessList.smali else sed -i '/static fields/,/instance fields/{/SERVICE_ADJ_REF/s/'$s vcref'/'$svcnew'/} /method static constructor/,/end method/{ s/0x5$/'$svcnew'/ s/0x7$/'$svcnew'/}' Proc essList.smali fi echo " Your smali files are now SuperCharged!" echo "" echo $line echo "" sleep 1 echo " But wait..." echo "" sleep 1 echo " ...there's MORE..." echo "" sleep 1 echo $line fi echo " The Maximum MultiTasking Mods!" echo $line echo "" sleep 1 echo " The Time Killer Killer..." sleep 1 echo " ...and..." echo "" sleep 1 echo " =====================================" if [ "$onthephone" ]; then busybox echo " \\\\\\\\\\ -=MAXIMUM OVERDRIVE= - /////" else echo " \\\\\\\\\\ -=MAXIMUM OVERDRIVE=- /////" fi echo " ================================="echo "" sleep 1 echo " 1. Android kills apps after 30 minutes..." echo "" sleep 1 echo " ...even if you have TONS of Free RAM. Ugh." echo "" sleep 1 echo " The Time Killer Killer raises it to 24hrs!" echo "" sleep 1 #echo " 2. Android remembers 20 recent tasks..." #echo "" #sleep 1 #echo " ...\"Total Recall\" will make it remember 50!" #echo "" #sleep 1 echo " 2. Android only allows 15 hidden apps to run..." echo "" sleep 1 echo " Even if you have TONS of RAM..." echo "" sleep 1 echo " ...YOU CAN'T MULTITASK AS YOU SHOULD!" echo "" sleep 1 echo $line echo " Maximum Overdrive will increase it to 70 APPS!" echo $line echo "" sleep 1 echo " Plus, Android will keep only 2 hidden apps..." echo "" sleep 1 echo " ...then empty apps can push them out of memory!" echo "" sleep 1 echo " But with \"Minimum Hidden Protection\"..." echo "" sleep 1 echo " ...it's bumped up to 15 ie. the old maximum!" echo "" sleep 1 echo $line if [ "$preics" ]; then echo " Bonus Mod for this ROM: \"ProActive Booster\"!" echo $line echo "" sleep 1 echo " Maximum Processes will go from 2 to 50..." echo "" sleep 1 echo " ...and Maximum Activities jump from 20 to 70!" else echo " Bonus Mod for this ROM: \"Service Preserver\"!" echo $line echo "" sleep 1 echo " Apps that you recently ran (service apps)..." echo ""sleep 1 echo " ...can sometimes become the \"worstType\"..." echo "" sleep 1 echo " ...and therefore can be easily killed. Duh!" echo "" sleep 1 echo " So this will stop that silly behaviour ;^]" fi echo "" sleep 1 echo $line echo " READ THIS IMPORTANT INFO!" echo $line echo "" sleep 1 echo " If your device gets laggy after this mod..." echo "" sleep 1 echo " Use the V6 SuperCharger script..." echo "" sleep 1 echo " ...to RAISE the minfree levels!" echo "" sleep 1 echo " The lowmemorykiller probably isn't even used..." echo "" sleep 1 echo " ...on high end devices..." echo "" sleep 1 echo " ...due to pre-emptive app killing!" echo "" sleep 1 echo " But for better MultiTasking..." echo "" sleep 1 echo " ...LOWER the minfree levels!" echo "" echo $line echo "" sleep 1 echo " Wanna test out The Maximum MultiTasking Mods?" echo "" sleep 1 echo -n " Enter Y for Yes, any key for No: " read MMM echo "" case $MMM in y|Y)thirtyminutes=0x1b7740 twentyfourhrs=0x5265c00 maxappsnew=0x46 maxappsnewinteger=70 minappsnew=0xf maxrecentnew=0x32 maxrecentold=`grep MAX_RECENT_TASKS:.*= ActivityManagerService.smali | awk '{print $NF}'` maxrecentref=`grep MAX_RECENT_TASKS_REF:.*= ActivityManagerService.sma li | awk '{print $NF}'` if [ "$maxrecentold" = "0x0" ] && [ ! "$maxrecentref" ]; then maxrecentref=0x14 sed -i '/ MAX_RECENT_TASKS:/ a\ .field static final MAX_RECENT_TASKS_REF:I = '$maxrecentref ActivityManagerServi ce.smali fi maxprocessnew=0x32 maxacitivitiesnew=0x46 echo $line echo "" sleep 1 echo " Applying The Time Killer Killer..." echo "" sleep 2 if [ "$preics" ]; then sed -i '/ MAX_RECENT_TASKS:/,/"started-services"/s/'$thirtyminut es'/'$twentyfourhrs'/' ActivityManagerService.smali else sed -i '/ MAX_RECENT_TASKS:/,/"bound-bg-services"/s/'$thirtyminu tes'/'$twentyfourhrs'/ '$(($keyline11-4))',/"bound-bg-services"/s/if-le /if-ge/ /method final updateOomAdjLocked/,/end method/s/ '$thirtyminutes'/'$twentyfourhrs'/' ActivityManagerService.smali fi echo $line echo " ...Enabling Maximum Overdrive!" echo $line echo "" sleep 2 if [ "$preics" ]; then maxappsold=`grep MAX_HIDDEN_APPS:.*= ActivityManagerService.smal i | awk '{print $NF}'` minappsold=`grep MIN_HIDDEN_APPS:.*= ActivityManagerService.smal i | awk '{print $NF}'` maxacitivitiesold=`grep MAX_ACTIVITIES:.*= ActivityManagerServic e.smali | awk '{print $NF}'` maxprocessold=`grep MAX_PROCESSES:.*= ActivityManagerService.sma li | awk '{print $NF}'` keyline12=`sed -n '/No longer want/=' ActivityManagerService.sma li` sed -i '/MAX_ACTIVITIES:/s/'$maxacitivitiesold'/'$maxacitivities new'/ /MAX_HIDDEN_APPS:/s/'$maxappsold'/'$maxappsnew'/ /MAX_PROCESSES:/s/'$maxprocessold'/'$maxprocessn ew'/ /MAX_RECENT_TASKS:/s/'$maxrecentold'/'$maxrecent new'/ /MIN_HIDDEN_APPS:/s/'$minappsold'/'$minappsnew'/ /final updateLruProcessInternalLocked/,/end meth od/{ /HashMap/,/object/{ /'$minappsold'/s/\/4/\/16/ s/'$minappsold'/'$minappsnew'/}} /final addRecentTaskLocked/,/end method/{/>inten t/,/>mRecentTasks/s/'$maxrecentold'/'$maxrecentnew'/} /method public setProcessLimit/,/end method/{ /iput p1.*>mProcessLimit / i\const/16 v0, '$maxappsnew' />mProcessLimit/s/p1/v0/ } '$(($keyline12-15))','$keyline12's/'$maxappsold' /'$maxappsnew'/' ActivityManagerService.smali echo " And now the Bonus Mod: \"ProActive Booster\"! ;^]" echo "" sleep 2 for keyline13 in `sed -n '/>mAlwaysFinishActivities/=' ActivityM anagerService.smali`; do sed -i $(($keyline13-5))','$keyline13'{ /'$maxprocessold '/s/\/4/\/16/ s/'$maxprocessol d'/'$maxprocessnew'/ s/'$maxacitiviti esold'/'$maxacitivitiesnew'/}' ActivityManagerService.smali done else maxappsold=`grep MAX_HIDDEN_APPS:.*= ProcessList.smali | awk '{p rint $NF}'` maxappsref=`grep MAX_HIDDEN_APPS_REF:.*= ProcessList.smali | awk '{print $NF}'` if [ "$maxappsold" = "0x0" ] && [ ! "$maxappsref" ]; then maxapp sref=0xf sed -i '/ MAX_HIDDEN_APPS:/ a\ .field static final MAX_HIDDEN_APPS_REF:I = '$maxappsref ProcessList.smali fi maxappslowmemold=`grep MAX_HIDDEN_APPS_FOR.*= ProcessList.smali | awk '{print $NF}'` maxappsinitold=`grep INIT_HIDDEN_APPS:.*= ProcessList.smali | aw k '{print $NF}'` minappsold=`grep MIN_HIDDEN_APPS:.*= ProcessList.smali | awk '{p rint $NF}'` minappsdhaold=`grep MIN_HIDDEN_APPS_FOR.*= ProcessList.smali | a wk '{print $NF}'` keyline14=`sed -n '/ro.MAX_HIDDEN_APPS/=' ProcessList.smali` keyline15=`sed -n '/SystemProperties;->getInt/=' ProcessList.sma li` if [ "$keyline14" ]; then sed -i '/ro.MAX_HIDDEN_APPS/,'$(($keyl ine14+3))'s/"\([0-9]*\)"/"'$maxappsnewinteger'"/' ProcessList.smali; fi if [ "$keyline15" ]; then sed -i $(($keyline15-3))','$keyline15' s/0x.*/'$maxappsnew'/' ProcessList.smali; fi for keyline16 in `sed -n '/>MAX_HIDDEN_APPS/=' ProcessList.smali `; do sed -i $(($keyline16-3))','$(($keyline16+7))'{/16/s/0x.* /'$maxappsnew'/}' ProcessList.smali done sed -i '/MIN_HIDDEN_APPS:/s/'$minappsold'/'$minappsnew'/ /MIN_HIDDEN_APPS_FOR/s/'$minappsdhaold'/'$minapp snew'/ /method static constructor/,/end method/{/if-eq/ s/^./#/}' ProcessList.smali if [ "$maxappsold" != "0x0" ]; then sed -i '/MAX_HIDDEN_APPS:/s/'$maxappsold'/'$maxappsnew'/ /MAX_HIDDEN_APPS_FOR/s/'$maxappslowmemol d'/'$maxappsnew'/ /INIT_HIDDEN_APPS:/s/'$maxappsinitold'/' $maxappsnew'/ /method static constructor/,/end method/{ s/'$maxappsold'/ '$maxappsnew'/ s/'$maxappslowme mold'/'$maxappsnew'/ s/'$maxappsinito ld'/'$maxappsnew'/}' ProcessList.smali for keyline17 in `sed -n '/>mProcessLimitOverride/=' Act ivityManagerService.smali`; do sed -i $(($keyline17-8))','$keyline17'{ s/'$maxa ppsold'/'$maxappsnew'/ s/'$maxa ppslowmemold'/'$maxappsnew'/ s/'$maxa ppsinitold'/'$maxappsnew'/}' ActivityManagerService.smali done else sed -i '/MAX_HIDDEN_APPS_REF/s/'$maxappsref'/'$maxappsne w'/' ProcessList.smali fi echo " And now the Bonus Mod: \"Service Preserver\"! ;^]" echo "" sleep 2 sed -i '/final updateLruProcessInternalLocked/,/end method/{ /HashMap/,/object/{ /'$minappsold'/s/\/4/\/16/ s/'$minappsold'/'$minappsnew'/}} /public killPids/,/end method/{/>HIDDEN_APP_MIN_ ADJ/,/"Killing processes "/{/0x/s/^./#/}} /isolated not needed/,/mNumServiceProcs/{/update HiddenAppNum/,/>mProcessLimit/{/iput/s/^./#/}}' ActivityManagerService.smali if [ ! "$jb2" ]; then sed -i '/MAX_HIDDEN_APPS/,/move/{/div-int/s/0x.*/0xa/} /iget.*>mProcessLimit.I/,/move-object/{/ div-int/s/0x.*/0xa/}' ActivityManagerService.smali fi if [ "$maxrecentold" != "0x0" ]; then sed -i '/MAX_RECENT_TASKS:/s/'$maxrecentold'/'$maxrecent new'/ /final addRecentTaskLocked/,/end method/ {/>intent/,/>mRecentTasks/s/'$maxrecentold'/'$maxrecentnew'/}' ActivityManagerSe rvice.smali else sed -i '/MAX_RECENT_TASKS_REF/s/'$maxrecentref'/'$maxrec entnew'/' ActivityManagerService.smali fi fi echo $line echo " Maximum MultiTasking Mods Installed!";; *);; esac if [ "$Sense4" ]; then echo $line echo "" sleep 1 echo " Sense 4 introduced an ADDITIONAL app limit..." echo ""sleep 1 echo " ...so you can run only 8 visible apps!" echo "" sleep 1 echo " Also added was \"HTC Recent App Fusion\"..." echo "" sleep 1 echo " ...which looks like nothing but overhead :p" echo "" sleep 1 echo " So... howabout a..." echo "" sleep 1 echo $line echo " Non-Sense App Limit!" echo $line echo "" sleep 1 echo " Visible app limit is bumped up to 50 apps..." echo "" sleep 1 echo " ...and \"HTC Recent App Fusion\" gets disabled!" echo "" echo $line echo "" sleep 1 echo " Wanna test out The Non-Sense App Limit Mod?" echo "" sleep 1 echo -n " Enter Y for Yes, any key for No: " read NSAL echo "" case $NSAL in y|Y)maxvistasksnew=0x32 echo $line echo "" sleep 1 echo " Applying The Non-Sense App Limit..." echo "" sleep 2 sed -i '/method static constructor/,/"System"/{ /method static construct or/,/MAX_VISIBLE_TASKS/{ s/16 v3, .*/16 v3, '$maxvistasksnew'/ s/16 v0, .*/16 v0, '$maxvistasksnew'/} /MAX_VISIBLE_TASKS/,/"Sy stem"/{/16 v3,/d}} /sput.*MAX_VISIBLE_TASKS/ a\ const/16 v3, 0x8 /sget.*MAX_VISIBLE_TASKS/,/TaskRecord/s/if-le v7/if-eq v8/' ActivityManagerService.smali echo $line echo " *);; esac fi echo $line Non-Sense App Limit Mod Installed!";;echo "" sleep 1 echo " Please leave feedback..." echo "" sleep 1 echo " ...in the XDA SuperCharger thread..." echo "" sleep 1 echo " ...or the Ultimate Jar Power Tools thread :D" echo "" sleep 1 echo $line echo " CUZ I'M ALL DONE!" echo $line echo "" sleep 1 if [ "$UltimaticMode" ]; then echo " So... get outta here... type \"exit\" remember?" echo "" echo $line echo "" sleep 1 fi