Merge "Explicitly restart the killed wallpaper service"

This commit is contained in:
Chris Tate
2018-02-21 21:49:31 +00:00
committed by Gerrit Code Review

View File

@@ -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) { private void processDisconnect(final ServiceConnection connection) {
synchronized (mLock) { synchronized (mLock) {
// The wallpaper disappeared. If this isn't a system-default one, track // The wallpaper disappeared. If this isn't a system-default one, track
@@ -871,13 +882,13 @@ public class WallpaperManagerService extends IWallpaperManager.Stub {
} else { } else {
mWallpaper.lastDiedTime = SystemClock.uptimeMillis(); mWallpaper.lastDiedTime = SystemClock.uptimeMillis();
// If we didn't reset it right away, do so after we couldn't connect to clearWallpaperComponentLocked(mWallpaper);
// it for an extended amount of time to avoid having a black wallpaper. if (bindWallpaperComponentLocked(
final Handler fgHandler = FgThread.getHandler(); wpService, false, false, mWallpaper, null)) {
fgHandler.removeCallbacks(mResetRunnable); mWallpaper.connection.scheduleTimeoutLocked();
fgHandler.postDelayed(mResetRunnable, WALLPAPER_RECONNECT_TIMEOUT_MS); } else {
if (DEBUG_LIVE) { Slog.w(TAG, "Reverting to built-in wallpaper!");
Slog.i(TAG, "Started wallpaper reconnect timeout for " + wpService); clearWallpaperLocked(true, FLAG_SYSTEM, mWallpaper.userId, null);
} }
} }
final String flattened = wpService.flattenToString(); final String flattened = wpService.flattenToString();