WiperService

This commit is contained in:
Matéo Duparc 2023-04-26 16:40:05 +02:00
parent e51bd2ceba
commit a4ce35c95d
Signed by: hardcoresushi
GPG Key ID: AFE384344A45E13A
5 changed files with 25 additions and 4 deletions

View File

@ -33,8 +33,8 @@ android {
applicationId "sushi.hardcore.droidfs"
minSdkVersion 21
targetSdkVersion 32
versionCode 30
versionName "2.0.0"
versionCode 31
versionName "2.0.1"
ndk {
abiFilters "x86", "x86_64", "armeabi-v7a", "arm64-v8a"

View File

@ -58,6 +58,7 @@
<activity android:name=".file_viewers.TextEditor" android:configChanges="screenSize|orientation" />
<activity android:name=".CameraActivity" android:screenOrientation="nosensor" />
<service android:name=".WiperService" android:exported="false" android:stopWithTask="false"/>
<service android:name=".file_operations.FileOperationService" android:exported="false"/>
<receiver android:name=".file_operations.NotificationBroadcastReceiver" android:exported="false">

View File

@ -128,6 +128,7 @@ class MainActivity : BaseActivity(), VolumeAdapter.Listener {
}
}
}
startService(Intent(this, WiperService::class.java))
Intent(this, FileOperationService::class.java).also {
bindService(it, object : ServiceConnection {
override fun onServiceConnected(className: ComponentName, service: IBinder) {

View File

@ -41,8 +41,10 @@ class VolumeManagerApp : Application(), DefaultLifecycleObserver {
}
override fun onStop(owner: LifecycleOwner) {
if (!isStartingExternalApp && !usfKeepOpen) {
volumeManager.closeAll()
if (!isStartingExternalApp) {
if (!usfKeepOpen) {
volumeManager.closeAll()
}
RestrictedFileProvider.wipeAll(applicationContext)
}
}

View File

@ -0,0 +1,17 @@
package sushi.hardcore.droidfs
import android.app.Service
import android.content.Intent
import android.os.IBinder
class WiperService : Service() {
override fun onBind(intent: Intent): IBinder? {
return null
}
override fun onTaskRemoved(rootIntent: Intent) {
super.onTaskRemoved(rootIntent)
(application as VolumeManagerApp).volumeManager.closeAll()
stopSelf()
}
}