You can detect external touch event in your application.
WINDOWS_SERVICE which is system service, can provide you with the information of touch on the Android device, for that you need one layout which should be of unit size of pixel so that it doesn't consumes you click event on external applications.
mWindowManager = (WindowManager) getSystemService(WINDOW_SERVICE);
WindowManager.LayoutParams params = new WindowManager.LayoutParams(
1, // width is equal to 1px
1, // height is equal to 1px
WindowManager.LayoutParams.TYPE_PHONE, // Type Phone, These are non-application windows providing user interaction with the phone
WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | // This window would never get key input focus.
WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH, // This window will get outside touch.
PixelFormat.TRANSPARENT // The view will be transparent
);
Now you have to add you layout to this window manager service.
//Adding view to the window manager
mWindowManager.addView(touchLayout, params);
For better explanation with code you can refer this link
http://allinmyspace.com/2016/08/28/android-detect-touch-events-on-external-applications/