platform_vendor_tequila/prebuilt/common/bin/handle_compcache
Andrew Sutherland 258d2a7b58 handle_compcache: update props to match MemoryManagement in settings
Change-Id: I74ebcb03d5e096b8e9c71672a23b1c5a70eaef37
2012-02-22 14:55:53 -06:00

31 lines
609 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.zram` == 1 ];
then
PROP=`getprop ro.zram.default`
setprop persist.service.zram $PROP
fi
if [ -e /data/property/persist.service.zram ];
then
PROP=`getprop persist.service.zram`
else
PROP=`getprop ro.zram.default`
setprop persist.service.zram $PROP
fi
if [ $PROP != 0 ]
then
CCSIZE=$(($(($MEMTOTAL * $PROP)) / 100))
`dirname $0`/compcache start $CCSIZE
else
`dirname $0`/compcache stop
fi
exit 0