-
Notifications
You must be signed in to change notification settings - Fork 90
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
Expose bthf #79
Expose bthf #79
Conversation
I think we can use the BTHF CallStatus signal handler or another BTHF method to suppress the native call screen from trying to take over from trying to steal video focus
I use many variations from this commit so I know that this compiles and runs well at this point |
I think you are the right track here for making the phone calls work correctly. This related to the input freezing issue which I think is very similar to the backup camera problems we had to work around. Basically the car OS tracks input focus and video focus separately. There are a variety of surfaces available and video output for AA goes on the "TV_TOUCH_SURFACE" whereas the normal car UI is on "JCI_OPERA_PRIMARY". When the phone asks for video focus we tell the car to switch to the TV surface (via the SetRequiredSurfaces DBUS call) and start capturing input. However when the phone call happens (or backup camera too but different surface) the car switches back to the Opera surface but there is no event to tell us that, so the headunit code keeps handling input, which results in the car UI not working. Pressing "Home" gives up input and video focus so that's why it makes the UI work again. So it seems like there a few options here:
So it seems like the CallStatus signal there is a good place to start but I'm not sure if has the right statues or even what the status codes are. |
bool waitsForFocus = false; | ||
|
||
MazdaEventCallbacks& callbacks; | ||
NativeGUICtrlClient guiClient; | ||
BTHFManagerClient bthfMgr; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
moved this to VideoManagerClient to use the bthfstate signal to keep video focus #79
I started to attempt option 2 before I saw this but all it does right now is log some return values of CallStatus like bthfstate at certain points so I can look at the logs. I've been brushing up on my C++ skills and I am just learning the difference between a &reference and a *pointer, ha. Anyways bthfstate is all we need for a trigger it goes like this:
So if I remember my C++ correctly that will always be false when 0 and true when something else so that is the trigger. |
OMG I just now understand how protobuf works hahahaha. |
I was toying with something in the JavaScript code, overwriting the
So now we have a few angles to try. EDIT: So this works perfectly in my emulator https://mzd.mazdatweaks.win but not in the actual car for some reason it seems like the JavaScript is not working at all which is so strange it should at least do something. But this is leading me to believe its going to have to be a native code fix within headunit that handles this. |
@lmagder Hey so I don't really know how to do this but the HU is sending a 32769 message over channel 8 the BT channel so that may help us take control of the video by controlling the audio, get me? or at least it might make it run smoother, here is the error: |
@Trevelopment You are the developer of AIO? Nice! well good work 👍 seems like there is a lot of crossover between the projects. To be honest I actually don't have very much experience with JS dev which is likely the source of bugs like #62, maybe you have ideas? We have like the opposite development background 😃 I added a HTTP-based API to the headunit process so that the js code could call it and that seems to work, so if we could get this information somehow in JS land then it's a possible solution. Ideally though the JS portion is as simple as possible since it seems to be the part the changes most OS version to version, but I'm not against the idea if the result is good. You could use the status request (see AAlogPoll in https://github.com/gartnera/headunit/blob/master/mazda/installer/config/androidauto/jci/gui/apps/_androidauto/js/_androidautoApp.js) to query if AA currently has video focus. GETing Alternatively the JS code which switches the surfaces actually fires a DBus message via a custom opera plugin (using the same API headunit uses) so if we could somehow snoop those messages on the C++ side or intercept them it would work too maybe? I have no idea about the media start stuff in the AA_CH_BT that channel is super stubbed out. Maybe it's trying to tell us to route phone audio over BT or something. I was hoping we wouldn't need to figure this out but possibly we do once we fix the other stuff and it still doesn't work... |
### Mapped Unused Keys: - Call Answer: Phone Screen (Answer Call) - Call End: End Call - Fav - AA Home Screen - Nav - Attempt to take back video focus + fix trailing spaces
@lmagder Cool man in my experience the best colab sessions I have had are with hackers with opposite skill sets as mine. Also, I always learn a lot from these kind of things and I have already went way past the C++ knowledge I had 13 years ago. Hopefully I can teach you a few things too like how to fix #62 is super easy. You can actually fix it a few ways but the easiest way is just to remove |
You don't have to merge this I just wanted to show you what the baso of my madness consisted of. Nothing I did with the signal handlers or the bthf methods worked but I think its just because I didn't know how to use them correctly. so I went off on like 20 different branches off this commit but I'm getting rid of most of them because now they just look like a crazy person did them.