]> glassweightruler.freedombox.rocks Git - waydroid.git/blobdiff - tools/helpers/props.py
hardware_manager: Validate upgrade zips against the saved ota channel
[waydroid.git] / tools / helpers / props.py
index 46ab268f0c455d78e875716859131344fb195cd9..8b6ca5b6688502ed39932ce06c0751abf58d82af 100644 (file)
@@ -21,31 +21,26 @@ def host_set(args, prop, value):
         tools.helpers.run.user(args, command)
 
 def get(args, prop):
         tools.helpers.run.user(args, command)
 
 def get(args, prop):
-    if os.path.exists(tools.config.session_defaults["config_path"]):
-        session_cfg = tools.config.load_session()
-        if session_cfg["session"]["state"] == "RUNNING":
-            platformService = IPlatform.get_service(args)
-            if platformService:
-                return platformService.getprop(prop, "")
-            else:
-                logging.error("Failed to access IPlatform service")
-        else:
-            logging.error("WayDroid container is {}".format(
-                session_cfg["session"]["state"]))
+    platformService = IPlatform.get_service(args)
+    if platformService:
+        return platformService.getprop(prop, "")
     else:
     else:
-        logging.error("WayDroid session is stopped")
+        logging.error("Failed to access IPlatform service")
 
 def set(args, prop, value):
 
 def set(args, prop, value):
-    if os.path.exists(tools.config.session_defaults["config_path"]):
-        session_cfg = tools.config.load_session()
-        if session_cfg["session"]["state"] == "RUNNING":
-            platformService = IPlatform.get_service(args)
-            if platformService:
-                platformService.setprop(prop, value)
-            else:
-                logging.error("Failed to access IPlatform service")
-        else:
-            logging.error("WayDroid container is {}".format(
-                session_cfg["session"]["state"]))
+    platformService = IPlatform.get_service(args)
+    if platformService:
+        platformService.setprop(prop, value)
     else:
     else:
-        logging.error("WayDroid session is stopped")
+        logging.error("Failed to access IPlatform service")
+
+def file_get(args, file, prop):
+    with open(file) as build_prop:
+        for line in build_prop:
+            line = line.strip()
+            if len(line) == 0 or line[0] == "#":
+                continue
+            k,v = line.partition("=")[::2]
+            if k == prop:
+                return v
+    return ""