summaryrefslogtreecommitdiffstats
path: root/core/java/android/service/wallpaper
diff options
context:
space:
mode:
authorMattias Petersson <mattias.petersson@sonyericsson.com>2011-01-12 15:38:55 +0100
committerJohan Redestig <johan.redestig@sonyericsson.com>2011-01-12 15:41:55 +0100
commitd9463f50c8c1aa8969502b117777a4c185971c08 (patch)
tree3c7bb30809c2cb7f5d0f3be82d6194157e4fae74 /core/java/android/service/wallpaper
parentcb8427538dfdc5eae941e377b11bfd11a95fc5a5 (diff)
downloadframeworks_base-d9463f50c8c1aa8969502b117777a4c185971c08.zip
frameworks_base-d9463f50c8c1aa8969502b117777a4c185971c08.tar.gz
frameworks_base-d9463f50c8c1aa8969502b117777a4c185971c08.tar.bz2
Fix for crash when setting live wallpaper.
This fix prevents a crash that sometimes happens when setting a live wallpaper. It happened when pressing "Set wallpaper" button in the live wallpaper preview activity, before the preview was fully loaded. The crash happened in native code while updating the wallpaper surface when calling mInputChannel.registerInputChannel(), because the previous call to mSession.add(mWindow, mLayout, View.VISIBLE, mContentInsets, mInputChannel) had failed. The fix aborts the surface update when it is not possible to add the window. Change-Id: I0e79a851e5c7f7b15eb07043c63d1f4d78f14616
Diffstat (limited to 'core/java/android/service/wallpaper')
-rw-r--r--core/java/android/service/wallpaper/WallpaperService.java7
1 files changed, 5 insertions, 2 deletions
diff --git a/core/java/android/service/wallpaper/WallpaperService.java b/core/java/android/service/wallpaper/WallpaperService.java
index 26346d2..9f362d3 100644
--- a/core/java/android/service/wallpaper/WallpaperService.java
+++ b/core/java/android/service/wallpaper/WallpaperService.java
@@ -514,8 +514,11 @@ public abstract class WallpaperService extends Service {
mLayout.windowAnimations =
com.android.internal.R.style.Animation_Wallpaper;
mInputChannel = new InputChannel();
- mSession.add(mWindow, mLayout, View.VISIBLE, mContentInsets,
- mInputChannel);
+ if (mSession.add(mWindow, mLayout, View.VISIBLE, mContentInsets,
+ mInputChannel) < 0) {
+ Log.w(TAG, "Failed to add window while updating wallpaper surface.");
+ return;
+ }
mCreated = true;
InputQueue.registerInputChannel(mInputChannel, mInputHandler,