M0-M2: LAN voice Android client skeleton + WSS protocol + audio pipeline
- M0: Gradle scaffold (AGP 8.5.2 / Kotlin 2.0.20 / Compose BOM 2024.09.03), arm64-v8a, minSdk 26 - M1: OkHttp WebSocket client, LV binary frame codec, connection generation guard, cert pinning - M2: AudioRecord capture (16k PCM16 20ms), AudioTrack playback (48k), barge-in, RECORD_AUDIO - Server address in res/values/config.xml; persona/lore resolved server-side - PLAN.md with milestones and decisions
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
plugins {
|
||||
id 'com.android.application'
|
||||
id 'org.jetbrains.kotlin.android'
|
||||
id 'org.jetbrains.kotlin.plugin.compose'
|
||||
}
|
||||
|
||||
// Android's <domain> text cannot reference @string. Generate it from the one address config
|
||||
// so changing voice_server_host and rebuilding also updates the certificate trust scope.
|
||||
def networkSecurityResources = layout.buildDirectory.dir('generated/networkSecurity/res')
|
||||
def generateNetworkSecurityConfig = tasks.register('generateNetworkSecurityConfig') {
|
||||
def serverConfig = file('src/main/res/values/config.xml')
|
||||
def template = file('src/main/network_security_config.xml')
|
||||
inputs.files(serverConfig, template)
|
||||
outputs.dir(networkSecurityResources)
|
||||
doLast {
|
||||
def host = new XmlSlurper().parse(serverConfig).string.find {
|
||||
it.@name.text() == 'voice_server_host'
|
||||
}.text()
|
||||
if (!(host ==~ /[A-Za-z0-9.:-]+/)) {
|
||||
throw new GradleException('voice_server_host must be an IP address or DNS host')
|
||||
}
|
||||
def output = new File(networkSecurityResources.get().asFile, 'xml/network_security_config.xml')
|
||||
output.parentFile.mkdirs()
|
||||
output.setText(template.getText('UTF-8').replace('@VOICE_SERVER_HOST@', host), 'UTF-8')
|
||||
}
|
||||
}
|
||||
|
||||
android {
|
||||
namespace 'com.gorios.lanvoice'
|
||||
compileSdk 34
|
||||
defaultConfig {
|
||||
applicationId 'com.gorios.lanvoice'
|
||||
minSdk 26
|
||||
targetSdk 34
|
||||
versionCode 1
|
||||
versionName '0.1.0-m2'
|
||||
ndk { abiFilters 'arm64-v8a' }
|
||||
}
|
||||
compileOptions { sourceCompatibility JavaVersion.VERSION_17; targetCompatibility JavaVersion.VERSION_17 }
|
||||
kotlinOptions { jvmTarget = '17' }
|
||||
buildFeatures { compose true }
|
||||
sourceSets.main.res.srcDir(networkSecurityResources)
|
||||
}
|
||||
tasks.named('preBuild').configure { dependsOn(generateNetworkSecurityConfig) }
|
||||
dependencies {
|
||||
implementation platform('androidx.compose:compose-bom:2024.09.03')
|
||||
implementation 'androidx.compose.ui:ui'
|
||||
implementation 'androidx.compose.material3:material3'
|
||||
implementation 'androidx.activity:activity-compose:1.9.3'
|
||||
implementation 'com.squareup.okhttp3:okhttp:4.12.0'
|
||||
}
|
||||
Reference in New Issue
Block a user