Merge "Fix race condition while WallpaperMS rebinding service." into rvc-dev am: bb4af580d1
Change-Id: If3b81c373e4bbdfa37e6e1ae4a8bc4db9c27d25e
This commit is contained in:
@@ -3501,8 +3501,11 @@ public final class ActiveServices {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// If unbound while waiting to start, remove the pending service
|
// If unbound while waiting to start and there is no connection left in this service,
|
||||||
|
// remove the pending service
|
||||||
|
if (s.getConnections().isEmpty()) {
|
||||||
mPendingServices.remove(s);
|
mPendingServices.remove(s);
|
||||||
|
}
|
||||||
|
|
||||||
if ((c.flags&Context.BIND_AUTO_CREATE) != 0) {
|
if ((c.flags&Context.BIND_AUTO_CREATE) != 0) {
|
||||||
boolean hasAutoCreate = s.hasAutoCreateConnections();
|
boolean hasAutoCreate = s.hasAutoCreateConnections();
|
||||||
|
|||||||
@@ -1173,6 +1173,10 @@ public class WallpaperManagerService extends IWallpaperManager.Stub
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
private Runnable mTryToRebindRunnable = () -> {
|
||||||
|
tryToRebind();
|
||||||
|
};
|
||||||
|
|
||||||
WallpaperConnection(WallpaperInfo info, WallpaperData wallpaper, int clientUid) {
|
WallpaperConnection(WallpaperInfo info, WallpaperData wallpaper, int clientUid) {
|
||||||
mInfo = info;
|
mInfo = info;
|
||||||
mWallpaper = wallpaper;
|
mWallpaper = wallpaper;
|
||||||
@@ -1279,7 +1283,7 @@ public class WallpaperManagerService extends IWallpaperManager.Stub
|
|||||||
saveSettingsLocked(mWallpaper.userId);
|
saveSettingsLocked(mWallpaper.userId);
|
||||||
}
|
}
|
||||||
FgThread.getHandler().removeCallbacks(mResetRunnable);
|
FgThread.getHandler().removeCallbacks(mResetRunnable);
|
||||||
mContext.getMainThreadHandler().removeCallbacks(this::tryToRebind);
|
mContext.getMainThreadHandler().removeCallbacks(mTryToRebindRunnable);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1337,7 +1341,7 @@ public class WallpaperManagerService extends IWallpaperManager.Stub
|
|||||||
< WALLPAPER_RECONNECT_TIMEOUT_MS) {
|
< WALLPAPER_RECONNECT_TIMEOUT_MS) {
|
||||||
// Bind fail without timeout, schedule rebind
|
// Bind fail without timeout, schedule rebind
|
||||||
Slog.w(TAG, "Rebind fail! Try again later");
|
Slog.w(TAG, "Rebind fail! Try again later");
|
||||||
mContext.getMainThreadHandler().postDelayed(this::tryToRebind, 1000);
|
mContext.getMainThreadHandler().postDelayed(mTryToRebindRunnable, 1000);
|
||||||
} else {
|
} else {
|
||||||
// Timeout
|
// Timeout
|
||||||
Slog.w(TAG, "Reverting to built-in wallpaper!");
|
Slog.w(TAG, "Reverting to built-in wallpaper!");
|
||||||
|
|||||||
Reference in New Issue
Block a user