4

Based in this answer I think that exists a solution at least to system apps (or probably also in rooted devices?). Happens that i not understood the code example linked on answer comments. Someone could explain a step by step to achieve this please (with a code example if possible)? Thanks in advance.

3 Answers3

2

Because of androids way of handling screenshots, excluding the overlay is not possible. But you could, as stated in your link, make the screenshot without your overlay.

This would result in having unrendered holes in your screenshot, whrere there would be only a black background.

If you want that, you could easyly just make your overlay black of the second you shoot the screenshot, or even disable the visibility, to get a clean screenshot. To give you a more detailed answer, we would need a more prescise question with examples and ideas how you wrote your code.

EDIT:

The problem is, that you could theoretically dig into androids source code and change the screenshot behaviour. But with that you would create a new Android version on your own. As @Hassan Uddin stated. Running that on your phone would require you to dig deep into androids source code and possibly not find any answer there.

TIMBLOCKER
  • 328
  • 4
  • 15
  • This long comment could be include on answer, except this part ( **If you want to get the excact answer from that post, why not ask under that post if you can get any help from @reker? He seems to have gooten to the point you need to know?** ) above and then deleted. –  Aug 10 '21 at 02:16
0

It is not possible because it's like a security feature. If you are willing to spy on someone's screen, then you are too late it's 2021... the OS will not let you do so... you have to MOD the OS instead

Hassan Uddin
  • 417
  • 5
  • 10
  • What you understood about linked answer on my question? –  Jul 30 '21 at 18:04
  • 1
    @Coringa Already told you bro.... it's possible and everything is possible if you violate the system software somehow (e.g. using root permission.) >> By the way, he talked about to see OS's [source code](https://android.googlesource.com/platform/frameworks/base/+/b267554/services/java/com/android/server/display/OverlayDisplayAdapter.java) here you can only understand how it generally works.... Android is an open source operating system. Your Manufacturer might be Modified it for your phone or not, hope you got the ans this time ------- – Hassan Uddin Jul 31 '21 at 04:52
-1

You can not exclude overlay from screen capture. you can hide or make it transparent in case of your overlay. you can not handle third part overlay.

Imtiyaz Khalani
  • 2,037
  • 18
  • 32
  • [This is possible](https://stackoverflow.com/a/41031064/13342561). But unfortunately i and you not know do. **-1** –  Jul 29 '21 at 19:46