forked from hardcoresushi/DroidFS
WiperService
This commit is contained in:
parent
e51bd2ceba
commit
a4ce35c95d
@ -33,8 +33,8 @@ android {
|
|||||||
applicationId "sushi.hardcore.droidfs"
|
applicationId "sushi.hardcore.droidfs"
|
||||||
minSdkVersion 21
|
minSdkVersion 21
|
||||||
targetSdkVersion 32
|
targetSdkVersion 32
|
||||||
versionCode 30
|
versionCode 31
|
||||||
versionName "2.0.0"
|
versionName "2.0.1"
|
||||||
|
|
||||||
ndk {
|
ndk {
|
||||||
abiFilters "x86", "x86_64", "armeabi-v7a", "arm64-v8a"
|
abiFilters "x86", "x86_64", "armeabi-v7a", "arm64-v8a"
|
||||||
|
@ -58,6 +58,7 @@
|
|||||||
<activity android:name=".file_viewers.TextEditor" android:configChanges="screenSize|orientation" />
|
<activity android:name=".file_viewers.TextEditor" android:configChanges="screenSize|orientation" />
|
||||||
<activity android:name=".CameraActivity" android:screenOrientation="nosensor" />
|
<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"/>
|
<service android:name=".file_operations.FileOperationService" android:exported="false"/>
|
||||||
|
|
||||||
<receiver android:name=".file_operations.NotificationBroadcastReceiver" android:exported="false">
|
<receiver android:name=".file_operations.NotificationBroadcastReceiver" android:exported="false">
|
||||||
|
@ -128,6 +128,7 @@ class MainActivity : BaseActivity(), VolumeAdapter.Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
startService(Intent(this, WiperService::class.java))
|
||||||
Intent(this, FileOperationService::class.java).also {
|
Intent(this, FileOperationService::class.java).also {
|
||||||
bindService(it, object : ServiceConnection {
|
bindService(it, object : ServiceConnection {
|
||||||
override fun onServiceConnected(className: ComponentName, service: IBinder) {
|
override fun onServiceConnected(className: ComponentName, service: IBinder) {
|
||||||
|
@ -41,8 +41,10 @@ class VolumeManagerApp : Application(), DefaultLifecycleObserver {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun onStop(owner: LifecycleOwner) {
|
override fun onStop(owner: LifecycleOwner) {
|
||||||
if (!isStartingExternalApp && !usfKeepOpen) {
|
if (!isStartingExternalApp) {
|
||||||
|
if (!usfKeepOpen) {
|
||||||
volumeManager.closeAll()
|
volumeManager.closeAll()
|
||||||
|
}
|
||||||
RestrictedFileProvider.wipeAll(applicationContext)
|
RestrictedFileProvider.wipeAll(applicationContext)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
17
app/src/main/java/sushi/hardcore/droidfs/WiperService.kt
Normal file
17
app/src/main/java/sushi/hardcore/droidfs/WiperService.kt
Normal 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()
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user