summaryrefslogtreecommitdiffstats
path: root/prebuilt/common/bin/handle_compcache
blob: 00b97d6899d5806fa00a0f4f6a288ed98df20258 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/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 * 1024))
  `dirname $0`/compcache start $CCSIZE
else
  `dirname $0`/compcache stop
fi

exit 0