Merge "make SignApk faster for OTA packages"
diff --git a/tools/signapk/SignApk.java b/tools/signapk/SignApk.java
index d8d9bf1..cb19296 100644
--- a/tools/signapk/SignApk.java
+++ b/tools/signapk/SignApk.java
@@ -497,7 +497,16 @@
                 outputStream = outputFile = new FileOutputStream(args[argstart+3]);
             }
             outputJar = new JarOutputStream(outputStream);
-            outputJar.setLevel(9);
+
+            // For signing .apks, use the maximum compression to make
+            // them as small as possible (since they live forever on
+            // the system partition).  For OTA packages, use the
+            // default compression level, which is much much faster
+            // and produces output that is only a tiny bit larger
+            // (~0.1% on full OTA packages I tested).
+            if (!signWholeFile) {
+                outputJar.setLevel(9);
+            }
 
             JarEntry je;