2010-08-17 17:39:15 +00:00
|
|
|
#!/system/bin/sh
|
|
|
|
#
|
|
|
|
# Compcache handler
|
|
|
|
# Decides whether or not Compcache is enabled
|
|
|
|
#
|
2010-08-31 23:04:01 +00:00
|
|
|
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
|
2010-08-17 17:39:15 +00:00
|
|
|
|
2010-08-20 17:42:40 +00:00
|
|
|
if [ -e /data/property/persist.service.compcache ];
|
|
|
|
then
|
|
|
|
PROP=`getprop persist.service.compcache`
|
|
|
|
else
|
|
|
|
PROP=`getprop ro.compcache.default`
|
2010-08-20 18:13:13 +00:00
|
|
|
setprop persist.service.compcache $PROP
|
2010-08-20 17:42:40 +00:00
|
|
|
fi
|
2010-08-17 17:39:15 +00:00
|
|
|
|
2010-08-31 23:04:01 +00:00
|
|
|
if [ $PROP != 0 ]
|
2010-08-17 17:39:15 +00:00
|
|
|
then
|
2011-02-16 08:50:57 +00:00
|
|
|
CCSIZE=$(($(($MEMTOTAL * $PROP)) / 100 * 1024))
|
2010-08-31 23:04:01 +00:00
|
|
|
`dirname $0`/compcache start $CCSIZE
|
2010-08-17 17:39:15 +00:00
|
|
|
else
|
|
|
|
`dirname $0`/compcache stop
|
|
|
|
fi
|
|
|
|
|
|
|
|
exit 0
|
|
|
|
|