From 7216a99fc33307c7dfb5e10d40cb4dff7d682a17 Mon Sep 17 00:00:00 2001
From: oxmc <67136658+oxmc@users.noreply.github.com>
Date: Mon, 8 Jun 2026 04:48:41 -0700
Subject: [PATCH] Add telephony settings, APN provisioning support, and
LineageOS APN submodule integration
- settings.xml: add conditional telephony block (mobile data, VoLTE, roaming, network mode)
- res/xml/apns.xml: simple single-file APN fallback with full attribute documentation
- assets/apns/global.xml: multi-file APN template compatible with LineageOS/android_vendor_apn
- build.gradle: add assets srcDir, Gradle copy tasks to pull only *.xml from APN submodules
---
assets/apns/global.xml | 74 +++++++++++++++++++++++++++++++++
build.gradle | 41 +++++++++++++++++++
res/xml/apns.xml | 93 ++++++++++++++++++++++++++++++++++++++++++
res/xml/settings.xml | 36 ++++++++++++++++
4 files changed, 244 insertions(+)
create mode 100644 assets/apns/global.xml
create mode 100644 res/xml/apns.xml
diff --git a/assets/apns/global.xml b/assets/apns/global.xml
new file mode 100644
index 0000000..0017261
--- /dev/null
+++ b/assets/apns/global.xml
@@ -0,0 +1,74 @@
+
+
+
+
+
+
+
+
+
diff --git a/build.gradle b/build.gradle
index e4ca2e7..888af32 100644
--- a/build.gradle
+++ b/build.gradle
@@ -19,6 +19,8 @@ android {
main {
manifest.srcFile 'AndroidManifest.xml'
res.srcDirs = ['res']
+ // 'assets' = hand-authored files; generated/assets = XMLs copied from submodules
+ assets.srcDirs = ['assets', "$buildDir/generated/assets"]
java.srcDirs = ['src']
kotlin.srcDirs = ['src']
}
@@ -51,3 +53,42 @@ android {
dependencies {
implementation 'org.jetbrains.kotlin:kotlin-stdlib:2.0.21'
}
+
+// ---------------------------------------------------------------------------
+// APN submodule copy tasks
+//
+// Each entry below copies only *.xml files from a repo submodule into
+// build/generated/assets/apns// so non-XML files (scripts, schemas,
+// YAML, licenses) are never packaged into the APK.
+//
+// To add a source:
+// 1. git submodule add (at repo root, not inside assets/)
+// 2. Add a copyApns_ task below following the same pattern.
+//
+// To use LineageOS/android_vendor_apn:
+// git submodule add https://github.com/LineageOS/android_vendor_apn lineage_apn
+// ---------------------------------------------------------------------------
+
+def apnSubmodules = [
+ // localDir (relative to project root) -> dest name under assets/apns/
+ 'lineage_apn': 'lineage',
+]
+
+apnSubmodules.each { srcDir, destName ->
+ def taskName = "copyApns_${destName}"
+ tasks.register(taskName, Copy) {
+ description = "Copy *.xml APN files from ${srcDir}/ into generated assets"
+ onlyIf { file(srcDir).exists() } // no-op if submodule not initialised
+ from(srcDir) { include '**/*.xml' }
+ into "$buildDir/generated/assets/apns/${destName}"
+ }
+}
+
+// Hook every copy task before the corresponding merge*Assets task
+tasks.configureEach { task ->
+ if (task.name.startsWith('merge') && task.name.endsWith('Assets')) {
+ apnSubmodules.each { srcDir, destName ->
+ task.dependsOn("copyApns_${destName}")
+ }
+ }
+}
diff --git a/res/xml/apns.xml b/res/xml/apns.xml
new file mode 100644
index 0000000..dbb1ebf
--- /dev/null
+++ b/res/xml/apns.xml
@@ -0,0 +1,93 @@
+
+
+
+
+
+
+
+
+
diff --git a/res/xml/settings.xml b/res/xml/settings.xml
index d43866f..4973fcf 100644
--- a/res/xml/settings.xml
+++ b/res/xml/settings.xml
@@ -89,4 +89,40 @@
-->
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+