80e88d8383
The system will crash the app if the worker that calls setForeground() finished before the service runner be able to call Service.startForeground(). This edge case is not handled by WorkManager and there is no way to check if the required calls are done. So here we suspend the worker by an arbitrary duration assuming the transition to foreground service is done by then. (cherry picked from commit 24e1b4034efe24cc042404e2237f01ca1f2cd9b3)