Bug 686694 - Don't extract libraries on Android unless we're starting with the DEBUG intent. r=dougt
authorMike Hommey <mh+mozilla@glandium.org>
Fri, 16 Sep 2011 10:00:42 +0200
changeset 77010 49c16f43ff260cb8f07f4d12bf49e4540c7967a5
parent 77009 39b192706927904d23385f8d37a3bf7d2f026f29
child 77011 ad202468df6335badd1c44be9913975a1a6099d8
push id3
push userfelipc@gmail.com
push dateFri, 30 Sep 2011 20:09:13 +0000
reviewersdougt
bugs686694
milestone9.0a1
Bug 686694 - Don't extract libraries on Android unless we're starting with the DEBUG intent. r=dougt
embedding/android/GeckoAppShell.java
--- a/embedding/android/GeckoAppShell.java
+++ b/embedding/android/GeckoAppShell.java
@@ -88,18 +88,16 @@ public class GeckoAppShell
     static private final HashMap<Integer, AlertNotification>
         mAlertNotifications = new HashMap<Integer, AlertNotification>();
 
     static private final int NOTIFY_IME_RESETINPUTSTATE = 0;
     static private final int NOTIFY_IME_SETOPENSTATE = 1;
     static private final int NOTIFY_IME_CANCELCOMPOSITION = 2;
     static private final int NOTIFY_IME_FOCUSCHANGE = 3;
 
-    static public final long kFreeSpaceThreshold = 157286400L; // 150MB
-    static private final long kLibFreeSpaceBuffer = 20971520L; // 29MB
     static private File sCacheFile = null;
     static private int sFreeSpace = -1;
 
     static private String sNetworkState = "unknown";
     static private String sNetworkType = "unknown";
     static private int sNetworkTypeCode = 0;
 
     /* The Android-side API: API methods that Android calls */
@@ -350,29 +348,30 @@ public class GeckoAppShell
             GeckoAppShell.putenv("UPDATES_DIRECTORY="   + updatesDir.getPath());
         }
         catch (Exception e) {
             Log.i(LOG_FILE_NAME, "No download directory has been found: " + e);
         }
 
         putLocaleEnv();
 
-        if (freeSpace + kLibFreeSpaceBuffer < kFreeSpaceThreshold) {
-            // remove any previously extracted libs since we're apparently low
+        boolean extractLibs = GeckoApp.ACTION_DEBUG.equals(i.getAction());
+        if (!extractLibs) {
+            // remove any previously extracted libs
             File[] files = cacheFile.listFiles();
             if (files != null) {
                 Iterator cacheFiles = Arrays.asList(files).iterator();
                 while (cacheFiles.hasNext()) {
                     File libFile = (File)cacheFiles.next();
                     if (libFile.getName().endsWith(".so"))
                         libFile.delete();
                 }
             }
         }
-        loadLibs(apkName, freeSpace > kFreeSpaceThreshold);
+        loadLibs(apkName, extractLibs);
     }
 
     private static void putLocaleEnv() {
         GeckoAppShell.putenv("LANG=" + Locale.getDefault().toString());
         NumberFormat nf = NumberFormat.getInstance();
         if (nf instanceof DecimalFormat) {
             DecimalFormat df = (DecimalFormat)nf;
             DecimalFormatSymbols dfs = df.getDecimalFormatSymbols();