diff options
| author | Adam Lesinski <adamlesinski@google.com> | 2014-04-28 20:30:35 +0000 |
|---|---|---|
| committer | Android (Google) Code Review <android-gerrit@google.com> | 2014-04-28 20:30:35 +0000 |
| commit | 8ea2d4512248ec612356f558ac35534c3e4c6db6 (patch) | |
| tree | c7241ea6cc62449068ed75f7abda96ca1ffae5d8 /core/java | |
| parent | 4f50911aa18f9d4650c6721456dd05ac499fcefd (diff) | |
| parent | 2c8d67c9b0574f229809d99b3d55aa411fad0c84 (diff) | |
Merge "Various CTS fixes" into klp-modular-dev
Diffstat (limited to 'core/java')
| -rw-r--r-- | core/java/android/app/WallpaperManager.java | 39 |
1 files changed, 17 insertions, 22 deletions
diff --git a/core/java/android/app/WallpaperManager.java b/core/java/android/app/WallpaperManager.java index f291e8298bc1..e16ae7ae2c34 100644 --- a/core/java/android/app/WallpaperManager.java +++ b/core/java/android/app/WallpaperManager.java @@ -283,13 +283,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( @@ -311,28 +313,21 @@ public class WallpaperManager { } private Bitmap getDefaultWallpaperLocked(Context context) { - try { - InputStream is = context.getResources().openRawResource( - com.android.internal.R.drawable.default_wallpaper); - if (is != null) { - int width = mService.getWidthHint(); - int height = mService.getHeightHint(); - + InputStream is = context.getResources().openRawResource( + com.android.internal.R.drawable.default_wallpaper); + 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; } |
