keymapperorg / KeyMapper

An Android app that change what the buttons do on your devices!
http://docs.keymapper.club
GNU General Public License v3.0
1.09k stars 154 forks source link

I want to set an accessibility shortcut to toggle "Sensors Off" quick access shortcut. #1092

Open User198263321 opened 2 years ago

User198263321 commented 2 years ago

Developer TODO (don't remove)

TLDR: Bind accessibility shortcut (volume up + power) to toggle quick settings shortcut (Sensors Off)

Here is my problem. I can't find literally any way on the internet to link "Sensors Off" quick settings developer tile to an accessibility shortcut. The shortcut is built into my Samsung device and it would allow me to press volume up and power button at the same time to instantly toggle this setting. Is there any way (using this app or not) to get something like this to work? Here are my reasons for this:

Toggling "Sensors Off" disables all camera sensors, light sensors, and rotation sensors. Basically every sensor on the device, which is great for privacy because any app can access these sensors and use it for telemetry with no permissions required. The obvious issue with this is that I can only toggle it when I swipe down to view my quick settings panel and toggle it. This gets tedious quickly because I would have to do this every time I want my auto brightness to kick in, launching the camera, and to rotate the device to portrait or landscape. Having this mappable to a button is pretty much the only reasonable way that I can take advantage of disabling sensors on my device like this without rooting it.

Ideally, this is what would happen:

I would set a custom trigger in your app which would rely on the accessibility shortcut (Vol up + Power) to piggyback your service (don't even know if I would need to enable the accessibility service for your app if I do this), and I would tell your app to toggle a quick setting icon that is on my device (in this case, Sensors Off). I would use ADB to give your app more permissions for this if necessary.

It would be nice to have vibration feedback as well.

Unless there is an easier way to do this with a different app that can add quick settings shortcuts to the accessibility menu, is there any way that I could do this using your app, or am I limited by Android?

User198263321 commented 2 years ago

If it's easier, I am fine with even just simple app support to disable the button service (like an accessibility shortcut override toggle) and rely on accessibility shortcuts to trigger actions. Then I can simply press volume up and power to pull up the quick settings panel and not even have your app running in the background

User198263321 commented 2 years ago

Right now binding any volume buttons screws with volume functionality and binding the power button doesn't work. Binding vol up and down buttons simultaneously also doesn't work.

sds100 commented 2 years ago

The only way for an app to control another app's tile is to execute cmd statusbar click-tile but this requires root access or Shizuku. Shizuku has the drawback that you have to do some setting up after every reboot if you aren't rooted. Is using Shizuku fine for you?

GL513 commented 2 years ago

Here's a quick link https://android.stackexchange.com/questions/214419/how-can-i-emulate-pressing-another-applications-quick-settings-tile