Android P will refuse the camera to access the background application

According to androidauthority XDA Developers found the source code submitted, Android P will detect and prevent background applications to access the camera.

The restrictions are based on the application’s user ID (UID) that Android assigns to each application installed on the device. UIDs are unique to each application and as long as these apps remain on your device, these UIDs will not change. The submission status indicates that Android P will detect when the UID is “idle,” and if an inactive UID is requested for camera access, an error will be immediately generated to prevent access to the camera.

Android P

Image: xda-developers

Previous Android 8.0 requires the application to display notifications when using the camera on its own initiative. Therefore, Android P camera restrictions can be seen as an extension of existing measures. This feature is a good deterrent to malicious applications that silently record video or take pictures without their knowledge.