Use StrictMode VmPolicy only in debug build type (#2002)

`StrictMode` makes sense mainly in for debug build types, enabling
it for release does not provide any value as it can add additional overhead and its logs going to be removed (because R8 strips them).
This commit is contained in:
Adam Szewera 2023-12-05 23:17:41 +01:00 committed by GitHub
parent ae27e7bb4d
commit f4ccad8329
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 0 deletions

View File

@ -25,6 +25,12 @@ public class SyncthingApp extends Application {
new Languages(this).setLanguage(this); new Languages(this).setLanguage(this);
if (BuildConfig.DEBUG) {
setStrictMode();
}
}
private void setStrictMode() {
// Set VM policy to avoid crash when sending folder URI to file manager. // Set VM policy to avoid crash when sending folder URI to file manager.
StrictMode.VmPolicy policy = new StrictMode.VmPolicy.Builder() StrictMode.VmPolicy policy = new StrictMode.VmPolicy.Builder()
.detectAll() .detectAll()