It seems that Google is finally focusing on user privacy and security with the next version of Android.
This claim may look a bit far-fetched, but it is likely that the company is working on introducing a new feature in Android P where the system will not allow idle background apps access to the camera.
What is interesting is the fact that this new version of Android could be weeks away from an official announcement as the annual Google developers conference is just around the corner. According to a report by XDAdevelopers, a commit in the AOSP code hints at Android P preventing idle background apps from using the camera hardware. This will ensure that any rogue app cannot take any compromising image or video from the front or the back camera without the permission of the user.
To ensure that all apps stay in line, the system will keep a track of the User IDs (UIDs) of the apps, a unique identifier that Android assigns to all apps at install. It will check if an ‘idle’ UID requests camera service. According to the report, Android P will restrict access to network and CPU intensive services for the apps in the background when the device is in ‘idle’ Doze state. Every time the UID will request camera access, the system will generate an error for the corresponding inactive UID.
According to the report, this approach is an evolution of the changes that were made to camera service with Android Marshmallow 6.0. Before that, all apps were given camera access depending on which app requested for the access first. With Marshmallow, apps that displayed user-visible activity and in the foreground were given preference.
As mentioned in the beginning, this is a big deal because this will bake the restrictions to a system level to ensure that no app can manipulate the system to breach the privacy of Android P users. As pointed out in the report, even trying to hide the app with a foreground service will ensure that a notification is served to users with the name of the service running in the background.