Fix some of the StrictMode violations (#1931)

Mostly it's disk reads/writes.

Conscrypt reads own version on startup which reads from disk multiple
times. There's no solution for it right now.

SharedPreferences which are used in BaseActivity also read from disk
and pretty early but it shouldn't be a problem.
This commit is contained in:
Ivan Kupalov 2020-11-23 20:05:48 +01:00 committed by GitHub
commit ef1ae581b4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 32 additions and 12 deletions

View file

@ -81,6 +81,7 @@ import com.uber.autodispose.android.lifecycle.autoDispose
import dagger.android.DispatchingAndroidInjector
import dagger.android.HasAndroidInjector
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.schedulers.Schedulers
import kotlinx.android.synthetic.main.activity_main.*
import javax.inject.Inject
@ -227,8 +228,10 @@ class MainActivity : BottomSheetActivity(), ActionButtonActivity, HasAndroidInje
}
}
// Flush old media that was cached for sharing
deleteStaleCachedMedia(applicationContext.getExternalFilesDir("Tusky"))
Schedulers.io().scheduleDirect {
// Flush old media that was cached for sharing
deleteStaleCachedMedia(applicationContext.getExternalFilesDir("Tusky"))
}
}
override fun onResume() {