Add New Squisher/Opticharger for Lollipop (2/2)
* From AOSPA-legacy/android_vendor_pa@f07d19e23a45216a86a7ef1273e27cce880d5959 and AOSPA-legacy/android_vendor_pa@1d56c3fc1f92b52bf6388e1322041f0324f44512
diff --git a/utils/squisher b/utils/squisher
new file mode 100755
index 0000000..95d8885
--- /dev/null
+++ b/utils/squisher
@@ -0,0 +1,34 @@
+#!/bin/bash
+#
+# Squish a CM otapackage for distribution
+# cyanogen
+
+. $ANDROID_BUILD_TOP/vendor/aosp/utils/colors
+
+OUT_TARGET_HOST=`uname -s`
+if [ x"$OUT_TARGET_HOST" = x"Linux" ]
+then
+ OUT_TARGET_HOST=linux-x86
+ XARGS="xargs --max-args=1 --max-procs `grep 'processor' /proc/cpuinfo|wc -l`"
+elif [ x"$OUT_TARGET_HOST" = x"Darwin" ]
+then
+ OUT_TARGET_HOST=darwin-x86
+ XARGS="xargs -n 1 -P `sysctl hw.ncpu | awk '{print $2}'`"
+else
+ echo -e $${CL_RED}"ERROR: unknown/unsupported host OS!"${CL_RST}
+ exit 1
+fi
+
+if [ -z "$OUT" -o ! -d "$OUT" ]; then
+ echo -e ${CL_RED}"ERROR: $0 only works with a full build environment. $OUT should exist."${CL_RST}
+ exit 1
+fi
+
+OPTICHARGER=$ANDROID_BUILD_TOP/vendor/aosp/utils/opticharger
+QUIET=-q
+DELETE_BINS="applypatch applypatch_static check_prereq recovery updater"
+
+# Optimize PNG resources in APKs
+( cd $OUT/system; find framework/ app/ priv-app/ vendor/app/ -name \*.apk -print | $XARGS $OPTICHARGER; )
+
+exit 0