[Sprint HTC EVO 4G LTE] zeppelinrox:
[MOD]{Test 14} Sense 4+ MultiTasking Breakthrough!Non-Sense App Limit! TRY & KILL IT!

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

If this is helpful, please Rate the thread 5 Stars and click Thanks! :)

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

It's been awhile since I've made a new thread but I thought that I should make one here...

Since this is where I figured out how to get proper multitasking to work on newer Sense ROMS.

And I'd like to refine it some more :D

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

It all started weeks ago when I first released my -=Maximum Overdrive=- Multitasking Mod.

It fixes Multitasking on ALL ROMS from Froyo to Jelly Bean (except for those with Sense 4 and up lol)

How? To put it simply, I bumped the MAX_HIDDEN_APPS value from 15 to 70 :D

And now, you can now patch your Sense services.jar yourself!

Do it with the Ultimate Jar Power Tools Patcher script HERE!

It's available as a Windows exe HERE! but does not yet have the Non-Sense App Limit (soon)

A great addition to this mod is the Unlimited Recent Apps Panels mod by steal25.

I tried and failed to do it :cyclops: - but at least I was able to help him break the 16 panel barrier to make it Unlimited :D

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

The plan is to have Sense's app limit bumped from 8 visible apps to 50 apps.

Don't worry about if you can't run that many apps at once - the lowmemorykiller will kick in according to your minfrees...

Just crank them up if you need more free ram... lower them for more multitasking :)

I'd suggest using V6 SuperCharger in conjunction with the mod in order to tweak the minfrees, but more importantly,

take advantage of its OOM grouping fixes

The OOM grouping fixes will help ensure that the higher, supercharged ADJs won't result in an overly-aggressive lowmemorykiller.

So if you're enjoying multitasking improvement without using V6 SuperCharger's grouping fix - it's even better with SuperCharger!

Get it HERE

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

A few ROMS already have this implemented but for those that don't, give it a spin!

Included Mods:

SuperCharged with Die-Hard Launcher

Maximum Multitasking Mods ie. -=Maximum Overdrive=- and Time Killer Killer

Non-Sense App Limit!

Installation:

1. Optional But Highly Recommended: Install my latest V6 SuperCharger script. See above as to why :)

2. Download your modded services-sense*.jar and rename it as services.jar

3. In terminal type: su, enter. Leave terminal running.

4. Copy the new services.jar into your /system/framework folder.

5. Go back to terminal and type: cd /system/framework, enter, chown 0.0 services.jar, enter, chmod 644 services.jar, enter.

6. Reboot. This will take awhile since it will optimize apps the first time.

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

About Battery Life: If you think battery is draining quicker, give it a couple of days before assuming the worst.

I'd guess that battery life should get better since the device won't have to restart apps as much as before.

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

So this is the progression for those that don't know what's up so far...

Test 1 - Found the additional Sense app limit... but FAILS to boot... lol

Test 1B - Boots! But doesn't work as good as hoped.

Test 2 - Ok now we're getting somewhere... messing with HTC_RECENT_APP_FUSION seems to be the key...

Test 3 - Fine tune a bit...

Test 4 - More refinements...

Test 5 - Totally disable MAX_VISIBLE_TASKS? Tweaked SuperCharger (more complete)

Test 6 - Tweaked "Trimming Apps" routine to take into account the larger max hidden apps value.

Test 7 - HIGHLY EXPERIMENTAL - Changed HIDDEN_APP_MIN_ADJ (priority) to be the same as SERVICE_ADJ - Why? Well... it may prevent recently ran apps like facebook or your browser from reloading since MaxOD is succesfully allowing 70 hidden apps to stay in memory.

Test 8 - Did away with last change - HIDDEN_APP_MIN_ADJ is back to stock ADJ 9

.......... - "Hidden Protector" added - less important Empty Apps can kick out more important hidden apps from memory. By default, Android will keep at least 2 hidden apps in memory before this happens. I bumped it up to 15 :)

.......... - I also prevent Server apps (apps you just left with ADJ 6 priority) from becoming a "worstType" ie. likely to be killed. This doesn't happen in pre-ICS roms so hey... it's worth a shot, eh?

Test 9 - HIGHLY EXPERIMENTAL - Going with the idea of making Service apps the same as Hidden Apps (since I can greatly control hidden apps) I raised the service app ADJ to be the same as hidden.

.......... - Re-enable HTC_RECENT_APP_FUSION since I'm now able to raise the visible app and recent app limits without touching it. This also means I don't have to mess with TaskRecord.smali or ActivityStack.smali.

Test 10 - Updating Ultimatic Tools code so here's a test run. Service Apps back to the usual ADJ as a test to see if previous test (with service adj the same as hidden apps) is better or not

Test 11 - Sense 4+! Not too much different appart from a big ass song and dance in ProcessList.smali to determine Max Hidden Apps based on ram.

By default I see that if you have 512 mb of ram, it's 10 apps, if you have 2gb of ram it's only 20 apps. Otherwise, it's the usual 15.

But it's 70 apps across the board in these jars lol

Test 12 - Sense 4+ - BIG TEST! After some deep analysis, I've made some important changes that should make memory management smoother. Lots of fixed up if/else conditions (which weren't making sense after changing ADJs) but also took out a few edits that actually hampered memory management to an extent.

Test 13 - Further refinements over Test 12. This is REALLY good... :D Also removed signature check so it better NOT bootloop :) (Thanks il Duce for the heads up)

Test 14 - Forced the low minfrees in ProcessList.smali so that the lowmemorykiller will treat ram like it's on a low memory device which means much less app killing overall.

Test 15 -

Added

: Hard-Coded minfrees - to ProcessList.smali. Without any minfree tweaks, the lowmemorykiller minfrees are 10, 14, 100, 110, 120, 130

............. -

Added

: Hard-Coded OOM Grouping Fix (adj grouping) - to ProcessList.smali. Without any adj grouping tweaks, the values are SuperChargers - 0, 3, 6, 10, 12, 15 (default is 0, 1, 2, 4, 7, 15)

............. -

Added

: Idle Offset Control Valve (see code below) - to ProcessList.smali and ActivityManagerService.smali

// We put empty content processes after any hidden processes that have
// been idle for less than [COLOR=Red]15 seconds[/COLOR].
static final long CONTENT_APP_IDLE_OFFSET = 15*1000;

// We put empty content processes after any hidden processes that have
// been idle for less than [COLOR=Red]120 seconds[/COLOR].
static final long EMPTY_APP_IDLE_OFFSET = 120*1000;

I made:

CONTENT_APP_IDLE_OFFSET = 65 seconds (instead of 15 seconds)

EMPTY_APP_IDLE_OFFSET = 305 seconds (instead of 120 seconds)

So now, if there were apps that normally get killed which you BulletProof (with V6 SuperCharger), you can probably now lessen the BulletProof frequency (it's an option now lol).

Say make it 60 seconds instead of 30 seconds.

I know some apps normally need it as low as 14 seconds to never get killed - which is why I figure it's related to content app idle offset default of 15 seconds.

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

What's hacked:

ActivityManagerService.smali

SuperCharging

Time Killer Killer - MAX_SERVICE_INACTIVITY boosted from 30 minutes to 24hrs

Non-Sense App Limit

..... - MAX_RECENT_TASKS boosted from 20 to 50

..... - MAX_VISIBLE_TASKS boosted from 8 to 50

..... - Rendered HTC_RECENT_APP_FUSION a non-factor - it prevented the application of boosted values

ProcessList.smali

SuperCharging

Maximum Overdrive - MAX_HIDDEN_APPS boosted from 15 to 70

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

How do I know if it worked?

Mod 1. Run the latest V6 SuperCharger script and it will tell you if your launcher is SuperCharged!

Mods 2 and 3. Install System Tuner and put the widget on the desktop.

Make note of how many apps the widget shows running after running a whole bunch of apps.

It would look like ##/##

So feel free to post before and after screen shots!

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

Another Test for Maximum Overdrive - Install aLogcat, before and after the mod, run as many apps as you can, run aLogcat and search for longer.

Example Before and After....

Notice how there is very little killing activity after the mod?

But more importantly, notice that before the mod, app #16 gets killed. After the mod, app #71 gets killed.

Because max hidden apps went from 15 to 70 :D

Note that you will

likely see a blank screen

after the mod, that means you never hit the app limit so nothing got killed :cool:

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

Feedback will be appreciated

For assistance, testing and support, thanks to:

il Duce, jeffsanace, steal25, bog3nator, fernando sor, mrlakadaddy, SteelH

Click THANKS, it tickles :cool: