2

Objective

I'm developing a custom app for internal use on a rooted android mini-pc. The goal (between others... so...many...others...) is to be able to turn on and off a tv using the serial port embeeded on the tv. I'm using an FTDI UART RS232 serial usb cable for it.

Status

The application is working right now, using an android library (serial-driver) i can communicate with the tv, but the problem is that the device asks for permissions every install (and sometimes, weirdly, again on the same device), so it needs to be improved.

Issue

Since the device doesn't have mouse or keyboard by default, when this happens someone has to click the buttons, and since the device is normally hidden behind the screen, it can be really annoying.

My two bits

This problem, i feel, can be solved by two methods, but i still haven't been able to make them work.

  1. Since the device is rooted, i might be able to modify an unknown (to me) parameter that allows me to bypass the permission request. For this i have tried to make an intent filter for the usb device, and to rewrite the interface that controlls this behaviour, both without success. Is there a way to make this android version more lenient about permissions?
  2. I use for other reasons SuperSU inside the app, so i can use the full width of the might shell power. Using this i've been trying to send commands manually to the device (/dev/bus/usb/00X/00Y), but this haven't worked. My theory is that it's beacuse of the permissions of the device path, but even doing an unhealthy chmod 777 i cannot have them working.

So, that's my problem right now. I hope someone here can help me.

Additional data

  • Running: Custom Android 4.4.2 (Cannot be changed)
  • Needs to be doable solely from within the apk (but it can use shell commands)
  • We don't have the manufacturer signature to install it as a system app
  • We can use only one app, so i cannot have another one to move this one to /sys/apps, and i don't know if an app can do that to itself.
  • using Busybox stty -F /dev/.../ returns "Operation not permitted"
Community
  • 1
  • 1
Asfura
  • 63
  • 1
  • 5
  • Have you looked into using something like the serial libraries in this thread: ? It seems like these would have done as much as possible to keep the permissions stable. If you are re-installing, how do you initiate the install if not by user input? It seems like you're saying that you can't click to dismiss the permissions popup. – BenPen Aug 23 '16 at 19:50
  • Thank you for answering. I tried with several libraries, including that one, before settling with the current one. Edit: clicked enter before finishing. I do not have physical access to the devices (usually), and the installation process is done trough the shell, doing: String execute = "am force-stop com.develop.app && pm install -r " + result + " && sleep 5 && am start -a android.intent.action.MAIN -n com.develop.app/.MainActivity"; Shell.CommandResult cr = Shell.SU.run(execute); – Asfura Aug 23 '16 at 19:52
  • Ah, with a rooted android there should certainly be something that emulates pushing a button on the screen. Have you tried looking into testing tools that you could leverage to push that button? OR, is there some way to have the permissions popup be represented in text form to the console/shell? – BenPen Aug 23 '16 at 20:27
  • Yep, that's our current solution, the app asks at the beginning if there's a usb device, if so, prompts the permission and emulates the inputs, but it's not an ideal solution for an enterprise-level app – Asfura Aug 23 '16 at 20:29
  • Ah, about the popup as a shell prompt, that would be ideal, but in general terms, apps are not supposed to go messing around in the console, so i doubt there's a default way to do that – Asfura Aug 23 '16 at 20:30
  • got linked automatically on the side, you've tried that collection of hints about permissions? This sounds like a useful skill to have. I would LOVE to have what is essentially a WIFI serial extender. a WIFI usb extender would also be excellent, but I'm not sure about the capabilities of Android to fully connect to a USB device like a camera. You'd totally have to manage the bandwidth question, but so does any wireless camera. To have an arbitrary USB<->wifi bridge, wow. Cell bridge too – BenPen Aug 23 '16 at 20:34
  • Oh, in terms of a "default way" to do the popup, if you're willing to hack Android code, I'm sure there's a way to route a popup to a console, even if it's non-portable or insecure. – BenPen Aug 23 '16 at 20:36

0 Answers0