@@ -235,8 +235,13 @@ private Bitmap getCurrentWallpaperLocked(Context context) {
235235 if (width <= 0 || height <= 0 ) {
236236 // Degenerate case: no size requested, just load
237237 // bitmap as-is.
238- Bitmap bm = BitmapFactory .decodeFileDescriptor (
239- fd .getFileDescriptor (), null , null );
238+ Bitmap bm = null ;
239+ try {
240+ bm = BitmapFactory .decodeFileDescriptor (
241+ fd .getFileDescriptor (), null , null );
242+ } catch (OutOfMemoryError e ) {
243+ Log .w (TAG , "Can't decode file" , e );
244+ }
240245 try {
241246 fd .close ();
242247 } catch (IOException e ) {
@@ -277,7 +282,12 @@ private Bitmap getDefaultWallpaperLocked(Context context) {
277282 if (width <= 0 || height <= 0 ) {
278283 // Degenerate case: no size requested, just load
279284 // bitmap as-is.
280- Bitmap bm = BitmapFactory .decodeStream (is , null , null );
285+ Bitmap bm = null ;
286+ try {
287+ bm = BitmapFactory .decodeStream (is , null , null );
288+ } catch (OutOfMemoryError e ) {
289+ Log .w (TAG , "Can't decode stream" , e );
290+ }
281291 try {
282292 is .close ();
283293 } catch (IOException e ) {
0 commit comments