Allow screen capture for a specified uid.
Currently, screenshots can either be done on the entire display or for a layer hierarchy. Screenshots can only be taken by a system process or a process with the correct permission. This change introduces a way for an app to screenshot itself without introducing security issues The following checks are done: 1. If the request is from graphics or has READ_FRAME_BUFFER permission flag, the request is allowed. If a uid was set to non -1, only layers from the specified uid will be captured. If uid in args is -1, everything will be in the screenshot, so no layers will be skipped 2. If the request doesn't have the permissions, the calling uid is compared to the uid in the request. If they match, we allow the screenshot code to proceed and only screenshot the layers with the matching uid. 3. Otherwise, we return with PERMISSION_DENIED Test: ScreenCaptureTest Bug: 155825630 Change-Id: I129b5a7f489383bf6d2f0ee333a416babc1444a2
Loading
Please register or sign in to comment