Loading
Access process fields only when valid
In some cases we can tear down ServiceRecord bookkeeping before its hosting ProcessRecord has been established. Make sure that we don't attempt to reference ProcessRecord information unless we've already established that it's available. In this case, the service can't be in the FGS state until the app's code has begun running and has called startForeground(), so checking `isForeground` provides the guarantee. Fixes: 197070543 Test: atest CtsAppTestCases:android.app.cts.ServiceTest Change-Id: I429c31c7ea87625b380a1ed70b6a1d9afa45bdb3