本文介绍了如何阻止拨号,主页,返回和结束通话按钮在Android的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道我怎么能阻止拨号,主页,返回和结束通话按钮,在Android设备上。

I would like to know how could i block the dial, home , back and the end call button on an android device.

我知道这是可能的,因为有一个应用程序:TheftAware它阻断了所有的按钮,使他们没有任何效果可言

I know this is possible because there is an application : TheftAware which does block all the buttons so they have no effect at all.

我也想知道如何使一个对话窗口或任何窗口这将留在上面无论什么(这是在theftaware也做了)。

And I also would like to know how to make a dialog window or any kind of window which would stay on top no matter what (this is also done in theftaware).

他们也能够阻止(隐藏)呼叫屏幕......没有人知道他们是怎么做的呢?

They are also able to block(hide) the call screen... does someone know how are they doing that ?

请注意:这一切都意味着,Android是不是以后所有的安全

Note: Does all this means that android is not that secure after all ?

推荐答案

我只是想澄清的信息数位位置。

I just wanted to clear up a few bits of information here.

从BeRecursive的code的例子是不正确在几个方面。正如已经指出的,它不会挡住主页按钮,但它具有其它的问题:

The code example from BeRecursive is incorrect in a few ways. As already noted, it won't block the Home button, but it has other problems:

  1. 在以消耗的情况下使Android框架的其余部分将不在它的行为,则需要返回的onkeydown 处理程序,不可以 。该合同是表示处理的应用程序事件和所述框架应不执行默认的按键事件处理。 (普利文的code的例子也有同样的问题)。

  1. In order to consume the event so therest of the Android framework won'tact upon it, you need to returntrue from the onKeyDown handler,not false. The contract is thattrue means the application handledthe event and the framework shouldnot perform the default key eventhandling. (Praveen's code example also has the same issue).

从安卓1.5及更高版本开始,Android框架移动行动启动从的onkeydown 的onkeyup 。所以,你还需要实施拦截的的onkeyup 处理程序,而不仅仅是的onkeydown 处理程序。

Starting from Android 1.5 and later,the Android framework moved theaction activation from onKeyDownto onKeyUp. So you'll also needto implement the blocking in theonKeyUp handler, not just theonKeyDown handler.

有可能阻止 KeyEvent.KEY code_CALL 按钮使用这种技术,但不是 KeyEvent.KEY code_ENDCALL 按钮。这似乎是安全的原因。

It is possible to block theKeyEvent.KEYCODE_CALL button usingthis technique, but not theKeyEvent.KEYCODE_ENDCALL button. This appears to be for securityreasons.

最后,在设置的伎俩 WindowManager.LayoutParams.TYPE_SYSTEM_ALERT 并没有在实际上阻止任何的硬件按钮方面对我有什么影响。它可能是从其他应用程序中苏pressing弹出窗口是有用的,但我还没有探讨过这个充分。

Finally, the trick of setting WindowManager.LayoutParams.TYPE_SYSTEM_ALERT didn't have any effect for me in terms of actually blocking any of the hardware buttons. It might be useful for supressing popups from other applications, but I haven't explored this fully.

有很多很好的信息由Android团队中的。

There's lots of good information from the Android team in this blog post.

这篇关于如何阻止拨号,主页,返回和结束通话按钮在Android的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-19 19:58