Bug 844832. r=blassey, a=bajaj
authorGian-Carlo Pascutto <gpascutto@mozilla.com>
Thu, 28 Feb 2013 19:12:14 +0100
changeset 132311 01c33ed5c6e0d706b8fa59ba3ce4881389c46bd5
parent 132310 ae38e54e2be3dcae39fc1ff2424d34d1dbc73659
child 132312 8323e52f55db55d75d94d113d6b95e62311f70ea
push id2323
push userbbajaj@mozilla.com
push dateMon, 01 Apr 2013 19:47:02 +0000
treeherdermozilla-beta@7712be144d91 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersblassey, bajaj
bugs844832
milestone21.0a2
Bug 844832. r=blassey, a=bajaj
mobile/android/base/mozglue/GeckoLoader.java.in
--- a/mobile/android/base/mozglue/GeckoLoader.java.in
+++ b/mobile/android/base/mozglue/GeckoLoader.java.in
@@ -91,20 +91,34 @@ public final class GeckoLoader {
             putenv("DOWNLOADS_DIRECTORY=" + downloadDir.getPath());
             putenv("UPDATES_DIRECTORY="   + updatesDir.getPath());
         }
         catch (Exception e) {
             Log.w(LOGTAG, "No download directory found.", e);
         }
     }
 
-    @SuppressWarnings("deprecation") // Context.MODE_WORLD_* is deprecated in android-17
+    private static void delTree(File file) {
+        if (file.isDirectory()) {
+            File children[] = file.listFiles();
+            for (File child : children) {
+                delTree(child);
+            }
+        }
+        file.delete();
+    }
+
     private static File getTmpDir(Context context) {
-        return context.getDir("tmp", Context.MODE_WORLD_READABLE |
-                              Context.MODE_WORLD_WRITEABLE );
+        File tmpDir = context.getDir("tmpdir", Context.MODE_PRIVATE);
+        // check if the old tmp dir is there
+        File oldDir = new File(tmpDir.getParentFile(), "app_tmp");
+        if (oldDir.exists()) {
+            delTree(oldDir);
+        }
+        return tmpDir;
     }
 
     public static void setupGeckoEnvironment(Context context, String[] pluginDirs, String profilePath) {
         setupPluginEnvironment(context, pluginDirs);
         setupDownloadEnvironment(context);
 
         // profile home path
         putenv("HOME=" + profilePath);