On Fri, 5 May 2023 14:58:15 GMT, Alexander Zvegintsev <azveg...@openjdk.org> wrote:
> Do we really need to add this new API? probably we can implement the feature > w/o this new method? Please review the changes to remove resetScreenCapturePermission The token is now stored together with the bounds of the screens for which the screen capture was allowed. Now when we want to take a screenshot, we create a list of the bounds of the system screens that have the data we're interested in. Based on this list, we pick up the tokens from the previously saved ones: a. exact match of the bounds of the screens b. the same size(screens can be moved, while the old token for them works) We try to get an image with these tokens, checking that the previously associated bounds have not changed and we get the image from the capture area available to us. If, for some reason, the old token is withdrawn, a new permission will be requested to capture screens. If none of the tokens worked, we try to get a new permission. If none of above worked, we throw a SecurityException. ------------- PR Comment: https://git.openjdk.org/jdk/pull/13803#issuecomment-1553360491