all roms ultimate jar power tools-smali patcher rc9.sh

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

If you can't read please download the document

Upload: gaurav-pawar

Post on 27-Dec-2015

34 views

Category:

Documents


16 download

DESCRIPTION

iqyriuhqwuh2uiornwiqeudfio2uiordij2ourio2uriu32iorufioqwfjwefjksadfjkf

TRANSCRIPT

#!/system/bin/sh## Ultimate Jar Power Tools Script RC9 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 mod to bypass the lowmemorykiller for greater multitasking!)# b. "Minimum Hidden Protection" - This keeps 15 hidden apps (doing background 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 inactivity 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 likely to be killed.# e. "ProActive Booster" - (Pre-ICS ROMS) This changes the processes limit 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 and 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 MultiTasking Potential!## Usage Notes:# 1. Mods 1 and 2 will edit ActivityManagerService.smali (Froyo and up) and ProcessList.smali (I SCream Sandwich [sic] and Jelly Bean)# Mod 3, for Sense 4 and above, only needs to patch ActivityManagerService.smali# 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 itself using Script Manager or Terminal Emulator.# Alternatively, you can run it on a PC, whether it be Linux or Mac OSX or Windows (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 minfree 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 -xline="================================================"if [ -f "c:/tmp/sed.exe" ]; then tooldir=c:/tmp/; fiawk=$tooldir"awk"grep=$tooldir"grep"sleep=$tooldir"sleep"tr=$tooldir"tr"sed=$tooldir"sed"clear 2>/dev/nullecho ""echo " Running $0..."echo ""cd "${0%/*}" 2>/dev/nullecho $lineecho " Ultimate Jar Power Tools!"echo $lineecho ""$sleep 1echo " 1. Jelly ISCream (SuperCharge ICS and up)..."echo ""$sleep 1echo " 2. Maximum MultiTasking Mods (Froyo and up)..."echo ""$sleep 1echo " 3. Non-Sense App Limit (Sense 4.0 and up)..."echo ""echo $lineecho ""$sleep 1echo " Brought to you by your sometimes..."echo ""$sleep 1echo " ...friendly..."echo ""$sleep 1echo " ...neighborhood..."echo ""$sleep 1echo " -=zeppelinrox=-"echo ""echo $lineecho ""$sleep 1echo " So... which files get patched...?"echo ""$sleep 1echo " ALL ROMS have ActivitiyManagerServices.smali..."echo ""$sleep 1echo " ICS ROMS and up also have ProcessList.smali..."echo ""if [ -f "/system/framework/services.jar" ]; then onthephone=yesid=`id`; id=`echo ${id#*=}`; id=`echo ${id%%\(*}`; id=`echo ${id%% *}`$sleep 1echo " See Post 2 of the XDA SuperCharger thread..."echo ""$sleep 1echo " ...and LEARN how to decompile services.jar!"echo ""$sleep 1echo " Put the smali file(s) on the SD Card..."echo ""$sleep 1echo " ...and in the SAME folder as this script!"echo ""if [ "$id" != "0" ] && [ "$id" != "root" ]; thenecho $lineecho ""$sleep 2echo " You are NOT running this script as root..."echo ""$sleep 3echo $lineecho " ...No SuperUser for you!!"echo $lineecho ""$sleep 3echo " ...Please Run as Root and try again..."echo ""echo $lineecho ""$sleep 3exit 69fifi#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`" ]; then Sense4=yes; fi 2>/dev/null#fiif [ ! -f "ActivityManagerService.smali" ]; then missingsmali=yeselif [ "`$grep "mProcessList" ActivityManagerService.smali`" ]; then postics=yesif [ ! -f "ProcessList.smali" ]; then missingsmali=yes; fiif [ "`$grep "HTC_RECENT_APP_FUSION" ActivityManagerService.smali`" ]; then Sense4=yes; fiif [ "`$grep "ActiveServices" ActivityManagerService.smali`" ]; then jb2=yes; fielse preics=yesfi 2>/dev/null$sleep 2echo $lineif [ "$missingsmali" ]; thenif [ ! -f "ActivityManagerService.smali" ]; then echo " FAIL: ActivityManagerService.smali NOT FOUND!"else echo " FAIL: ProcessList.smali NOT FOUND!"fiecho $lineecho ""$sleep 2echo " NO SUPERTOOLS FOR YOU!"echo ""echo $lineecho ""$sleep 2if [ "$postics" ]; thenecho -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 $lineecho ""$sleep 2echo " Next time, READ POST 2!"echo ""$sleep 2echo " And no, I didn't wipe the SD CArd..."echo ""$sleep 2echo $lineecho " That would be CRAZY..."echo $lineecho ""$sleep 2echo " ...Or did I?"echo ""$sleep 2echo " oops..."echo ""$sleep 3fiexit 69fiecho ""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; donekeyline4=`$sed -n '/\"started-bg-ui-services\"/=' ActivityManagerService.smali`for i in `$sed -n '/\"bg-services\"/=' ActivityManagerService.smali`; do keyline5=$i; donekeyline6=`$sed -n '/\"home.\"/=' ActivityManagerService.smali`keyline7=`$sed -n '/\"kill.background\"/=' ActivityManagerService.smali`keyline8=`$sed -n '/\"bound-bg-services\"/=' ActivityManagerService.smali`if [ ! "`$grep -m 5 ".line" ActivityManagerService.smali`" ]; thennodebuginfo=yeskeyline3=$(($keyline3+1))fiecho $lineif [ "$postics" ]; thenecho " \"Jelly ISCream\" for Jelly Bean and Ice Cream!"echo $lineecho ""$sleep 1echo " Wanna SuperCharge your services.jar?"echo ""$sleep 1echo -n " Enter Y for Yes, any key for No: "read superservecho ""$sleep 1case $superserv in y|Y)hellzyeah=yes;;*);;esacecho $linefiif [ "$hellzyeah" ]; thenecho " In the V6 Thread, this is STEP 5 in Post #2!"echo $lineecho ""$sleep 1echo " Because you're too lazy to edit smali files..."echo ""$sleep 1echo " ...and I like showing off... LOL"echo ""$sleep 1echo " I'll edit ActivityManagerService.smali..."echo ""$sleep 1echo " ...and ProcessList.smali"echo ""$sleep 1echo " So they'll be SuperCharged nice, nice..."echo ""echo $lineecho ""$sleep 1echo " SuperCharged Launcher Strength..."echo " ================================="echo ""$sleep 1echo " Hard To Kill Launcher is..."echo ""$sleep 1echo " ...Strong BUT Still Killable!"echo ""$sleep 1echo " Die-Hard Launcher is..."echo ""$sleep 1echo " ...VERY Strong and RECOMMENDED!"echo ""$sleep 1echo " BulletProof Launcher is..."echo ""$sleep 1echo " ...Strongest and UNKILLABLE!"echo ""$sleep 1echo " ==========================================="if [ "$onthephone" ]; then busybox echo " \\\\\\\\\\ BULLETPROOF LAUNCHER WARNING! /////"else echo " \\\\\\\\\\ BULLETPROOF LAUNCHER WARNING! /////"fiecho " ======================================="echo ""$sleep 1echo $lineecho " This Breaks \"Long-Press Back To Kill\"!"echo $lineecho ""$sleep 1echo " If you don't have or don't use this feature..."echo ""$sleep 1echo " ...don't worry about it ;)"echo ""$sleep 1echo $lineecho " Note 1: This is NOT for Gamers! (Less Free RAM)"echo $line$sleep 1echo " Note 2: It also does not play nice with Tasker!"echo $lineecho ""$sleep 1echo " Select a Launcher Strength..."echo ""echo -n " (H)TK, (B)ulletProof, any key for Die-Hard: "read lstrengthecho ""echo $linecase $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!";;esacecho $lineecho ""$sleep 1bkupnew=0x7hvynew=0x4homenew=0x$launcheradjprevnew=0x5visnew=0x3svcnew=0x6bkupold=`$grep BACKUP_APP_ADJ:.*= ProcessList.smali | $awk '{print $NF}'`hvyold=`$grep HEAVY_WEIGHT_APP_ADJ:.*= ProcessList.smali | $awk '{print $NF}'`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.smalifiecho " Prior ADJs from ProcessList.smali are..."echo ""$sleep 1echo " 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 = $svcold"else echo " SERVICE_ADJ = $svcref"fiecho " BACKUP_APP_ADJ = $bkupold"echo ""echo $lineecho ""$sleep 1echo " New ADJs will be... "echo ""$sleep 1echo " 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 $lineecho ""$sleep 1echo " And... "echo ""$sleep 1echo " Here..."echo ""$sleep 1echo " We... "echo ""$sleep 1echo $lineecho " GO!"echo $lineecho ""$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/'$hvyold'$/'$hvynew'//\"heavy\"/,'$(($keyline3-11))'s/'$homeold'$/'$homenew'//\"home\"/,/\"previous\"/s/'$prevold'$/'$prevnew'//\"previous\"/,/\"backup\"/s/'$bkupold'$/'$bkupnew'/}/\"svcb.\"/,/\"fore.\"/{/\"svcb.\"/,/\"vis..\"/s/if-lt/if-ne//\"svcb.\"/,/\"home.\"/s/'$prevold'$/'$prevnew'/'$(($keyline6-12))',/\"home.\"/s/'$homeold'$/'$homenew'/'$(($keyline6+6))',/ProcessRecord/s/'$homeold'$/'$homenew'//\"home.\"/,/\"prcp.\"/{s/'$bkupold'$/'$bkupnew'/s/'$hvyold'$/'$hvynew'/}/\"prcp.\"/,/\"fore.\"/s/'$visold'$/'$visnew'/}/0x7541/,/>lastRequestedGc/s/'$hvyold'$/'$hvynew'//VISIBLE_APP_ADJ/,/SERVICE_B_ADJ/{/VISIBLE_APP_ADJ/,/PERCEPTIBLE_APP_ADJ/s/'$visold'$/'$visnew'//HEAVY_WEIGHT_APP_ADJ/,/BACKUP_APP_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_ADJ/s/'$prevold'$/'$prevnew'/}' ActivityManagerService.smaliif [ "$svcold" != "0x0" ]; then$sed -i '/\"Background\"/,/end method/{'$(($keyline1+6))'s/'$svcold'/'$svcnew'/}/\"top-activity\"/,/\"started-bg-services\"/{'$(($keyline4-8))',/\"started-bg-services\"/s/'$svcold'$/'$svcnew'/}/\"bg-ui-provider\"/,/>serviceb/{/\"provider\"/,/>serviceb/s/'$svcold'$/'$svcnew'/}/\"svcb.\"/,/\"fore.\"/{/\"home.\"/,/\"prcp.\"/s/'$svcold'$/'$svcnew'/}/VISIBLE_APP_ADJ/,/SERVICE_B_ADJ/{/SERVICE_ADJ/,/HOME_APP_ADJ/s/'$svcold'$/'$svcnew'/}/method public killBackgroundProcesses/,/\"kill.background\"/{'$(($keyline7-14))',/\"kill.background\"/s/'$svcold'$/'$svcnew'/}' ActivityManagerService.smalifiif [ "$nodebuginfo" ]; then$sed -i '/\"bound-bg-services\"/,/\"bg-services\"/{'$(($keyline5-40))','$(($keyline5-32))'s/'$visold'$/'$visnew'/'$(($keyline5-24))',/\"bg-services\"/s/'$visold'$/'$visnew'/}' ActivityManagerService.smalielseif [ "$Sense4" ]; then$sed -i '/\"bound-bg-services\"/,/\"bg-services\"/{'$(($keyline5-58))','$(($keyline5-50))'s/'$visold'$/'$visnew'/'$(($keyline5-36))',/\"bg-services\"/s/'$visold'$/'$visnew'/}' ActivityManagerService.smalielse$sed -i '/\"bound-bg-services\"/,/\"bg-services\"/{'$(($keyline5-58))','$(($keyline5-50))'s/'$visold'$/'$visnew'/'$(($keyline5-38))',/\"bg-services\"/s/'$visold'$/'$visnew'/}' ActivityManagerService.smalififi$sed -i '/static fields/,/instance fields/{/BACKUP_APP_ADJ:/s/'$bkupold'$/'$bkupnew'//HEAVY_WEIGHT_APP_ADJ:/s/'$hvyold'$/'$hvynew'//HOME_APP_ADJ:/s/'$homeold'$/'$homenew'//PREVIOUS_APP_ADJ:/s/'$prevold'$/'$prevnew'//VISIBLE_APP_ADJ:/s/'$visold'$/'$visnew'/}' ProcessList.smaliif [ "$svcold" != "0x0" ]; then$sed -i '/static fields/,/instance fields/{/SERVICE_ADJ:/s/'$svcold'$/'$svcnew'/}' ProcessList.smalielse$sed -i '/static fields/,/instance fields/{/SERVICE_ADJ_REF/s/'$svcref'$/'$svcnew'/}/method static constructor/,/end method/{s/0x5$/'$svcnew'/s/0x7$/'$svcnew'/}' ProcessList.smalifiecho " Your smali files are now SuperCharged!"echo ""echo $lineecho ""$sleep 1echo " But wait..."echo ""$sleep 1echo " ...there's MORE..."echo ""$sleep 1echo $linefiecho " The Maximum MultiTasking Mods!"echo $lineecho ""$sleep 1echo " The Time Killer Killer..."$sleep 1echo " ...and..."echo ""$sleep 1echo " ====================================="if [ "$onthephone" ]; then busybox echo " \\\\\\\\\\ -=MAXIMUM OVERDRIVE=- /////"else echo " \\\\\\\\\\ -=MAXIMUM OVERDRIVE=- /////"fiecho " ================================="echo ""$sleep 1echo " 1. Android kills apps after 30 minutes..."echo ""$sleep 1echo " ...even if you have TONS of Free RAM. Ugh."echo ""$sleep 1echo " 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 1echo " 2. Android only allows 15 hidden apps to run..."echo ""$sleep 1echo " Even if you have TONS of RAM..."echo ""$sleep 1echo " ...YOU CAN'T MULTITASK AS YOU SHOULD!"echo ""$sleep 1echo $lineecho " Maximum Overdrive will increase it to 70 APPS!"echo $lineecho ""$sleep 1echo " Plus, Android will keep only 2 hidden apps..."echo ""$sleep 1echo " ...then empty apps can push them out of memory!"echo ""$sleep 1echo " But with \"Minimum Hidden Protection\"..."echo ""$sleep 1echo " ...it's bumped up to 15 ie. the old maximum!"echo ""$sleep 1echo $lineif [ "$preics" ]; thenecho " Bonus Mod for this ROM: \"ProActive Booster\"!"echo $lineecho ""$sleep 1echo " Maximum Processes will go from 2 to 50..."echo ""$sleep 1echo " ...and Maximum Activities jump from 20 to 70!"elseecho " Bonus Mod for this ROM: \"Service Preserver\"!"echo $lineecho ""$sleep 1echo " Apps that you recently ran (service apps)..."echo ""$sleep 1echo " ...can sometimes become the \"worstType\"..."echo ""$sleep 1echo " ...and therefore can be easily killed. Duh!"echo ""$sleep 1echo " So this will stop that silly behaviour ;^]"fiecho ""$sleep 1echo $lineecho " READ THIS IMPORTANT INFO!"echo $lineecho ""$sleep 1echo " If your device gets laggy after this mod..."echo ""$sleep 1echo " Use the V6 SuperCharger script..."echo ""$sleep 1echo " ...to RAISE the minfree levels!"echo ""$sleep 1echo " The lowmemorykiller probably isn't even used..."echo ""$sleep 1echo " ...on high end devices..."echo ""$sleep 1echo " ...due to pre-emptive app killing!"echo ""$sleep 1echo " But for better MultiTasking..."echo ""$sleep 1echo " ...LOWER the minfree levels!"echo ""echo $lineecho ""$sleep 1echo " Wanna test out The Maximum MultiTasking Mods?"echo ""$sleep 1echo -n " Enter Y for Yes, any key for No: "read MMMecho ""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.smali | $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 ActivityManagerService.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/'$thirtyminutes'$/'$twentyfourhrs'/' ActivityManagerService.smali else$sed -i '/ MAX_RECENT_TASKS:/,/\"bound-bg-services\"/s/'$thirtyminutes'$/'$twentyfourhrs'/'$(($keyline8-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" ]; thenmaxappsold=`$grep MAX_HIDDEN_APPS:.*= ActivityManagerService.smali | $awk '{print $NF}'`minappsold=`$grep MIN_HIDDEN_APPS:.*= ActivityManagerService.smali | $awk '{print $NF}'`maxacitivitiesold=`$grep MAX_ACTIVITIES:.*= ActivityManagerService.smali | $awk '{print $NF}'`maxprocessold=`$grep MAX_PROCESSES:.*= ActivityManagerService.smali | $awk '{print $NF}'`keyline9=`$sed -n '/No longer want/=' ActivityManagerService.smali`$sed -i '/MAX_ACTIVITIES:/s/'$maxacitivitiesold'$/'$maxacitivitiesnew'//MAX_HIDDEN_APPS:/s/'$maxappsold'$/'$maxappsnew'//MAX_PROCESSES:/s/'$maxprocessold'$/'$maxprocessnew'//MAX_RECENT_TASKS:/s/'$maxrecentold'$/'$maxrecentnew'//MIN_HIDDEN_APPS:/s/'$minappsold'$/'$minappsnew'//final updateLruProcessInternalLocked/,/end method/{/HashMap/,/object/{/'$minappsold'$/s/\/4/\/16/s/'$minappsold'$/'$minappsnew'/}}/final addRecentTaskLocked/,/end method/{/>intent/,/>mRecentTasks/s/'$maxrecentold'$/'$maxrecentnew'/}/method public setProcessLimit/,/end method/{/iput p1.*>mProcessLimit/ i\ const/16 v0, '$maxappsnew'/>mProcessLimit/s/p1/v0/}'$(($keyline9-15))','$keyline9's/'$maxappsold'$/'$maxappsnew'/' ActivityManagerService.smaliecho " And now the Bonus Mod: \"ProActive Booster\"! ;^]"echo ""$sleep 2for keyline10 in `$sed -n '/>mAlwaysFinishActivities/=' ActivityManagerService.smali`; do$sed -i $(($keyline10-5))','$keyline10'{/'$maxprocessold'$/s/\/4/\/16/s/'$maxprocessold'$/'$maxprocessnew'/s/'$maxacitivitiesold'$/'$maxacitivitiesnew'/}' ActivityManagerService.smalidone elsemaxappsold=`$grep MAX_HIDDEN_APPS:.*= ProcessList.smali | $awk '{print $NF}'`maxappsref=`$grep MAX_HIDDEN_APPS_REF:.*= ProcessList.smali | $awk '{print $NF}'`if [ "$maxappsold" = "0x0" ] && [ ! "$maxappsref" ]; then maxappsref=0xf$sed -i '/ MAX_HIDDEN_APPS:/ a\.field static final MAX_HIDDEN_APPS_REF:I = '$maxappsref ProcessList.smalifimaxappslowmemold=`$grep MAX_HIDDEN_APPS_FOR.*= ProcessList.smali | $awk '{print $NF}'`maxappsinitold=`$grep INIT_HIDDEN_APPS:.*= ProcessList.smali | $awk '{print $NF}'`minappsold=`$grep MIN_HIDDEN_APPS:.*= ProcessList.smali | $awk '{print $NF}'`minappsdhaold=`$grep MIN_HIDDEN_APPS_FOR.*= ProcessList.smali | $awk '{print $NF}'`keyline11=`$sed -n '/ro.MAX_HIDDEN_APPS/=' ProcessList.smali`keyline12=`$sed -n '/SystemProperties;->getInt/=' ProcessList.smali`if [ "$keyline11" ]; then $sed -i '/ro.MAX_HIDDEN_APPS/,'$(($keyline11+3))'s/"\([0-9]*\)"/"'$maxappsnewinteger'"/' ProcessList.smali; fiif [ "$keyline12" ]; then $sed -i $(($keyline12-3))','$keyline12's/0x.*/'$maxappsnew'/' ProcessList.smali; fifor keyline13 in `$sed -n '/>MAX_HIDDEN_APPS/=' ProcessList.smali`; do$sed -i $(($keyline13-3))','$(($keyline13+7))'{/16/s/0x.*/'$maxappsnew'/}' ProcessList.smalidonekeyline14=`$sed -n '/sput.*>HIDDEN_APP_MIN_ADJ/=' ProcessList.smali`$sed -i '/MIN_HIDDEN_APPS:/s/'$minappsold'$/'$minappsnew'//MIN_HIDDEN_APPS_FOR/s/'$minappsdhaold'/'$minappsnew'//method static constructor/,/end method/{/if-eq/s/^./#//method static constructor/,'$(($keyline14-3))'{s/ 0x.*/'$maxappsnew'/}}' ProcessList.smaliif [ "$maxappsold" != "0x0" ]; then$sed -i '/MAX_HIDDEN_APPS:/s/'$maxappsold'$/'$maxappsnew'//MAX_HIDDEN_APPS_FOR/s/'$maxappslowmemold'/'$maxappsnew'//INIT_HIDDEN_APPS:/s/'$maxappsinitold'/'$maxappsnew'//method static constructor/,/end method/{s/'$maxappsold'$/'$maxappsnew'/s/'$maxappslowmemold'/'$maxappsnew'/s/'$maxappsinitold'/'$maxappsnew'/}' ProcessList.smalifor keyline15 in `$sed -n '/>mProcessLimitOverride/=' ActivityManagerService.smali`; do$sed -i $(($keyline15-8))','$keyline15'{s/'$maxappsold'$/'$maxappsnew'/s/'$maxappslowmemold'/'$maxappsnew'/s/'$maxappsinitold'/'$maxappsnew'/}' ActivityManagerService.smalidoneelse$sed -i '/MAX_HIDDEN_APPS_REF/s/'$maxappsref'$/'$maxappsnew'/' ProcessList.smalifiecho " 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/{/updateHiddenAppNum/,/>mProcessLimit/{/iput/s/^./#/}}/MAX_HIDDEN_APPS/,/move/{/div-int/s/0x.*/0x9/}' ActivityManagerService.smalifor keyline16 in `$sed -n '/iget.*>mProcessLimit.I/=' ActivityManagerService.smali`; do$sed -i $keyline16','$(($keyline16+4))'{/mul-int/s/0x.*/0x3//div-int/s/0x.*/0x9/}' ActivityManagerService.smalidoneif [ "$maxrecentold" != "0x0" ]; then$sed -i '/MAX_RECENT_TASKS:/s/'$maxrecentold'$/'$maxrecentnew'//final addRecentTaskLocked/,/end method/{/>intent/,/>mRecentTasks/s/'$maxrecentold'$/'$maxrecentnew'/}' ActivityManagerService.smalielse$sed -i '/MAX_RECENT_TASKS_REF/s/'$maxrecentref'$/'$maxrecentnew'/' ActivityManagerService.smalifi fi echo $line echo " Maximum MultiTasking Mods Installed!";;*);;esacif [ "$Sense4" ]; thenecho $lineecho ""$sleep 1echo " Sense 4 introduced an ADDITIONAL app limit..."echo ""$sleep 1echo " ...so you can run only 8 visible apps!"echo ""$sleep 1echo " Also added was \"HTC Recent App Fusion\"..."echo ""$sleep 1echo " ...which looks like nothing but overhead :p"echo ""$sleep 1echo " So... howabout a..."echo ""$sleep 1echo $lineecho " Non-Sense App Limit!"echo $lineecho ""$sleep 1echo " Visible app limit is bumped up to 50 apps..."echo ""$sleep 1echo " ...and \"HTC Recent App Fusion\" gets disabled!"echo ""echo $lineecho ""$sleep 1echo " Wanna test out The Non-Sense App Limit Mod?"echo ""$sleep 1echo -n " Enter Y for Yes, any key for No: "read NSALecho ""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 constructor/,/MAX_VISIBLE_TASKS/{s/16 v3, .*/16 v3, '$maxvistasksnew'/s/16 v0, .*/16 v0, '$maxvistasksnew'/}/MAX_VISIBLE_TASKS/,/\"System\"/{/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 " Non-Sense App Limit Mod Installed!";;*);;esacfiecho $lineecho ""$sleep 1echo " Please leave feedback..."echo ""$sleep 1echo " ...in the XDA SuperCharger thread..."echo ""$sleep 1echo " ...or the Ultimate Jar Power Tools thread :D"echo ""$sleep 1echo $lineecho " CUZ I'M ALL DONE!"echo $lineecho ""$sleep 1