[Verizon Droid Charge] dSlice:
*****************************************************************************************************************

OK! Listen up! A little disclaimer before we begin...

*****************************************************************************************************************​

Now that, that is done and over with let's begin, shall we?

I have scoured the vast online community, that is the great XDA and have researched and tested various scripts(init.d) and tweaks(build.prop and gps.conf) to help our greatly handicapped Droid Charge somewhat "compete" with the big boys.

Dwitherell has kindly uploaded them to Tweaktools.

You may ask init.d? But we have a stock kernel that doesn't support init.d... Thanks to this post and Dwitherell's genius we have working init.d baked right into our ROM, yes that's right baked in!

P.S. - We now have a custom kernel that is able to use init.d tweaks without any hacks... Lazarus Recharged Kernel

RENICE Tutorial

Renice operates on the principal that the lower the value of the process (the scale is from -20 to +19), the higher the priority the process has on CPU time. In other words, a process that is nice to others, is +19. One that isn’t so nice is at -20. In function then, a process that requires lots of immediate CPU time such as a launcher, benefits from running at a higher priority (thus as a negative on the niceness scale) than, say, Google Maps.

Anywho, here is a run down of each of the modifications...

init.d

S2dSliceTweaks

[ Updated 1.4.13 ]

[B][COLOR="Red"]Various tweaks that will be known as [COLOR="black"]S2dSliceTweaks[/COLOR][/COLOR][/B]

#!/system/bin/sh

###################################
# Various tweaks found from XDA #
# - dSlice - #
###################################

# Strict Minfree Handler Tweak
####################################

echo "2048,3072,6144,15360,17920,20480" > /sys/module/lowmemorykiller/parameters/minfree

# Internet Speed Tweaks
#############################

echo "0" > /proc/sys/net/ipv4/tcp_timestamps;
echo "1" > /proc/sys/net/ipv4/tcp_tw_reuse;
echo "1" > /proc/sys/net/ipv4/tcp_sack;
echo "1" > /proc/sys/net/ipv4/tcp_dsack;
echo "1" > /proc/sys/net/ipv4/tcp_tw_recycle;
echo "1" > /proc/sys/net/ipv4/tcp_window_scaling;
echo "5" > /proc/sys/net/ipv4/tcp_keepalive_probes;
echo "30" > /proc/sys/net/ipv4/tcp_keepalive_intvl;
echo "30" > /proc/sys/net/ipv4/tcp_fin_timeout;
echo "1" > /proc/sys/net/ipv4/tcp_moderate_rcvbuf;
echo "1" > /proc/sys/net/ipv4/route/flush;
echo "6144" > /proc/sys/net/ipv4/udp_rmem_min;
echo "6144" > /proc/sys/net/ipv4/udp_wmem_min;
echo "1" > /proc/sys/net/ipv4/tcp_rfc1337;
echo "0" > /proc/sys/net/ipv4/ip_no_pmtu_disc;
echo "0" > /proc/sys/net/ipv4/tcp_ecn;
echo "6144 87380 2097152" > /proc/sys/net/ipv4/tcp_wmem;
echo "6144 87380 2097152" > /proc/sys/net/ipv4/tcp_rmem;
echo "1" > /proc/sys/net/ipv4/tcp_fack;
echo "2" > /proc/sys/net/ipv4/tcp_synack_retries;
echo "2" > /proc/sys/net/ipv4/tcp_syn_retries;
echo "1" > /proc/sys/net/ipv4/tcp_no_metrics_save;
echo "1800" > /proc/sys/net/ipv4/tcp_keepalive_time;
echo "0" > /proc/sys/net/ipv4/ip_forward;
echo "0" > /proc/sys/net/ipv4/conf/default/accept_source_route;
echo "0" > /proc/sys/net/ipv4/conf/all/accept_source_route;
echo "0" > /proc/sys/net/ipv4/conf/all/accept_redirects;
echo "0" > /proc/sys/net/ipv4/conf/default/accept_redirects;
echo "0" > /proc/sys/net/ipv4/conf/all/secure_redirects;
echo "0" > /proc/sys/net/ipv4/conf/default/secure_redirects;
echo "0" > /proc/sys/net/ipv4/ip_dynaddr;
echo "1440000" > /proc/sys/net/ipv4/tcp_max_tw_buckets;
echo "57344 57344 524288" > /proc/sys/net/ipv4/tcp_mem;
echo "1440000" > /proc/sys/net/ipv4/tcp_max_tw_buckets;
echo "2097152" > /proc/sys/net/core/rmem_max;
echo "2097152" > /proc/sys/net/core/wmem_max;
echo "262144" > /proc/sys/net/core/rmem_default;
echo "262144" > /proc/sys/net/core/wmem_default;
echo "20480" > /proc/sys/net/core/optmem_max;
echo "2500" > /proc/sys/net/core/netdev_max_backlog;
echo "50" > /proc/sys/net/unix/max_dgram_qlen;

# VM Management Tweaks
############################

echo 3 > /proc/sys/vm/page-cluster;
echo 3000 > /proc/sys/vm/dirty_expire_centisecs;
echo 500 > /proc/sys/vm/dirty_writeback_centisecs;
echo "5120" > /proc/sys/vm/min_free_kbytes;
echo "0" > /proc/sys/vm/oom_kill_allocating_task;
echo "0" > /proc/sys/vm/panic_on_oom;
echo "35" > /proc/sys/vm/dirty_background_ratio;
echo "70" > /proc/sys/vm/dirty_ratio;
echo "10" > /proc/sys/vm/vfs_cache_pressure;
echo "1" > /proc/sys/vm/overcommit_memory;
echo "4" > /proc/sys/vm/min_free_order_shift;
echo "0" > /proc/sys/vm/laptop_mode;
echo "0" > /proc/sys/vm/block_dump;
echo "1" > /proc/sys/vm/oom_dump_tasks;

# Misc Kernel Tweaks
##########################

echo "500,512000,64,2048" > /proc/sys/kernel/sem;
echo "268435456" > /proc/sys/kernel/shmmax;
echo "2097152" > /proc/sys/kernel/shmall;
echo "4096" > /proc/sys/kernel/shmmni;
echo "2048" > /proc/sys/kernel/msgmni;
echo "64000" > /proc/sys/kernel/msgmax;
echo "30" > /proc/sys/kernel/panic;
echo "0" > /proc/sys/kernel/panic_on_oops;
echo "5000" > /proc/sys/kernel/threads-max;
echo "10" > /proc/sys/fs/lease-break-time;
echo "65536" > /proc/sys/fs/file-max;

# Battery Tweaks
######################

echo "500" > /proc/sys/vm/dirty_expire_centisecs
echo "1000" > /proc/sys/vm/dirty_writeback_centisecs

# Removes Journalism
##########################

tune2fs -o journal_data_writeback /block/path/to/system
tune2fs -O ^has_journal /block/path/to/system
tune2fs -o journal_data_writeback /block/path/to/cache
tune2fs -O ^has_journal /block/path/to/cache
tune2fs -o journal_data_writeback /block/path/to/data
tune2fs -O ^has_journal /block/path/to/data

# Perfect Mount Options
#############################

busybox mount -o remount,noatime,noauto_da_alloc,nodiratime,barrier=0,nobh /system
busybox mount -o remount,noatime,noauto_da_alloc,nosuid,nodev,nodiratime,barrier=0,nobh /data
busybox mount -o remount,noatime,noauto_da_alloc,nosuid,nodev,nodiratime,barrier=0,nobh /cache

# Flags Blocks As Non-Rotational And Increases Cache Size
###############################################################

LOOP=`ls -d /sys/block/loop*`;
RAM=`ls -d /sys/block/ram*`;
MMC=`ls -d /sys/block/mmc*`;
for j in $LOOP $RAM
do
echo "0" > $j/queue/rotational;
echo "2048" > $j/queue/read_ahead_kb;
done

# MicroSD Card Speed Tweak
################################

READ_AHEAD_KB="2049"

if [ -e /sys/devices/virtual/bdi/0:18/read_ahead_kb ]; then
echo $READ_AHEAD_KB > /sys/devices/virtual/bdi/0:18/read_ahead_kb
fi

if [ -e /sys/devices/virtual/bdi/179:0/read_ahead_kb ]; then
echo $READ_AHEAD_KB > /sys/devices/virtual/bdi/179:0/read_ahead_kb
fi

if [ -e /sys/devices/virtual/bdi/7:0/read_ahead_kb ]; then
echo $READ_AHEAD_KB > /sys/devices/virtual/bdi/7:0/read_ahead_kb
fi

if [ -e /sys/devices/virtual/bdi/7:1/read_ahead_kb ]; then
echo $READ_AHEAD_KB > /sys/devices/virtual/bdi/7:1/read_ahead_kb
fi

if [ -e /sys/devices/virtual/bdi/7:2/read_ahead_kb ]; then
echo $READ_AHEAD_KB > /sys/devices/virtual/bdi/7:2/read_ahead_kb
fi

if [ -e /sys/devices/virtual/bdi/7:3/read_ahead_kb ]; then
echo $READ_AHEAD_KB > /sys/devices/virtual/bdi/7:3/read_ahead_kb
fi

if [ -e /sys/devices/virtual/bdi/7:4/read_ahead_kb ]; then
echo $READ_AHEAD_KB > /sys/devices/virtual/bdi/7:4/read_ahead_kb
fi

if [ -e /sys/devices/virtual/bdi/7:5/read_ahead_kb ]; then
echo $READ_AHEAD_KB > /sys/devices/virtual/bdi/7:5/read_ahead_kb
fi

if [ -e /sys/devices/virtual/bdi/7:6/read_ahead_kb ]; then
echo $READ_AHEAD_KB > /sys/devices/virtual/bdi/7:6/read_ahead_kb
fi

if [ -e /sys/devices/virtual/bdi/7:7/read_ahead_kb ]; then
echo $READ_AHEAD_KB > /sys/devices/virtual/bdi/7:7/read_ahead_kb
fi

if [ -e /sys/devices/virtual/bdi/default/read_ahead_kb ]; then
echo $READ_AHEAD_KB > /sys/devices/virtual/bdi/default/read_ahead_kb
fi

# Defrags Database Files
##############################

for i in \
`find /data -iname "*.db"`
do \
sqlite3 $i 'VACUUM;';
done

# Remove Logger
#####################

busybox rm /dev/log/main

# Ondemand Governor Tweaks
################################

SAMPLING_RATE=$(busybox expr `cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_transition_latency` \* 750 / 1000)
echo 95 > /sys/devices/system/cpu/cpufreq/ondemand/up_threshold
echo $SAMPLING_RATE > /sys/devices/system/cpu/cpu0/cpufreq/ondemand/sampling_rate

# Auto Change Governor and I/O Scheduler
# I/O Scheduler (Best: MTD devices - VR; EMMC devices - SIO) - needs kernel with these
############################################################################################

echo "cfq" > /sys/block/mmcblk0/queue/scheduler

# Governor
################

echo "SmartAssV2" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor

# Move Dalvik-Cache To Cache Partition (If It's Big Enough) To Free Up Data Partition Space
#################################################################################################

CACHESIZE=$(df -k /cache | tail -n1 | tr -s ' ' | cut -d ' ' -f2)
if [ $CACHESIZE -gt 80000 ]
then
if [ ! -d /cache/dalvik-cache ]
then
busybox rm -rf /cache/dalvik-cache /data/dalvik-cache
mkdir /cache/dalvik-cache /data/dalvik-cache
fi

busybox chown 1000:1000 /cache/dalvik-cache
busybox chmod 0771 /cache/dalvik-cache

# bind mount dalvik-cache so we can still boot without the sdcard
busybox mount -o bind /cache/dalvik-cache /data/dalvik-cache
busybox chown 1000:1000 /data/dalvik-cache
busybox chmod 0771 /data/dalvik-cache
else
fi

# Disable normalize sleeper
#################################

mount -t debugfs none /sys/kernel/debug
echo NO_NORMALIZED_SLEEPER > /sys/kernel/debug/sched_features

# Clear Junk Caches And Junk Data
#######################################

busybox find /data/data -type d -iname "*cache*" -exec busybox rm -f {}/* ';' -exec echo "Cleared {}" ';'
rm -f /data/local/*.apk
rm -f /data/local/tmp/*.apk
rm -f /data/*.log
rm -f /data/log/*.log
rm -f /cache/*.*
rm -f /cache/recovery/*.*
rm -f /data/system/dropbox/*.txt
rm -f /data/backup/pending/*.tmp
rm -f /data/tombstones/*.*

# Disable IO Stats To Reduce Overhead
###########################################

if [ -e $i/queue/iostats ];
then
echo "0" > $i/queue/iostats;
fi;

# SqLite Optimize
#######################

for i in \
`busybox find /data -iname "*.db"`;
do \
/system/xbin/sqlite3 $i 'VACUUM;';
/system/xbin/sqlite3 $i 'REINDEX;';
done;

if [ -d "/dbdata" ]; then
for i in \
`busybox find /dbdata -iname "*.db"`;
do \
/system/xbin/sqlite3 $i 'VACUUM;';
/system/xbin/sqlite3 $i 'REINDEX;';
done;
fi;

if [ -d "/datadata" ]; then
for i in \
`busybox find /datadata -iname "*.db"`;
do \
/system/xbin/sqlite3 $i 'VACUUM;';
/system/xbin/sqlite3 $i 'REINDEX;';
done;
fi;

for i in \
`busybox find /sdcard -iname "*.db"`;
do \
/system/xbin/sqlite3 $i 'VACUUM;';
/system/xbin/sqlite3 $i 'REINDEX;';
done;

# Ram Optimizers, Allows Ram Switching To Gaming And Multitasking
#######################################################################

if [ -e /sys/module/lowmemorykiller/parameters/adj ]; then
echo "0,1,2,4,6,15" > /sys/module/lowmemorykiller/parameters/adj
fi

if [ -e /sys/module/lowmemorykiller/parameters/minfree ]; then
echo "2560,4096,6144,11264,11776,14336" > /sys/module/lowmemorykiller/parameters/minfree
fi

if [ -e /proc/sys/vm/swappiness ]; then
echo "20" > /proc/sys/vm/swappiness
fi

if [ -e /proc/sys/vm/vfs_cache_pressure ]; then
echo "70" > /proc/sys/vm/vfs_cache_pressure
fi

if [ -e /proc/sys/vm/dirty_expire_centisecs ]; then
echo "3000" > /proc/sys/vm/dirty_expire_centisecs
fi

if [ -e /proc/sys/vm/dirty_writeback_centisecs ]; then
echo "500" > /proc/sys/vm/dirty_writeback_centisecs
fi

if [ -e /proc/sys/vm/dirty_ratio ]; then
echo "15" > /proc/sys/vm/dirty_ratio
fi

if [ -e /proc/sys/vm/dirty_background_ratio ]; then
echo "3" > /proc/sys/vm/dirty_background_ratio
fi

# From Darky's Zipalign Tweak
###################################

LOG_FILE=/data/zipalign.log;
ZIPALIGNDB=/data/zipalign.db;

if [ -e $LOG_FILE ]; then
rm $LOG_FILE;
fi;

if [ ! -f $ZIPALIGNDB ]; then
touch $ZIPALIGNDB;
fi;

echo "Starting FV Automatic ZipAlign $( date +"%m-%d-%Y %H:%M:%S" )" | tee -a $LOG_FILE;

for DIR in /system/app /data/app; do
cd $DIR;
for APK in *.apk; do
if [ $APK -ot $ZIPALIGNDB ] && [ $(grep "$DIR/$APK" $ZIPALIGNDB|wc -l) -gt 0 ]; then
echo "Already checked: $DIR/$APK" | tee -a $LOG_FILE;
else
ZIPCHECK=`/system/xbin/zipalign -c -v 4 $APK | grep FAILED | wc -l`;
if [ $ZIPCHECK == "1" ]; then
echo "Now aligning: $DIR/$APK" | tee -a $LOG_FILE;
/system/xbin/zipalign -v -f 4 $APK /data/local/$APK;
busybox mount -o rw,remount /system;
cp -f -p /data/local/$APK $APK;
grep "$DIR/$APK" $ZIPALIGNDB > /dev/null || echo $DIR/$APK >> $ZIPALIGNDB;
else
echo "Already aligned: $DIR/$APK" | tee -a $LOG_FILE;
grep "$DIR/$APK" $ZIPALIGNDB > /dev/null || echo $DIR/$APK >> $ZIPALIGNDB;
fi;
fi;
done;
done;

busybox mount -o ro,remount /system;
touch $ZIPALIGNDB;
echo "Automatic ZipAlign finished at $( date +"%m-%d-%Y %H:%M:%S" )" | tee -a $LOG_FILE;

# Background Process To Optimize Dialer Process
#####################################################

(while [ 1 ];
do
sleep 10;
MAX_PHONE;
done &);

# Remove Lag When Answering Phone Calls
#############################################

MAX_PHONE()
{
pidphone=`pidof com.android.phone`;
if [ $pidphone ]; # Wait for com.android.phone to start;
then
echo -17 > /proc/$pidphone/oom_adj; # exclude com.android.phone from oom-killer;
renice -20 $pidphone; # set highest nice level for com.android.phone;
log -p i -t SSSwitch_v0.8 "*** MAX phone *** set oom_adj(-17) and nice(-20) for com.android.phone";
exit;
else
sleep 5;
MAX_PHONE;
fi;
}

S1dSliceRenice

[ Updated 1.4.13 ]

[B][COLOR="Red"]Rewritten RENICE script that is a new name [COLOR="black"]S1dSliceRenice[/COLOR][/COLOR][/B]

#!/system/bin/sh

##########################################################
# Renice processes at wake a.k.a. Loopy Smoothness Tweak #
##########################################################

for n in 1 2
do

USER_LAUNCHER="com.mobint.hololauncher" # Change this to your launcher app #
USER_INPUT_METHOD="com.nuance.swype.input" #Change this to your keyboard app #

################################## ##################################
# Common Launchers # # Common Keyboards #
# ---------------- # # ---------------- #
# com.sec.android.app.twlauncher # # com.swype.android.inputmethod #
# org.adwfreak.launcher # # com.touchtype.swiftkey #
# org.zeam.core # # com.cootek.smartinputv5 #
# com.gau.go.launcherex # # com.dasur.slideit.vt.lite #
################################## ##################################

###################################################
NUMBER_OF_CHECKS=60 # Total number of rechecks before ending 1st loop #
# ----------------------------------------------- #
SLEEP_TIME=3 # Number of seconds between re-checking processes #
#------------------------------------------------ #
PROCESSES_TOTAL=20 # Must be edited to match the #
# number of processes to be checked #
# ----------------------------------------------- #
DEBUG_ECHO=1 # Debug: ON (1) / OFF (0) #
# ----------------------------------------------- #
CHECK_COUNT=0 # DON'T EDIT!!!! DON'T EDIT!!!! DON'T EDIT!!!! #
# ----------------------------------------------- #
P_CHECK=0 # DON'T EDIT!!!! DON'T EDIT!!!! DON'T EDIT!!!! #
# ----------------------------------------------- #
CHECK_OK=0 # UN-USED ^('_')^ #
###################################################

PROCESS_1=0; PROCESS_2=0; PROCESS_3=0; PROCESS_4=0; PROCESS_5=0; PROCESS_6=0;
PROCESS_7=0; PROCESS_8=0; PROCESS_9=0; PROCESS_10=0; PROCESS_11=0; PROCESS_12=0;
PROCESS_13=0; PROCESS_14=0; PROCESS_15=0; PROCESS_16=0; PROCESS_17=0; PROCESS_18=0;
PROCESS_19=0; PROCESS_20=0; PROCESS_21=0; PROCESS_22=0; PROCESS_23=0; PROCESS_24=0;

if [ $n -eq "1" ]; then
if [ $DEBUG_ECHO -eq "1" ]; then
echo ""
echo "LST Debug: $(date)"
echo "LST Debug: Initiate"
fi;

#######################################################################
# Pause and then loop until kswapd0 is found, which should be instant #
#######################################################################

sleep 1
SWAP_SLEEP_TIME=3; SWAP_NUMBER_OF_CHECKS=30; SWAP_CHECK_COUNT=0; SWAP_CHECK_COUNT_OK=0; while [ $SWAP_CHECK_COUNT -lt $SWAP_NUMBER_OF_CHECKS ]; do if [ `pidof kswapd0` ]; then renice 19 `pidof kswapd0`; SWAP_CHECK_COUNT=$SWAP_NUMBER_OF_CHECKS; SWAP_CHECK_COUNT_OK=1; else sleep $SWAP_SLEEP_TIME; fi; SWAP_CHECK_COUNT=`expr $SWAP_CHECK_COUNT + 1`; done; if [ $SWAP_CHECK_COUNT_OK -lt 1 ]; then echo "LST Debug: 'kswapd0' expired after `expr $SWAP_CHECK_COUNT \* $SWAP_SLEEP_TIME` seconds"; fi;

if [ $DEBUG_ECHO -eq "1" ]; then
echo "LST Debug: $(date)";
echo "LST Debug: kswapd0 found";
fi;
fi;

###############################
# Check briefly one more time #
###############################

if [ $n -eq "2" ]; then
if [ $DEBUG_ECHO -eq "1" ]; then
echo "LST Debug: 2nd loop"
fi; ##################
NUMBER_OF_CHECKS=6 # DON'T EDIT!!!! #
SLEEP_TIME=5 # DON'T EDIT!!!! #
fi; ##################

while [ $CHECK_COUNT -lt $NUMBER_OF_CHECKS ];
do

########################
# Resident system apps #
# -------------------- #
# (No Need To Edit) #
########################

if [ $PROCESS_1 -eq "0" ]; then PNAME="com.android.phone"; NICELEVEL=-20; if [ `pidof $PNAME` ]; then renice $NICELEVEL `pidof $PNAME`; PROCESS_1=1; P_CHECK=`expr $P_CHECK + 1`; fi; fi;
if [ $PROCESS_2 -eq "0" ]; then PNAME="com.android.systemui"; NICELEVEL=-18; if [ `pidof $PNAME` ]; then renice $NICELEVEL `pidof $PNAME`; PROCESS_2=1; P_CHECK=`expr $P_CHECK + 1`; fi; fi;
if [ $PROCESS_3 -eq "0" ]; then PNAME="com.android.settings"; NICELEVEL=-18; if [ `pidof $PNAME` ]; then renice $NICELEVEL `pidof $PNAME`; PROCESS_3=1; P_CHECK=`expr $P_CHECK + 1`; fi; fi;
if [ $PROCESS_4 -eq "0" ]; then PNAME="$USER_INPUT_METHOD"; NICELEVEL=-18; if [ `pidof $PNAME` ]; then renice $NICELEVEL `pidof $PNAME`; PROCESS_4=1; P_CHECK=`expr $P_CHECK + 1`; fi; fi;
if [ $PROCESS_5 -eq "0" ]; then PNAME="$USER_LAUNCHER"; NICELEVEL=-18; if [ `pidof $PNAME` ]; then renice $NICELEVEL `pidof $PNAME`; PROCESS_5=1; P_CHECK=`expr $P_CHECK + 1`; fi; fi;
if [ $PROCESS_6 -eq "0" ]; then PNAME="com.android.vending"; NICELEVEL=-18; if [ `pidof $PNAME` ]; then renice $NICELEVEL `pidof $PNAME`; PROCESS_6=1; P_CHECK=`expr $P_CHECK + 1`; fi; fi;
if [ $PROCESS_7 -eq "0" ]; then PNAME="com.android.mms"; NICELEVEL=-19; if [ `pidof $PNAME` ]; then renice $NICELEVEL `pidof $PNAME`; PROCESS_7=1; P_CHECK=`expr $P_CHECK + 1`; fi; fi;
if [ $PROCESS_8 -eq "0" ]; then PNAME="android.process.acore"; NICELEVEL=-3; if [ `pidof $PNAME` ]; then renice $NICELEVEL `pidof $PNAME`; PROCESS_8=1; P_CHECK=`expr $P_CHECK + 1`; fi; fi;
if [ $PROCESS_9 -eq "0" ]; then PNAME="android.process.media"; NICELEVEL=-3; if [ `pidof $PNAME` ]; then renice $NICELEVEL `pidof $PNAME`; PROCESS_9=1; P_CHECK=`expr $P_CHECK + 1`; fi; fi;

#####################
# Other system apps #
#####################

if [ $PROCESS_10 -eq "0" ]; then PNAME="com.sec.android.app.dialertab"; NICELEVEL=-19; if [ `pidof $PNAME` ]; then renice $NICELEVEL `pidof $PNAME`; PROCESS_10=1; P_CHECK=`expr $P_CHECK + 1`; fi; fi;
if [ $PROCESS_11 -eq "0" ]; then PNAME="com.sec.android.app.samsungapps"; NICELEVEL=-19; if [ `pidof $PNAME` ]; then renice $NICELEVEL `pidof $PNAME`; PROCESS_11=1; P_CHECK=`expr $P_CHECK + 1`; fi; fi;
if [ $PROCESS_12 -eq "0" ]; then PNAME="com.sec.android.app.controlpanel"; NICELEVEL=-18; if [ `pidof $PNAME` ]; then renice $NICELEVEL `pidof $PNAME`; PROCESS_12=1; P_CHECK=`expr $P_CHECK + 1`; fi; fi;
if [ $PROCESS_13 -eq "0" ]; then PNAME="com.sec.android.app.camera"; NICELEVEL=-6; if [ `pidof $PNAME` ]; then renice $NICELEVEL `pidof $PNAME`; PROCESS_13=1; P_CHECK=`expr $P_CHECK + 1`; fi; fi;

##############
# Other apps #
##############

if [ $PROCESS_14 -eq "0" ]; then PNAME="com.android.tsm_parts"; NICELEVEL=-15; if [ `pidof $PNAME` ]; then renice $NICELEVEL `pidof $PNAME`; PROCESS_14=1; P_CHECK=`expr $P_CHECK + 1`; fi; fi;
if [ $PROCESS_15 -eq "0" ]; then PNAME="os.tools.scriptmanager"; NICELEVEL=-15; if [ `pidof $PNAME` ]; then renice $NICELEVEL `pidof $PNAME`; PROCESS_15=1; P_CHECK=`expr $P_CHECK + 1`; fi; fi;
if [ $PROCESS_16 -eq "0" ]; then PNAME="com.mobint.locker"; NICELEVEL=-15; if [ `pidof $PNAME` ]; then renice $NICELEVEL `pidof $PNAME`; PROCESS_16=1; P_CHECK=`expr $P_CHECK + 1`; fi; fi;
if [ $PROCESS_17 -eq "0" ]; then PNAME="com.android.browser"; NICELEVEL=-9; if [ `pidof $PNAME` ]; then renice $NICELEVEL `pidof $PNAME`; PROCESS_17=1; P_CHECK=`expr $P_CHECK + 1`; fi; fi;
if [ $PROCESS_18 -eq "0" ]; then PNAME="com.google.android.youtube"; NICELEVEL=-6; if [ `pidof $PNAME` ]; then renice $NICELEVEL `pidof $PNAME`; PROCESS_18=1; P_CHECK=`expr $P_CHECK + 1`; fi; fi;
if [ $PROCESS_19 -eq "0" ]; then PNAME="com.google.android.apps.maps"; NICELEVEL=-6; if [ `pidof $PNAME` ]; then renice $NICELEVEL `pidof $PNAME`; PROCESS_19=1; P_CHECK=`expr $P_CHECK + 1`; fi; fi;
if [ $PROCESS_20 -eq "0" ]; then PNAME="pidof kondemand/0"; NICELEVEL=19; if [ `pidof $PNAME` ]; then renice $NICELEVEL `pidof $PNAME`; PROCESS_20=1; P_CHECK=`expr $P_CHECK + 1`; fi; fi;

####################################################
# If all processes are done, loop can finish early #
####################################################

if [ $P_CHECK -ge $PROCESSES_TOTAL ]; then CHECK_COUNT=$NUMBER_OF_CHECKS; else sleep $SLEEP_TIME; fi;

CHECK_COUNT=`expr $CHECK_COUNT + 1`;
done

if [ $DEBUG_ECHO -eq "1" ]; then
echo "LST Debug: $(date)"
if [ $PROCESS_1 -eq "0" ]; then echo "LST Debug: PROCESS_1 expired after `expr $CHECK_COUNT \* $SLEEP_TIME` seconds"; fi;
if [ $PROCESS_2 -eq "0" ]; then echo "LST Debug: PROCESS_2 expired after `expr $CHECK_COUNT \* $SLEEP_TIME` seconds"; fi;
if [ $PROCESS_3 -eq "0" ]; then echo "LST Debug: PROCESS_3 expired after `expr $CHECK_COUNT \* $SLEEP_TIME` seconds"; fi;
if [ $PROCESS_4 -eq "0" ]; then echo "LST Debug: PROCESS_4 expired after `expr $CHECK_COUNT \* $SLEEP_TIME` seconds"; fi;
if [ $PROCESS_5 -eq "0" ]; then echo "LST Debug: PROCESS_5 expired after `expr $CHECK_COUNT \* $SLEEP_TIME` seconds"; fi;
if [ $PROCESS_6 -eq "0" ]; then echo "LST Debug: PROCESS_6 expired after `expr $CHECK_COUNT \* $SLEEP_TIME` seconds"; fi;
if [ $PROCESS_7 -eq "0" ]; then echo "LST Debug: PROCESS_7 expired after `expr $CHECK_COUNT \* $SLEEP_TIME` seconds"; fi;
if [ $PROCESS_8 -eq "0" ]; then echo "LST Debug: PROCESS_8 expired after `expr $CHECK_COUNT \* $SLEEP_TIME` seconds"; fi;
if [ $PROCESS_9 -eq "0" ]; then echo "LST Debug: PROCESS_9 expired after `expr $CHECK_COUNT \* $SLEEP_TIME` seconds"; fi;
if [ $PROCESS_10 -eq "0" ]; then echo "LST Debug: PROCESS_10 expired after `expr $CHECK_COUNT \* $SLEEP_TIME` seconds"; fi;
if [ $PROCESS_11 -eq "0" ]; then echo "LST Debug: PROCESS_11 expired after `expr $CHECK_COUNT \* $SLEEP_TIME` seconds"; fi;
if [ $PROCESS_12 -eq "0" ]; then echo "LST Debug: PROCESS_12 expired after `expr $CHECK_COUNT \* $SLEEP_TIME` seconds"; fi;
if [ $PROCESS_13 -eq "0" ]; then echo "LST Debug: PROCESS_13 expired after `expr $CHECK_COUNT \* $SLEEP_TIME` seconds"; fi;
if [ $PROCESS_14 -eq "0" ]; then echo "LST Debug: PROCESS_14 expired after `expr $CHECK_COUNT \* $SLEEP_TIME` seconds"; fi;
if [ $PROCESS_15 -eq "0" ]; then echo "LST Debug: PROCESS_15 expired after `expr $CHECK_COUNT \* $SLEEP_TIME` seconds"; fi;
if [ $PROCESS_16 -eq "0" ]; then echo "LST Debug: PROCESS_16 expired after `expr $CHECK_COUNT \* $SLEEP_TIME` seconds"; fi;
if [ $PROCESS_17 -eq "0" ]; then echo "LST Debug: PROCESS_17 expired after `expr $CHECK_COUNT \* $SLEEP_TIME` seconds"; fi;
if [ $PROCESS_18 -eq "0" ]; then echo "LST Debug: PROCESS_18 expired after `expr $CHECK_COUNT \* $SLEEP_TIME` seconds"; fi;
if [ $PROCESS_19 -eq "0" ]; then echo "LST Debug: PROCESS_19 expired after `expr $CHECK_COUNT \* $SLEEP_TIME` seconds"; fi;
if [ $PROCESS_20 -eq "0" ]; then echo "LST Debug: PROCESS_20 expired after `expr $CHECK_COUNT \* $SLEEP_TIME` seconds"; fi;

echo "LST Debug: Checking complete"
fi;

done

if [ $DEBUG_ECHO -eq "1" ]; then
echo "LST Debug: Done"
echo ""
fi;