Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bixby button detection #118

Open
12 tasks
sds100 opened this issue Mar 30, 2019 · 22 comments
Open
12 tasks

Bixby button detection #118

sds100 opened this issue Mar 30, 2019 · 22 comments
Assignees
Labels
enhancement New feature or request

Comments

@sds100
Copy link
Collaborator

sds100 commented Mar 30, 2019

two options for detection:

  • read logs which could in theory allow Key Mapper to treat the Bixby button like any other button. Downside is the user has to grant Key Mapper permissions with ADB and this is probably not very reliable and needs a lot of testing.

  • make a companion app that the Bixby button opens. This is restricted to short presses and double presses. This is probably a laggy way to do it (especially for keyevent actions) so this won't be an option.

  • only start reading the log if the bixby package is installed and there are remaps for it.

  • disable the button to remap Bixby if the Bixby package name isn't installed.

  • empty the log outputstream

  • Create a separate section of the app for Bixby and other special buttons.

  • If Key Mapper doesn't have READ_LOGS permission, show a card prompting the user to give it permission via ROOT or ADB. Show this card instead of the usual layout.

  • When backing up keymaps, also backup Bixby remaps.

  • make a custom screen with all the action and trigger options and constraints. Have a list of options and a list of constraints.

  • BixbyKeymap class with these properties: action, constraints, extras and flags

  • BixbyDetectionDelegate that accepts a logcat outputstream that is filtered to show only one line. The delegate will process the time of every new line to figure out what kind of press it is.

  • write Unit tests for the BixbyDetectionDelegate.

  • save a BixbyKeymap for short press, long press and double press to shared preferences using a custom serializer and deserializer. use SerializedName annotations.

  • logcat options: -v epoch to get epoch time, *:W filterspec, -e option to filter output

@sds100 sds100 added the enhancement New feature or request label Mar 30, 2019
@sds100 sds100 self-assigned this Mar 30, 2019
@sds100
Copy link
Collaborator Author

sds100 commented Apr 7, 2019

https://www.xda-developers.com/samsung-galaxy-s10-plus-bixby-button-remapping-update/

create a second launcher intent which when opened sends a broadcast intent telling the accessbility service the bixby button has been pressed. Find tester with S10 and S9. Advertise on XDA?

@ghost
Copy link

ghost commented Feb 28, 2020

Ready to be a tester (rooted S10+), give me instructions.
The bixby remap option in open source app is very apreciated for samsung users.

@sds100 sds100 assigned ghost Feb 28, 2020
@sds100
Copy link
Collaborator Author

sds100 commented Feb 28, 2020

Hi, thank you for offering! Right now I'm very busy studying so development is really slow until August. First I want to get the 2.0 release https://github.com/sds100/KeyMapper/projects/4 out, then I can focus on all the little features. Bixby button support will definitely be high priority! I would really appreciate some feedback on this layout for the 2.0 release... #299. Thank you.

@ghost
Copy link

ghost commented Feb 29, 2020

Ok)

@sds100
Copy link
Collaborator Author

sds100 commented Jun 8, 2020

@exili0n Does Samsung offer a way to remap the Bixby button on your phone?

@ghost
Copy link

ghost commented Jun 14, 2020

@sds100 hi, at the moment i'm usin Lineage OS (custom rom), and it has this feature built in, but stock samsung rom allows officially single or double press remap on some apps. With root you can remap single press to som basic features (there is info on XDA) and there are some apps in google store that allow to remap not only single press, but double and long press to lots of actions, but you need eather root or give it permissions via ADB, gues it is running as catch press service...

@sds100
Copy link
Collaborator Author

sds100 commented Jun 18, 2020

Is this what you were referring to? If you remap the Bixby button to another button (e.g the recents button) with this tutorial, does it show up in Key Mapper as the "recents" button? https://forum.xda-developers.com/galaxy-s8+/how-to/root-remap-bixby-button-o-app-t3601061 If so, this would be a great way to do it if people have ADB because then Key Mapper doesn't have to treat the Bixby button in a special way and restrict how it can be used. Downside of this is inexperienced users could break their device and they have to know how to use adb.

@sds100
Copy link
Collaborator Author

sds100 commented Jun 18, 2020

This would be another way to do it: https://www.xda-developers.com/tasker-beta-remap-bixby-button/
Key Mapper would create another "app", which can be launched when Bixby is single pressed or double pressed. In Key Mapper, I would create a separate screen to remap "special" buttons to guide the user. I think Key Mapper would then have a generic way to assign actions to an "app" so other devices and apps can launch Key Mapper actions by launching an "app".

@sds100
Copy link
Collaborator Author

sds100 commented Jun 18, 2020

@exili0n could you join the Discord server so we can easily test and discuss with the other people who have Bixby buttons? I think we have figured out a way with logs to detect when the Bixby button is pressed but I am not sure how reliable it is.

@ghost
Copy link

ghost commented Jun 23, 2020

@sds100, yes, this is the right guide i tried, buti guess it works only with root permissions, in playstore there is app called "Button Mapper" it can do the trick with granting premission via ADB. Momentaly i can not test the thing you are asking, becouse i moved to Lineage OS and don't have root, but i guess next weekend i can flash stock rom on my second samsung and root it. As soon as i test it, i'll report) The second coise is interestig as well, but first one is more functional and clear, the app can give certain instructions how2adb, it made so in app i mentioned, the first option with limited possibilities - remap bixby with samsung stock option on eather single or double press to some limited actions, second - remap with adb, almost everything can be remapped, and third - root method, there you can remap to every option that is present in app, bud i personnaly dont trust closed-source apps to have such permissions...)
I don't have discord, i'll try to reply faster here))

@sds100
Copy link
Collaborator Author

sds100 commented Jun 23, 2020

That's fine. This other person in Discord helped me to figure out how to determine when the Bixby button was pressed down and released by reading the logcat. The script Button Mapper runs just gives the app READ_LOGS and WRITE_SECURE_SETTINGS permission and disables the com.samsung.android.bixby.agent package. I would do the same in Key Mapper but I probably won't make a fancy Windows program to do it for the user. The one problem with this detection method is it somtimes has unpredictable behaviour. And for some reason it outputs a line after holding it down for 500ms, which makes detecting when it is pressed down and up more complicated. Double pressing it really fast has strange behaviour too. Because of all this, I've decided I don't want any "special" buttons to be remapped like normal buttons in Key Mapper. Key Mapper has complicated detection logic and it relies solely on reliable key "down" and "up" events. I don't think I could get this to work well with the Bixby button without too often messing up other keymaps someone could have. I would like to try and figure out the pattern in the logs. I just realised another problem with this method. Because the exact same line is outputted everytime it is pressed down or up or held down etc, Key Mapper has no way of knowing what is a "down" event or an "up" event. I'd really like to figure If the user is rooted I could probably get it to work like the other buttons with the getevent command. Like I did in #129 I also up for adding a feature to save an action to an app so it can be remapped with Samsung's stock method.

Once you get your stock Samsung device running, let me know. Thank you.

@sds100 sds100 mentioned this issue Jun 24, 2020
24 tasks
@jstetten
Copy link

jstetten commented Sep 4, 2020

Hi. Great app! If you do manage to find out how to map the Bixby button I would be more than happy to test it on my non-rooted Galaxy S9, if it would work. Cheers.

@GL513
Copy link
Contributor

GL513 commented Sep 30, 2021

#680 would be of use pertaining to this. Old issue, but new solution. Hope that helps.

@sds100
Copy link
Collaborator Author

sds100 commented Sep 30, 2021

yeah

@Candlemass
Copy link

Hello,

Was this ever completed?

I'm using an S9+ with Lineage OS and trying to find a way to remap the bixby button to flashlight.

Rooted exynos model.

Cheers.

@sds100
Copy link
Collaborator Author

sds100 commented Feb 14, 2022

Hi, I still haven't done this but since you're rooted you can work around this. https://docs.keymapper.club/faq/#can-i-remap-my-bixby-button

@Candlemass
Copy link

@sds100

Thanks for the advice. I read the XDA thread suggested on the bottom of the page your linked to but there doesn't appear to be any code indicated for what the flashlight command is. Also the bad news is that apparently it doesn't work with the screen off which would defeat the whole purpose of doing this since you'd have to unlock the screen first anyway.

The second option mentioned is bxactions which I have already tried but because lineage OS has no default setting for the bixby button, when the app asks to grant it permission to the key there is no permission present for it other than the volume keys.

Still looking for an alternate solution I guess.....

@sds100
Copy link
Collaborator Author

sds100 commented Feb 15, 2022

@Candlemass Oh, you want to detect it when the screen is off. That is pretty much impossible without Xposed unfortunately.

@Candlemass
Copy link

I have no problem with installing Xposed.

The issue is that the install of Xposed listed in my magisk app always fails upon trying to.

@sds100
Copy link
Collaborator Author

sds100 commented Feb 16, 2022

@Candlemass which xposed are you using? I'm not sure if there is already an app that can remap the Bixby button with xposed but I know it is the only (good) way that is technically possible.

@Candlemass
Copy link

@sds100

The version that's available to me on Magisk is 58. Every time I try to install it on Lineage it fails.

The ROM I'm running is based on Android 11.

@Candlemass
Copy link

?????

@sds100 sds100 mentioned this issue Sep 4, 2024
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants