#!/bin/bash
#
# Super-mega opticharger of doom
# Shrinks apks by running pngcrush or optipng or pngout on png images
#
# Point APKCERTS at the full path to a generated apkcerts.txt file, such as:
# /home/shade/dev/sources/android-cm-eclair/out/target/product/dream_sapphire/obj/PACKAGING/target_files_intermediates/cyanogen_dream_sapphire-target_files-eng.shade/META/apkcerts.txt
#
# cyanogen - shade@chemlab.org
# ChrisSoyars - me@ctso.me

set -e
QUIET=1
BASE=`pwd`
BRUTECRUSH="-brute"
TMPDIR=/tmp/opticharge-$$

. $ANDROID_BUILD_TOP/vendor/cm/tools/functions

if [ -z "$BRUTE_PNGCRUSH" ]
then
    BRUTECRUSH=""
fi

if [ "$APKCERTS" = "" ];
then
    if [ "$TARGET_BUILD_VARIANT" = "userdebug" ]; then
       TARGET_BUILD_VARIANT="eng"
    elif [ "$TARGET_BUILD_VARIANT" = "user" ]; then
       TARGET_BUILD_VARIANT="eng"
    fi

    APKCERTS=$OUT/obj/PACKAGING/target_files_intermediates/$TARGET_PRODUCT-target_files-$TARGET_BUILD_VARIANT.$USER/META/apkcerts.txt
    if [ ! -f "$APKCERTS" ];
    then
        echo -e $CL_RED"Set APKCERTS to the path to your apkcerts.txt file"$CL_RST
        exit 1;
    fi
fi

if [ ! -f "$APKCERTS" ];
then
    echo -e $CL_RED"Invalid path to apkcerts.txt, set APKCERTS to the correct path."$CL_RST
fi

if [ "$(which pngcrush)" != "" ];
then
    optimize_png () {
        pngcrush -q ${BRUTECRUSH} $1 ${1}.out 1> /dev/null 2> /dev/null
        mv ${1}.out ${1} 2> /dev/null
    }
elif [ "$(which optipng)" != "" ];
then
    optimize_png () {
        optipng -o7 -quiet $1 1> /dev/null 2> /dev/null
    }
elif [ "$(which pngout-static)" != "" ];
then
    optimize_png () {
        pngout-static $1
    }
elif [ "$(which pngout)" != "" ];
then
    optimize_png () {
        pngout $1
    }
else
    echo -e $CL_RED"Please install pngcrush, optipng, or pngout"$CL_RST
    exit 1;
fi

if [ "`which aapt`" = "" ];
then
    echo -e $CL_RED"Please ensure aapt is in your \$PATH"$CL_RST
    exit 1;
fi

if [ "`which zipalign`" = "" ];
then
    echo -e $CL_RED"Please ensure zipalign is in your \$PATH"$CL_RST
    exit 1;
fi

if [ -e "$1" ];
then
    NAME=`basename $1`;
    echo -e $CL_YLW"Optimize:"$CL_RST" $NAME..";

    if [ "$2" != "" ];
    then
        CERT=build/target/product/security/$2.x509.pem
        KEY=build/target/product/security/$2.pk8
        if [ ! -f "$ANDROID_BUILD_TOP/$CERT" ];
        then
            echo -e $CL_RED"$CERT does not exist!"$CL_RST;
            exit 1;
        fi
    else
        APKINFO=`grep "name=\"$NAME\"" $APKCERTS`;
        [ $QUIET ] || echo "APKINFO: $APKINFO";
        if [ "$APKINFO" = "" ];
        then
            echo -e $CL_RED"No apk info for $NAME"$CL_RST;
            exit 1;
        fi
        CERT=`echo $APKINFO | awk {'print $2'} | cut -f 2 -d "=" | tr -d "\""`;
        KEY=`echo $APKINFO | awk {'print $3'} | cut -f 2 -d "=" | tr -d "\""`;
        if [ "$CERT" = "" ];
        then
            echo -e $CL_RED"Unable to find certificate for $NAME"$CL_RST
            exit 1;
        fi
        if [ "$CERT" = "PRESIGNED" ];
        then
            echo -e $CL_YLW"$NAME is presigned, skipping"$CL_RST
            exit 1;
        fi
    fi

    [ $QUIET ] || echo -e $CL_YLW"Certificate:"$CL_RST" $CERT";

    [ -d $TMPDIR/$NAME ] && rm -rf $TMPDIR/$NAME
    mkdir -p $TMPDIR/$NAME
    trap "rm -rf $TMPDIR; exit" INT TERM EXIT
    cd $TMPDIR/$NAME
    unzip -q $BASE/$1
    for x in `find . -name "*.png" | grep -v "\.9.png$" | tr "\n" " "`
    do
        [ $QUIET ] || echo -e $CL_YLW"Crushing $x"$CL_RST
        optimize_png $x
    done
    cp $BASE/$1 $BASE/$1.old

    [ $QUIET ] || echo -e $CL_YLW"Repacking apk.."$CL_RST
    aapt p -0 .dat -0 .dict -0 .arsc -F $NAME .
    
    [ $QUIET ] || echo -e $CL_YLW"Resigning with cert: `echo $CERT`"$CL_RST

    [ $QUIET ] || echo java -jar $ANDROID_HOST_OUT/framework/signapk.jar $ANDROID_BUILD_TOP/$CERT $ANDROID_BUILD_TOP/$KEY $NAME signed_$NAME
    java -jar $ANDROID_HOST_OUT/framework/signapk.jar $ANDROID_BUILD_TOP/$CERT $ANDROID_BUILD_TOP/$KEY $NAME signed_$NAME
    [ $QUIET ] || echo -e $CL_YLW"Zipaligning.."$CL_RST
    zipalign -f 4 signed_$NAME $BASE/$1
    if [ ! $QUIET ]; then
        ls -l $BASE/$1.old
        ls -l $BASE/$1
    fi
    rm $BASE/$1.old
else
    echo "Usage: $0 [apk file]"
fi

