android_device_htc_click/custom/handle_compcache
Arne Coucheron 8767919981 click: Use custom script to handle compcache
There's no zram support in kernel 2.6.29, and after the system-wide
script got changed to handle zram, it broke handling of compcache,
resulting in allocating way too much memory for swap.

Change-Id: Iaf36c96cb1a7207ff5887ed784b99ae5b31bb9f0
2011-02-24 06:03:54 +01:00

32 lines
644 B
Bash

#!/system/bin/sh
#
# Compcache handler
# Decides whether or not Compcache is enabled
#
MEMTOTAL=$( awk '{ if ($1 eq "MemTotal:") print $2 ;exit }' </proc/meminfo )
if [ `getprop persist.service.compcache` == 1 ];
then
PROP=`getprop ro.compcache.default`
setprop persist.service.compcache $PROP
fi
if [ -e /data/property/persist.service.compcache ];
then
PROP=`getprop persist.service.compcache`
else
PROP=`getprop ro.compcache.default`
setprop persist.service.compcache $PROP
fi
if [ $PROP != 0 ]
then
CCSIZE=$(($(($MEMTOTAL * $PROP)) / 100))
`dirname $0`/compcache start $CCSIZE
else
`dirname $0`/compcache stop
fi
exit 0