[Linux] Use up_client_get_devices2 when possible (#127699)
The Linux platform channels sample makes a call to the libupower function `up_client_get_devices`, which was deprecated in libupower 0.99.8 in favour of `up_client_get_devices2`. In order to build both for users on older versions of libupower, such as 0.99.7, which ships with Ubuntu 18.04 (Bionic), as well as users on newer versions where `up_client_get_devices` is deprecated, this adds a preprocessor check and selects the function available on the host system on which the build takes place. The Flutter devicelab prod bots have been migrated to Ubuntu 20.04 LTS (Focal) which includes 0.99.11, but the trybots are still in the process of being migrated. This allows the build to work on both, and makes life easier for users running on a variety of Linux distributions. No tests are added or modified since `up_client_get_devices` and `up_client_get_devices2` have the same semantics. See: https://upower.freedesktop.org/docs/UpClient.html#up-client-get-devices See: https://gitlab.freedesktop.org/upower/upower/-/blob/master/libupower-glib/up-version.h.in Note: the `UP_CHECK_VERSION` macro has been around since 2010 (13 years ago), when DKP was forked into libupower. https://gitlab.freedesktop.org/upower/upower/-/commit/27fada20be7feba6783abc5b6cad91ee274ad3df Issue: https://github.com/flutter/flutter/issues/127611
Showing
Please register or sign in to comment