diff --git a/app/build.gradle b/app/build.gradle
index d2aed68..a039c1a 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -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"
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 9921a3a..0c43b8b 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -58,6 +58,7 @@
+
diff --git a/app/src/main/java/sushi/hardcore/droidfs/MainActivity.kt b/app/src/main/java/sushi/hardcore/droidfs/MainActivity.kt
index 305c214..6c3ad62 100644
--- a/app/src/main/java/sushi/hardcore/droidfs/MainActivity.kt
+++ b/app/src/main/java/sushi/hardcore/droidfs/MainActivity.kt
@@ -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) {
diff --git a/app/src/main/java/sushi/hardcore/droidfs/VolumeManagerApp.kt b/app/src/main/java/sushi/hardcore/droidfs/VolumeManagerApp.kt
index 96b1bad..4e270c7 100644
--- a/app/src/main/java/sushi/hardcore/droidfs/VolumeManagerApp.kt
+++ b/app/src/main/java/sushi/hardcore/droidfs/VolumeManagerApp.kt
@@ -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)
}
}
diff --git a/app/src/main/java/sushi/hardcore/droidfs/WiperService.kt b/app/src/main/java/sushi/hardcore/droidfs/WiperService.kt
new file mode 100644
index 0000000..3394137
--- /dev/null
+++ b/app/src/main/java/sushi/hardcore/droidfs/WiperService.kt
@@ -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()
+ }
+}
\ No newline at end of file