bug 699716 - Incorrect screenshot shown when starting up after clearing app data r=mfinkle
authorBrad Lassey <blassey@mozilla.com>
Thu, 10 Nov 2011 21:37:21 -0500
changeset 81798 dce9246b76d7cde6aeb9c1c3918e9f7a5f19a53f
parent 81797 13f5d3d70ecbbf00224341af29517eed89dd3f3d
child 81799 043d1443dbc2315b74f6b1fc01b5252d9d85bec1
push idunknown
push userunknown
push dateunknown
reviewersmfinkle
bugs699716
milestone10.0a1
bug 699716 - Incorrect screenshot shown when starting up after clearing app data r=mfinkle
embedding/android/GeckoApp.java
embedding/android/gfx/PlaceholderLayerClient.java
--- a/embedding/android/GeckoApp.java
+++ b/embedding/android/GeckoApp.java
@@ -479,18 +479,18 @@ abstract public class GeckoApp
            case R.id.addons:
                GeckoAppShell.sendEventToGecko(new GeckoEvent("about:addons"));
                return true;
            default:
                return super.onOptionsItemSelected(item);
         }
     }
 
-    public String getStartupBitmapFilePath() {
-        File file = new File(Environment.getExternalStorageDirectory(),
+    public static String getStartupBitmapFilePath() {
+        File file = new File(GeckoAppShell.getCacheDir(),
                              "lastScreen.png");
         return file.toString();
     }
 
     private void rememberLastScreen(boolean sync) {
         if (mUserDefinedProfile)
             return;
 
--- a/embedding/android/gfx/PlaceholderLayerClient.java
+++ b/embedding/android/gfx/PlaceholderLayerClient.java
@@ -37,16 +37,17 @@
 
 package org.mozilla.gecko.gfx;
 
 import org.mozilla.gecko.gfx.BufferedCairoImage;
 import org.mozilla.gecko.gfx.CairoUtils;
 import org.mozilla.gecko.gfx.IntSize;
 import org.mozilla.gecko.gfx.LayerClient;
 import org.mozilla.gecko.gfx.SingleTileLayer;
+import org.mozilla.gecko.GeckoApp;
 import android.content.Context;
 import android.graphics.Bitmap;
 import android.graphics.BitmapFactory;
 import android.os.Environment;
 import android.util.Log;
 import java.io.File;
 import java.nio.ByteBuffer;
 
@@ -67,17 +68,17 @@ public class PlaceholderLayerClient exte
         mWidth = bitmap.getWidth();
         mHeight = bitmap.getHeight();
         mFormat = CairoUtils.bitmapConfigToCairoFormat(bitmap.getConfig());
         mBuffer = ByteBuffer.allocateDirect(mWidth * mHeight * 4);
         bitmap.copyPixelsToBuffer(mBuffer.asIntBuffer());
     }
 
     public static PlaceholderLayerClient createInstance(Context context) {
-        File path = new File(Environment.getExternalStorageDirectory(), "lastScreen.png");
+        File path = new File(GeckoApp.getStartupBitmapFilePath());
         BitmapFactory.Options options = new BitmapFactory.Options();
         options.inScaled = false;
         Bitmap bitmap = BitmapFactory.decodeFile("" + path, options);
         if (bitmap == null)
             return null;
 
         return new PlaceholderLayerClient(context, bitmap);
     }