p/android-4.9+: relax QTAGUID requirements

Q userspace will use eBPF for bandwidth measurement
and does not require QTAGUID netfilter extension.
As such we are okay with either QTAGUID or the less
functional but sufficient OWNER extension (provided
the requisite eBPF config options are also enabled).

ie. we require either XT_MATCH_QTAGUID or XT_MATCH_OWNER.

Furthermore XT_MATCH_OWNER also requires:
  CONFIG_BPF_SYSCALL=y
  CONFIG_CGROUP_BPF=y
  CONFIG_NETFILTER_XT_MATCH_BPF=y
  CONFIG_NET_CLS_BPF=y
(the first 3 of which are already base requirements on P 4.9+)

Note: while this change is complex, it *widens* the
set of valid kernel configurations.  Any kernel that passed
configuration requirements before this change will also pass
them after this change.  However additionally this allows a
Q kernel to pass on a shipped as P but then upgraded to Q
device.

Also note that as Alistair points out this doesn't work for
shipped as O then upgraded to Q devices, as:
  system/bpf/libbpf_android/BpfUtils.cpp
is still checking "first_api_level" for P, and thus will not
use eBPF and thus it would actually break without QTAGUID.

Bug: 125362907
Signed-off-by: Maciej ┼╗enczykowski <maze@google.com>
Change-Id: Ia6ce9e857d260cc6c74dd59731555479f7d38078
(cherry picked from commit 1d961dc1ab31616f1aa5598a71f98c7c0c40c0c9)
diff --git a/p/android-4.14/android-base-conditional.xml b/p/android-4.14/android-base-conditional.xml
index 19e685d..2357adb 100644
--- a/p/android-4.14/android-base-conditional.xml
+++ b/p/android-4.14/android-base-conditional.xml
@@ -1 +1,31 @@
 <kernel minlts="4.14.42" />
+
+<!-- CONFIG_NETFILTER_XT_MATCH_QTAGUID || (CONFIG_NETFILTER_XT_MATCH_OWNER && BPF) -->
+<group>
+	<conditions>
+		<config>
+			<key>CONFIG_NETFILTER_XT_MATCH_QTAGUID</key>
+			<value type="bool">n</value>
+		</config>
+	</conditions>
+	<config>
+		<key>CONFIG_NETFILTER_XT_MATCH_OWNER</key>
+		<value type="bool">y</value>
+	</config>
+	<config>
+		<key>CONFIG_NET_CLS_BPF</key>
+		<value type="bool">y</value>
+	</config>
+</group>
+<group>
+	<conditions>
+		<config>
+			<key>CONFIG_NETFILTER_XT_MATCH_OWNER</key>
+			<value type="bool">n</value>
+		</config>
+	</conditions>
+	<config>
+		<key>CONFIG_NETFILTER_XT_MATCH_QTAGUID</key>
+		<value type="bool">y</value>
+	</config>
+</group>
diff --git a/p/android-4.14/android-base.config b/p/android-4.14/android-base.config
index 6aae521..76ac72e 100644
--- a/p/android-4.14/android-base.config
+++ b/p/android-4.14/android-base.config
@@ -103,7 +103,6 @@
 CONFIG_NETFILTER_XT_MATCH_MARK=y
 CONFIG_NETFILTER_XT_MATCH_PKTTYPE=y
 CONFIG_NETFILTER_XT_MATCH_POLICY=y
-CONFIG_NETFILTER_XT_MATCH_QTAGUID=y
 CONFIG_NETFILTER_XT_MATCH_QUOTA2=y
 CONFIG_NETFILTER_XT_MATCH_QUOTA=y
 CONFIG_NETFILTER_XT_MATCH_SOCKET=y
diff --git a/p/android-4.9/android-base-conditional.xml b/p/android-4.9/android-base-conditional.xml
index 4922685..5334a22 100644
--- a/p/android-4.9/android-base-conditional.xml
+++ b/p/android-4.9/android-base-conditional.xml
@@ -1 +1,31 @@
 <kernel minlts="4.9.84" />
+
+<!-- CONFIG_NETFILTER_XT_MATCH_QTAGUID || (CONFIG_NETFILTER_XT_MATCH_OWNER && BPF) -->
+<group>
+	<conditions>
+		<config>
+			<key>CONFIG_NETFILTER_XT_MATCH_QTAGUID</key>
+			<value type="bool">n</value>
+		</config>
+	</conditions>
+	<config>
+		<key>CONFIG_NETFILTER_XT_MATCH_OWNER</key>
+		<value type="bool">y</value>
+	</config>
+	<config>
+		<key>CONFIG_NET_CLS_BPF</key>
+		<value type="bool">y</value>
+	</config>
+</group>
+<group>
+	<conditions>
+		<config>
+			<key>CONFIG_NETFILTER_XT_MATCH_OWNER</key>
+			<value type="bool">n</value>
+		</config>
+	</conditions>
+	<config>
+		<key>CONFIG_NETFILTER_XT_MATCH_QTAGUID</key>
+		<value type="bool">y</value>
+	</config>
+</group>
diff --git a/p/android-4.9/android-base.config b/p/android-4.9/android-base.config
index a242828..6ac8ed5 100644
--- a/p/android-4.9/android-base.config
+++ b/p/android-4.9/android-base.config
@@ -101,7 +101,6 @@
 CONFIG_NETFILTER_XT_MATCH_MARK=y
 CONFIG_NETFILTER_XT_MATCH_PKTTYPE=y
 CONFIG_NETFILTER_XT_MATCH_POLICY=y
-CONFIG_NETFILTER_XT_MATCH_QTAGUID=y
 CONFIG_NETFILTER_XT_MATCH_QUOTA2=y
 CONFIG_NETFILTER_XT_MATCH_QUOTA=y
 CONFIG_NETFILTER_XT_MATCH_SOCKET=y