From 2fecb6b4c275c634fa87e1e4fb33804757009493 Mon Sep 17 00:00:00 2001 From: Lucas Dupin Date: Mon, 26 Jun 2017 12:19:12 -0700 Subject: Avoid crash when unbinding wallpaper A wallpaper service might have crashed before we try to unbind it, in this case a runtime exception will be thrown. Let's just ignore it since there is nothing else to be done. Bug: 62828614 Test: manually set Windy wallpaper and resize it Change-Id: If9882ea27aaf3c92d2069ae6c8ef409c6ae2fa91 (cherry picked from commit b989a5e9de2d0300c578e79705f670c2b7ffe199) --- src/com/android/wallpaper/livepicker/LiveWallpaperPreview.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/com/android/wallpaper/livepicker/LiveWallpaperPreview.java b/src/com/android/wallpaper/livepicker/LiveWallpaperPreview.java index baaa13c..6dab5c6 100644 --- a/src/com/android/wallpaper/livepicker/LiveWallpaperPreview.java +++ b/src/com/android/wallpaper/livepicker/LiveWallpaperPreview.java @@ -439,7 +439,12 @@ public class LiveWallpaperPreview extends Activity { } mEngine = null; } - unbindService(this); + try { + unbindService(this); + } catch (IllegalArgumentException e) { + Log.w(LOG_TAG, "Can't unbind wallpaper service. " + + "It might have crashed, just ignoring.", e); + } mService = null; } } @@ -485,7 +490,7 @@ public class LiveWallpaperPreview extends Activity { } } } - + public ParcelFileDescriptor setWallpaper(String name) { return null; } -- cgit v1.2.3