I didn't want to risk making the SuperCharge & Bulletproof thread too confusing so I figured it best to make a "sister" thread.
This is a work in progress.
But if this information is helpful, please click the thanks button
HUGE thanks to Feeyo and Bear in NM for helping me figure out a workable solution on locking a background app in memory on boot up.
Feeyo gave me the gist of it but it wouldn't work on boot.
After posting in this thread at Droid Forums, things got rolling - with alot of help from Bear in NM.
Create a Unix script file with no extension (I named it 97oom) with Notepad++ and put it in your i/system/etc/init.d/ folder and put this inside:
#!/system/bin/sh sleep 60 PPID=$(pidof com.estrongs.android.safer) echo "-17" > /proc/$PPID/oom_adj
You can also do it on the phone itself:
1. Make a copy of 10overclock
2. Renamed it to 97oom (I have a 98governor and a 99complete so...)
3. Deleted the text and put the text you see above
4. Set permissions
Then reboot to test!
You can check to see if it worked with either Auto Memory Manager (AMM) or AutoKiller Memory Optimizer (AKMO).
The bold text in the above code is the process name of the app that you want to protect!
Note: You can get the process name from most process monitors or with AKMO or AMM.
That command "as is" will give ES Security Manager the highest priority of -17.
AKMO shows it as being ignored by the OOM killer
At first it wasn't working on boot because ES Security was not yet loaded in memory.
The "sleep 60 "command fixes that by waiting 60 seconds to execute the command
You can also do this in GScript Lite with this:
PPID=$(pidof com.estrongs.android.safer) echo "-17" > /proc/$PPID/oom_adj
I suggest you get Busybox Installer and have it install the latest BusyBox (v1.19).
This ensures GScript doesn't spit out ugly stderr: messages.
GScript Tip: 1. Make a file (with any text editor) with the commands
................. 2. Rename it with an .sh extension (example 97oom.sh)
................. 3. Put it in sdcard/gscript folder
................. 4. Run GScript, Menu key, Add script, and click Load file, select a script and Save (leave SU checked)
Even better, you can make shortcut for any GScript.
Long press desktop > Shortcuts > GScript Lite > Select... BOOYA!
As I said, this is a work in progress.
Taming the OOM Killer explains that an app will be ignored by the OOM killer if it has the -17 priority.
The problem is that Android will still shuffle it's priority downwards like it does with any inactive app.
If that happens, then the app reverts to it's usual priority.
This is why ESS will lose it's -17 after a couple of hours. It just sleeps ALL the time.
My thinking that if a more active background app, such as an SMS app or a music app is given the -17, it won't lose it's priority at all.
Feedback with results is more than welcome!