diff options
| author | Adam Lesinski <adamlesinski@google.com> | 2014-04-28 14:15:06 -0700 |
|---|---|---|
| committer | Adam Lesinski <adamlesinski@google.com> | 2014-04-28 14:15:06 -0700 |
| commit | e929bee9bbb418b52fea877f5fff1449aab247fb (patch) | |
| tree | 18defb24caf25e9effd0105a40c8a296eb22e494 /core/java/android | |
| parent | 812ad2265ed1386b347c98f48cc8a2b2925541b3 (diff) | |
| parent | 734a78fb867384dfb84f5f42f65b4681562d62b5 (diff) | |
Merge commit '734a78fb' into manualmerge
Conflicts:
core/java/android/app/WallpaperManager.java
Change-Id: Id103f540329ea484ff2e0829a0fc8158621f3dd3
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; } |
