Android P will Prevent Background Apps from Accessing the Camera
Yes, it is too early to talk about Android P, the next major version of Android as it's going to be at least a few weeks before it will be unveiled and a few more months before it's rolled out. We know that it’ll let carriers hide signal strength and define how they’re displayed in the status bar. It is speculated to support phones with multiple screens and notched displays, and it could also come with a call recording tone feature.
Our friends over at XDA Developers did some digging and found new rule-sets in Android P will prevent idle background apps from accessing the camera, which will ensure that apps running in the background cannot take pictures of you without your knowledge. The rule targets apps' UIDs, the identifiers Android assigns each application upon installation. It doesn’t change as long as an app remains installed on your device.
When the camera service detects that a UID is in an idle state, the operating system will generate an error and revoke access to the camera. Subsequent camera requests from the inactive UID will immediately generate an error, preventing the application from gaining camera access until it is active again.
Long overdue change
Limits on background app camera access are long overdue. In 2014, a developer published a blog post explaining how applications could secretly take photos and record videos by manipulating Android’s camera permissions. Using a clever exploit the developer was able to gain access to a Nexus 5‘s camera without alerting users to the app’s activities even when the app was running in the background, and the phone’s screen was switched off.
With Android P‘s background camera limits in place, malicious apps would be easier to detect as they would need to implement a foreground service to stay alive. The app would have to display a notification telling you the app is running and that the app is displaying on top of other apps. If an app tried to remain hidden in the background, it wouldn't have camera functionalities.
Once again, it's too early to talk about Android P. A good chunk of recent devices are yet to get Oreo, so it'll be a while before we can see Android P in action. But we're glad that it comes with safeguards that will make spying on your a bit harder than it already is.
Source: XDA developers