这是indexloc提供的服务,不要输入任何密码
Skip to content

Termux should handle commands spamming the bell better. #442

@easyaspi314

Description

@easyaspi314
$ mv ~/.termux/termux.properties ~/.termux.properties.bak # reset to vibrate only
<relaunch>
$ while ; do tput bel &; done; # more temporary alternative: cat `which bash`

Snap, crackle, pop, until you force stop. No other way to stop it. Termux freezes, so you can't Ctrl+C, hit Exit on the notification, or swipe away.
Need I say more?

Ideas:

  • Have a minimum delay between bells, probably 25 ms (half vibration time) at the least. This will fix the crackling from the Vibrator trying to activate before it is "ready". If we get any bell signals during that delay, we will wait until that delay is over, then beep/vibrate once:
Signals: bell bell bell bell bell bell bell bell bell
Output:  bell                bell                bell
Signals: bell     bell     
Output:  bell                bell
Signals: bell                           bell
Output:  bell                           bell
  • Don't block the thread so the user can Ctrl+C it. This stupidity in the Android OS seems relevant; as it seems that Termux is attempting to run the bell on a separate thread.

"Like many callbacks from the system, the methods on this class are called from the main thread of your process." — ServiceConnection documentation

  • If spamming is detected, perhaps give a Snackbar saying something like "A command is repeatedly using the bell." with an option to temporarily silence it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions