summaryrefslogtreecommitdiffstats
path: root/WallpaperPicker
diff options
context:
space:
mode:
authorChristoph Studer <chstuder@google.com>2014-03-03 16:00:05 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2014-03-03 16:00:06 +0000
commit8657bac9b55a8db9ce587ea896a03325968498ea (patch)
treed2ab05a917141a47497c42146be1e55f0cd73c74 /WallpaperPicker
parent3aa28319ceca347dfd4958ca95b94652bb8e2a3d (diff)
parent7084c606eb1e613d2bc5681f3c54ad7912859eed (diff)
downloadandroid_packages_apps_Trebuchet-8657bac9b55a8db9ce587ea896a03325968498ea.tar.gz
android_packages_apps_Trebuchet-8657bac9b55a8db9ce587ea896a03325968498ea.tar.bz2
android_packages_apps_Trebuchet-8657bac9b55a8db9ce587ea896a03325968498ea.zip
Merge "Guard against null default wallpaper" into ub-now-lunchbox
Diffstat (limited to 'WallpaperPicker')
-rw-r--r--WallpaperPicker/src/com/android/launcher3/WallpaperPickerActivity.java24
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 3f3dca8f9..ab25fa939 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;
@@ -248,6 +246,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);
@@ -420,13 +424,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