mirror of
https://gitlab.futo.org/keyboard/latinime.git
synced 2024-09-28 14:54:30 +01:00
Fix Android 14+ FGS type crash
This commit is contained in:
parent
965b17d912
commit
ec6969b5c2
@ -15,7 +15,8 @@
|
|||||||
-->
|
-->
|
||||||
|
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
package="org.futo.inputmethod.latin">
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
package="org.futo.inputmethod.latin">
|
||||||
|
|
||||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
|
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
|
||||||
<uses-permission android:name="android.permission.DOWNLOAD_WITHOUT_NOTIFICATION"/>
|
<uses-permission android:name="android.permission.DOWNLOAD_WITHOUT_NOTIFICATION"/>
|
||||||
@ -35,6 +36,7 @@
|
|||||||
<uses-permission android:name="android.permission.RECORD_AUDIO"/>
|
<uses-permission android:name="android.permission.RECORD_AUDIO"/>
|
||||||
<uses-permission android:name="android.permission.WAKE_LOCK"/>
|
<uses-permission android:name="android.permission.WAKE_LOCK"/>
|
||||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
|
<uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
|
||||||
|
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_SPECIAL_USE"/>
|
||||||
|
|
||||||
<!-- A signature-protected permission to ask AOSP Keyboard to close the software keyboard.
|
<!-- A signature-protected permission to ask AOSP Keyboard to close the software keyboard.
|
||||||
To use this, add the following line into calling application's AndroidManifest.xml
|
To use this, add the following line into calling application's AndroidManifest.xml
|
||||||
@ -200,5 +202,15 @@
|
|||||||
android:multiprocess="false"
|
android:multiprocess="false"
|
||||||
android:label="@string/dictionary_provider_name">
|
android:label="@string/dictionary_provider_name">
|
||||||
</provider>
|
</provider>
|
||||||
|
|
||||||
|
<service
|
||||||
|
android:name="androidx.work.impl.foreground.SystemForegroundService"
|
||||||
|
android:foregroundServiceType="specialUse"
|
||||||
|
tools:node="merge">
|
||||||
|
|
||||||
|
<property android:name="android.app.PROPERTY_SPECIAL_USE_FGS_SUBTYPE"
|
||||||
|
android:value="Neural network model training"/>
|
||||||
|
|
||||||
|
</service>
|
||||||
</application>
|
</application>
|
||||||
</manifest>
|
</manifest>
|
||||||
|
@ -3,6 +3,7 @@ package org.futo.inputmethod.latin.xlm
|
|||||||
import android.app.NotificationChannel
|
import android.app.NotificationChannel
|
||||||
import android.app.NotificationManager
|
import android.app.NotificationManager
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
|
import android.content.pm.ServiceInfo
|
||||||
import android.os.Build
|
import android.os.Build
|
||||||
import android.os.PowerManager
|
import android.os.PowerManager
|
||||||
import androidx.annotation.RequiresApi
|
import androidx.annotation.RequiresApi
|
||||||
@ -204,7 +205,11 @@ class TrainingWorker(context: Context, parameters: WorkerParameters) : Coroutine
|
|||||||
.addAction(android.R.drawable.ic_delete, cancel, intent)
|
.addAction(android.R.drawable.ic_delete, cancel, intent)
|
||||||
.build()
|
.build()
|
||||||
|
|
||||||
return ForegroundInfo(NOTIFICATION_ID, notification)
|
return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) {
|
||||||
|
ForegroundInfo(NOTIFICATION_ID, notification, ServiceInfo.FOREGROUND_SERVICE_TYPE_SPECIAL_USE)
|
||||||
|
} else {
|
||||||
|
ForegroundInfo(NOTIFICATION_ID, notification)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequiresApi(Build.VERSION_CODES.O)
|
@RequiresApi(Build.VERSION_CODES.O)
|
||||||
|
Loading…
Reference in New Issue
Block a user