am 7c65585f: Merge "Make sure OutOfMemoryError is handled by WallpaperManager"
Merge commit '7c65585feb761a3e00bb2b8a468d43f70a8c3cdc' into gingerbread-plus-aosp * commit '7c65585feb761a3e00bb2b8a468d43f70a8c3cdc': Make sure OutOfMemoryError is handled by WallpaperManager
This commit is contained in:
committed by
Android Git Automerger
commit
d77b0dfdf3
@@ -235,8 +235,13 @@ public class WallpaperManager {
|
|||||||
if (width <= 0 || height <= 0) {
|
if (width <= 0 || height <= 0) {
|
||||||
// Degenerate case: no size requested, just load
|
// Degenerate case: no size requested, just load
|
||||||
// bitmap as-is.
|
// bitmap as-is.
|
||||||
Bitmap bm = BitmapFactory.decodeFileDescriptor(
|
Bitmap bm = null;
|
||||||
fd.getFileDescriptor(), null, null);
|
try {
|
||||||
|
bm = BitmapFactory.decodeFileDescriptor(
|
||||||
|
fd.getFileDescriptor(), null, null);
|
||||||
|
} catch (OutOfMemoryError e) {
|
||||||
|
Log.w(TAG, "Can't decode file", e);
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
fd.close();
|
fd.close();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
@@ -277,7 +282,12 @@ public class WallpaperManager {
|
|||||||
if (width <= 0 || height <= 0) {
|
if (width <= 0 || height <= 0) {
|
||||||
// Degenerate case: no size requested, just load
|
// Degenerate case: no size requested, just load
|
||||||
// bitmap as-is.
|
// bitmap as-is.
|
||||||
Bitmap bm = BitmapFactory.decodeStream(is, null, null);
|
Bitmap bm = null;
|
||||||
|
try {
|
||||||
|
bm = BitmapFactory.decodeStream(is, null, null);
|
||||||
|
} catch (OutOfMemoryError e) {
|
||||||
|
Log.w(TAG, "Can't decode stream", e);
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
is.close();
|
is.close();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
|||||||
Reference in New Issue
Block a user