Handling MotionEvents from AccessibilityService - General Questions and Answers

Greetings all,
I am working on an AccessibilityService that takes input from game controllers (PS5 controller, Xbox Controller, etc.), I am using OnKeyEvent() for handling button presses and releases ,however I am having a lot of trouble figuring out how to receive input from the Joysticks.
Generally I would use OnGenericMotionEvent() to handle MotionEvents from the joysticks, but since this is an AccessibilityService and not an Activity, it doesn't seem to have that method.
The MotionEvents I want to handle are as follows: AXIS_X, AXIS_Y, AXIS_Y, AXIS_RZ, AXIS_RY, AXIS_RX, AXIS_HAT_X, AXIS_HAT_Y, AXIS_LTRIGGER, AXIS_RTRIGGER, AXIS_BRAKE, AXIS_GAS
Does anyone here know how I could handle MotionEvents from an AccessibilityService? I've looked at the official docs and codelabs a lot but this has me stumped.
Regards,
0xB01b

Related

[APP]SciLor's WiMoBlue OLD Phone as Gamepad for HD2 :)

Hello Guys,
as I developed my SciLor's WiMoBlue for my very own HD2, I want also post it here
SciLor's WiMoBlue is an Application that allows to control a Windows Mobile Phone with another one. In my case my new HD2 with my old Kaiser. Playing FpseCE and Morphgear gets real fun Also you can use the "old" phone as hardware keyboard.
Download/Videos/Info available here:
www.scilor.com/wimoblue.html
PS: Please take a look at my WiMoBlue Bug Report section to give through any working Device combi! (Direct link on the right side of the video in red)
Looks pretty cool SciLor! Thanks a lot. And looks like it's time to get my fuze back Ready to see if this will work on my TP2.
genius, insane but genius
I'll give it a go tomorrow, I wonder if I could get my HD2 to stick to the front of my Advantage
fards said:
I wonder if I could get my HD2 to stick to the front of my Advantage
Click to expand...
Click to collapse
If you do so, make a Photo xD
Release of v3: www.scilor.com/wimoblue.html
Pre-Alpha v3(2010-02-23)
-Enhancement: Show Connection Status of the Server
-Enhancement: Controller disables the "Disconnect" Button. You can activate it by touching the form anywhere.
-Enhancement: "Gaming"-Hack for Hardware-Keyboards, that allows to hold and release multiple button, intending the first button is still hold if one of them is released. (Some Keyboards only send a KeyPress Event with the Keys Information, the Releasing Events are the same)
-Enhancement: Show "Idle" Curson on while connecting.
-Readme Mistake: Should work on any WM Device
Release of v4: www.scilor.com/wimoblue.html
Pre-Alpha v4(2010-03-04)
-Feature: Experimental WM Smartphone Client added (Tested on Typhoon with WM 6.1, but should work with any Smartphone with WM5 or higher!)
Release of v0.0.1: www.scilor.com/wimoblue.html
v0.0.1(2010-03-06)
-Enhancement: Controller/Server functions now in external DLL's which are Cross-Compiled for every supported system
-Feature: Servers/Controllers for Smartphone/Touchscreen/Desktop PC
-Feature: Multiple devices can be used now (Limited to 2 for now)
-Change: Removed Server Discovery Nag screen
-Fix: No error messages on exit if no controller is connected
-Fix: All Controllers now exit on disconnect
-Fix: Used an old library for the Smartphone client, now it is the newest one
Hi, I love the idea of this program. I got it to work fine with the WinMo start screen. But can't seem to get FpseCE to work with it. Using the same two phones (kaiser+HD2) am I missing something?
Tried assigning the hardware keys for use with FpseCE but with no luck, then resorted to pressing randomly with less luck. It's connected fine, thought I might have something set up wrong with FpseCE. Any help I'd appreciate, thanks.
Try to type in a text editor. If that works, which fpsece version do you have? I use the supporter.
To asign the keys in fpsece open the controller.screen and tap/double tap on the button you want to set (Do not press on the number!) Then ibstead of the numver on top of the button should get '--'. Then press your button on tge Kaiser and it should change to a number, thats it.
I've tried all that, I use the latest supporter version with Simon Mallions theme. Perhaps changing the theme back to default will help, i've tried everything else. Works fine with writing sms and word mobile, just fpsece not registering any key presses. Thanks for the reply, I'll try it again with the default skin.
I am currently reworking it. With a udp support, plugins etc.
UDP will allow to use it with your computer without bluetooth or use it over wifi if you phones do not have bluetooth.
I am currently fighting agains problems with bluetooth streams that may delay the Video Streaming of the other device
SciLor
Here some info about the upcoming version
http://www.scilor.com/myboard/viewtopic.php?f=4&t=126
o . _
Hi SciLor,
congratulations for all your projects. They are really interesting starting from FuelBlaster to WinMoBlue. You are an "insane" genius!!
I have tried WinMoBlue on my Blackstone (controlled) and my PC (Windows Server 2003 sp2 bla bla bla .NET Framework 3.5 SP3) but doesn't run....
In this case running the PC part doesn't start nothing. In the event viewer this error: Generate Activation Context non riuscito per C:\Programmi\SciLor\SciLor's WiMoBlue Server Desktop\32feetWidcomm.dll
The server part on Blackstone starts but naturally doesn't find nothing to connect...
In reverse mode (PC controlled - HD controller) there is no way to take control too. In this case it the PC returns error about bluestack not supported.
As Bluetooth device i use a CONITECH DAKOTA Bluetooth 2.0 EDR USB Dongle Class1 based on Broadcom Widcomm driver v5.1.0.1700
Hope this can help you for future development. Keep it updated: it has many prosepctives!!!
NiceOne
Nice to know that you like my projects
I think the bluetooth driver I use does not support your dongle .
In the next version (which is under heaving developement and may come in the next weeks) I will additional support wifi, so you may try it over wifi l8er. The best thing will be, plugin support, not only keyboard input, but also mouse input. AND a video stream from the other device .
GREAT SciLor: YOU ARE GREAT!!!
I've subsribed this thread and so surely I'll test your next releases.. ;-)
NiceOne and Regards!
Any possibility of having it so you press a touchscreen button on the phone and it corresponds to a button press on the other device.
Example:
Phone has a picture of a NES Controller on it. Tapping the A button on the screen presses A on the controlled device, thus allowing it to emulate various gamepads.
I am currently recoding WiMoBlue to a Remote Controlling Software with Plugins.
Adding such an plugin will be very easy I will try to add it!
its an improvement for the touchscreen games. i'd love someone to connect a joystick or a bt keyboard
This sounds awesome, ill keep an eye on this, wifi will make it even better
It works!
Hi Scilor, I have tested it with sucess, but with a few small problems, some that I will report after more tests, and some are in the end of the reply. thank you to keep working on this project.
I've controlled my HD2 with a smartphone, the HTC S711 AKA VOX (winmo 6.1) and it works well with FpseCE, but unfortunately not yet writing messages.
Small problems:
1- Some hardware keys still works in the smartphone after connected and not in the HD2, wich was annoying becouse sometimes I've unintentionally closed the program in the smartphone.
2- the "Fn" key doesn't work.
Thank you and sorry if I wrote something wrong.

[Q] Android Keyboard with Alt key?

Is there a way of submitting Alt commands via an Android keyboard to my windows PC?
I presently use Air Mouse on an Ipod Touch to control my HTPC remotely.
This is the only use I have for the thing and I'd like to think that there will be the perfect Android solution for me soon.
The benefit of Air Mouse over RemoteDroid and GMote is the Alt key ability which neither of the Android apps have (or if they have I haven't found it yet), a function I find a lot of use for.
(I should add that the only Android device I have at present is an HTC Desire....so I guess that could be the limitation rather than the apps)
I don't really understand what you mean by alt key ability. Could you please explain, and maybe we can help sugest a solution?
What is it that this alt key ability of air mouse do, or more importantly, what is it that you want to accomplish with such an alt key ability?
Thanks for the reply, I had a feeling I wasn't being very clear.
I'd like to use my Android device as a trackpad and mouse for my HTPC.
My media player of choice (MPC-HC) uses a lot of keyboard shortcuts with the "Alt" signifier. For example Alt+X closes the program. These shortcuts are especially important because the program runs in a fullscreen mode which removes any context menus.
All the various android soft keyboards I have seen have no Alt key so I would lose a lot of functionality controlling the HTPC from an android device.
I have read that pressing the trackball twice on an HTC Desire may be a substitute for pressing the "Alt" key but have never got this to work in practice.
Just found an app that might suit your needs. I suggest you check it out.
GRemote Pro
Edit:
Ok, I just tried this app out, and it does exactly what you need.
It comes packed with an app alt, ctrl, tab and del buttons that let you alt+tab among other things.
I didn't see MPC-HC in the server setup, but that's not a problem as you can configure your own profiles with specific commands.
Fair warning, it's a bit on the slow side (seems to be a port of a winmo app), but I'm sure it'll get better with time and updates. It's a very polished Remote app for android and it even comes with drivers for a G-sensor controller to play games with (use android as wii-mote/controller).
This app defenitly rocks.
You sir (or madam) are a legend.
I was disappointed at first to see that this app doesn't simply add Alt and Ctrl keys to the standard keyboard, but it does allow considerable control of the media player directly.
Need to have a much longer play to see if it's really what I need...but I appreciate your effort already.
Another Suggestion
Have you tried unified remote?
It's got a full windows keyboard, You can create your own custom remotes and if you wanted, you could even have multiple droids connected.
Yes, this reply is s bit late, but better late than never
try Hackers Keyboard
I installed hackers keyboard and tried to activate it. It gives a prompt message that this will collect all information except passwords, including personal data and credit card numbers....!!!

Remap gamepad buttons

Hello there!
I am trying to get a Shanwan Generic Gamepad to work with my Tronsmart MK908.
I own two alike gamepads. They both basically work, but send D_Pad_xx and Generic button messages to my system.
I have installed the following apk, to see what is sent by my gamepads: [ github.com/chrisboyle/keytest/downloads ]
It shows me, that both gamepads send the same signals to my Android Mini PC.
As I plan to make them work with MAME4DROID, I would like to remap the inputs to letters (as if sent by a keyboard), which I can again remap to certain actions in MAME4DROID (latter works).
I have found a ressource on the internet which describes how to define keys mapped to a certain keycode from a certain device [ source.android.com/tech/input/key-layout-files.html ]
I have installed USB Device Info [ de.appszoom.com/android_applications/tools/usb-device-info_btyps.html ] to see how the gamepads are seen by my Android PC. Whatever Vendor or ProductID (changes from tab "Android" to tab "Linux") I name my *.kl file after, I cannot remap the keycodes sent from my gamepads.
Does anyone of you know how to map gamepad inputs to, say, letters of a keyboard?
Sorry for not posting real URLs, but I am not able yet (<10 posts)...
Thank you so much!
LeFish

[Feature Request] Remote control of the touchscreen

Guys, the app idea is great, have you considered adding remote control of the touchscreen? it is possible through adb by input tap, input swipe + input text commands.
If you would combine that with mouse tracking, coordinate capturing in the client, you'd have full blown device remote
proof of concept is done in VB:see http://forum.xda-developers.com/showthread.php?t=2786395
ogonzuhnina said:
Guys, the app idea is great, have you considered adding remote control of the touchscreen? it is possible through adb by input tap, input swipe + input text commands.
If you would combine that with mouse tracking, coordinate capturing in the client, you'd have full blown device remote
proof of concept is done in VB:see http://forum.xda-developers.com/showthread.php?t=2786395
Click to expand...
Click to collapse
Thank you for your suggestion, we'll consider adding it in future version. Actually we've receive some similar suggestions.
Personally, I think this feature is cool but not useful to me. I may use it when the screen is broken or the phone is not nearby. But since I can use AirDroid to send SMS, make calls, why would I use this for? I can do other things like tweet, watch video on pc directly.
Well, maybe I will found it useful when I broke my touchscreen.
I've moved your post to this new thread.
Hint: we are developing VNC feature in new version. Hope you like that.

[Completed] Android Mouse Input

Hi everyone,
I'm working on solving an issue I'm having with Google Glass, which is, when connecting a mouse I get a cursor but clicking doesn't seem to do anything. Which I half expect using a "glassapp"; but I have a variety of legacy apps I have side-loaded that I know work with a mouse but just don't on glass.
Through adb I can see that a new mouse is created in /dev/input/ and when I do getevent I can see mouse events firing. These include mouse movements, as well as button down and button up events. It looks like all the driver stuff is set up correctly and the mouse is working fine.
What I believe is the issue is that there is a disconnect between the event and the event listener in the actual apps. So what I am curious to know is, how do event listeners actually get triggered by a system event?
My guess is that the app is looking for /system/lib/libinput.so to register the mouse event but the lib loaded on glass doesn't have methods for mouse inputs. In which case if I updated this library I could potentially get this functionality back? If this is true how can I go about decompiling this library to add this functionality?
My understanding of apks and unix system events is very limited and this is just my current hunch. If anyone who knows more could lend me some knowledge or point me in a better direction I would appreciate it.
XDA Visitor said:
Hi everyone,
I'm working on solving an issue I'm having with Google Glass, which is, when connecting a mouse I get a cursor but clicking doesn't seem to do anything. Which I half expect using a "glassapp"; but I have a variety of legacy apps I have side-loaded that I know work with a mouse but just don't on glass.
Through adb I can see that a new mouse is created in /dev/input/ and when I do getevent I can see mouse events firing. These include mouse movements, as well as button down and button up events. It looks like all the driver stuff is set up correctly and the mouse is working fine.
What I believe is the issue is that there is a disconnect between the event and the event listener in the actual apps. So what I am curious to know is, how do event listeners actually get triggered by a system event?
My guess is that the app is looking for /system/lib/libinput.so to register the mouse event but the lib loaded on glass doesn't have methods for mouse inputs. In which case if I updated this library I could potentially get this functionality back? If this is true how can I go about decompiling this library to add this functionality?
My understanding of apks and unix system events is very limited and this is just my current hunch. If anyone who knows more could lend me some knowledge or point me in a better direction I would appreciate it.
Click to expand...
Click to collapse
Greetings,
Thank you for using XDA Assist.
Please create an XDA account and ask your question here:
Questions and Answers
You'll receive expert advice there. Good luck and welcome to XDA!

Categories

Resources