nathaneltitane / dextop

Unlock the full potential of your Android device and transform it into a Linux-based workstation in minutes with Dextop! No tech expertise needed - it's user-friendly and hassle-free!
http://dextop.app
GNU General Public License v3.0
166 stars 13 forks source link

Kill vnc:// intent when stopping session or logging out of proot #1

Closed nathaneltitane closed 4 years ago

nathaneltitane commented 4 years ago

Use am to kill app that serves vnc:// intent when display is loaded to not have it hang in background and prevent other session(s) from loading.

nathaneltitane commented 4 years ago

@xeffyr can I bug you on this one:

what would be the command to pass through termux's am to kill a specific application?

Thank you

ghost commented 4 years ago

Not sure whether it is possible to stop random activities but you can stop service with something like

am stopservice com.termux/.app.TermuxService

Replace package name & service class name with appropriate values.

ghost commented 4 years ago

For example, if you use VNC Viewer by RealVNC, try this command:

am stopservice com.realvnc.viewer.android/.app.ConnectionService
nathaneltitane commented 4 years ago

Thank you @xeffyr! i will look into the manifests to get the info :)

EDIT:

so having realvnc viewer already installed, even when launching a vnc connection, there does not seem to be any active service running that calls on com.realvnc.viewer.android.app.ConnectionService although the manifest clearly lists <service android:exported="false" android:name="com.realvnc.viewer.android.app.ConnectionService" android:stopWithTask="true"/>

Am I doing this wrong? Should i explicitly launch the service from termux to have it be closed by am afterwards?

Sidenote:

Just for discussion's sake and the possible use cases made of termux such as my project: what are the odds termux could build it's own vnc viewer that ties into the already existing product and has users control the session à la LinuxOnDex?

ghost commented 4 years ago

there does not seem to be any active service

This is not true. com.realvnc.viewer.android.app.ConnectionService is a background job responsible for VNC connection.

Seems like regular application can stop only its own services. I was not able to stop it from Termux but from ADB with root permissions command from https://github.com/nathaneltitane/linux-dextop/issues/1#issuecomment-701973956 worked fine:

heroltexx:/ # am stopservice com.realvnc.viewer.android/.app.ConnectionService
Stopping service: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.realvnc.viewer.android/.app.ConnectionService }
Service stopped