From 2259ae916239a3e6a84226583edc610a578cb98e Mon Sep 17 00:00:00 2001 From: Daniel Weipert Date: Sat, 29 Apr 2023 10:07:00 +0200 Subject: initial commit --- .gitignore | 1 + Makefile | 9 ++++++ Readme.md | 7 +++++ WORKSPACE | 14 +++++++++ app/java/AndroidManifest.xml | 41 +++++++++++++++++++++++++ app/java/BUILD | 14 +++++++++ app/java/res/layout/main.xml | 29 ++++++++++++++++++ app/java/res/values/dimens.xml | 4 +++ app/java/res/values/strings.xml | 10 ++++++ app/java/src/DNSService.java | 33 ++++++++++++++++++++ app/java/src/MainActivity.java | 68 +++++++++++++++++++++++++++++++++++++++++ shell.nix | 31 +++++++++++++++++++ 12 files changed, 261 insertions(+) create mode 100644 .gitignore create mode 100644 Makefile create mode 100644 Readme.md create mode 100644 WORKSPACE create mode 100644 app/java/AndroidManifest.xml create mode 100644 app/java/BUILD create mode 100644 app/java/res/layout/main.xml create mode 100644 app/java/res/values/dimens.xml create mode 100644 app/java/res/values/strings.xml create mode 100644 app/java/src/DNSService.java create mode 100644 app/java/src/MainActivity.java create mode 100644 shell.nix diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a6ef824 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/bazel-* diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..9003dc3 --- /dev/null +++ b/Makefile @@ -0,0 +1,9 @@ +build: app/java/src/*.java + bazel build //app/java:dnsproxy + +watch: + ibazel build //app/java:dnsproxy + +install: + adb install bazel-bin/app/java/dnsproxy.apk + #bazel mobile-install //app/java:dnsproxy diff --git a/Readme.md b/Readme.md new file mode 100644 index 0000000..804c469 --- /dev/null +++ b/Readme.md @@ -0,0 +1,7 @@ +- https://github.com/IngoZenz/personaldnsfilter/blob/master/app/src/main/java/dnsfilter/android/DNSFilterService.java +- https://android.googlesource.com/platform/development/+/master/samples/ToyVpn/src/com/example/android/toyvpn/ToyVpnService.java +- https://developer.android.com/guide/components/services#StartingAService +- https://developer.android.com/guide/components/services#Foreground +- https://stackoverflow.com/questions/600207/how-to-check-if-a-service-is-running-on-android +- https://www.vogella.com/tutorials/AndroidServices/article.html#communication-with-services +- https://github.com/googlecodelabs/bazel-android-intro/blob/master/sample/mediarecorder/java/com/example/android/mediarecorder/MainActivity.java diff --git a/WORKSPACE b/WORKSPACE new file mode 100644 index 0000000..24b7050 --- /dev/null +++ b/WORKSPACE @@ -0,0 +1,14 @@ +# Load the Android build rules +load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") +http_archive( + name = "build_bazel_rules_android", + urls = ["https://github.com/bazelbuild/rules_android/archive/v0.1.1.zip"], + sha256 = "cd06d15dd8bb59926e4d65f9003bfc20f9da4b2519985c27e190cddc8b7a7806", + strip_prefix = "rules_android-0.1.1", +) + +# Configure Android SDK Path +load("@build_bazel_rules_android//android:rules.bzl", "android_sdk_repository") +android_sdk_repository( + name = "androidsdk", +) diff --git a/app/java/AndroidManifest.xml b/app/java/AndroidManifest.xml new file mode 100644 index 0000000..ef81463 --- /dev/null +++ b/app/java/AndroidManifest.xml @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/java/BUILD b/app/java/BUILD new file mode 100644 index 0000000..c19473f --- /dev/null +++ b/app/java/BUILD @@ -0,0 +1,14 @@ +load("@build_bazel_rules_android//android:rules.bzl", "android_library", "android_binary") + +android_library( + name = "main", + srcs = glob(["src/*.java"]), + manifest = "AndroidManifest.xml", + resource_files = glob(["res/**"]), +) + +android_binary( + name = "dnsproxy", + manifest = "AndroidManifest.xml", + deps = [":main"], +) diff --git a/app/java/res/layout/main.xml b/app/java/res/layout/main.xml new file mode 100644 index 0000000..4a644b6 --- /dev/null +++ b/app/java/res/layout/main.xml @@ -0,0 +1,29 @@ + + + + + +