diff options
author | Christoph Studer <chstuder@google.com> | 2014-02-28 15:57:18 +0100 |
---|---|---|
committer | Danesh M <daneshm90@gmail.com> | 2014-06-06 22:54:28 -0700 |
commit | 1a835b1bcf20a6cbbf50deeb19fd205b4268efa7 (patch) | |
tree | 6ca0838686e82878c604eec6725e5aa68ec1c628 | |
parent | a2f009489eee19dc70ac76247d887e5039d3ab97 (diff) | |
download | android_packages_apps_Trebuchet-1a835b1bcf20a6cbbf50deeb19fd205b4268efa7.tar.gz android_packages_apps_Trebuchet-1a835b1bcf20a6cbbf50deeb19fd205b4268efa7.tar.bz2 android_packages_apps_Trebuchet-1a835b1bcf20a6cbbf50deeb19fd205b4268efa7.zip |
Guard against null default wallpaper
Deal with WallpaperManager.getBuiltInDrawable() returning null.
Bug: 13109487
Change-Id: Ib5665a0eb947e9784cdcd0e8dfab1a01b4deca82
-rw-r--r-- | WallpaperPicker/src/com/android/launcher3/WallpaperPickerActivity.java | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/WallpaperPicker/src/com/android/launcher3/WallpaperPickerActivity.java b/WallpaperPicker/src/com/android/launcher3/WallpaperPickerActivity.java index 0070add2a..93967ad5d 100644 --- a/WallpaperPicker/src/com/android/launcher3/WallpaperPickerActivity.java +++ b/WallpaperPicker/src/com/android/launcher3/WallpaperPickerActivity.java @@ -16,7 +16,6 @@ package com.android.launcher3; -import android.animation.Animator; import android.animation.LayoutTransition; import android.app.ActionBar; import android.app.Activity; @@ -33,7 +32,6 @@ import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.Canvas; import android.graphics.Matrix; -import android.graphics.Paint; import android.graphics.Point; import android.graphics.PorterDuff; import android.graphics.Rect; @@ -252,6 +250,12 @@ public class WallpaperPickerActivity extends WallpaperCropActivity { Drawable defaultWallpaper = WallpaperManager.getInstance(a).getBuiltInDrawable( c.getWidth(), c.getHeight(), false, 0.5f, 0.5f); + if (defaultWallpaper == null) { + Log.w(TAG, "Null default wallpaper encountered."); + c.setTileSource(null, null); + return; + } + c.setTileSource( new DrawableTileSource(a, defaultWallpaper, DrawableTileSource.MAX_PREVIEW_SIZE), null); c.setScale(1f); @@ -424,13 +428,15 @@ public class WallpaperPickerActivity extends WallpaperCropActivity { // Add a tile for the default wallpaper if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { DefaultWallpaperInfo defaultWallpaperInfo = getDefaultWallpaper(); - FrameLayout defaultWallpaperTile = (FrameLayout) createImageTileView( - getLayoutInflater(), 0, null, mWallpapersView, defaultWallpaperInfo.mThumb); - setWallpaperItemPaddingToZero(defaultWallpaperTile); - defaultWallpaperTile.setTag(defaultWallpaperInfo); - mWallpapersView.addView(defaultWallpaperTile, 0); - defaultWallpaperTile.setOnClickListener(mThumbnailOnClickListener); - defaultWallpaperInfo.setView(defaultWallpaperTile); + if (defaultWallpaperInfo != null) { + FrameLayout defaultWallpaperTile = (FrameLayout) createImageTileView( + getLayoutInflater(), 0, null, mWallpapersView, defaultWallpaperInfo.mThumb); + setWallpaperItemPaddingToZero(defaultWallpaperTile); + defaultWallpaperTile.setTag(defaultWallpaperInfo); + mWallpapersView.addView(defaultWallpaperTile, 0); + defaultWallpaperTile.setOnClickListener(mThumbnailOnClickListener); + defaultWallpaperInfo.setView(defaultWallpaperTile); + } } // Select the first item; wait for a layout pass so that we initialize the dimensions of |