fix(android): silence StrictMode cleartext violations for Tor SOCKS on 127.0.0.1
Add a network_security_config.xml that keeps cleartext globally permitted (so user-configured ws:// relays still work) but adds an explicit domain-config for 127.0.0.1 and localhost. This stops StrictMode's detectCleartextNetwork from flooding logcat with CleartextNetworkViolation stacks each time the app talks to the local Tor SOCKS proxy (220+ per benchmark session previously). Verified on a playBenchmark build: zero CleartextNetworkViolation lines to 127.0.0.1 even though the app continued attempting Tor connections on port 9050. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -86,6 +86,7 @@
|
||||
android:theme="@style/Theme.Amethyst"
|
||||
android:largeHeap="true"
|
||||
android:usesCleartextTraffic="true"
|
||||
android:networkSecurityConfig="@xml/network_security_config"
|
||||
android:hardwareAccelerated="true"
|
||||
android:localeConfig="@xml/locales_config"
|
||||
tools:targetApi="34">
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Cleartext traffic is permitted globally so user-configured ws:// relays keep working.
|
||||
The explicit localhost domain-config silences StrictMode CleartextNetworkViolation
|
||||
for the Tor SOCKS proxy on 127.0.0.1.
|
||||
-->
|
||||
<network-security-config>
|
||||
<base-config cleartextTrafficPermitted="true">
|
||||
<trust-anchors>
|
||||
<certificates src="system" />
|
||||
</trust-anchors>
|
||||
</base-config>
|
||||
<domain-config cleartextTrafficPermitted="true">
|
||||
<domain includeSubdomains="false">127.0.0.1</domain>
|
||||
<domain includeSubdomains="false">localhost</domain>
|
||||
</domain-config>
|
||||
</network-security-config>
|
||||
Reference in New Issue
Block a user