diff options
| author | 2010-09-10 14:25:14 -0700 | |
|---|---|---|
| committer | 2010-09-10 14:25:14 -0700 | |
| commit | 7c65585feb761a3e00bb2b8a468d43f70a8c3cdc (patch) | |
| tree | ae47dba03cad97605436fff6f131c06f312ee65d | |
| parent | 4940ff85d561310d2c122ca6bd7de4d00772b095 (diff) | |
| parent | 2c4a56af4d56f87a1bbf14386f045bcf57602ef2 (diff) | |
Merge "Make sure OutOfMemoryError is handled by WallpaperManager"
| -rw-r--r-- | core/java/android/app/WallpaperManager.java | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/core/java/android/app/WallpaperManager.java b/core/java/android/app/WallpaperManager.java index e455a5966c8a..92b7cf519887 100644 --- a/core/java/android/app/WallpaperManager.java +++ b/core/java/android/app/WallpaperManager.java @@ -235,8 +235,13 @@ public class WallpaperManager { if (width <= 0 || height <= 0) { // Degenerate case: no size requested, just load // bitmap as-is. - Bitmap bm = BitmapFactory.decodeFileDescriptor( - fd.getFileDescriptor(), null, null); + Bitmap bm = null; + try { + bm = BitmapFactory.decodeFileDescriptor( + fd.getFileDescriptor(), null, null); + } catch (OutOfMemoryError e) { + Log.w(TAG, "Can't decode file", e); + } try { fd.close(); } catch (IOException e) { @@ -277,7 +282,12 @@ public class WallpaperManager { if (width <= 0 || height <= 0) { // Degenerate case: no size requested, just load // 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 { is.close(); } catch (IOException e) { |