简体   繁体   English

在无障碍服务中禁用 Android 中的触摸屏

[英]Disable touch screen in Android in accessibility service

I am developing an Android application for the deaf and blind using the accessibility service我正在使用可访问性服务为聋哑人和盲人开发 Android 应用程序

Need to disable the touch screen, because android app is controlled through a third-party device需要禁用触摸屏,因为android app是通过第三方设备控制的

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我试图向 WindowManager 添加一个视图并禁用那里的所有内容( FLAG_NOT_FOCUSABLEFLAG_NOT_TOUCHABLE ),但据我所知,它仅在此视图中禁用了触摸屏,但根本没有

I can request any type of permission except the root我可以请求除 root 之外的任何类型的权限

EDIT:编辑:

Due to Android security, disabling the touchscreen is not possible without root由于 Android 安全性,在没有root 的情况下无法禁用触摸屏

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.和 2. 覆盖 onBackPressed 并且永远不允许它调用 super.onBackPressed() 或在 OnPause() 方法中重新启动您的应用程序。

Hope this helps somewhat.希望这会有所帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM