]>
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
5 import tools
.actions
.container_manager
6 import tools
.actions
.session_manager
8 from tools
import helpers
9 from tools
.interfaces
import IHardware
14 def enableNFC(enable
):
15 logging
.debug("Function enableNFC not implemented")
17 def enableBluetooth(enable
):
18 logging
.debug("Function enableBluetooth not implemented")
21 cfg
= tools
.config
.load(args
)
22 if cfg
["waydroid"]["suspend_action"] == "stop":
23 tools
.actions
.session_manager
.stop(args
)
25 tools
.actions
.container_manager
.freeze(args
)
28 helpers
.lxc
.stop(args
)
29 helpers
.lxc
.start(args
)
31 def upgrade(system_zip
, system_time
, vendor_zip
, vendor_time
):
32 helpers
.lxc
.stop(args
)
33 helpers
.images
.umount_rootfs(args
)
34 helpers
.images
.replace(args
, system_zip
, system_time
,
35 vendor_zip
, vendor_time
)
36 helpers
.images
.mount_rootfs(args
, args
.images_path
)
37 helpers
.protocol
.set_aidl_version(args
)
38 helpers
.lxc
.start(args
)
42 IHardware
.add_service(
43 args
, enableNFC
, enableBluetooth
, suspend
, reboot
, upgrade
)
47 args
.hardware_manager
= threading
.Thread(target
=service_thread
)
48 args
.hardware_manager
.start()
55 args
.hardwareLoop
.quit()
56 except AttributeError:
57 logging
.debug("Hardware service is not even started")