fix: android 14 foreground permissions

Closes #71
This commit is contained in:
Zane Schepke 2023-12-21 12:17:03 -05:00
parent ffa7a207fb
commit f0ec661223
5 changed files with 21 additions and 10 deletions

View File

@ -70,7 +70,7 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
# fix hardcode changelog file name
body_path: ${{ github.workspace }}/fastlane/metadata/android/en-US/changelogs/32400.txt
body_path: ${{ github.workspace }}/fastlane/metadata/android/en-US/changelogs/32500.txt
tag_name: ${{ github.ref_name }}
name: Release ${{ github.ref_name }}
draft: false

View File

@ -20,9 +20,8 @@
<!--foreground service exempt android 14-->
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_SYSTEM_EXEMPTED"/>
<uses-permission android:name="android.permission.SCHEDULE_EXACT_ALARM"/>
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_SPECIAL_USE"/>
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_LOCATION"/>
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_REMOTE_MESSAGING"/>
<!--foreground service permissions-->
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
@ -46,6 +45,7 @@
</queries>
<application
android:allowBackup="true"
android:enableOnBackInvokedCallback="true"
android:name=".WireGuardAutoTunnel"
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules"
@ -55,7 +55,7 @@
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.WireguardAutoTunnel"
tools:targetApi="31">
tools:targetApi="tiramisu">
<activity
android:name=".ui.MainActivity"
android:exported="true"
@ -84,7 +84,8 @@
<service
android:name=".service.foreground.ForegroundService"
android:enabled="true"
android:foregroundServiceType="remoteMessaging"
android:foregroundServiceType="systemExempted|specialUse"
tools:node="merge"
android:exported="false">
</service>
<service
@ -106,7 +107,8 @@
android:permission="android.permission.BIND_VPN_SERVICE"
android:enabled="true"
android:persistent="true"
android:foregroundServiceType="systemExempted"
android:foregroundServiceType="systemExempted|specialUse"
tools:node="merge"
android:exported="false">
<intent-filter>
<action android:name="android.net.VpnService"/>
@ -119,7 +121,8 @@
android:enabled="true"
android:stopWithTask="false"
android:persistent="true"
android:foregroundServiceType="systemExempted"
android:foregroundServiceType="systemExempted|specialUse"
tools:node="merge"
android:exported="false">
</service>
<receiver android:enabled="true" android:name=".receiver.BootReceiver"

View File

@ -46,6 +46,7 @@ class WireGuardTunnelService : ForegroundService() {
override fun startService(extras: Bundle?) {
super.startService(extras)
// TODO fix grapheneOS calls always-on on install
launchVpnStartingNotification()
val tunnelConfigString = extras?.getString(getString(R.string.tunnel_extras_key))
cancelJob()
@ -179,7 +180,12 @@ class WireGuardTunnelService : ForegroundService() {
showTimestamp = true,
description = message
)
super.startForeground(foregroundId, notification)
ServiceCompat.startForeground(
this,
foregroundId,
notification,
Constants.SYSTEM_EXEMPT_SERVICE_TYPE_ID
)
}
private fun cancelJob() {

View File

@ -1,7 +1,7 @@
object Constants {
const val VERSION_NAME = "3.2.4"
const val VERSION_NAME = "3.2.5"
const val JVM_TARGET = "17"
const val VERSION_CODE = 32400
const val VERSION_CODE = 32500
const val TARGET_SDK = 34
const val MIN_SDK = 26
const val APP_ID = "com.zaneschepke.wireguardautotunnel"

View File

@ -0,0 +1,2 @@
Fixes:
- Android 14 foreground permissions