From af29dd0ddf998a4bbe85a591d4d03a67a03a7345 Mon Sep 17 00:00:00 2001 From: Rikka <1103670381@qq.com> Date: Sun, 8 Jan 2023 20:46:06 +0800 Subject: [PATCH] restart WayDroid container after installation --- waydroid_extras.py | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/waydroid_extras.py b/waydroid_extras.py index 7771e0c..1c85c4e 100755 --- a/waydroid_extras.py +++ b/waydroid_extras.py @@ -56,6 +56,12 @@ def DBusContainerService(object_path="/ContainerManager", intf="id.waydro.Contai def DBusSessionService(object_path="/SessionManager", intf="id.waydro.SessionManager"): return dbus.Interface(dbus.SessionBus().get_object("id.waydro.Session", object_path), intf) +def restart(): + waydroid_session = DBusContainerService().GetSession() + if DBusContainerService().GetSession(): + DBusContainerService().Stop() + DBusContainerService().Start(waydroid_session) + def install_gapps(): dl_links = { @@ -129,6 +135,7 @@ def install_gapps(): shutil.copytree(os.path.join(extract_to, "appunpack", app_name, "common", ccdir), os.path.join(sys_image_mount, "system", ccdir), dirs_exist_ok=True) print("==> OpenGapps installation complete try re init /restarting waydroid") print("==> Please note, google apps wont be usable without device registration !, Use --get-android-id for registration instructions") + restart() def get_android_id(): @@ -228,7 +235,8 @@ on property:ro.enable.native.bridge.exec=1 with open(init_path, "w") as initfile: initfile.write(initcontent) - print("==> libndk translation installed ! Restart waydroid service to apply changes !") + print("==> libndk translation installed ! Restarting waydroid service to apply changes !") + restart() def install_houdini(): @@ -313,8 +321,8 @@ on property:ro.enable.native.bridge.exec=1 with open(init_path, "w") as initfile: initfile.write(initcontent) - - print("==> libhoudini translation installed ! Restart waydroid service to apply changes !") + print("==> libhoudini translation installed ! Restarting waydroid container to apply changes !") + restart() def install_magisk(): dl_link = "https://huskydg.github.io/magisk-files/app-release.apk" @@ -441,7 +449,8 @@ on property:init.svc.zygote=stopped with open(bootanim, "w") as initfile: initfile.write(initcontent) - print("==> Magisk was installed ! Restart waydroid service to apply changes !") + print("==> Magisk was installed ! Restarting waydroid container to apply changes !") + restart() def install_widevine(): vendor_image_mount = "/var/lib/waydroid/overlay/vendor" @@ -478,7 +487,8 @@ def install_widevine(): shutil.copytree(os.path.join(extract_to, "vendor_google_proprietary_widevine-prebuilt-94c9ee172e3d78fecc81863f50a59e3646f7a2bd", "prebuilts"), vendor_image_mount, dirs_exist_ok=True) - print("==> Widevine installed ! Restart waydroid service to apply changes !") + print("==> Widevine installed ! Restarting waydroid container to apply changes !") + restart() def main(): about = """