什么是修改安卓键盘布局以使用按键唤醒系统的现代正确方法?

huangapple go评论73阅读模式
英文:

What is the modern proper way to modify an android keylayout to wake the system from sleep with a key?

问题

以下是已翻译的内容:

有很多搜索结果解释了您可以通过修改键位布局文件来使您的Android手机可以通过修改音量键按键来唤醒。您只需在相关的按键上添加"WAKE"或"WAKE_DROPPED"。

例如,要允许音量增加键唤醒Android:

/vendor/usr/keylayouts/MyKeyboard.kl

key 115 VOLUME_UP WAKE

这似乎不再适用。"WAKE"标志似乎被忽略。此外,如果我使用"WAKE_DROPPED"来使用"validatekeymaps"工具,您会发现它不再被识别为有效选项。

validatekeymaps MyKeyboard.kl
期望的按键标志标签是"WAKE_DROPPED"。

另一方面,如果我将按键更改为发送POWER键,系统将被唤醒。

/vendor/usr/keylayouts/MyKeyboard.kl

key 115 POWER

系统会在有或没有"WAKE"标志的情况下唤醒,因为似乎POWER键具有其他属性来告诉系统唤醒。当然,这会破坏音量增加的功能,这是不希望的。

所以我的问题是,如何在按键上设置"WAKE"属性的新正确方法是什么?"WAKE_DROPPED"又是什么情况?

英文:

There are plenty of search results explaining that you can modify your android phone to wake up due to a volume key press by modify the keylayout file. You are to simply add WAKE or WAKE_DROPPED to the key in question.

An example to allow the volume up key to wake android:

# /vendor/usr/keylayouts/MyKeyboard.kl
key 115 VOLUME_UP WAKE

This doesn't seem to be applicable any longer. The WAKE flag seems to be ignored. In addition, if I use the validatekeymaps tool with WAKE_DROPPED, you can see it is not even recognized as a valid option any longer.

> validatekeymaps MyKeyboard.kl
Expected key flag label, got 'WAKE_DROPPED'.

If on the other hand, I change the key to be sent to be the POWER key, the system will wake up.

# /vendor/usr/keylayouts/MyKeyboard.kl
key 115 POWER

The system wakes up with or without the WAKE flag is it seems the POWER key has some other attribute set to tell the system to wake up. This of course breaks the volume up functionality and is undesirable.

So my question is, what is the new proper way to set the WAKE attribute on a key? What about WAKE_DROPPED?

答案1

得分: 3

你现在无法在键上设置WAKE属性。已经移除了唤醒标志。唤醒键由KeyEvent.isWakeKey定义。

英文:

You can not set the WAKE attribute on a key now. The wake flags was removed.
The wake key is defined by KeyEvent.isWakeKey

huangapple
  • 本文由 发表于 2023年2月8日 22:03:38
  • 转载请务必保留本文链接:https://go.coder-hub.com/75386908.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定