Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apps are killed immediately if executing waydroid app launch before starting a session #1066

Open
w568w opened this issue Aug 26, 2023 · 4 comments

Comments

@w568w
Copy link

w568w commented Aug 26, 2023

Describe the bug
Most apps being killed immediately if I execute waydroid app launch <PKG_NAME> before starting a session manually with waydroid session start.

Have confirmed that this is a totally different problem from #474 or #702.

To be exact:

  1. Run waydroid session stop to ensure that the session had been killed;
  2. Run waydroid app launch com.hypergryph.arknights;
  3. In several seconds, a window shows up, but then disappear after ~100ms;
  4. Nothing happens after that. waydroid status says:
$ waydroid status
Session:        RUNNING
Container:      FROZEN
Vendor type:    MAINLINE
IP address:     192.168.240.112
Session user:   w568w(1000)
Wayland display:        wayland-0

On the other hand:

  1. Run waydroid session start to ensure that the session had been started up; wait until Android with user 0 is ready printed;
  2. Run waydroid app launch com.hypergryph.arknights;
  3. A window shows up, and the app runs normally.

General information (please complete the following information):

  • Waydroid tools Version 1.4.1
  • Waydroid Images Version system_datetime/vendor_datetime from /var/lib/waydroid/waydroid.cfg: 1692422331 / 1692444077

Desktop (please complete the following information):

  • OS: Archlinux x86_64
  • GPU: AMD Ryzen 7 4800H with iGPU
  • Kernel version: 6.4.12-x64v2-xanmod1-1 (it happens on Linux mainline kernel 6.4.12 with binder patches, too)
  • Host mesa version: mesa 23.1.6
  • Desktop: KDE Plasma 5.27.7

Additional context
I can confirm that the application had been killed by ActivityManager as soon as the app initializes, which claimed that the app had started up too many empty processes without components:

08-26 15:15:17.252   272   735 I ActivityManager: Killing 1071:com.hypergryph.arknights/u0a140 (adj 985): empty #17

I compared two logcat files, and found that an exception only occurs when killing:

08-26 15:15:16.286   489   700 W PluginManagerImpl: Cannot get class loader for non-whitelisted plugin. Src:/system/app/BoringdroidSystemUIApk/BoringdroidSystemUIApk.apk, pkg: com.boringdroid.systemui
08-26 15:15:16.287   272   650 E BoringdroidConfig: Don't save package windowing mode when pc mode disabled
08-26 15:15:16.290   272   649 D CompatibilityChangeReporter: Compat change id reported: 135634846; UID 10134; state: DISABLED
08-26 15:15:16.291   489   700 W PluginInstanceManager: Couldn't load plugin: com.boringdroid.systemui
08-26 15:15:16.291   489   700 W PluginInstanceManager: java.lang.ClassNotFoundException: com.boringdroid.systemui.SystemUIOverlay
08-26 15:15:16.291   489   700 W PluginInstanceManager: 	at java.lang.Class.classForName(Native Method)
08-26 15:15:16.291   489   700 W PluginInstanceManager: 	at java.lang.Class.forName(Class.java:454)
08-26 15:15:16.291   489   700 W PluginInstanceManager: 	at com.android.systemui.shared.plugins.PluginInstanceManager$PluginHandler.handleLoadPlugin(PluginInstanceManager.java:350)
08-26 15:15:16.291   489   700 W PluginInstanceManager: 	at com.android.systemui.shared.plugins.PluginInstanceManager$PluginHandler.handleQueryPlugins(PluginInstanceManager.java:315)
08-26 15:15:16.291   489   700 W PluginInstanceManager: 	at com.android.systemui.shared.plugins.PluginInstanceManager$PluginHandler.handleMessage(PluginInstanceManager.java:264)
08-26 15:15:16.291   489   700 W PluginInstanceManager: 	at android.os.Handler.dispatchMessage(Handler.java:106)
08-26 15:15:16.291   489   700 W PluginInstanceManager: 	at android.os.Looper.loop(Looper.java:223)
08-26 15:15:16.291   489   700 W PluginInstanceManager: 	at android.os.HandlerThread.run(HandlerThread.java:67)
08-26 15:15:16.291   489   700 W PluginInstanceManager: Caused by: java.lang.ClassNotFoundException: com.boringdroid.systemui.SystemUIOverlay
08-26 15:15:16.291   489   700 W PluginInstanceManager: 	... 8 more

So I suspect that it has something to do with this patch. Seems that the app walks in before the system UI has been initialized…

I cleaned the logcat outputs by hand and these two logs should be more readable:

readable_logcat_not_killed.log
readable_logcat_killed.log

Logs (please upload as file)

@w568w w568w changed the title Apps being killed immediately if executing waydroid app launch before starting a session Apps are killed immediately if executing waydroid app launch before starting a session Aug 26, 2023
@TriMoon
Copy link

TriMoon commented Aug 27, 2023

TOO BIG TO UPLOAD (~0.5 GB!)

You should be able to upload a gzip version of the logs...
But better would be to just truncate -s0 /var/lib/waydroid/waydroid.log and then reproduce to get fresh logs and upload those, i think it will be much smaller that way 😉

⚠️ The command i provided will erase the contents inside that logfile, so make a backup if you need the old contents...

@w568w
Copy link
Author

w568w commented Aug 27, 2023

But better would be to just truncate -s0 /var/lib/waydroid/waydroid.log and then reproduce to get fresh logs and upload those, i think it will be much smaller that way 😉

Thanks for your tip! I have uploaded the fresh log.

@XilinJia
Copy link

On Waydroid 1.4.2 on Manjaro KDE Wayland.

In my case, if I start an app before starting Waydroid session, a full-screen window shows up with some telltale, then the window disappears without starting the app. I checked with ps and found the Waydroid session has indeed been started. If I start the app again, it starts.

@sertonix
Copy link

sertonix commented Apr 15, 2024

This line silently fails since status isn't checked:

status, exception = reader.read_int32()

Adding a 1 second delay works but it's only a hack:

diff --git a/tools/services/user_manager.py b/tools/services/user_manager.py
index 83a50cc..bd845a6 100644
--- a/tools/services/user_manager.py
+++ b/tools/services/user_manager.py
@@ -3,6 +3,7 @@
 import logging
 import os
 import threading
+import time
 import tools.config
 import tools.helpers.net
 from tools.interfaces import IUserMonitor
@@ -83,6 +84,9 @@ NoDisplay={str(hide).lower()}
                 makeDesktopFile(app)
             multiwin = platformService.getprop("persist.waydroid.multi_windows", "false")
             makeWaydroidDesktopFile(multiwin == "true")
+
+        # HACK: Applications are killed when they are started too early
+        time.sleep(1)
         if unlocked_cb:
             unlocked_cb()
 

Maybe this patch is causing "user unlock" to be returned too early:
https://github.com/waydroid/android_vendor_waydroid/blob/lineage-18.1/waydroid-patches/base-patches-30/lineage-sdk/0004-WaydroidUserMonitor-Get-service-on-demand.patch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants