]> glassweightruler.freedombox.rocks Git - waydroid.git/blobdiff - tools/actions/container_manager.py
Add first-launch command [v2]
[waydroid.git] / tools / actions / container_manager.py
index d6ce155f86935b8fc23849e26ab20d1e62bad94b..9539394d90f519e06dd85ac82ff3c63c400e85fb 100644 (file)
@@ -82,33 +82,6 @@ def start(args):
         for path in perm_list:
             chmod(path, mode)
 
         for path in perm_list:
             chmod(path, mode)
 
-    def set_aidl_version():
-        cfg = tools.config.load(args)
-        android_api = 0
-        try:
-            android_api = int(helpers.props.file_get(args,
-                    tools.config.defaults["rootfs"] + "/system/build.prop",
-                    "ro.build.version.sdk"))
-        except:
-            logging.error("Failed to parse android version from system.img")
-
-        if android_api < 28:
-            binder_protocol = "aidl"
-            sm_protocol =     "aidl"
-        elif android_api < 30:
-            binder_protocol = "aidl2"
-            sm_protocol =     "aidl2"
-        elif android_api < 31:
-            binder_protocol = "aidl3"
-            sm_protocol =     "aidl3"
-        else:
-            binder_protocol = "aidl3"
-            sm_protocol =     "aidl4"
-
-        cfg["waydroid"]["binder_protocol"] = binder_protocol
-        cfg["waydroid"]["service_manager_protocol"] = sm_protocol
-        tools.config.save(args, cfg)
-
     def signal_handler(sig, frame):
         services.hardware_manager.stop(args)
         stop(args)
     def signal_handler(sig, frame):
         services.hardware_manager.stop(args)
         stop(args)
@@ -159,7 +132,7 @@ def start(args):
         # Mount rootfs
         helpers.images.mount_rootfs(args, cfg["waydroid"]["images_path"])
 
         # Mount rootfs
         helpers.images.mount_rootfs(args, cfg["waydroid"]["images_path"])
 
-        set_aidl_version()
+        helpers.protocol.set_aidl_version(args)
 
         # Mount data
         helpers.mount.bind(args, session_cfg["session"]["waydroid_data"],
 
         # Mount data
         helpers.mount.bind(args, session_cfg["session"]["waydroid_data"],
@@ -169,8 +142,9 @@ def start(args):
         if which("start"):
             command = ["start", "cgroup-lite"]
             tools.helpers.run.user(args, command, check=False)
         if which("start"):
             command = ["start", "cgroup-lite"]
             tools.helpers.run.user(args, command, check=False)
-        command = ["umount", "-l", "/sys/fs/cgroup/schedtune"]
-        tools.helpers.run.user(args, command, check=False)
+        if os.path.ismount("/sys/fs/cgroup/schedtune"):
+            command = ["umount", "-l", "/sys/fs/cgroup/schedtune"]
+            tools.helpers.run.user(args, command, check=False)
 
         #TODO: remove NFC hacks
         if which("stop"):
 
         #TODO: remove NFC hacks
         if which("stop"):