update-binary: Selectively remove Google's SuW

* This is done based on the total memory as reported by /proc/meminfo
* If the memory in the MemTotal field is less than 1572864 kB (1.5 GB),
  then Google's SuW is removed as a precaution, as it is known to crash
  on devices that don't have much memory available to use
* Thanks to cdesai for the solution idea

Change-Id: If0d5b9dff7f9536f78d4069df8665b19209fea52
Signed-off-by: Paul Keith <javelinanddart@bestas.gr>
This commit is contained in:
Paul Keith 2017-05-05 15:03:18 -05:00
parent e6b11e3fe7
commit 2caf62a12b

View File

@ -53,10 +53,17 @@ if [ -d /system/lib64 ]; then
LD_PATH=/system/lib64
fi
LOWMEM=1572864
MEM=`cat /proc/meminfo | head -1 | sed 's/[^0-9]*//g'`
ui_print "Extracting files"
cd /tmp
unzip -o "$ZIP" system/*
cd system
if [ "$MEM" -lt "$LOWMEM" ]; then
ui_print "Low RAM device detected, removing Google SuW"
exec_util "rm -rf priv-app/SetupWizard"
fi
ui_print "Generating addon.d file"
cat addon.d/addond_head > addon.d/30-gapps.sh
for f in `exec_util "find . -type f"`; do