]> glassweightruler.freedombox.rocks Git - waydroid.git/blob - tools/helpers/protocol.py
protocol: Correct gbinder protocol version for API 33
[waydroid.git] / tools / helpers / protocol.py
1 from tools import helpers
2 import tools.config
3 import logging
4
5 # Call me with rootfs mounted!
6 def set_aidl_version(args):
7 cfg = tools.config.load(args)
8 android_api = 0
9 try:
10 android_api = int(helpers.props.file_get(args,
11 tools.config.defaults["rootfs"] + "/system/build.prop",
12 "ro.build.version.sdk"))
13 except:
14 logging.error("Failed to parse android version from system.img")
15
16 if android_api < 28:
17 binder_protocol = "aidl"
18 sm_protocol = "aidl"
19 elif android_api < 30:
20 binder_protocol = "aidl2"
21 sm_protocol = "aidl2"
22 elif android_api < 31:
23 binder_protocol = "aidl3"
24 sm_protocol = "aidl3"
25 elif android_api < 33:
26 binder_protocol = "aidl4"
27 sm_protocol = "aidl3"
28 else:
29 binder_protocol = "aidl3"
30 sm_protocol = "aidl3"
31
32 cfg["waydroid"]["binder_protocol"] = binder_protocol
33 cfg["waydroid"]["service_manager_protocol"] = sm_protocol
34 tools.config.save(args, cfg)