]>
glassweightruler.freedombox.rocks Git - waydroid.git/blob - tools/services/hardware_manager.py
1 # Copyright 2021 Erfan Abdi
2 # SPDX-License-Identifier: GPL-3.0-or-later
6 import tools
.actions
.container_manager
7 import tools
.actions
.session_manager
9 from tools
import helpers
10 from tools
.interfaces
import IHardware
15 def enableNFC(enable
):
16 logging
.debug("Function enableNFC not implemented")
18 def enableBluetooth(enable
):
19 logging
.debug("Function enableBluetooth not implemented")
22 cfg
= tools
.config
.load(args
)
23 if cfg
["waydroid"]["suspend_action"] == "stop":
24 tools
.actions
.session_manager
.stop(args
)
26 tools
.actions
.container_manager
.freeze(args
)
29 helpers
.lxc
.stop(args
)
30 helpers
.lxc
.start(args
)
32 def upgrade(system_zip
, system_time
, vendor_zip
, vendor_time
):
33 if os
.path
.exists(system_zip
) and not helpers
.images
.validate(args
, "system_ota", system_zip
):
34 logging
.warning("Not upgrading because system.img comes from an unverified source")
36 if os
.path
.exists(vendor_zip
) and not helpers
.images
.validate(args
, "vendor_ota", vendor_zip
):
37 logging
.warning("Not upgrading because vendor.img comes from an unverified source")
39 helpers
.lxc
.stop(args
)
40 helpers
.images
.umount_rootfs(args
)
41 helpers
.images
.replace(args
, system_zip
, system_time
,
42 vendor_zip
, vendor_time
)
43 args
.session
["background_start"] = "false"
44 helpers
.images
.mount_rootfs(args
, args
.images_path
, args
.session
)
45 helpers
.protocol
.set_aidl_version(args
)
46 helpers
.lxc
.start(args
)
50 IHardware
.add_service(
51 args
, enableNFC
, enableBluetooth
, suspend
, reboot
, upgrade
)
55 args
.hardware_manager
= threading
.Thread(target
=service_thread
)
56 args
.hardware_manager
.start()
63 args
.hardwareLoop
.quit()
64 except AttributeError:
65 logging
.debug("Hardware service is not even started")