bk138/droidVNC-NG

Start on boot not working when paired with other application that also starts on boot and "locks" the device

Opened this issue · 7 comments

f0lg0 commented

As @bk138 requested, I'm moving the conversation at LibVNC/libvncserver#637 here.

Let me add more context by saying that I'm running Android 9 on a Banana Pi M5 that I've deployed to act as a digital signage device. I possess a root shell on the device and I'm able to connect to it via adb.
I am also running Slideshow which is an app that lets me configure the device to display some media, basically to get it to act as a kiosk.
The interesting bit relies on the fact that this app starts on boot too and it's configured to be locked in the foreground, which results in some Android UI features being disabled (like the home button, the status bar which lets me go into settings etc).
image.

With this configuration, droidVNC-NG is not able to properly start (see logcat) on boot
logcat.txt

If I disable that option in the screenshot, so leaving the device "unlocked", droidVNC starts correctly after some time (even with 0s delay).

Hope this is enought information, I'm willing to go more in depth with the setup.

Pivoting a bit away from droidVNC, I'd like to mention that ideally I'd prefer a binrary for a VNC server so I can start it in the background on boot using init.rc, without having to install a whole APK, do you know any option I could exploit? Without knowing too much about droidVNC I bet it starts some deamon in the background; being able to start it manually by myself by issuing a command would be awesome. In fact, that Slideshow software provides a way to run a command on the root shell after it boots up correctly, so it might be something worth considering.

Hopefully this doesn't pivot away too much from your software.

Thanks for your collaboration and patience.

bk138 commented

Seems like the last message from droidVNC-NG is 11-07 11:28:01.813 4061 4061 I InputService: onServiceConnected in this log dump. There should be an OnBootReceiver etc afterwards. If there is absolutely not, the system just doesn't send the broadcast.

One idea is to let your other app start later...

f0lg0 commented

@bk138 Do you need more of that logcat?
Unfortunately I can't find an option to let that app start later on during the boot process

Pivoting a bit away from droidVNC, I'd like to mention that ideally I'd prefer a binrary for a VNC server so I can start it in the background on boot using init.rc, without having to install a whole APK, do you know any option I could exploit? Without knowing too much about droidVNC I bet it starts some deamon in the background; being able to start it manually by myself by issuing a command would be awesome. In fact, that Slideshow software provides a way to run a command on the root shell after it boots up correctly, so it might be something worth considering.

Pinning also this.

Also saw that droidVNC-NG starts something on port 5800 with protocol HTTP. Is that noVNC? How can I use it?
I get File Not Found when I visit that url

bk138 commented

Logcat from boot until 5 minutes on would be nice.

5800 is noVNC which you can use with a web browser. There's a share button for the correct URL on the Admin Panel.

f0lg0 commented

log.txt
here's the extended logcat, I see that there's the OnBootReceiver you were talking about but I still can't get it to start if that Slideshow option is set.

Is there a way I can start the VNC server in the background using the shell? So maybe I can manually start it later on.

I see the noVNC link but if I click on it it says that there's no app to open it. How's an URL composed? Ideally I don't have physical access to the device so I'd need to know it programmatically

Thanks!

@bk138

bk138 commented

log.txt here's the extended logcat, I see that there's the OnBootReceiver you were talking about but I still can't get it to start if that Slideshow option is set.

Is there a way I can start the VNC server in the background using the shell? So maybe I can manually start it later on.

RTFM ;-) ->the README has an example at https://github.com/bk138/droidVNC-NG/tree/master?tab=readme-ov-file#start-a-password-protected-view-only-server-on-port-5901

I see the noVNC link but if I click on it it says that there's no app to open it. How's an URL composed? Ideally I don't have physical access to the device so I'd need to know it programmatically

Look at the source ;-) -> https://github.com/bk138/droidVNC-NG/blob/master/app/src/main/java/net/christianbeier/droidvnc_ng/MainActivity.java#L774

bk138 commented

PS you can give #243 a try but I haven't found the time to give this a through look.

f0lg0 commented

log.txt here's the extended logcat, I see that there's the OnBootReceiver you were talking about but I still can't get it to start if that Slideshow option is set.
Is there a way I can start the VNC server in the background using the shell? So maybe I can manually start it later on.

RTFM ;-) ->the README has an example at https://github.com/bk138/droidVNC-NG/tree/master?tab=readme-ov-file#start-a-password-protected-view-only-server-on-port-5901

I see the noVNC link but if I click on it it says that there's no app to open it. How's an URL composed? Ideally I don't have physical access to the device so I'd need to know it programmatically

Look at the source ;-) -> https://github.com/bk138/droidVNC-NG/blob/master/app/src/main/java/net/christianbeier/droidvnc_ng/MainActivity.java#L774

Unfortunately I had tried that before but it just doesn't start, more specifically:
log.txt

It does not start even with Slideshow completely closed. Here's the command I ran to start it because I'd like it not to be view-only

adb shell am start-foreground-service \
 -n net.christianbeier.droidvnc_ng/.MainService \
 -a net.christianbeier.droidvnc_ng.ACTION_START \
 --es net.christianbeier.droidvnc_ng.EXTRA_ACCESS_KEY de32550a6efb43f8a5d145e6c07b2cde \
 --ei net.christianbeier.droidvnc_ng.EXTRA_PORT 5900 \
 --es net.christianbeier.droidvnc_ng.EXTRA_PASSWORD banana \
 --ez net.christianbeier.droidvnc_ng.EXTRA_VIEW_ONLY false
Starting service: Intent { act=net.christianbeier.droidvnc_ng.ACTION_START cmp=net.christianbeier.droidvnc_ng/.MainService (has extras) }

Thanks for the noVNC reference. I will also look at #243 asap