diff options
| author | 2018-02-21 21:49:31 +0000 | |
|---|---|---|
| committer | 2018-02-21 21:49:31 +0000 | |
| commit | 0780b18a9ffdd1a7ed187b4d77a01a9ada8b919b (patch) | |
| tree | 8e128bd90a7377939f0b06ec61d7e0d7fdb12039 | |
| parent | bb5cbc539fb9870fb5e39bc975a9a7d7dc67b8a8 (diff) | |
| parent | 06919216e48d3e8521c50bd9a6e2c7e363e70495 (diff) | |
Merge "Explicitly restart the killed wallpaper service"
| -rw-r--r-- | services/core/java/com/android/server/wallpaper/WallpaperManagerService.java | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/services/core/java/com/android/server/wallpaper/WallpaperManagerService.java b/services/core/java/com/android/server/wallpaper/WallpaperManagerService.java index b888ec21e708..f6e863b0aafb 100644 --- a/services/core/java/com/android/server/wallpaper/WallpaperManagerService.java +++ b/services/core/java/com/android/server/wallpaper/WallpaperManagerService.java @@ -847,6 +847,17 @@ public class WallpaperManagerService extends IWallpaperManager.Stub { } } + public void scheduleTimeoutLocked() { + // If we didn't reset it right away, do so after we couldn't connect to + // it for an extended amount of time to avoid having a black wallpaper. + final Handler fgHandler = FgThread.getHandler(); + fgHandler.removeCallbacks(mResetRunnable); + fgHandler.postDelayed(mResetRunnable, WALLPAPER_RECONNECT_TIMEOUT_MS); + if (DEBUG_LIVE) { + Slog.i(TAG, "Started wallpaper reconnect timeout for " + mWallpaper.wallpaperComponent); + } + } + private void processDisconnect(final ServiceConnection connection) { synchronized (mLock) { // The wallpaper disappeared. If this isn't a system-default one, track @@ -871,13 +882,13 @@ public class WallpaperManagerService extends IWallpaperManager.Stub { } else { mWallpaper.lastDiedTime = SystemClock.uptimeMillis(); - // If we didn't reset it right away, do so after we couldn't connect to - // it for an extended amount of time to avoid having a black wallpaper. - final Handler fgHandler = FgThread.getHandler(); - fgHandler.removeCallbacks(mResetRunnable); - fgHandler.postDelayed(mResetRunnable, WALLPAPER_RECONNECT_TIMEOUT_MS); - if (DEBUG_LIVE) { - Slog.i(TAG, "Started wallpaper reconnect timeout for " + wpService); + clearWallpaperComponentLocked(mWallpaper); + if (bindWallpaperComponentLocked( + wpService, false, false, mWallpaper, null)) { + mWallpaper.connection.scheduleTimeoutLocked(); + } else { + Slog.w(TAG, "Reverting to built-in wallpaper!"); + clearWallpaperLocked(true, FLAG_SYSTEM, mWallpaper.userId, null); } } final String flattened = wpService.flattenToString(); |