mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-03 16:10:00 +00:00
Fix StrictMode config (#7837)
Remove `penaltyDialog()` as it makes the app unusable even in debug builds
This commit is contained in:
committed by
GitHub
parent
5ed880d539
commit
558c4541cd
@@ -40,19 +40,7 @@ class ElementXApplication : Application(), DependencyInjectionGraphOwner, Config
|
|||||||
override fun onCreate() {
|
override fun onCreate() {
|
||||||
super.onCreate()
|
super.onCreate()
|
||||||
|
|
||||||
// Workaround to avoid NetworkOnMainThreadException when using the network on the main thread.
|
enableStrictMode()
|
||||||
// This is a temporary solution to rustls doing the certificate verification using blocking network requests.
|
|
||||||
// It should be removed once the underlying issue is fixed.
|
|
||||||
// Also, we only want to enable it on nightly and release builds so we can debug the issue on debug builds.
|
|
||||||
if (!BuildConfig.DEBUG) {
|
|
||||||
StrictMode.setThreadPolicy(
|
|
||||||
StrictMode.ThreadPolicy.Builder()
|
|
||||||
.detectNetwork()
|
|
||||||
.penaltyLog()
|
|
||||||
.penaltyDialog()
|
|
||||||
.build()
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
AppInitializer.getInstance(this).apply {
|
AppInitializer.getInstance(this).apply {
|
||||||
initializeComponent(CrashInitializer::class.java)
|
initializeComponent(CrashInitializer::class.java)
|
||||||
@@ -67,4 +55,16 @@ class ElementXApplication : Application(), DependencyInjectionGraphOwner, Config
|
|||||||
// Remove once https://issuetracker.google.com/issues/477038695 is fixed.
|
// Remove once https://issuetracker.google.com/issues/477038695 is fixed.
|
||||||
isAnchoredDraggableComponentsStrictOffsetCheckEnabled = false
|
isAnchoredDraggableComponentsStrictOffsetCheckEnabled = false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun enableStrictMode() {
|
||||||
|
// Workaround to avoid NetworkOnMainThreadException when using the network on the main thread.
|
||||||
|
// This is a temporary solution to rustls doing the certificate verification using blocking network requests.
|
||||||
|
// It should be removed once the underlying issue is fixed.
|
||||||
|
StrictMode.setThreadPolicy(
|
||||||
|
StrictMode.ThreadPolicy.Builder()
|
||||||
|
.detectNetwork()
|
||||||
|
.penaltyLog()
|
||||||
|
.build()
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user