sailfishos-open / waydroid

Waydroid packaging for Sailfish OS
34 stars 8 forks source link

Waydroid launcher to manage session #4

Closed rinigus closed 2 years ago

rinigus commented 2 years ago

This is suggested assuming that we support full-ui mode only. In this case, it would make sense to

Now start bit is simple - just one command to run before showing full ui. Stop would require something monitoring Lipstick windows. I can look into it, hopefully info is available via DBus.

CC @lal883 to get feedback on the plan

lal883 commented 2 years ago

Stopping session on closing sould allow relaunching the full UI consistently after closing it instead of the spinning circle I presume.

Although, wouldn't stopping session while closing also mean next launch is going to have a short delay (time to start the session). If passing closed signal to Waydroid was feasible, as discussed on the #waydroid channel last day, wonder if that would be slightly more convenient.

lal883 commented 2 years ago

On second thought, it doesn't look very useful to keep Waydroid session running in the background, considering that all the app notifications are currently limited to Waydroid environment only. Will have to open the full UI to see them no matter what.

rinigus commented 2 years ago

Now practical problem is that I don't know how to catch closure of full-ui window. there is nothing useful on DBus, as far as I can see. Only relevant records

 signal time=1634833195.586142 sender=:1.22 -> destination=(null destination) serial=211 path=/com/jolla/lipstick; interface=com.jolla.lipstick; member=coverstatus
   int32 1
signal time=1634833195.586242 sender=:1.22 -> destination=(null destination) serial=212 path=/com/jolla/lipstick; interface=com.jolla.lipstick; member=coverstatus
   int32 2
signal time=1634833195.829562 sender=:1.22 -> destination=(null destination) serial=213 path=/; interface=org.nemomobile.compositor; member=privateTopmostWindowProcessIdChanged
   int32 0

May have to dig into Lipstick and Jolla QMLs to see how Alien is handled

rinigus commented 2 years ago

We can do it somewhat differently by using nested Wayland composer, same way as was used for Flatpak. While SFOS 4.2 broke the composer, I have just fixed it and made it work. Surprise-surprise, if I set

WAYLAND_DISPLAY="../../display/wayland-1"

and start session

waydroid session start

then waydroid show-full-ui will show into flatpak-runner window.

So, I am going to write a small SFOS app (waydroid-runner) that will be a wrapper around Android. Its task will be to start session when the app is started and close session when the app is closed. Android will be shown inside the app. I think that way we will not need Waydroid settings for now and can use Waydroid via such app.

In future, if Waydroid multiwindow support would allow us to use SFOS launcher natively, we could use the both approaches. For users preferring "seamless" Waydroid experience, we can resurrect current Waydroid settings and provide those. For users preferring full-ui, we can use dedicated waydroid-runner.

I think it would make sense to already now split waydroid package into waydroid and waydroid-settings RPM. Then it would be easy to experiment with it.