To capture the screen without your overlays, you need to make sure that your floating window is transparent. You can achieve this by setting the alpha value of your floating window to 0, which will make it completely transparent.
Here's an example of how to create a transparent floating window:
// Create the layout for the floating window
View floatingView = LayoutInflater.from(this).inflate(R.layout.floating_window_layout, null);
// Set the alpha value of the floating view to 0 to make it transparent
floatingView.setAlpha(0);
// Set up the layout parameters for the floating window
WindowManager.LayoutParams layoutParams = new WindowManager.LayoutParams(
WindowManager.LayoutParams.WRAP_CONTENT,
WindowManager.LayoutParams.WRAP_CONTENT,
WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY,
WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL,
PixelFormat.TRANSPARENT);
// Add the floating window to the window manager
WindowManager windowManager = (WindowManager) getSystemService(WINDOW_SERVICE);
windowManager.addView(floatingView, layoutParams);