-
Notifications
You must be signed in to change notification settings - Fork 74
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
remote hci android app #312
Conversation
3f09468
to
246b119
Compare
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.
Lgtm! Also added @DeltaEvo and @SilverBzH since they have way more expertise on this than me 😄
FYI, I tried running bumble-pair and starting pairing from Android, it was stuck at the following step:
The packets were sent over from the other device, I guess some packets are discarded. |
Have you considered writing this in a command line app? Why is a GUI app is needed |
I am quite surprised this can work... |
You’re right that the UI isn’t essential here. But I wanted a Java-only app for simplicity (easier to debug, more people are familiar with it on Android), and I don’t know of a way to write an Android Java app that can be purely a CLI app with no activity. Plus, writing Kotlin and Java is much nicer than C++. |
You’re right. I wanted to start with something simple that most users could try out easily for themselves and send feedback/contribute, but it should evolve over time to offer more options for automation, including with things like a Mobly RPC interface. |
The issue is fixed now in the latest commit. |
Can we have a workflow for this? Like building, and running some simple tests with Android Emulator. |
Yes, that would be great. I didn't have time to look into it yet (many steps, involving downloading SDKs, etc, there are GH actions available for it but they need to be investigated). It will also require running the emulator with SELinux disabled. I propose doing that as a future PR. |
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.
LGTM.
mListener.onMessage("Waiting for connection on port " + mPort); | ||
try ( | ||
ServerSocket serverSocket = new ServerSocket(mPort); | ||
Socket clientSocket = serverSocket.accept() | ||
) { |
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.
In case user select port 0 (allocate by the system)
mListener.onMessage("Waiting for connection on port " + mPort); | |
try ( | |
ServerSocket serverSocket = new ServerSocket(mPort); | |
Socket clientSocket = serverSocket.accept() | |
) { | |
try ( | |
ServerSocket serverSocket = new ServerSocket(mPort); | |
mListener.onMessage("Waiting for connection on port " + serverSocket.getLocalPort()); | |
Socket clientSocket = serverSocket.accept() | |
) { |
I mean a simple cmd program with no UI. I think for this purpose, GUI seems to be an overhaul, which makes it even harder to control (if we consider using it in some automate workflow). Also, if we have a cmd program, it is always easy to wrap it in a GUI app. |
I don't think there is any way to create CLI program in Android besides NDK. A proper way to achieve that is through instrumentation, which allows launching over |
For sure, a UI-less mode would be useful as well. That's why I separated the UI (MainActivity.kt) from the proxy implementation (HciProxy.java) with a simple HciProxy class that can be instantiated by just passing a port number and a listener. So we could easily add a ui-less host that just uses the HciProxy class. Another option I'm considering going forward is to make the HciProxy into a service (currently it just runs in a regular thread, for convenience). |
Yes, NDK is the android native toolchain. Actually there are some key differences. In addition to the difference in taking user inputs, other differences I have experienced include: when the screen is turned off, or some other app is brought to foreground, the app is is not working anymore. I think there are other ways to avoid this though. |
Should we go for |
For running in the background while other apps are in front, running as a background service rather than just a thread started from the main activity will do that. I intend to implement that in a separate PR. |
Would just starting the activity from |
It can reduce the amount of files required in bumble sources, but apart from this I don't know |
A simple kotlin+java HCI proxy app that can be built as a simple user app without checking out the AOSP tree.