Keeping oom_adj value of specific apps low permantly - Android Q&A, Help & Troubleshooting

Hi there,
My Messaging APP can hardly stay running in background, and this cause me receive those important messages late. After digging in some information, I found that changing the three oom values of the process can make LMK see this process as high priority and won't kill it easily. By the way, I also changed niceness. However, it seems that Android system will change those oom values itself after a particular duration, so my tweak can only take effect in a short time. Is there any way to lock oom values or reach the same result?
My script of changing oom values and niceness:
Code:
#!/system/bin/sh
X=$(pidof jp.naver.line.android)
echo "-17" > /proc/$X/oom_adj
echo "0" > /proc/$X/oom_score
echo "-1000" > /proc/$X/oom_score_adj
renice -n -20 $X

Related

RAMDISK.TAR a few issue's to resolve.

I have noticed that developers here like to shove VM and Cpu setting into the init.delta.sh file.
The problem with this is compatibility.. for example using the smart ass govender with these settings...
echo "ondemand" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
echo 90 > /sys/devices/system/cpu/cpu0/cpufreq/ondemand/up_threshold
echo 30 > /sys/devices/system/cpu/cpu0/cpufreq/ondemand/down_differential
echo 500000 > /sys/devices/system/cpu/cpu0/cpufreq/ondemand/sampling_rate
echo 122880 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
echo 614400 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
Click to expand...
Click to collapse
Will most definitely cause issue's where the frequency will get stuck.
Why not make it possible to rather edit these value's externally.
as these can also be called from hw_config.sh there by causing less problems when users try to make 3'rd party changes.

The Guide for Awesome Performance OR Battery Life

Yes, this thread used to be on just battery life, that was when there was almost no development for the Razr on ICS. Now we have plenty of ROMs, Mods, and How-Tos'. Sorry to all of the GSM users, but since I own a CDMA Razr some things in this guide might only be for CDMA Razr's. If any of you feel up to it, PM me an equivalent Mod or ROM and I'll include it.
NOTE: Most of these tips assume you have root access and a custom recovery!
(Huge Savings!)
Tip 1. Black Themes
It's proven that black themes use less battery. It takes 0 battery to display a black pixel. So make sure your theme is dark. A good ROM for a black theme is Black Widow by andlaw.
(HUGE SAVINGS)
Tip 2. Brightness
Use automatic brightness! If you're using an AOKP/CM9 based ROM, don't be shy to play around with the Automatic backlight settings under Display. To minimize battery drain, it's good to minimize sampling rates and lower brightness.
OR for even bigger battery savings, use Widgetsoid or Tasker to make a Homescreen, battery friendly as there is no syncing, widget to change your brightness when needed.
You can also use Widgetsoid to add customized pull down toggles to any ROM, which is great!
Idea from HSD-Pilot
(HUGE SAVINGS)
Tip 3.The CPU and I/O
The CPU takes up A LOT of battery, to minimize the battery drain, it's good to under clock/under volt(UV when we get Custom Kernels/Mods)
Tips for Under clocking: The lowest the CPU can go and still be able to manage most or all load you put on it is 800Mhz, so keep it there, and if you play a lot of games, you might increase it to 1Ghz.
Use the "hotplug" CPU Governor: "hotplug" as you will see it called is unique in our phone in the aspect that when CPU load is low enough, it tuns off the second core, saving battery. What is also great about this governor is that it's smart enough that when CPU load is high, it turns the second core on quickly. The frequency stepping values on this governor are superb, you'll get the best performance and battery life.
Tips for Screen Off: If you make profiles for screen off DON'T set it 300Mhz minimum and maximum, that uses MORE BATTERY!
Explanation: When you turn the screen off, the CPU probably still has some tasks it still needs to do and when it's at 300Mhz, it can't do those tasks quickly, this keeps the phone out of deep idle. When the phone is at 600Mhz it can do tasks faster and more efficiently therefore the phone hits deep idle faster, saving more battery.
I guess sometimes when you have your min and max frequency as 300 when screen off and you let the screen time out while a program is running your Razr can crash, just another reason to put it on 600.
CPU Sleeper is a great app that turns off the second core of the CPU when the screen is off, saving a lot of battery life.
Instructions for use:
1. Download and install the apk on your phone.
2. Open your app drawer and locate and select CPU Sleeper.
3. Enable auto-start on reboot and click on "Start service" 2x to activate.
(This shuts off 1 core while the phone's screen is off! Both cores resume when the screen is turned back on.)
4. Enjoy!
If you can, install the Kernel Modules by whirleyes found here. I can personally recommend the hotplugx CPU governor and the SIO I/O Scheduler.
Hotplugx is just an enhanced version of hotplug, as I understand it the second core (CPU 1) is turned off and on faster, resulting in a smoother experience. For clarification, when there is less CPU load, instead it taking 1 second to turn off CPU 1 it takes .5 seconds. When CPU 1 is needed it is turned on faster. Hotplugx does not just have different values of up threshold and down threshold, it actually has optimized code to turn the cores off and on faster. Those values are hypothetical, but you get the point.
SIO is an I/O Scheduler based on Deadline, and Noop. The advantages of it are:
It's very simple, which means better battery life and performance.
Minimized starvation of requests(everybody gets their turn).
For more information on CPU Governors and I/O Schedulers go here.
(Medium to High Savings)
Tip 4. Data+Wifi
Undoubtedly, one of the biggest battery suckers is Mobile Data and Wifi, specifically 4G. So what we can do is download the Phone Info app, Located Here to change the LTE/CDMA connection type to CDMA only. This saves battery by looking for less bands to connect to and by not connecting to battery consuming 4G.
Do this by going under the section "Phone Info" and scrolling down to the bottom and where it says "Set preferred network type" select "CDMA Auto(PLR)".
Wifi: It's proven that having the "Wifi on while sleep" setting on improves battery life.
Do this by going into settings and under "Wifi" hit the menu button and go to "Advanced" and make sure "Keep Wifi on during sleep" says "Always".
(Low to High Savings-Depends on use)
Tip 5. build.prop tweaks
To increase battery life efficiency while in deep sleep and while looking for connections, add or change these lines to the bottom of the build.prop using Root File Managers such as Root Explorer or Root Browser.
REALLY IMPORTANT: MAKE A NANDROID BACKUP BEFORE MESSING WITH THIS!
NOTE: The build.prop is located in /system/build.prop
NOTE 2: Don't open the build.prop in a windows based text editor, it messes up the formatting and you will brick. Use Notepad++ It's better this.
A "#" means it's commented and the compiler/system does not read it.
Code:
#Keep at 1 or 0.
ro.ril.disable.power.collapse=0
#Keep at 1
pm.sleep_mode=1
#Could break tethering
ro.mot.eri.losalert.delay=1000
ro.kernel.android.checkjni=0
EDIT EXISTING LINE!
Code:
#Keep value high to minimize battery drain.
wifi.supplicant_scan_interval=120
(Low to High-depends)
Tip 6. Apps,Services,etc.
Sometimes you get an app or service that uses an immense amount of battery, a lot of these apps are built on, which is called bloatware. We are able to "Freeze" apps like this via the App Manager in ICS or via Titanium Backup. Once you freeze an app, be vigilant about Force closes, random reboots, freezes, etc. Don't freeze anything that you know would be system vital, such as "SIM Toolkit or "System UI". Basically, be smart about it.
Bad Apps: Sometimes you download apps from the market that use an immense amount of battery, you'll know when you just downloaded an app and battery life got really bad. In the situation you know what app it is, uninstall it. In the situation that you don't, use an app like Watchdog Task Manager Lite to monitor the apps using memory and CPU.
What I have frozen:
Amazon Kindle 3.6.0.8.7
Apps 3.06.86
Backup Assistant Plus 1.0
Backup Assistant Plus 4.0.4-47
Backup Assistant+ 4.0.4-47
Backup Assistant+ Contacts Client 1.0
Backup Assistant+ Media 1.0
Calendar 4.0.4-47
[Calendar] Calendar Storage 4.0.4-47
com.motorola.huxvmm.setting 4.0.4-47
Device Setup 1.0
Emergency Alerts 4.0.4-47
Facebook 1.9.6
Flash Removal 4.0.4-47
Google Calendar Sync 4.0.4-338691
Google+ 3.0.1.32017166
Guided Tours 1.0
Help Center 1.0
Home screen tips 1.0
Homescreen 7.7.0Q-129 11
Homescreen VZW Config
Magic Smoke Wallpapers 4.0.4-47
ModemStatsService 1.0
MOG Music 1.01
MOTOACTV 1.0.265G
MotoPrint 5.0.0.26
Music Store 1.1.112
Music Visualization Wallpapers 4.0.4-47
MusicFX 1.4
My Gallery 1.1.112
My Music 1.1.112
My Verizon Mobile 10.0.332
net.juniper.junos.pulse.placeholder 1.0
Netflix 1.0.0 build 1161240-trunk
NFL Mobile 5.7
Quickoffice 5.0.109
Rescue Security 7.0.442
Slacker Radio 3.2.2047
Slingbox 1.0
Smart Actions 3.1.5.2.0
Smart Actions FW 1.0.13
Social Location 7.0.28
Social Sharing 4.0.4-47
Sync Service 2.5.1.4.9
Talk 4.0.4-338691
TalkBack 3.0.2
Tasks 3.0
V CAST Tones 4.5.13
Verizon Remote Diagnostics 2.42.166
Verizon Video 6.2.51
Video Calling 1.0
Video Editor Lite 3.2.1.18
VideoSurf 2.3.0
Voicemail 1.1
VZ Navigator 7.5.1.94
Weather 4.0.4-47
World Clock 1.0
If you have any problems, I'll take it off the list.
Known battery media apps:
Facebook
Twitter
Google+
Solution- Try to find an all in one client,like HootSuite or Tweetdeck it will sync less and will take up less RAM and CPU cycles.
Amazon Appstore
Solution- Uninstall it or make sure you kill every time you use it.
Skype
Steam
Solution- Only run Steam and Skype when you need to, I don't know of any all in one for that combination.
Google Drive
Dropbox
Box
Solution- Try to limit your syncing, turn off instant upload.
Flashlight apps:
Brightest Flashlight Free
Flashlight
All benchmark apps if used too much:
Quadrant Standard
Antutu Benchamrk
Smartbench
The solution - It's okay to bench your phone a lot, just limit it if you need your phone to last that day.
Battery sucking games(all of them, even if they're not on this list):
Cut the Rope
Emulators
All of the Angry Birds
Temple Run
GTA III
Amazing Alex
The solution- Play less graphically intensive games, graphically intensive games work the CPU/ GPU really hard.
Music Streaming Apps:
Google Play Music
Pandora
Winamp
Motocast
iHeartRadio
Slacker Radio
TuneIn Radio
Some tips on limiting battery drain while listening to music: Avoid streaming services like Winamp,Motocast , Slacker Radio and TuneIn Radio.
Google Play Music and Pandora are slightly better.
Why Google Play Music is better in terms of battery life
Although Google Music is still capable of streaming music you've stored on Google's cloud,(sucks battery) when you listen to a song the app caches the song temporarily, so if you were addicted to the new song you got and listened to it 2 times in a row, the app wouldn't have to stream the song again. It's the same thing if you were to go back and listen to the same song 2 or 3 songs later, you wouldn't have to stream it again. Another advantage of Google Music is that you can play music from your sdcard as well as songs from your Google Play Library. No streaming, just reading from the sdcard.
Why is better Pandora better?
Yes, it streams music just like all the other ones I told you not to use, but there is one thing that is unique about Pandora, it doesn't stream music exactly, it packs the song into the cache as fast as possible, it's not constantly using your data connection.
So use Google Play Music or Pandora, preferably Google Play Music.
It can go on and on and it will.
(Medium to High Savings)
Tip 7. Custom ROMs
A custom ROM(Read Only Memory) is a custom version of Android, usually with bloatware and manufacturer skin removed, performance enhancements, and a custom theme. I can personally recommend Eclipse for ICS, Artic for ICS and my personal favorite Liquid Smooth for ICS. They are all GREAT ROMs.
(Low to Medium)
Tip 8. Scripts
A script is a series of instructions carried out by a program to do an action. The ones we're interested in are ones that we can set at boot to apply values. Here is a script you can use to improve battery life. If you make any scripts I'll include them here.
Code:
echo "2400" > /proc/sys/vm/dirty_writeback_centisecs
echo "2000" > /proc/sys/vm/dirty_expire_centisecs
echo "256" > /proc/sys/kernel/random/write_wakeup_threshold
echo "256" > /proc/sys/kernel/random/read_wakeup_threshold
rm /dev/log/main
(Low)
Tip 9. Location Services
Location Services are great, so are Google account backups, they improve search results, help in navigation, back up settings, all sorts of things. Unfortunately, they suck up Battery, so lets disable them.
In settings, under "Location Services" make sure everything is unchecked. Under "Backup & reset" make sure "Backup my data" is unchecked.
(Medium to HUGE)
Tip 10. Battery Savers
Yes, Battery Savers, like JuiceDefender, which is the one we're going to talk about. JuiceDefender in the free version, optimizes your battery by controlling when your phone connects to Mobile Data, very simple. There WILL be at least some improvement with JuiceDefender managing your connections. If you're constantly fighting with it, read some of the manuals and make sure you haven't set any settings you didn't mean to.
Remember, if you liked JuiceDefender, consider buying the Plus or Ultimate versions.
(Medium to High)
Tip 11. Launchers
Live Wallpapers are cool and all, but they drain battery. So swap it for something static and preferably black.
Widgets are great too, they display dynamic information in an easy to look at way. Too bad they suck battery by forcing a refresh every time you turn the screen on. So try to minimize how many you use.
(Low)
Tip 12. Haptic Feedback
Haptic feedback is when you press a button, soft key or key on the keyboard, and the phone vibrates. This takes up valuable resources best used else where. To turn this off go under "Sound" in settings and make sure everything from "Dial pad touch tones" to "Vibrate on touch is unchecked.
(Low to Medium)
Tip 13. Sync
An example of sync is when you open the Facebook application and all the latest new is synced. Except the Sync were talking about is done automatically at specified intervals. Taking up valuable juice, so lets disable it!
To do this go into settings and under "Accounts & sync" if it's on in the top right it will be green, if it's off it will be grey. Make sure it's off.
(Low to Medium)
Tip 14. Animations
Animations happen when you transition in homescreens, open an app, etc. This sucks battery life because it causes the CPU/GPU to work harder to do a simple task like opening an app.
To turn this off go under "Developer options" in settings and at the bottom of "User Interface" section make sure that "Window animation scale" and "Transition animation scale" are set to off.
(HUGE SAVINGS)
Tip 15.Disable things when not in use
This is one of the most important rules for great battery life EVER, you can't expect to get great battery life when you constantly have Bluetooth, Wifi and Mobile Data on. So turn things off if you're not using it!!!!!!!!!!!!
If you have any ideas, post them!
Performance
This section is for people who want to increase their performance but don't want to compromise on battery life.
Tip 1. ROMs
Pretty much any ROM and once again:
Eclipse for ICS
Artic for ICS
Liquid Smooth for ICS
Tip 2. Kernel Modules by whirleyes
Again, I can recommend hotplugx and SIO, they're the best that I have tested together.
Whirleyes has made an experimental overclock module to set the max frequency for 1350Mhz, but beware some people have reported random reboots and freezes.
Download link: Overclock Module
For more information on CPU and I/O Schedulers go here.
Tip 3. Scripts/Mods
Most of us know about zeppelinrox's Superchager v6 and there are many other memorable ones.
Like my Speed it UP script.
Like The Universal Adrenaline Shot
Two scripts that improve RAM management,kernel performance, VM tweaks, dirty tweaks, improves sdcard read speed, file system speedups, sets I/O scheduler to noop or SIO and the CPU Governor to hotplug or hotplugx, changes kernel memory swappiness, and tweaks to the hotplug/hotplugx CPU Governor.
Code:
echo "700000" > /proc/sys/kernel/sched_latency_ns
echo "300000" > /proc/sys/kernel/sched_min_granularity_ns
echo "26188" > /proc/sys/kernel/sched_features
#writes more pages to disc, when given oppurtunity
echo "8" > /proc/sys/vm/page-cluster
#drop all cahces when given oppurtunity
echo "3" > /proc/sys/vm/drop_caches
#Keep 4MB in memory
echo "4096" > /proc/sys/vm/min_free_kbytes
#Dump Vfs cache less
echo "20" > /proc/sys/vm/vfs_cache_pressure
echo "80" > /proc/sys/vm/dirty_background_ratio
#How much dirty data there must be to write to disc
echo "90" > /proc/sys/vm/dirty_ratio
#How often writeback daemons wakeup to write data to disc.
echo "1200" > /proc/sys/vm/dirty_writeback_centisecs
#How old 'dirty" data has to be to be written to disc
echo "900" > /proc/sys/vm/dirty_expire_centisecs
#^^^^^^Both expressed in 100th of second^^^^^^
echo "20" > /proc/sys/vm/swappiness
#faster sdcard read speed
echo "2048" > /sys/devices/virtual/bdi/179:0/read_ahead_kb
# file system speedups
mount -o remount,noauto_da_alloc /system /system
mount -o remount,noauto_da_alloc /data /data
mount -o remount,noauto_da_alloc /cache /cache
# disable logcat - performance boost & save memory,comment, reboot for logcat.
rm /dev/log/main
#sets I/O scheduler to SIO, considered best.
echo "noop" > /sys/block/mmcblk0/queue/scheduler
#sets cpu governor to hotplug, is most intelligent
echo "hotplug" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
echo "950" > /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_transition_latency
#decreases sampling rate, stops lag and saves battery
echo "450000" > /sys/devices/system/cpu/cpufreq/hotplug/sampling_rate
echo "75" > /sys/devices/system/cpu/cpufreq/hotplug/up_threshold
echo "45" > /sys/devices/system/cpu/cpufreq/hotplug/down_threshold
echo "15" > /sys/devices/system/cpu/cpufreq/hotplug/hotplug_out_sampling_periods
echo "5" > /sys/devices/system/cpu/cpufreq/hotplug/hotplug_in_sampling_periods
#better memory mangement
echo "2048,4096,43008,47104,51456,55808" > /sys/module/lowmemorykiller/parameters/minfree
#ADJ fixes , shoould see awesome increase in multitasking
echo "0,3,6,10,12,15" > /sys/module/lowmemorykiller/parameters/adj
Use this script if you have the hotplugx CPU Governor and the SIO I/O scheduler:
Code:
echo "700000" > /proc/sys/kernel/sched_latency_ns
echo "300000" > /proc/sys/kernel/sched_min_granularity_ns
echo "26188" > /proc/sys/kernel/sched_features
#writes more pages to disc, when given oppurtunity
echo "8" > /proc/sys/vm/page-cluster
#drop all cahces when given oppurtunity
echo "3" > /proc/sys/vm/drop_caches
#Keep 4MB in memory
echo "4096" > /proc/sys/vm/min_free_kbytes
#Dump Vfs cache less
echo "20" > /proc/sys/vm/vfs_cache_pressure
echo "80" > /proc/sys/vm/dirty_background_ratio
#How much dirty data there must be to write to disc
echo "90" > /proc/sys/vm/dirty_ratio
#How often writeback daemons wakeup to write data to disc.
echo "900" > /proc/sys/vm/dirty_writeback_centisecs
#How old 'dirty" data has to be to be written to disc
echo "800" > /proc/sys/vm/dirty_expire_centisecs
#^^^^^^Both expressed in 100th of second^^^^^^
echo "20" > /proc/sys/vm/swappiness
#faster sdcard read speed
echo "2048" > /sys/devices/virtual/bdi/179:0/read_ahead_kb
# file system speedups
mount -o remount,noauto_da_alloc /system /system
mount -o remount,noauto_da_alloc /data /data
mount -o remount,noauto_da_alloc /cache /cache
# disable logcat - performance boost & save memory,comment, reboot for logcat.
rm /dev/log/main
#sets I/O scheduler to SIO, considered best.
echo "sio" > /sys/block/mmcblk0/queue/scheduler
#sets cpu governor to hotplug, is most intelligent
echo "hotplugx" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
echo "950" > /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_transition_latency
#decreases sampling rate, stops lag and saves battery
echo "450000" > /sys/devices/system/cpu/cpufreq/hotplug/sampling_rate
echo "75" > /sys/devices/system/cpu/cpufreq/hotplug/up_threshold
echo "45" > /sys/devices/system/cpu/cpufreq/hotplug/down_threshold
echo "15" > /sys/devices/system/cpu/cpufreq/hotplug/hotplug_out_sampling_periods
echo "5" > /sys/devices/system/cpu/cpufreq/hotplug/hotplug_in_sampling_periods
#better memory mangement
echo "2048,4096,43008,47104,51456,55808" > /sys/module/lowmemorykiller/parameters/minfree
#ADJ fixes , shoould see awesome increase in multitasking
echo "0,3,6,10,12,15" > /sys/module/lowmemorykiller/parameters/adj
Tip 4. Build.prop tweaks
I would say that theses help the most, they can raise a ROMs performance 400 points alone in a benchmark.
Here they are:
Code:
#allows for sound during boot
ro.config.play.bootsound=1
persist.cust.tell.eons=1
#Locks home app in memory.
ro.HOME_APP_ADJ=1
pm.sleep_mode=1
persist.service.swiqi.enable=1
persist.sys.ui.hw=1
#renders UI with GPU
debug.sf.hw=1
debug.performance.tuning=1
#forces hardware acceleration
video.accelerate.hw=1
debug.egl.profiler=1
debug.egl.hw=1
#renders graphics with GPU + CPU
debug.composition.type=gpu
debug.composition.type=cpu
#raises JPEG quality
ro.media.enc.jpeg.quality=100
#raises how much memory can be spent on rendering JPEGs.
ro.media.dec.jpeg.memcap=8000000
ro.media.enc.hprof.vid.bps=8000000
#3g speed tweaks
ro.ril.enable.a52=0
ro.ril.enable.a53=1
ro.ril.enable.sdr=1
ro.ril.enable.dtm=1
ro.ril.enable.gea3=1
ro.ril.disable.fd.plmn.prefix=23402,23410,23411
ro.ril.disable.mcc.filter=1
ro.ril.disable.power.collapse=0
ro.ril.hsdpa.category=14
ro.ril.gprsclass=12
ro.ril.htcmaskw1.bitmask=4294967295
ro.ril.htcmaskw1=268449905
ro.ril.fast.dormancy.rule=0
ro.ril.emc.mode=1
ro.ril.hep=0
ro.ril.hsxpa=2
ro.ril.gprsclass=12
ro.ril.enable.dtm=1
ro.ril.enable.a53=1
ro.ril.enable.3g.prefix=1
#scrolling tweaks
ro.min_pointer_dur=5
ro.max.fling_velocity=12000
ro.min.fling_velocity=8000
#better voice quality in calls
ro.ril.enable.amr.wideband=1
#stops kernel error checking, will speed things up and will fix some application issues.
ro.kernel.android.checkjni=0
ro.kernel.checkjni=0
dalvik.vm.checkjni=false
#uses less RAM but worse performance
dalvik.vm.verify-bytecode=false
#use Dalvik Just In Time Compiler, much faster.
dalvik.vm.execution-mode=int:jit
#dalvik optimizes all classes
dalvik.vm.dexopt-flags=m=v,o=a
dalvik.vm.jmiopts=forcecopy
#increases media performance a lot.
media.stagefright.enable-meta=true
media.stagefright.enable-scan=true
media.stagefright.enable-http=true
media.stagefright.enable-record=false
#higher overall net speeds
net.tcp.buffersize.default=4096,87380,256960,4096,16384,256960
net.tcp.buffersize.wifi=4096,87380,256960,4096,16384,256960
net.tcp.buffersize.umts=4096,87380,256960,4096,16384,256960
net.tcp.buffersize.gprs=4096,87380,256960,4096,16384,256960
net.tcp.buffersize.edge=4096,87380,256960,4096,16384,256960
#ipv4 net tweaks
net.ipv4.tcp_ecn=0
net.ipv4.route.flush=1
net.ipv4.tcp_rfc1337=1
net.ipv4.ip_no_pmtu_disc=0
net.ipv4.tcp_sack=1
net.ipv4.tcp_fack=1
net.ipv4.tcp_window_scaling=1
net.ipv4.tcp_timestamps=1
net.ipv4.tcp_rmem=4096 39000 187000
net.ipv4.tcp_wmem=4096 39000 187000
net.ipv4.tcp_mem=187000 187000 187000
net.ipv4.tcp_no_metrics_save=1
net.ipv4.tcp_moderate_rcvbuf=1
Edit existing lines!
Code:
#instant ring when called
ro.telephony.call_ring.delay=0
#increases FPS to beyond what screen can render, really smooth.
windowsmgr.max_events_per_sec=240
#fixes black screen after call end
mot.proximity.delay=0
Tip 5. Mod your services.jar
The services.jar is where Out Of Memory(OOM) priorities are read. Modding your services.jar is a mandatory part of being fully "Supercharged" in zeppelinrox's Superchager v6 script. Getting the modded services.jar that I will provide gives you the OOM fixes from the script. I recommend that you use the services.jar that I provide, but if you feel like getting your own. Go here if you want to mod your own.
Get the services.jar here.
Note: The services.jar is located in /system/framework
Instructions for replacing your services.jar:
1. Download or get your own services.jar.
2. Navigate to /system/framework using a root file browser.
3. Copy the services.jar into /system/framework.
4. Make sure the permissions are 0644 or rw-r--r--.
5. Reboot and enjoy
And more to come!
If you liked my guide enough, Donate!
Or at least leave me a "Thanks".
<<<<<<<<<<<<<<<<<<<<<<<<
Credit: http://forum.xda-developers.com/showthread.php?t=1599025&highlight=battery+saving+guide
Added Launchers Haptic feedback and Sync.
Sent from my XT912
Instead of Autobrightness I've an toggle from Widgetsoid on my Home Screen. 3 Settings (18 / 25 / 35)
So when I need it, I set in higher but usual I use the 18 %
Isn't that better for battery drain?
Sent from my XT910 using Tapatalk 2
HSD-Pilot said:
Instead of Autobrightness I've an toggle from Widgetsoid on my Home Screen. 3 Settings (18 / 25 / 35)
So when I need it, I set in higher but usual I use the 18 %
Isn't that better for battery drain?
Sent from my XT910 using Tapatalk 2
Click to expand...
Click to collapse
Yes, it would be, no sampling the light every couple of seconds.
Thanks! I'll add this idea to the OP.
Sent from my XT912
All right. It's the same thing with the Data Connection. Especially when I'm @ work, I set it to edge because I didn't need 3G.
Sure, you can let your Razr do almost everything from alone, but everything automated needs CPU / Battery. So toggles are battery's best friends
Sent from my XT910 using Tapatalk 2
HSD-Pilot said:
All right. It's the same thing with the Data Connection. Especially when I'm @ work, I set it to edge because I didn't need 3G.
Sure, you can let your Razr do almost everything from alone, but everything automated needs CPU / Battery. So toggles are battery's best friends
Sent from my XT910 using Tapatalk 2
Click to expand...
Click to collapse
Yeah, I thought about that while making this thread, but since there are only two ROMs that have pull down toggles as of now, Liquid Smooth and Eclipse, for CDMA anyway.
I also thought about 2G, but I don't know a method of of cycling to other than turning off Mobile Data. And you would be surprised, JuiceDefender uses really small amount of battery. It doesn't show up in battery stats, ever.
Sent from my XT912
But with Widgetsoid you can add customized Notification - Toggles in every Rom.
I've used JuiceDefender for an while, but I missed the Email push. So it's gone from my Phone
Sent from my XT910 using Tapatalk 2
HSD-Pilot said:
But with Widgetsoid you can add customized Notification - Toggles in every Rom.
I've used JuiceDefender for an while, but I missed the Email push. So it's gone from my Phone
Sent from my XT910 using Tapatalk 2
Click to expand...
Click to collapse
I'll also add that! You learn new things every day.
Sent from my XT912
If I used all these tips I could nearly bought a low end phone for 1/4 of the price of my razr
maarawoe said:
If I used all these tips I could nearly bought a low end phone for 1/4 of the price of my razr
Click to expand...
Click to collapse
Could you please rephrase that?
Updated with Animations, new script, and Common Sense!
maarawoe said:
If I used all these tips I could nearly bought a low end phone for 1/4 of the price of my razr
Click to expand...
Click to collapse
I disagree. I have used many of these techniques (including turning off data) for a couple of years on various android devices. With the use of notification toggles you can still use it as a smart phone while receiving all the emails you need and maintaining good battery.
Sent from my XT910 using xda premium
Sorry I expressed myself incorrectly (in fact not correctly at all ;-) ) - I wanted to say that its a bit sad that we have to use such workarounds to get a worthy battery juice on the high end and quitew expensive phone..
I didn't wanted to disparage the tips above at all...
maarawoe said:
Sorry I expressed myself incorrectly (in fact not correctly at all ;-) ) - I wanted to say that its a bit sad that we have to use such workarounds to get a worthy battery juice on the high end and quitew expensive phone..
I didn't wanted to disparage the tips above at all...
Click to expand...
Click to collapse
Yes, I would agree, and some of my own tips I don't even use. But they're all there in case somebody needs their phone for some situation to last a little bit longer.
Does anybody know the difference between mot_hotplug and the hotplug governor?
WillKennerley said:
Does anybody know the difference between mot_hotplug and the hotplug governor?
Click to expand...
Click to collapse
Yes, mot_hotplug is just hotplug for Gingerbread. Since I've been on ICS for a while, that's the way I'm speaking. So mot_hotplug and hotplug are the same thing. Just different versions of Android.
Sent from my XT912
OP updated with awesome new tweaks scripts Kernel Modules, freezable apps, and a small performance section.
Excellent tips. I have a couple of questions though. What is the difference between Hotplug and HotplugX? Maybe we could put together a list of apps that are battery thirsty and their more effective alternatives.
Good work!
g_mosh said:
Excellent tips. I have a couple of questions though. What is the difference between Hotplug and HotplugX? Maybe we could put together a list of apps that are battery thirsty and their more effective alternatives.
Good work!
Click to expand...
Click to collapse
Thank you.
For clarification, when there is less CPU load, instead it taking 1 second to turn off CPU 1 it takes .5 seconds. When CPU 1 is needed it is turned on faster. Hotplugx does not just have different values of up threshold and down threshold, it actually has optimized code to turn the cores off and on faster. Those are hypothetical values, but you get the point.
Good idea! I added some that I know of, but I don't exactly go crazy with installing apps, so if anybody can give some help here, it's very welcome.
Updated with new battery sucking apps and links, more build.prop tweaks and clarified hotplugx.

How to get better performance in games (root required)

I just wanted to share a few tricks i learned to get graphics-intensive games to run much more smoothly. These commands should be run in android terminal emulator as root, in adb shell as root, or ran as a script with any script-running app with root privileges
All of the following is only temporary and will be reset to normal after a reboot
Code:
stop mpdecision
stops the hotplugging binary used to turn on/off extra cpus we want this gone because we want to specify which cpus are online ourselves
Code:
echo 1 > /sys/devices/system/cpu/cpu1/online
echo 1 > /sys/devices/system/cpu/cpu2/online
echo 1 > /sys/devices/system/cpu/cpu3/online
turns on the other cpu cores (you probably don't need all 3 extra cores on, just turning cpu1 online makes a big difference)
Code:
echo performance > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
sets all online cpus to maximum frequency
Code:
echo performance > /sys/devices/platform/kgsl-3d0.0/kgsl/kgsl-3d0/pwrscale/trustzone/governor
sets the gpu to stay at maximum frequency
as a script:
Code:
#!/system/bin/sh
stop mpdecision
echo 1 > /sys/devices/system/cpu/cpu1/online
echo 1 > /sys/devices/system/cpu/cpu2/online
echo 1 > /sys/devices/system/cpu/cpu3/online
echo performance > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
echo performance > /sys/devices/platform/kgsl-3d0.0/kgsl/kgsl-3d0/pwrscale/trustzone/governor
would this help improve general smoothness across the ui and other apps? Does it reduce the choppiness in the maps app????
It would, but i'm not sure how long the battery would last.
Faux kernel with Faux Clock you can do all this! It is great!
Jeepers. Seems the device gets hot enough without doing this, but what makes the user happy.
rushless said:
Jeepers. Seems the device gets hot enough without doing this, but what makes the user happy.
Click to expand...
Click to collapse
havent noticed mine get that hot at all?
Perhaps subjective to the user. Playing 3d games gets the device hot and OC ing will get it hotter. If the user does not mind, that is what matters.
may add this to the roms/ guides / etc list
bsimpson1 said:
as a script:
Code:
#!/system/bin/sh
stop mpdecision
echo 1 > /sys/devices/system/cpu/cpu1/online
echo 1 > /sys/devices/system/cpu/cpu2/online
echo 1 > /sys/devices/system/cpu/cpu3/online
echo performance > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
echo performance > /sys/devices/platform/kgsl-3d0.0/kgsl/kgsl-3d0/pwrscale/trustzone/governor
Click to expand...
Click to collapse
You might also want a script for when you're done with gaming. Probably something like:
Code:
#!/system/bin/sh
start mpdecision
echo ondemand > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
echo ondemand > /sys/devices/platform/kgsl-3d0.0/kgsl/kgsl-3d0/pwrscale/trustzone/governor
This way once you're done with gaming/whatever, the phone can go back to scaling down CPU speeds and hotplugging cores to save battery. It's not very useful for an idle phone to have all 4 cores active and running at full speed.
What if I just reboot the phone, would that stop the script(s)? Anyone try the S4 with PSP emulator (PPSSPP)?
IamPro said:
What if I just reboot the phone, would that stop the script(s)? Anyone try the S4 with PSP emulator (PPSSPP)?
Click to expand...
Click to collapse
Rebooting would restart mpdecision, and therefore let your hotplugging go back to working order. I'm not certain it would reset your governor, though. So your phone may still be running at full speed 24/7, even after a reboot.
Cilraaz said:
You might also want a script for when you're done with gaming. Probably something like:
Code:
#!/system/bin/sh
start mpdecision
echo ondemand > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
echo ondemand > /sys/devices/platform/kgsl-3d0.0/kgsl/kgsl-3d0/pwrscale/trustzone/governor
This way once you're done with gaming/whatever, the phone can go back to scaling down CPU speeds and hotplugging cores to save battery. It's not very useful for an idle phone to have all 4 cores active and running at full speed.
Click to expand...
Click to collapse
I don't think start mpdecision will do what you're intending but according to cat "/proc/`pgrep mpdecision`/cmdline" it was started by "mpdecision --nosleep --avg_comp"

Persistently Setting CPU Frequency

Persistently setting cpu frequency
I can't seem to set the cpu frequency. I've tried a number of utilities (e.g. cpufreqd / cpufrequtils), as well as just manually editing the cpu frequency using commands like:
Code:
echo performance | sudo tee /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq | sudo tee /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
Doing this works for a short time, but as soon as I do any cpu-intensive work, the file /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq seems to be overwritten.
This doesn't happen if I boot into android, and use an app like SetCPU, and then do the same amount of cpu work.

[MAGISK][MOD]--Pixel4a-CpuTweak--V2

Pixel4a-CpuTweak--V2​
Short story : I do from time to time some monitoring on my phones(Using Francokernel app). Watching cpu freq, battery amp, etc. Since Android12 on my Pixel4a i noticed the cpu was almost always high for no serious reason compared to Android11. So i made a little script that use magisk to run as root and on boot to change some kernel parameters to make cpu way more batery friendly. It just let the little cores goes as low as they can and use the big cores for heavy task.
If you noticed a bad Screen On Time since Android12 then this module is for you.
This magisk module will make your cpu consume less power.
-Little cores can now go down to their lowest frequency
-Big cores are used for heavy task
Download attached below​
Spoiler: CHANGELOG
Code:
--V2
-Fix some tunable being reset by system
-set them after boot complete
-fix some typo
Spoiler: CODE
Code:
[/CENTER]
#!/system/bin/sh
MODDIR=${0%/*}
# # # WAIT TILL BOOT IS COMPLETE # # #
while true; do BOOT=$(getprop sys.boot_completed); if [ "$BOOT" -eq "1" ]; then sleep 3; break; else sleep 9; fi; done
# # # KERNEL SCHED # # #
echo '0' > /proc/sys/kernel/sched_schedstats; chmod 0444 /proc/sys/kernel/sched_schedstats
echo '1' > /proc/sys/kernel/sched_tunable_scaling; chmod 0444 /proc/sys/kernel/sched_tunable_scaling
# # # SCHEDUTIL FREQ # # #
echo '1248000' > /sys/devices/system/cpu/cpufreq/policy0/schedutil/hispeed_freq; chmod 0444 /sys/devices/system/cpu/cpufreq/policy0/schedutil/hispeed_freq
echo '1555200' > /sys/devices/system/cpu/cpufreq/policy6/schedutil/hispeed_freq; chmod 0444 /sys/devices/system/cpu/cpufreq/policy6/schedutil/hispeed_freq
# # # SCHEDTUNE # # #
#general
echo '0' > /dev/stune/schedtune.boost; chmod 0444 /dev/stune/schedtune.boost
echo '0' > /dev/stune/schedtune.prefer_high_cap; chmod 0444 /dev/stune/schedtune.prefer_high_cap
echo '1' > /dev/stune/schedtune.prefer_idle; chmod 0444 /dev/stune/schedtune.prefer_idle
echo '0-7' > /dev/cpuset/cpus; chmod 0444 /dev/cpuset/cpus
#background
echo '0' > /dev/stune/background/schedtune.boost; chmod 0444 /dev/stune/background/schedtune.boost
echo '0' > /dev/stune/background/schedtune.prefer_high_cap; chmod 0444 /dev/stune/background/schedtune.prefer_high_cap
echo '1' > /dev/stune/background/schedtune.prefer_idle; chmod 0444 /dev/stune/background/schedtune.prefer_idle
echo '0-5,7' > /dev/cpuset/background/cpus; chmod 0444 /dev/cpuset/background/cpus
#foreground
echo '0' > /dev/stune/foreground/schedtune.boost; chmod 0444 /dev/stune/foreground/schedtune.boost
echo '0' > /dev/stune/foreground/schedtune.prefer_high_cap; chmod 0444 /dev/stune/foreground/schedtune.prefer_high_cap
echo '1' > /dev/stune/foreground/schedtune.prefer_idle; chmod 0444 /dev/stune/foreground/schedtune.prefer_idle
echo '0-5,7' > /dev/cpuset/foreground/cpus; chmod 0444 /dev/cpuset/foreground/cpus
#top-app
echo '0' > /dev/stune/top-app/schedtune.boost; chmod 0444 /dev/stune/top-app/schedtune.boost
echo '0' > /dev/stune/top-app/schedtune.prefer_high_cap; chmod 0444 /dev/stune/top-app/schedtune.prefer_high_cap
echo '1' > /dev/stune/top-app/schedtune.prefer_idle; chmod 0444 /dev/stune/top-app/schedtune.prefer_idle
echo '0-5,7' > /dev/cpuset/top-app/cpus; chmod 0444 /dev/cpuset/top-app/cpus
#camera-daemon
echo '0' > /dev/stune/camera-daemon/schedtune.boost; chmod 0444 /dev/stune/camera-daemon/schedtune.boost
echo '0' > /dev/stune/camera-daemon/schedtune.prefer_high_cap; chmod 0444 /dev/stune/camera-daemon/schedtune.prefer_high_cap
echo '1' > /dev/stune/camera-daemon/schedtune.prefer_idle; chmod 0444 /dev/stune/camera-daemon/schedtune.prefer_idle
echo '0-5,7' > /dev/cpuset/camera-daemon/cpus; chmod 0444 /dev/cpuset/camera-daemon/cpus
#nnapi-hal
echo '0' > /dev/stune/nnapi-hal/schedtune.boost; chmod 0444 /dev/stune/nnapi-hal/schedtune.boost
echo '0' > /dev/stune/nnapi-hal/schedtune.prefer_high_cap; chmod 0444 /dev/stune/nnapi-hal/schedtune.prefer_high_cap
echo '1' > /dev/stune/nnapi-hal/schedtune.prefer_idle; chmod 0444 /dev/stune/nnapi-hal/schedtune.prefer_idle
#rt
echo '0' > /dev/stune/rt/schedtune.boost; chmod 0444 /dev/stune/rt/schedtune.boost
echo '0' > /dev/stune/rt/schedtune.prefer_high_cap; chmod 0444 /dev/stune/rt/schedtune.prefer_high_cap
echo '1' > /dev/stune/rt/schedtune.prefer_idle; chmod 0444 /dev/stune/rt/schedtune.prefer_idle
#restricted
echo '0-2,5' > /dev/cpuset/restricted/cpus; chmod 0444 /dev/cpuset/restricted/cpus
#system background
echo '0-2,5' > /dev/cpuset/system-background/cpus; chmod 0444 /dev/cpuset/system-background/cpus
I cannot speak for battery life but my phone feels significantly less responsive after installing the mod. Otherwise great idea, just doesn't work for my workflow.
Tom 23 said:
I cannot speak for battery life but my phone feels significantly less responsive after installing the mod. Otherwise great idea, just doesn't work for my workflow.
Click to expand...
Click to collapse
Thanks for the feedback. I've updated the module if you wanna try again. There was some typo that could make the phone less responsive. Now it will work as intended.
Dead-neM said:
Short story : I do from time to time some monitoring on my phones(Using Francokernel app). Watching cpu freq, battery amp, etc. Since Android12 on my Pixel4a i noticed the cpu was almost always high for no serious reason compared to Android11. So i made a little script that use magisk to run as root and on boot to change some kernel parameters to make cpu way more batery friendly. It just let the little cores goes as low as they can and use the big cores for heavy task.[/SIZE]
...snip...
Click to expand...
Click to collapse
COuld it be thyat by checking your phones current CPU useage, you are actually using ypour phone, and so the governor is ramping up your CPU clock to ensure the phone is reacting or ready to react? Have you compared your changes to switching to the conservative governor? (I am guessing this gov is available on the phone).
DiamondJohn said:
COuld it be thyat by checking your phones current CPU useage, you are actually using ypour phone, and so the governor is ramping up your CPU clock to ensure the phone is reacting or ready to react? Have you compared your changes to switching to the conservative governor? (I am guessing this gov is available on the phone).
Click to expand...
Click to collapse
There's no conservative governor in stock kernel. Schedutil is good and many little component rely on it (at least on stock rom)
Yes checking your cpu usage use cpu but you see how much and its so little that it doesn't ramp up cpu.
Android like Linux have the "top" terminal cmd which display the current process in use. More or less like task manager windows have.
Dead-neM said:
There's no conservative governor in stock kernel. Schedutil is good and many little component rely on it (at least on stock rom)
Yes checking your cpu usage use cpu but you see how much and its so little that it doesn't ramp up cpu.
Android like Linux have the "top" terminal cmd which display the current process in use. More or less like task manager windows have.
Click to expand...
Click to collapse
You are right, there is no "Conservative" gov. its not called "Conservative" but there is one called "Powersave"; which is the conservative gov, just named differently to what has been on my previous devices.
I took a moment to have a play, and set all the CPU's to the powersave gov, and found (surprisingly) if I set the smaller govs to powersave, then I notice big lags. Especially in the "tripple-tap-to-zoom" and then dragging about was completely unuseable. Leaving the small CPU's on schedutil and the big ones on powersave, I cant really say I noticed the lag. .But, since I dont have battery problems (i use an aggressive doze profile, and keep running apps under control, ie out of top -n 1;), I switched back to the standard gov.
One other little surprise is that I switched my IO scheduler to "noop" and although it *may* of possibly felt a tiny bit little more responsive, testing long running scripts, heavy in IO, actually ran slower.
Long story short, the powersave gov on the smaller cpu's induces lag. I did not check if the gov on the bugger CPU's saves much power.

Categories

Resources