Exclude restartAppIfNecessary from generated code. Make a call to runCallbacks if restartAppIfNecessary is going to return true