Waydroid and suspend

Hello folks,

I need to use Waydroid to get MFA from my bank, which is basically my only, but crucial use case.

To make use more bearable, I created two icons for it. One does waydroid stop and the other one stops the waydroid container.

However, sometimes after fully stopping Waydroid, my phone fails to suspend. After getting out of battery on the street a few times, I found out a quick check: try to restart the phone. If Waydroid is stuck, I will have on the restart window information that “Waydroid is preventing idle”. If the restart popup is clear, I know the phone will suspend. So far, the only way to truly make Waydroid go away is, of course, to restart. If Waydroid was stuck and I start a new Waydroid session, next time I try to restart Waydroid will be listed in the restart popup twice.

So my questions are:

  1. How could I find what is going on? More specifically, why does it happen only sometimes? I found out that if I Force Quit background applications before stopping Waydroid, sometimes I get rid of the problem.
  2. How can I kill all Waydroid-related processes without restarting the phone? I could then put a script together and add it to the home screen as a shortcut.
2 Likes

I also get this behaviour with Waydroid. Not only does it prevent suspend, but also screen locking. I, too, have found no better workaround than to reboot the host system.

As far as I know, applications use DBus to request this kind of inhibition of idle. Usually it is used for things like media playback, so your screen doesn’t lock in the middle of watching a video, or possibly to prevent the interruption of long-running processes. It seems to me that Waydroid is requesting it but then failing to rescind the request once it no longer requires it. Then, the inhibition stands permanently until the next restart, even after all Waydroid processes are terminated. In other words, my intuition is that Waydroid has a resource leak regarding this feature.

From my limited reading around the topic, I get the impression that Waydroid is likely just passing through a request to inhibit suspend from an app that’s running within Waydroid. I’ve yet to figure out which specific apps cause this and in what specific states. (It does seem to be state-dependent, because I always have the same small set of installed apps and they usually do not cause the problem behaviour.)

Intuitively, I feel like maybe it helps to swipe away all open apps before closing the Waydroid window, and I feel like it usually only gets stuck inhibiting suspend if I leave an app open, but I don’t actually have any data to back that hypothesis up.

1 Like

@dos Is this related to this issue? Automatic freeze isn't triggered if user closed the window after idle timeout has already passed · Issue #500 · waydroid/waydroid · GitHub
If that’s the case, do you have any updates?

This is the last issue that, at least in my case, prevents me from being able to just have my Librem 5 on for days and days and days without worrying about it not suspending. Nowadays, I do a quick reboot check just to see if Waydroid will not prevent my phone from suspending.

Also @patch Do you know a practical way of monitoring DBus resources? I created a custom icon linked to a script that I use to start and stop Waydroid and I could potentially track the created resources and kill them when I stop Waydroid, as I only keep Waydroid running when I actually need it.