boolean () { Application application = ApplicationManager.getApplication(); boolean isHeadless = application.isUnitTestMode() || application.isHeadlessEnvironment(); return !isHeadless || shouldKeepTasksAsynchronousInHeadlessMode(); }