'Disable touch screen in Android in accessibility service

I am developing an Android application for the deaf and blind using the accessibility service

Need to disable the touch screen, because android app is controlled through a third-party device

I tried to add a view to WindowManager and disable everything there (FLAG_NOT_FOCUSABLE, FLAG_NOT_TOUCHABLE), but as far as I understand, it disabled the touch screen only in this view, but not at all

I can request any type of permission except the root

EDIT:

Due to Android security, disabling the touchscreen is not possible without root, but you can use Proximity Sensor to disable touchscreen until first power button pressure



Solution 1:[1]

Congratulations and good will for you are working for a good cause.

Not sure exactly how to do this but One way is to create a full screen activity - hide navigation bar and soft navigation buttons also -- please refer this documentation

And 2. override onBackPressed and never allow it to call super.onBackPressed() or relaunch your app in OnPause() method.

Hope this helps somewhat.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 mayank1513