I did a little bit more tests today. And I found that iOS does not really suspend the app while it's in the background state anymore. Here's how I test it.
while(true){
napLock.wait(timeout: .now() + napDelay)
looperLog.i("running")
}
It's running on a worker thread. When the app is in the background state, the iOS will suspend all activities of this app before iOS 13.5. So there should be no more logs in the console. But after several switching between the foreground state and background state, iOS stops moving this app to the suspended state, so the app keeps running in the background. I think that's why there are so many apps showing a long running background activities in the battery usage page. Because all the apps are in background state rather than suspended state, so the system sees them as running in the background. I haven't migrated to the new UIScreenDelegate, so I'm still using AppDelegate to manage window and transitions. If there's some new features about it, shouldn't be applied to my app. This kind of thing changed the whole lifecycle, but there's nothing about it in the release notes.
I think that's the reason why iOS 13.5.1 is draining battery so fast. Because all the apps are permitted to running in the background without a limitation of time.