summaryrefslogtreecommitdiffstats
path: root/WallpaperPicker/src
diff options
context:
space:
mode:
authorChristoph Studer <chstuder@google.com>2014-02-28 15:57:18 +0100
committerDanesh M <daneshm90@gmail.com>2014-06-06 22:54:28 -0700
commit1a835b1bcf20a6cbbf50deeb19fd205b4268efa7 (patch)
tree6ca0838686e82878c604eec6725e5aa68ec1c628 /WallpaperPicker/src
parenta2f009489eee19dc70ac76247d887e5039d3ab97 (diff)
downloadandroid_packages_apps_Trebuchet-1a835b1bcf20a6cbbf50deeb19fd205b4268efa7.zip
android_packages_apps_Trebuchet-1a835b1bcf20a6cbbf50deeb19fd205b4268efa7.tar.gz
android_packages_apps_Trebuchet-1a835b1bcf20a6cbbf50deeb19fd205b4268efa7.tar.bz2
Guard against null default wallpaper
Deal with WallpaperManager.getBuiltInDrawable() returning null. Bug: 13109487 Change-Id: Ib5665a0eb947e9784cdcd0e8dfab1a01b4deca82
Diffstat (limited to 'WallpaperPicker/src')
-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 0070add..93967ad 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