replicant-vendor_replicant/prebuilt/common/bin/handle_compcache
Wes Garner 2f1711de17 CMParts: Allow CompCache size to be set by user - via % of total RAM
Use % instead of a set size - per suggestion from Cyanogen
Fix to integer instead of decimal being passed around - props to Nameless
Handle older versions changing enabled CC to Default CC size (25%)
Enable PerformanceSettings dialog to view new CC setup
Final cleanup and fix default values / bash arithmetic

Change-Id: Ie7525cfa1f8829bb037961a66620ab8664f39cec

German translation - Matthias Büchner
French translation - Sébastien Vaucher
2010-10-17 02:19:02 -04:00

32 lines
644 B
Bash
Executable File

#!/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