Write Data Saver setting to BPF map

The information is needed by modules who want to know whether a
specific UID is blocked by Data Saver feature.

1. Add a one-element map data_saver_enabled_map.
2. Update current data saver setting to the map.

Bug: 288340533
Test: atest FrameworksNetTests:android.net.connectivity.com.android.serv
er.BpfNetMapsTest
Test: atest bpf_existence_test

Change-Id: I981da4b569247c33cba2d365cb6f2691f673474e
diff --git a/bpf_progs/netd.c b/bpf_progs/netd.c
index b77a8d1..5759df7 100644
--- a/bpf_progs/netd.c
+++ b/bpf_progs/netd.c
@@ -112,6 +112,9 @@
                        BPFLOADER_IGNORED_ON_VERSION, BPFLOADER_MAX_VER, LOAD_ON_ENG,
                        LOAD_ON_USER, LOAD_ON_USERDEBUG);
 
+DEFINE_BPF_MAP_RO_NETD(data_saver_enabled_map, ARRAY, uint32_t, bool,
+                       DATA_SAVER_ENABLED_MAP_SIZE)
+
 // iptables xt_bpf programs need to be usable by both netd and netutils_wrappers
 // selinux contexts, because even non-xt_bpf iptables mutations are implemented as
 // a full table dump, followed by an update in userspace, and then a reload into the kernel,
diff --git a/bpf_progs/netd.h b/bpf_progs/netd.h
index 2b28f06..f960dcf 100644
--- a/bpf_progs/netd.h
+++ b/bpf_progs/netd.h
@@ -126,6 +126,7 @@
 static const int UID_OWNER_MAP_SIZE = 4000;
 static const int INGRESS_DISCARD_MAP_SIZE = 100;
 static const int PACKET_TRACE_BUF_SIZE = 32 * 1024;
+static const int DATA_SAVER_ENABLED_MAP_SIZE = 1;
 
 #ifdef __cplusplus
 
@@ -172,6 +173,7 @@
 #define INGRESS_DISCARD_MAP_PATH BPF_NETD_PATH "map_netd_ingress_discard_map"
 #define PACKET_TRACE_RINGBUF_PATH BPF_NETD_PATH "map_netd_packet_trace_ringbuf"
 #define PACKET_TRACE_ENABLED_MAP_PATH BPF_NETD_PATH "map_netd_packet_trace_enabled_map"
+#define DATA_SAVER_ENABLED_MAP_PATH BPF_NETD_PATH "map_netd_data_saver_enabled_map"
 
 #endif // __cplusplus