getBpfSupportLevel - make 4.14+ kernel trump ro.product.first_api_level

Devices launching with Android 'X' must have one of the following kernels:
  O: 3.18 4.4  4.9
  P: 4.4  4.9  4.14
  Q: 4.9  4.14 4.19
  R: 4.14 4.19 5.4

You can see this by looking at:
  https://android.googlesource.com/kernel/configs/+/refs/heads/master
where the main directory is currently R (api level 30) and the subdirs for:
  O (26), O-MR1 (27), P (28), and Q (29)

As such running a 'Y' kernel is proof of being at least Android 'X':
  4.9  is O+
  4.14 is P+
  4.19 is Q+
  5.4  is R+

And we know Android P VINTF has always required eBPF support from its
kernels.  As such we can reorder the checks, to check kernel prior
to checking first_api_level.

This is *theoretically* a no-op.

But of course in practice it will actually fix a number of issues:
- Devices which launched on O with a 4.9 kernel but have been upgraded
  to a 4.14-Q kernel and thus now support ebpf and don't support xt_qtaguid,
  this will hopefully eliminate the need for test waivers...
- Devices during turn up where they're on a 4.19 kernel, targetting R,
  and yet somehow still erroneously reporting a first_api_level of 26 (O),
  this will hopefully eliminate some crash bugs.

Test: atest
Bug: 151753987
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I7eaca016d0f77e5f320b499ac428987e23a6d184
Merged-In: I7eaca016d0f77e5f320b499ac428987e23a6d184
1 file changed
tree: 8fb3af89ab4af559526e1b94839ab2b292ea9ec9
  1. bpfloader/
  2. libbpf_android/
  3. progs/
  4. Android.bp
  5. MODULE_LICENSE_APACHE2
  6. NOTICE
  7. OWNERS
  8. PREUPLOAD.cfg