diff options
| author | Adam Lesinski <adamlesinski@google.com> | 2014-04-28 21:20:00 +0000 |
|---|---|---|
| committer | Android (Google) Code Review <android-gerrit@google.com> | 2014-04-28 21:20:01 +0000 |
| commit | 1ebf4ef18877b1fbf4d85bf80917aac660b44567 (patch) | |
| tree | 6e4a4d43a54aebecfbc235e2d76517338095c5df /core/java/android | |
| parent | 802667b20b2170ddce94d70a022b68b64b9a7493 (diff) | |
| parent | e929bee9bbb418b52fea877f5fff1449aab247fb (diff) | |
Merge "Merge commit '734a78fb' into manualmerge"
Diffstat (limited to 'core/java/android')
| -rw-r--r-- | core/java/android/app/WallpaperManager.java | 37 |
1 files changed, 16 insertions, 21 deletions
diff --git a/core/java/android/app/WallpaperManager.java b/core/java/android/app/WallpaperManager.java index f08097b65f81..5f8ebbee1eda 100644 --- a/core/java/android/app/WallpaperManager.java +++ b/core/java/android/app/WallpaperManager.java @@ -279,13 +279,15 @@ public class WallpaperManager { } private Bitmap getCurrentWallpaperLocked(Context context) { + if (mService == null) { + Log.w(TAG, "WallpaperService not running"); + return null; + } + try { Bundle params = new Bundle(); ParcelFileDescriptor fd = mService.getWallpaper(this, params); if (fd != null) { - int width = params.getInt("width", 0); - int height = params.getInt("height", 0); - try { BitmapFactory.Options options = new BitmapFactory.Options(); return BitmapFactory.decodeFileDescriptor( @@ -307,27 +309,20 @@ public class WallpaperManager { } private Bitmap getDefaultWallpaperLocked(Context context) { - try { - InputStream is = openDefaultWallpaper(context); - if (is != null) { - int width = mService.getWidthHint(); - int height = mService.getHeightHint(); - + InputStream is = openDefaultWallpaper(context); + if (is != null) { + try { + BitmapFactory.Options options = new BitmapFactory.Options(); + return BitmapFactory.decodeStream(is, null, options); + } catch (OutOfMemoryError e) { + Log.w(TAG, "Can't decode stream", e); + } finally { try { - BitmapFactory.Options options = new BitmapFactory.Options(); - return BitmapFactory.decodeStream(is, null, options); - } catch (OutOfMemoryError e) { - Log.w(TAG, "Can't decode stream", e); - } finally { - try { - is.close(); - } catch (IOException e) { - // Ignore - } + is.close(); + } catch (IOException e) { + // Ignore } } - } catch (RemoteException e) { - // Ignore } return null; } |
