diff options
| author | 2023-09-15 08:42:52 -0700 | |
|---|---|---|
| committer | 2023-09-15 08:56:00 -0700 | |
| commit | 336ac019b43411e1c9631bc57c83cb38005d5cdc (patch) | |
| tree | b76845a6dedf247e081e79e1d8067637870f71e9 | |
| parent | 09af2b3b5e189bf777a4ec791f1f759f36406c4c (diff) | |
Gracefully handle unbind errors when detaching
When detaching from a previous wallpaper we unbind our connection from
the underlying service. This can generate an exception if the service is
no longer available and lead to the wallpaper state being left in a
half-cleared state as well as causing the detach operation to fail. This
CL adds a catch to handle the exception, in this case it doesn't matter
if the the service has gone away since we're detaching from it anyway.
Bug: 296508731
Test: atest WallpaperManagerTest
Change-Id: I19a3fedecafca10744cf21f2e6bd40c9f8f6350a
| -rw-r--r-- | services/core/java/com/android/server/wallpaper/WallpaperManagerService.java | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/services/core/java/com/android/server/wallpaper/WallpaperManagerService.java b/services/core/java/com/android/server/wallpaper/WallpaperManagerService.java index 00992a03634d..4c525e902b88 100644 --- a/services/core/java/com/android/server/wallpaper/WallpaperManagerService.java +++ b/services/core/java/com/android/server/wallpaper/WallpaperManagerService.java @@ -3749,7 +3749,11 @@ public class WallpaperManagerService extends IWallpaperManager.Stub mContext.getMainThreadHandler().removeCallbacks( wallpaper.connection.mTryToRebindRunnable); - mContext.unbindService(wallpaper.connection); + try { + mContext.unbindService(wallpaper.connection); + } catch (IllegalArgumentException e) { + Slog.w(TAG, "Error unbinding wallpaper when detaching", e); + } wallpaper.connection = null; if (wallpaper == mLastWallpaper) { mLastWallpaper = null; |