One of the biggest issues with Android right now is how every smartphone OEM handles applications running in the background. Every OEM has its own take on background tasks, with some being overly aggressive in killing them which leads to delayed notifications and apps behaving weirdly. This was highlighted by the folks over at Android Police in an article recently and how it affects smaller developers as they have to spend more time and resources in resolving these issues.
In a Reddit AMA, the Android engineering team was asked about this problem in response to which they have highlighted the steps taken in Android 11 to curb this issue. The team notes that the topic of background kills is a "complicated" one and that it has been talking to various Android OEMs to understand as to why they do this. The reasons vary and include not just preserving battery life and resources, but to also protect users from misbehaving apps.
Starting with Android 11, Google is updating its Compatibility Definition Document (CDD) to ensure that OEMs alert "users of the app restrictions in a timely manner" to avoid delayed or missed notifications. It is also making it mandatory that OEMs do not create a whitelist for top apps as this is unfair for smaller developers and affects the entire app ecosystem negatively. Google is also working with "top device manufacturers" to fix CDD violations, with many for them rolling out the changes in the latest firmware of their flagship devices.
To make lives easier for developers, Google has introduced a new API that will allow developers to know why their app was killed. Additionally, there are new measures from Google to make Android more resilient to abusive and misbehaving apps.
While these changes sound good on paper, the Android engineering team itself notes that they will not solve all the issues related to the background killing of apps. The "finish line" is still far but the team is committed to working on a fix for this issue to deliver a better experience for users as well as for developers.
Source: r/AndroidDev