Merge "Clearing screenshot bitmap references and recycling bitmap data immediately after saving. (Bug 7974275)"

This commit is contained in:
Winson Chung
2013-01-17 00:27:19 +00:00
committed by Android (Google) Code Review

View File

@ -220,13 +220,21 @@ class SaveImageInBackgroundTask extends AsyncTask<SaveImageInBackgroundData, Voi
resolver.update(uri, values, null, null);
params[0].imageUri = uri;
params[0].image = null;
params[0].result = 0;
} catch (Exception e) {
// IOException/UnsupportedOperationException may be thrown if external storage is not
// mounted
params[0].imageUri = null;
params[0].image = null;
params[0].result = 1;
}
// Recycle the bitmap data
if (image != null) {
image.recycle();
}
return params[0];
}
@ -461,6 +469,10 @@ class GlobalScreenshot {
// Save the screenshot once we have a bit of time now
saveScreenshotInWorkerThread(finisher);
mWindowManager.removeView(mScreenshotLayout);
// Clear any references to the bitmap
mScreenBitmap = null;
mScreenshotView.setImageBitmap(null);
}
});
mScreenshotLayout.post(new Runnable() {