aboutsummaryrefslogtreecommitdiff
path: root/gethostsfile.cpp
diff options
context:
space:
mode:
authorAli B <abittin@gmail.com>2020-12-07 10:57:29 +0100
committerGerrit Code Review <gerrit@box1>2020-12-07 10:57:29 +0100
commit6a7bd233c5ae53ac52818794cad431850b509f3a (patch)
tree387a3fd994c68254741fc1f3c577291977d1d833 /gethostsfile.cpp
parent3334a5e0fc7b049e3e550da97014112f415a0736 (diff)
parenta56c2362d97fd198f32b6d8dd8ff6f10cec4b833 (diff)
Merge "Toggle-able adblock hosts file [1/3]" into r11.0r11.0
Diffstat (limited to 'gethostsfile.cpp')
-rw-r--r--gethostsfile.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/gethostsfile.cpp b/gethostsfile.cpp
new file mode 100644
index 00000000..72faa471
--- /dev/null
+++ b/gethostsfile.cpp
@@ -0,0 +1,16 @@
+#include <string.h>
+#include <netdb.h>
+#include <sys/system_properties.h>
+
+#include "gethostsfile.h"
+
+const char* gethostsfile() {
+ char hosts_setting[128];
+ int prop_len = __system_property_get(AICP_HOSTS_SETTING_PROP,
+ hosts_setting);
+ if (prop_len > 0 && strncmp(hosts_setting, "true", 4) == 0) {
+ return AICP_PATH_ADBLOCK_HOSTS;
+ } else {
+ return _PATH_HOSTS;
+ }
+}