a5aea9438a
TDD: 先加守护测试(断言 kApiBaseUrl 走 https 且不含硬编码 IP),确认失败后 再改 api_config.dart 默认值 + 去掉 AndroidManifest 的 usesCleartextTraffic。 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013nMthbVEmQquxBRKb9Fj8u
78 lines
3.2 KiB
XML
78 lines
3.2 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
|
|
|
<!-- 网络权限(隧道流量) -->
|
|
<uses-permission android:name="android.permission.INTERNET" />
|
|
|
|
<!-- 默认网络监听需要(DefaultNetworkMonitor 用 ConnectivityManager 取默认接口) -->
|
|
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
|
|
|
<!-- 前台服务(VPN 持续运行所需,API 28+) -->
|
|
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
|
|
|
|
<!--
|
|
Android 14 (API 34+) 要求前台服务必须声明类型。
|
|
VPN 不属于任何预定义类型,故使用 specialUse。
|
|
Play Store 上架时需在 specialUse 说明中填写 VPN 用途(国内合规绕过此字段)。
|
|
-->
|
|
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_SPECIAL_USE" />
|
|
|
|
<!--
|
|
允许应用请求豁免电池优化(后台 30 分钟不被杀必须)。
|
|
不能在运行时动态请求,必须在 manifest 声明。
|
|
-->
|
|
<uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS" />
|
|
|
|
<application
|
|
android:label="穿山甲"
|
|
android:name="${applicationName}"
|
|
android:icon="@mipmap/ic_launcher">
|
|
|
|
<!-- 主 Activity -->
|
|
<activity
|
|
android:name=".MainActivity"
|
|
android:exported="true"
|
|
android:launchMode="singleTop"
|
|
android:theme="@style/LaunchTheme"
|
|
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
|
|
android:hardwareAccelerated="true"
|
|
android:windowSoftInputMode="adjustResize">
|
|
<meta-data
|
|
android:name="io.flutter.embedding.android.NormalTheme"
|
|
android:resource="@style/NormalTheme" />
|
|
<intent-filter>
|
|
<action android:name="android.intent.action.MAIN"/>
|
|
<category android:name="android.intent.category.LAUNCHER"/>
|
|
</intent-filter>
|
|
</activity>
|
|
|
|
<!--
|
|
VPN 服务。
|
|
android:permission="android.permission.BIND_VPN_SERVICE" 确保只有系统可 bind。
|
|
intent-filter android.net.VpnService 是 VpnService 规范要求。
|
|
android:foregroundServiceType="specialUse" — Android 14 (API 34) 强制要求。
|
|
-->
|
|
<service
|
|
android:name=".PangolinVpnService"
|
|
android:exported="false"
|
|
android:permission="android.permission.BIND_VPN_SERVICE"
|
|
android:foregroundServiceType="specialUse">
|
|
<intent-filter>
|
|
<action android:name="android.net.VpnService" />
|
|
</intent-filter>
|
|
|
|
<!--
|
|
Android 14 specialUse 前台服务类型需在此声明用途说明。
|
|
若目标 API < 34 可忽略此 meta-data;保留不影响低版本兼容性。
|
|
-->
|
|
<property
|
|
android:name="android.app.PROPERTY_SPECIAL_USE_FGS_SUBTYPE"
|
|
android:value="vpn" />
|
|
</service>
|
|
|
|
<meta-data
|
|
android:name="flutterEmbedding"
|
|
android:value="2" />
|
|
</application>
|
|
</manifest>
|